[ARVADOS] created: 705c3f77f15a4bab44ee0754061b1e4062e3730c

git at public.curoverse.com git at public.curoverse.com
Thu Mar 12 10:17:28 EDT 2015


        at  705c3f77f15a4bab44ee0754061b1e4062e3730c (commit)


commit 705c3f77f15a4bab44ee0754061b1e4062e3730c
Author: Brett Smith <brett at curoverse.com>
Date:   Thu Mar 12 10:15:39 2015 -0400

    5034: Improve Workbench collection display.
    
    * Display the UUID, and make it auto-select for easy copying.
    * Do the same for the portable data hash, and call it the content
      address to emphasize that.
    * Display information about the collection's size on the show page and
      preview pane.  This relies on an updated Ruby SDK.
    * Clean up code that checks for a portable data hash in the UUID.
      That can't happen anymore thanks to the redirect/list display logic
      in the controller.

diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index d3746a8..7747801 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -1,7 +1,7 @@
 source 'https://rubygems.org'
 
 gem 'rails', '~> 4.1.0'
-gem 'arvados', '>= 0.1.20150210011250'
+gem 'arvados', '>= 0.1.20150310184329'
 
 gem 'sqlite3'
 
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index 9a88697..266f9b7 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -40,7 +40,7 @@ GEM
     andand (1.3.3)
     angularjs-rails (1.3.8)
     arel (5.0.1.20140414130214)
-    arvados (0.1.20150210011250)
+    arvados (0.1.20150310184329)
       activesupport (>= 3.2.13)
       andand (~> 1.3, >= 1.3.3)
       google-api-client (~> 0.6.3, >= 0.6.3)
@@ -258,7 +258,7 @@ DEPENDENCIES
   RedCloth
   andand
   angularjs-rails
-  arvados (>= 0.1.20150210011250)
+  arvados (>= 0.1.20150310184329)
   bootstrap-sass (~> 3.1.0)
   bootstrap-tab-history-rails
   bootstrap-x-editable-rails
diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js
index 63887b3..172ff87 100644
--- a/apps/workbench/app/assets/javascripts/application.js
+++ b/apps/workbench/app/assets/javascripts/application.js
@@ -129,6 +129,9 @@ jQuery(function($){
                     this.addClass('label-danger').fadeTo('fast', '1');
                 });
             return false;
+        }).
+        on('click focusin', 'input.select-on-focus', function(event) {
+            event.target.select();
         });
 
     $(document).
diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index 710bc92..0ae44a3 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -93,6 +93,14 @@ form.small-form-margin {
 .nowrap {
     white-space: nowrap;
 }
+input.select-on-focus {
+    font-family: monospace;
+    background: inherit;
+    border: none;
+    border-left: thin #ddd solid;
+    border-bottom: thin #ddd solid;
+    border-radium: .2em;
+}
 
 /* top nav */
 $top-nav-bg: #3c163d;
diff --git a/apps/workbench/app/views/application/_show_autoselect_text.html.erb b/apps/workbench/app/views/application/_show_autoselect_text.html.erb
new file mode 100644
index 0000000..746ebcf
--- /dev/null
+++ b/apps/workbench/app/views/application/_show_autoselect_text.html.erb
@@ -0,0 +1,4 @@
+<%# Render local `text` so the entire text is automatically selected when
+    clicked or focused. %>
+<input class="select-on-focus <%= tagclass %>" type="text" readonly
+       size="<%= text.size %>" value="<%= text %>">
diff --git a/apps/workbench/app/views/collections/_show_source_summary.html.erb b/apps/workbench/app/views/collections/_show_source_summary.html.erb
index 592e802..d98b525 100644
--- a/apps/workbench/app/views/collections/_show_source_summary.html.erb
+++ b/apps/workbench/app/views/collections/_show_source_summary.html.erb
@@ -1,3 +1,6 @@
+<p><%= pluralize(@object.manifest.files_count, "file") %> totalling
+  <%= raw(human_readable_bytes_html(@object.manifest.files_size)) %></p>
+
 <% if not (@output_of.andand.any? or @log_of.andand.any?) %>
   <p><i>No source information available.</i></p>
 <% end %>
diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb
index 75a7086..8b82cca 100644
--- a/apps/workbench/app/views/collections/show.html.erb
+++ b/apps/workbench/app/views/collections/show.html.erb
@@ -3,15 +3,13 @@
     <div class="panel panel-info">
       <div class="panel-heading">
         <h3 class="panel-title">
-          <% if @name_link.nil? and @object.uuid.match /[0-9a-f]{32}/ %>
-            Content hash <%= @object.portable_data_hash %>
-          <% else %>
-            <%= if @object.respond_to? :name
-                  render_editable_attribute @object, :name
-                else
-                  @name_link.andand.name || @object.uuid
-                end %>
-            <% end %>
+          <%= if @object.respond_to? :name
+                render_editable_attribute @object, :name
+              elsif @name_link
+                @name_link.name
+              else
+                @object.uuid
+              end %>
         </h3>
       </div>
       <div class="panel-body">
@@ -19,8 +17,11 @@
           <%= render_editable_attribute @object, 'description', nil, { 'data-emptytext' => "(No description provided)", 'data-toggle' => 'manual' } %>
         </div>
         <img src="/favicon.ico" class="pull-right" alt="" style="opacity: 0.3"/>
-        <p><i>Content hash:</i><br />
-          <span class="arvados-uuid"><%= link_to @object.portable_data_hash, collection_path(@object.portable_data_hash) %></span>
+        <p><i>Arvados UUID:</i><br />
+          <%= render partial: "show_autoselect_text", locals: {text: @object.uuid, tagclass: "arvados-uuid"} %>
+        </p>
+        <p><i>Content address:</i><br />
+          <%= render partial: "show_autoselect_text", locals: {text: @object.portable_data_hash, tagclass: "arvados-uuid"} %>
         </p>
         <%= render partial: "show_source_summary" %>
       </div>

commit f1d26c2b4c9937f4645986d17245764a49f156e8
Author: Brett Smith <brett at curoverse.com>
Date:   Tue Mar 10 14:43:29 2015 -0400

    5034: Add Keep::Manifest#files_size to Ruby SDK.

diff --git a/sdk/ruby/lib/arvados/keep.rb b/sdk/ruby/lib/arvados/keep.rb
index ede40c3..e4f6208 100644
--- a/sdk/ruby/lib/arvados/keep.rb
+++ b/sdk/ruby/lib/arvados/keep.rb
@@ -191,6 +191,11 @@ module Keep
       seen_files.size
     end
 
+    def files_size
+      # Return the total size of all files in this manifest.
+      files.reduce(0) { |total, (_, _, size)| total + size }
+    end
+
     def exact_file_count?(want_count)
       files_count(want_count + 1) == want_count
     end
diff --git a/sdk/ruby/test/test_keep_manifest.rb b/sdk/ruby/test/test_keep_manifest.rb
index 8ad8134..2038719 100644
--- a/sdk/ruby/test/test_keep_manifest.rb
+++ b/sdk/ruby/test/test_keep_manifest.rb
@@ -70,6 +70,10 @@ class ManifestTest < Minitest::Test
     assert_equal(0, Keep::Manifest.new("").files_count)
   end
 
+  def test_empty_files_size
+    assert_equal(0, Keep::Manifest.new("").files_size)
+  end
+
   def test_empty_has_file?
     refute(Keep::Manifest.new("").has_file?(""))
   end
@@ -164,6 +168,15 @@ class ManifestTest < Minitest::Test
     refute(manifest.exact_file_count?(6), "+1 file count true")
   end
 
+  def test_files_size_multiblock
+    assert_equal(22, Keep::Manifest.new(MULTIBLOCK_FILE_MANIFEST).files_size)
+  end
+
+  def test_files_size_with_skipped_overlapping_data
+    manifest = Keep::Manifest.new(". #{random_block(9)} 3:3:f1 5:3:f2\n")
+    assert_equal(6, manifest.files_size)
+  end
+
   def test_has_file
     manifest = Keep::Manifest.new(MULTIBLOCK_FILE_MANIFEST)
     assert(manifest.has_file?("./repfile"), "one-arg repfile not found")

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list