Merge branch '8784-dir-listings'
[arvados.git] / apps / workbench / app / models / collection.rb
index 1bd711be6423fad3fc0b360cce9e918653419fdb..09af60fb9cc5f18a9102d02ed8133e6651f5ecc9 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require "arvados/keep"
 
 class Collection < ArvadosBase
@@ -35,7 +39,11 @@ class Collection < ArvadosBase
   end
 
   def content_summary
-    ApplicationController.helpers.human_readable_bytes_html(total_bytes) + " " + super
+    if total_bytes > 0
+      ApplicationController.helpers.human_readable_bytes_html(total_bytes) + " " + super
+    else
+      super + " modified at " + modified_at.to_s
+    end
   end
 
   def total_bytes
@@ -67,7 +75,7 @@ class Collection < ArvadosBase
   end
 
   def editable_attributes
-    %w(name description manifest_text)
+    %w(name description manifest_text filename)
   end
 
   def provenance
@@ -94,4 +102,7 @@ class Collection < ArvadosBase
     [ 'description' ]
   end
 
+  def untrash
+    arvados_api_client.api(self.class, "/#{self.uuid}/untrash", {"ensure_unique_name" => true})
+  end
 end