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