Merge branch '2049-run-job-from-workbench' into 1971-show-image-thumbnails
[arvados.git] / apps / workbench / app / models / collection.rb
1 class Collection < ArvadosBase
2   def total_bytes
3     if files
4       tot = 0
5       files.each do |file|
6         tot += file[2]
7       end
8       tot
9     end
10   end
11
12   def attribute_editable?(attr)
13     false
14   end
15
16   def self.creatable?
17     false
18   end
19
20   def provenance
21     $arvados_api_client.api "collections/#{self.uuid}/", "provenance"
22   end
23
24   def used_by
25     $arvados_api_client.api "collections/#{self.uuid}/", "used_by"
26   end
27
28   # def selection_label
29   #   name = ''
30   #   i = 0 
31   #   if self.files.length > 3
32   #     m = 3
33   #   else
34   #     m = self.files.length 
35   #   end
36   #   while i < m
37   #     name += "#{self.files[i][1]}"
38   #     i += 1
39   #     name += ", " if i < m
40   #   end
41   #   if i < self.files.length
42   #     name += "&ellip;"
43   #   end
44   #   name
45   # end
46 end