[ARVADOS] updated: 037fd10ba7643413c99892100cb4356669acebb1

git at public.curoverse.com git at public.curoverse.com
Tue Feb 4 15:10:40 EST 2014


Summary of changes:
 .../app/assets/javascripts/application.js          |   28 ++++
 .../app/assets/stylesheets/application.css         |    9 ++
 .../app/controllers/application_controller.rb      |   11 ++-
 .../app/controllers/authorized_keys_controller.rb  |    4 -
 apps/workbench/app/controllers/jobs_controller.rb  |    6 +
 .../app/controllers/repositories_controller.rb     |    3 -
 .../app/controllers/virtual_machines_controller.rb |    3 -
 apps/workbench/app/models/arvados_base.rb          |   14 ++-
 apps/workbench/app/models/link.rb                  |    3 +
 .../{_help.html.erb => _index_help.html.erb}       |    0
 .../app/views/application/_arvados_object.html.erb |   63 ---------
 .../app/views/application/_index_table.html.erb    |   52 +++++++
 ..._show_attributes.html.erb => _preview.html.erb} |    0
 .../app/views/application/_recent.html.erb         |   61 ---------
 .../app/views/application/_show_about.html.erb     |   15 ++
 .../views/application/_show_api_response.html.erb  |    3 +
 .../views/application/_show_cli_example.html.erb   |    8 +
 .../views/application/_show_curl_example.html.erb  |   11 ++
 .../application/_show_python_example.html.erb      |    5 +
 .../workbench/app/views/application/index.html.erb |   52 ++++---
 apps/workbench/app/views/application/show.html.erb |   31 +---
 .../{_help.html.erb => _index_help.html.erb}       |    0
 .../{_recent.html.erb => _index_table.html.erb}    |    0
 apps/workbench/app/views/jobs/_recent.html.erb     |  141 --------------------
 ...ow.html.erb => _show_provenance_graph.html.erb} |    2 -
 .../app/views/links/_breadcrumb_page_name.html.erb |    3 +-
 apps/workbench/app/views/links/_recent.html.erb    |   57 --------
 .../app/views/pipeline_instances/_recent.html.erb  |   91 -------------
 .../app/views/pipeline_templates/_recent.html.erb  |   34 -----
 .../{_help.html.erb => _index_help.html.erb}       |    0
 .../{_help.html.erb => _index_help.html.erb}       |    0
 31 files changed, 202 insertions(+), 508 deletions(-)
 rename apps/workbench/app/views/api_client_authorizations/{_help.html.erb => _index_help.html.erb} (100%)
 create mode 100644 apps/workbench/app/views/application/_index_table.html.erb
 copy apps/workbench/app/views/application/{_show_attributes.html.erb => _preview.html.erb} (100%)
 delete mode 100644 apps/workbench/app/views/application/_recent.html.erb
 create mode 100644 apps/workbench/app/views/application/_show_about.html.erb
 create mode 100644 apps/workbench/app/views/application/_show_api_response.html.erb
 create mode 100644 apps/workbench/app/views/application/_show_cli_example.html.erb
 create mode 100644 apps/workbench/app/views/application/_show_curl_example.html.erb
 create mode 100644 apps/workbench/app/views/application/_show_python_example.html.erb
 rename apps/workbench/app/views/authorized_keys/{_help.html.erb => _index_help.html.erb} (100%)
 rename apps/workbench/app/views/collections/{_recent.html.erb => _index_table.html.erb} (100%)
 delete mode 100644 apps/workbench/app/views/jobs/_recent.html.erb
 rename apps/workbench/app/views/jobs/{show.html.erb => _show_provenance_graph.html.erb} (77%)
 delete mode 100644 apps/workbench/app/views/links/_recent.html.erb
 delete mode 100644 apps/workbench/app/views/pipeline_instances/_recent.html.erb
 delete mode 100644 apps/workbench/app/views/pipeline_templates/_recent.html.erb
 rename apps/workbench/app/views/repositories/{_help.html.erb => _index_help.html.erb} (100%)
 rename apps/workbench/app/views/virtual_machines/{_help.html.erb => _index_help.html.erb} (100%)

       via  037fd10ba7643413c99892100cb4356669acebb1 (commit)
       via  e5e6cd61267241cffc9a9c6099fcdc4055a3a1c1 (commit)
      from  b028a43c769746336168467eaa012c243dfa9cc1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 037fd10ba7643413c99892100cb4356669acebb1
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Feb 4 12:09:50 2014 -0800

    Drop special-case jobs index

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index b77c01f..2985249 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -63,6 +63,9 @@ class ApplicationController < ActionController::Base
     end
   end
 
+  def show_pane_list
+    %w(Attributes About API_response curl_example CLI_example Python_example)
+  end
   def show
     if !@object
       return render_not_found("object not found")
diff --git a/apps/workbench/app/controllers/jobs_controller.rb b/apps/workbench/app/controllers/jobs_controller.rb
index e6179ff..3f0dbe5 100644
--- a/apps/workbench/app/controllers/jobs_controller.rb
+++ b/apps/workbench/app/controllers/jobs_controller.rb
@@ -1,5 +1,9 @@
 class JobsController < ApplicationController
 
+  def show_pane_list
+    super | %w(Provenance_graph)
+  end
+
   def generate_provenance(jobs)
     nodes = []
     collections = []
@@ -25,9 +29,11 @@ class JobsController < ApplicationController
     else
       @jobs = Job.all
     end
+    @objects = @jobs
   end
 
   def show
     generate_provenance([@object])
+    super
   end
 end
diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb
index c93af1f..943f64a 100644
--- a/apps/workbench/app/views/application/index.html.erb
+++ b/apps/workbench/app/views/application/index.html.erb
@@ -22,7 +22,7 @@
       <% panes.each_with_index do |(name, content), i| %>
       <li class="<%= 'active' if i==0 %>"><a href="#index_<%= name %>" data-toggle="tab"><%= name.capitalize.gsub '_', ' ' %></a></li>
       <% end %>
-      <li><a href="#index_detail" data-toggle="tab">Detail</a></li>
+      <li><a href="#index_detail" data-toggle="tab">Details</a></li>
     </ul>
 
     <div class="tab-content">
diff --git a/apps/workbench/app/views/application/show.html.erb b/apps/workbench/app/views/application/show.html.erb
index e28031c..ccc2349 100644
--- a/apps/workbench/app/views/application/show.html.erb
+++ b/apps/workbench/app/views/application/show.html.erb
@@ -4,7 +4,7 @@
 <% end %>
 
 <%
-   pane_list = controller.show_pane_list rescue %w(Attributes About API_response curl_example CLI_example Python_example)
+   pane_list = controller.show_pane_list
    pane_content = Hash[pane_list.map { |pane| [pane, render(partial: 'show_' + pane.downcase)] }.select { |k,v| v.andand.strip.length > 0 }]
    %>
 
diff --git a/apps/workbench/app/views/jobs/_index_table.html.erb b/apps/workbench/app/views/jobs/_index_table.html.erb
deleted file mode 100644
index 2f16391..0000000
--- a/apps/workbench/app/views/jobs/_index_table.html.erb
+++ /dev/null
@@ -1,141 +0,0 @@
-<% content_for :css do %>
-  table.topalign>tbody>tr>td {
-  vertical-align: top;
-  }
-  table.topalign>thead>tr>td {
-  vertical-align: bottom;
-  }
-<% end %>
-
-<table class="topalign table">
-  <thead>
-    <tr class="contain-align-left">
-      <th>
-      </th><th>
-	status
-      </th><th>
-	progress
-      </th><th>
-	uuid
-      </th><th>
-	script
-      </th><th>
-	version
-      </th><th>
-	output
-      </th>
-    </tr>
-  </thead>
-  <tbody>
-
-    <% @jobs.sort_by { |j| j[:created_at] }.reverse.each do |j| %>
-
-    <tr class="cell-noborder">
-      <td>
-        <i class="icon-plus-sign expand-collapse-row" data-id="<%= j.uuid %>" style="cursor: pointer"></i>
-      </td>
-      <td>
-        <% if j.success == false %>
-        <span class="badge badge-warning" title="fail">&#x2716;</span>
-        <% elsif j.success %>
-        <span class="badge badge-success" title="success">&#x2714;</span>
-        <% elsif j.running %>
-        <span class="badge badge-info" title="running">&#x2708;</span>
-        <% else %>
-        <span class="badge" title="queued">&#x2709;</span>
-        <% end %>
-      </td>
-      <td>
-        <% if j.started_at and not j.finished_at %>
-        <% percent_total_tasks = 100 / (j.tasks_summary[:running] + j.tasks_summary[:done] + j.tasks_summary[:todo]) rescue 0 %>
-        <div class="progress" style="margin-bottom: 0">
-          <div class="bar bar-success" style="width: <%= j.tasks_summary[:done] * percent_total_tasks rescue 0 %>%;"></div>
-          <div class="bar" style="width: <%= j.tasks_summary[:running] * percent_total_tasks rescue 0 %>%; opacity: 0.3"></div>
-        </div>
-        <% end %>
-      </td>
-      <td>
-        <%= link_to_if_arvados_object j.uuid %>
-      </td>
-      <td>
-        <%= j.script %>
-      </td>
-      <td>
-        <%= j.script_version.andand[0..8] %>
-      </td>
-      <td>
-        <%= link_to_if_arvados_object j.output %>
-      </td>
-    </tr>
-    <tr class="cell-noborder" id="<%= j.uuid %>" style="display:none">
-      <td colspan="7"><table class="table table-justforlayout"><tr>
-      <td style="border-left: 1px solid black">
-        <table class="table table-condensed">
-          <tr>
-            <td>
-              queued
-            </td>
-            <td>
-	      &#x2709; <span title="<%= j.created_at %>"><%= raw distance_of_time_in_words(Time.now, j.created_at).sub('about ','~').sub(' ',' ') + ' ago' if j.created_at %></span>
-            </td>
-            <td>
-	      <%= raw('for ' + distance_of_time_in_words(j.started_at, j.created_at).sub('about ','~').sub(' ',' ')) if j.created_at and j.started_at %>
-            </td>
-          </tr>
-          <% if j.started_at.is_a? Time %>
-          <tr>
-            <td>
-              started
-            </td>
-            <td>
-	      &#x2708; <span title="<%= j.created_at %>"><%= raw distance_of_time_in_words(j.started_at, Time.now).sub('about ','~').sub(' ',' ') + ' ago' if j.started_at %></span>
-            </td>
-            <td>
-              <% if j.finished_at.is_a? Time %>
-	      <%= raw('ran ' + distance_of_time_in_words(j.finished_at, j.started_at).sub('about ','~').sub(' ',' ')) %>
-              <% elsif j.running %>
-              <span class="badge badge-success" title="tasks finished">&#x2714; <%= j.tasks_summary[:done] %></span>
-              <span class="badge badge-info" title="tasks running">&#x2708; <%= j.tasks_summary[:running] %></span>
-              <span class="badge" title="tasks todo">&#x2709; <%= j.tasks_summary[:todo] %></span>
-              <% if j.tasks_summary[:failed] %>
-              <span class="badge badge-warning" title="task failures">&#x2716; <%= j.tasks_summary[:failed] %></span>
-              <% end %>
-              <% end %>
-            </td>
-          </tr>
-          <% end %>
-        </table>
-      </td><td>
-        <table class="table table-condensed">
-          <tr><td colspan="2">
-              <%= j.script %> <%= j.script_version %>
-          </td></tr>
-          <% j.script_parameters.sort.each do |k,v| %>
-          <tr>
-            <td><%= k %></td><td><%= link_to_if_arvados_object v %></td>
-          </tr>
-          <% end %>
-          <tr>
-            <td>output</td><td><%= link_to_if_arvados_object j.output %></td>
-          </tr>
-        </table>
-      </td><td>
-        <table class="table table-condensed">
-        <% j.runtime_constraints.sort.each do |k,v| %>
-        <tr><td><%= v %></td><td><%= k %></td></tr>
-        <% end %>
-        </table>
-      </td>
-      </tr></table></td>
-    </tr>
-
-    <% end %>
-
-  </tbody>
-</table>
-
-<%= render partial: 'application/svg_div', locals: {
-      divId: "provenance_graph", 
-      svgId: "provenance_svg", 
-      svg: @svg } %>
-
diff --git a/apps/workbench/app/views/jobs/show.html.erb b/apps/workbench/app/views/jobs/_show_provenance_graph.html.erb
similarity index 77%
rename from apps/workbench/app/views/jobs/show.html.erb
rename to apps/workbench/app/views/jobs/_show_provenance_graph.html.erb
index 2bc74ca..253af56 100644
--- a/apps/workbench/app/views/jobs/show.html.erb
+++ b/apps/workbench/app/views/jobs/_show_provenance_graph.html.erb
@@ -1,5 +1,3 @@
-<%= render partial: 'arvados_object' %>
-
 <%= render partial: 'application/svg_div', locals: {
       divId: "provenance_graph", 
       svgId: "provenance_svg", 
diff --git a/apps/workbench/app/views/pipeline_instances/_index_table.html.erb b/apps/workbench/app/views/pipeline_instances/_index_table.html.erb
deleted file mode 100644
index 481d276..0000000
--- a/apps/workbench/app/views/pipeline_instances/_index_table.html.erb
+++ /dev/null
@@ -1,91 +0,0 @@
-<%= form_tag do |f| %>
-
-<table class="table table-hover">
-  <thead>
-    <tr class="contain-align-left">
-      <th>
-      </th><th>
-	status
-      </th><th>
-	id
-      </th><th>
-	name
-      </th><th>
-	template
-      </th><th>
-	owner
-      </th><th>
-	components
-      </th><th>
-	dependencies
-      </th><th>
-	created
-      </th><th>
-      </th>
-    </tr>
-  </thead>
-  <tbody>
-
-    <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %>
-
-    <tr data-object-uuid="<%= ob.uuid %>">
-      <td>
-        <%= check_box_tag 'uuids[]', ob.uuid, false %>
-      </td><td>
-        <% if ob.success %>
-        <span class="label label-success">success</span>
-        <% elsif ob.active %>
-        <span class="label label-info">active</span>
-        <% end %>
-      </td><td>
-        <%= link_to_if_arvados_object ob %>
-      </td><td>
-        <%= ob.name %>
-      </td><td>
-        <%= link_to_if_arvados_object ob.pipeline_template_uuid %>
-      </td><td>
-        <%= link_to_if_arvados_object ob.owner_uuid %>
-      </td><td>
-        <% ob.components.each do |cname, c| %>
-        <% status = if !(c.is_a?(Hash) && c[:job].is_a?(Hash)) then nil elsif c[:job][:success] then 'success' elsif c[:job][:running] then 'info' else 'warning' end %>
-        <span class="label <%= "label-#{status}" if status %>"><%= cname.to_s %></span>
-        <% end %>
-      </td><td>
-        <small>
-          <% ob.dependencies.each do |d| %>
-          <%= d %><br />
-          <% end %>
-        </small>
-      </td><td>
-        <%= ob.created_at %>
-      </td><td>
-        <% if ob.editable? %>
-        <%= link_to({action: 'destroy', id: ob.uuid}, method: :delete, remote: true, data: {confirm: "You are about to delete #{controller.model_class} #{ob.uuid}.\n\nAre you sure?"}) do %>
-        <i class="icon-trash"></i>
-        <% end %>
-        <% end %>
-      </td>
-    </tr>
-
-    <% end %>
-
-  </tbody>
-</table>
-
-<% end %>
-
-<% content_for :footer_js do %>
-var showhide_compare = function() {
-    var form = $('form#compare')[0];
-    $('input[type=hidden][name="uuids[]"]', form).remove();
-    $('input[type=submit]', form).prop('disabled',true);
-    $('input[name="uuids[]"]').each(function(){
-        if(this.checked) {
-            $('input[type=submit]', form).prop('disabled',false).show();
-            $(form).append($('<input type="hidden" name="uuids[]"/>').val(this.value));
-        }
-    });
-};
-$('form input[name="uuids[]"]').on('click', showhide_compare);
-showhide_compare();
-<% end %>
diff --git a/apps/workbench/app/views/pipeline_templates/_index_table.html.erb b/apps/workbench/app/views/pipeline_templates/_index_table.html.erb
deleted file mode 100644
index dd8bad0..0000000
--- a/apps/workbench/app/views/pipeline_templates/_index_table.html.erb
+++ /dev/null
@@ -1,34 +0,0 @@
-<table class="table table-hover">
-  <thead>
-    <tr class="contain-align-left">
-      <th>
-	id
-      </th><th>
-	name
-      </th><th>
-	owner
-      </th><th>
-	components
-      </th>
-    </tr>
-  </thead>
-  <tbody>
-
-    <% @objects.sort_by { |ob| ob[:created_at] }.reverse.each do |ob| %>
-
-    <tr>
-      <td>
-        <%= link_to_if_arvados_object ob %>
-      </td><td>
-        <%= render_editable_attribute ob, 'name' %>
-      </td><td>
-        <%= link_to_if_arvados_object ob.owner_uuid %>
-      </td><td>
-        <%= ob.components.collect { |k,v| k.to_s }.join(", ") %>
-      </td>
-    </tr>
-
-    <% end %>
-
-  </tbody>
-</table>

commit e5e6cd61267241cffc9a9c6099fcdc4055a3a1c1
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Feb 4 11:58:17 2014 -0800

    Show detail pane on rhs of generic index page.
    
    refs #1979

diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js
index 8bd556b..f7f1b20 100644
--- a/apps/workbench/app/assets/javascripts/application.js
+++ b/apps/workbench/app/assets/javascripts/application.js
@@ -44,4 +44,32 @@ jQuery(function($){
         on('ajax:complete', function(e, status) {
             $('.loading').hide();
         });
+    $(document).
+        on('workbench:index:show', function() {
+            $('.index-table').removeClass('span12').addClass('span8');
+            $('.index-detail').addClass('span4').show();
+        }).
+        on('ready', function() {
+            if ($('.index-detail #index_help').length > 0) {
+                $(document).trigger('workbench:index:show');
+            }
+        }).
+        on('click', '.index-table tr[data-object-preview-href]', function() {
+            $('.index-detail #index_detail.tab-pane').fadeTo(50, 0.01);
+            $.ajax({
+                type: 'GET',
+                dataType: 'html',
+                url: $(this).attr('data-object-preview-href'),
+                success: function(data) {
+                    $('.index-detail #index_detail.tab-pane').
+                        html(data).fadeTo('fast', 1.0);
+                    $('.loading').hide();
+                    $(document).trigger('workbench:index:show');
+                    $('.index-detail .nav-tabs a[href=#index_detail]').
+                        trigger('click');
+                    $('.editable').editable();
+                }
+            });
+            $('.loading').show();
+        });
 })(jQuery);
diff --git a/apps/workbench/app/assets/stylesheets/application.css b/apps/workbench/app/assets/stylesheets/application.css
index 8c777c8..88e672a 100644
--- a/apps/workbench/app/assets/stylesheets/application.css
+++ b/apps/workbench/app/assets/stylesheets/application.css
@@ -89,3 +89,12 @@ form.small-form-margin {
 .navbar .nav .dropdown .dropdown-menu li a {
     padding: 2px 20px;
 }
+.index-detail .tabbable {
+    background: #eee;
+}
+.index-detail .tabbable .nav-tabs {
+    background: #fff;
+}
+.index-detail .tabbable .tab-content {
+    padding: 0 1em;
+}
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 3f495ca..b77c01f 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -71,7 +71,11 @@ class ApplicationController < ActionController::Base
       f.json { render json: @object }
       f.html {
         if request.method == 'GET'
-          render
+          if %w(preview).index params[:partial]
+            render partial: params[:partial]
+          else
+            render
+          end
         else
           redirect_to params[:return_to] || @object
         end
@@ -157,7 +161,9 @@ class ApplicationController < ActionController::Base
   def thread_clear
     Thread.current[:arvados_api_token] = nil
     Thread.current[:user] = nil
+    Rails.cache.delete_matched(/^request_#{Thread.current.object_id}_/)
     yield
+    Rails.cache.delete_matched(/^request_#{Thread.current.object_id}_/)
   end
 
   def thread_with_api_token(login_optional = false)
diff --git a/apps/workbench/app/controllers/authorized_keys_controller.rb b/apps/workbench/app/controllers/authorized_keys_controller.rb
index 4cd5280..6bbb01d 100644
--- a/apps/workbench/app/controllers/authorized_keys_controller.rb
+++ b/apps/workbench/app/controllers/authorized_keys_controller.rb
@@ -1,8 +1,4 @@
 class AuthorizedKeysController < ApplicationController
-  def index_pane_list
-    %w(recent help)
-  end
-
   def new
     super
     @object.authorized_user_uuid = current_user.uuid if current_user
diff --git a/apps/workbench/app/controllers/repositories_controller.rb b/apps/workbench/app/controllers/repositories_controller.rb
index b6b3295..d710bd6 100644
--- a/apps/workbench/app/controllers/repositories_controller.rb
+++ b/apps/workbench/app/controllers/repositories_controller.rb
@@ -1,5 +1,2 @@
 class RepositoriesController < ApplicationController
-  def index_pane_list
-    %w(recent help)
-  end
 end
diff --git a/apps/workbench/app/controllers/virtual_machines_controller.rb b/apps/workbench/app/controllers/virtual_machines_controller.rb
index c3512e2..a62ba81 100644
--- a/apps/workbench/app/controllers/virtual_machines_controller.rb
+++ b/apps/workbench/app/controllers/virtual_machines_controller.rb
@@ -1,7 +1,4 @@
 class VirtualMachinesController < ApplicationController
-  def index_pane_list
-    %w(recent help)
-  end
   def index
     @objects ||= model_class.all
     @vm_logins = {}
diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index 6b5ee81..72b76a5 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -68,11 +68,21 @@ class ArvadosBase < ActiveRecord::Base
     self.columns
     @attribute_info
   end
-  def self.find(uuid)
+  def self.find(uuid, opts={})
     if uuid.class != String or uuid.length < 27 then
       raise 'argument to find() must be a uuid string. Acceptable formats: warehouse locator or string with format xxxxx-xxxxx-xxxxxxxxxxxxxxx'
     end
-    new.private_reload(uuid)
+
+    # Only do one lookup on the API side per {class, uuid, workbench
+    # request} unless {cache: false} is given via opts.
+    cache_key = "request_#{Thread.current.object_id}_#{self.to_s}_#{uuid}"
+    if opts[:cache] == false
+      Rails.cache.write cache_key, $arvados_api_client.api(self, '/' + uuid)
+    end
+    hash = Rails.cache.fetch cache_key do
+      $arvados_api_client.api(self, '/' + uuid)
+    end
+    new.private_reload(hash)
   end
   def self.order(*args)
     ArvadosResourceList.new(self).order(*args)
diff --git a/apps/workbench/app/models/link.rb b/apps/workbench/app/models/link.rb
index 899a800..8e36533 100644
--- a/apps/workbench/app/models/link.rb
+++ b/apps/workbench/app/models/link.rb
@@ -4,4 +4,7 @@ class Link < ArvadosBase
   def self.by_tail(t, opts={})
     where(opts.merge :tail_kind => t.kind, :tail_uuid => t.uuid)
   end
+  def friendly_link_name
+    "#{link_class}/#{name}: #{tail_kind.andand.sub('arvados#','') || tail_uuid} > #{head_kind.andand.sub('arvados#','') || head_uuid}"
+  end
 end
diff --git a/apps/workbench/app/views/api_client_authorizations/_help.html.erb b/apps/workbench/app/views/api_client_authorizations/_index_help.html.erb
similarity index 100%
rename from apps/workbench/app/views/api_client_authorizations/_help.html.erb
rename to apps/workbench/app/views/api_client_authorizations/_index_help.html.erb
diff --git a/apps/workbench/app/views/application/_arvados_object.html.erb b/apps/workbench/app/views/application/_arvados_object.html.erb
index d04ca84..13187fd 100644
--- a/apps/workbench/app/views/application/_arvados_object.html.erb
+++ b/apps/workbench/app/views/application/_arvados_object.html.erb
@@ -59,66 +59,3 @@
 <% else %>
 <%= yield :arvados_object_table %>
 <% end %>
-
-<div>
-  <ul class="nav nav-tabs">
-    <% if content_for? :page_content %>
-    <li><a href="#arvados-object-table" data-toggle="tab">Table</a></li>
-    <% end %>
-    <li class="active"><a href="#arvados-object-json" data-toggle="tab">API response JSON</a></li>
-    <% if @object.andand.uuid %>
-    <li><a href="#arvados-object-curl" data-toggle="tab">curl update example</a></li>
-    <li><a href="#arvados-object-arv" data-toggle="tab">“arv” CLI examples</a></li>
-    <li><a href="#arvados-object-python" data-toggle="tab">Python example</a></li>
-    <% end %>
-  </ul>
-
-  <div class="tab-content">
-    <% if content_for? :page_content %>
-    <div id="arvados-object-table" class="tab-pane fade">
-      <%= yield :arvados_object_table %>
-    </div>
-    <% end %>
-    <div id="arvados-object-json" class="tab-pane fade in active">
-      <pre>
-<%= JSON.pretty_generate(@object.attributes.reject { |k,v| k == 'id' }) rescue nil %>
-      </pre>
-    </div>
-
-    <% if @object.andand.uuid %>
-
-    <div id="arvados-object-curl" class="tab-pane fade">
-      <pre>
-curl -X PUT \
- -H "Authorization: OAuth2 $ARVADOS_API_TOKEN" \
- --data-urlencode <%= @object.class.to_s.underscore %>@/dev/stdin \
- https://$ARVADOS_API_HOST/arvados/v1/<%= @object.class.to_s.pluralize.underscore %>/<%= @object.uuid %> \
- <<EOF
-<%= JSON.pretty_generate({@object.attributes.keys[-3] => @object.attributes.values[-3]}) %>
-EOF
-      </pre>
-    </div>
-
-    <div id="arvados-object-arv" class="tab-pane fade">
-      <pre>
-arv --pretty <%= @object.class.to_s.underscore %> get \
- --uuid <%= @object.uuid %>
-
-arv <%= @object.class.to_s.underscore %> update \
- --uuid <%= @object.uuid %> \
- --<%= @object.class.to_s.underscore.gsub '_', '-' %> '<%= JSON.generate({@object.attributes.keys[-3] => @object.attributes.values[-3]}).gsub("'","'\''") %>'
-      </pre>
-    </div>
-
-    <div id="arvados-object-python" class="tab-pane fade">
-      <pre>
-import arvados
-
-x = arvados.api().<%= @object.class.to_s.pluralize.underscore %>().get(uuid='<%= @object.uuid %>').execute()
-      </pre>
-    </div>
-
-    <% end %>
-
-  </div>
-</div>
diff --git a/apps/workbench/app/views/application/_index_table.html.erb b/apps/workbench/app/views/application/_index_table.html.erb
new file mode 100644
index 0000000..f63ac33
--- /dev/null
+++ b/apps/workbench/app/views/application/_index_table.html.erb
@@ -0,0 +1,52 @@
+<table class="table arv-index">
+  <colgroup>
+    <col width="65%" />
+    <col width="15%" />
+    <col width="15%" />
+    <col width="5%" />
+  </colgroup>
+  <thead>
+    <tr>
+      <th><%= controller.model_class.to_s.underscore.gsub '_', ' ' %></th>
+      <th>modified</th>
+      <th>owner</th>
+      <th>
+        <!-- a column for delete buttons -->
+      </th>
+    </tr>
+  </thead>
+      
+  <tbody>
+    <% @objects.each do |object| %>
+    <tr data-object-uuid="<%= object.uuid %>" data-object-preview-href="<%= url_for(controller: params[:controller], action: 'show', partial: 'preview', id: object.uuid) %>">
+      <td>
+        <%= link_to(
+            {action: 'show', id: object.uuid},
+            method: :get, remote: true) do %>
+        <%= object.friendly_link_name %>
+        <% end %>
+      </td><td>
+        <%= distance_of_time_in_words(object.modified_at, Time.now) %>
+      </td><td>
+        <%= link_to_if_arvados_object object.andand.owner_uuid, friendly_name: true %>
+      </td><td>
+        <% if object.editable? %>
+        <%= link_to({action: 'destroy', id: object.uuid}, method: :delete, remote: true, data: {confirm: "You are about to delete #{controller.model_class} #{object.uuid}.\n\nAre you sure?"}) do %>
+        <i class="icon-trash"></i>
+        <% end %>
+        <% end %>
+      </td>
+    </tr>
+    <% end %>
+  </tbody>
+
+  <tfoot>
+    <% if @objects.empty? %>
+    <tr>
+      <td colspan="3">
+        No <%= controller.model_class.to_s.pluralize.underscore.gsub '_', ' ' %> to display.
+      </td>
+    </tr>
+    <% end %>
+  </tfoot>
+</table>
diff --git a/apps/workbench/app/views/application/_preview.html.erb b/apps/workbench/app/views/application/_preview.html.erb
new file mode 100644
index 0000000..0e8d2a2
--- /dev/null
+++ b/apps/workbench/app/views/application/_preview.html.erb
@@ -0,0 +1 @@
+<%= render partial: 'arvados_object' %>
diff --git a/apps/workbench/app/views/application/_recent.html.erb b/apps/workbench/app/views/application/_recent.html.erb
deleted file mode 100644
index 6ea3818..0000000
--- a/apps/workbench/app/views/application/_recent.html.erb
+++ /dev/null
@@ -1,61 +0,0 @@
-<% if @objects.empty? %>
-<br/>
-<p style="text-align: center">
-  No <%= controller.model_class.to_s.pluralize.underscore.gsub '_', ' ' %> to display.
-</p>
-
-<% else %>
-
-<% attr_blacklist = ' created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at' %>
-
-<table class="table arv-index">
-  <thead>
-    <tr>
-      <% @objects.first.attributes_for_display.each do |attr, attrvalue| %>
-      <% next if attr_blacklist.index(" "+attr) %>
-      <th class="arv-attr-<%= attr %>">
-        <%= controller.model_class.attribute_info[attr.to_sym].andand[:column_heading] or attr.sub /_uuid/, '' %>
-      </th>
-      <% end %>
-      <th>
-        <!-- a column for delete buttons -->
-      </th>
-    </tr>
-  </thead>
-      
-  <tbody>
-    <% @objects.each do |object| %>
-    <tr data-object-uuid="<%= object.uuid %>">
-      <% object.attributes_for_display.each do |attr, attrvalue| %>
-      <% next if attr_blacklist.index(" "+attr) %>
-      <td class="arv-object-<%= object.class.to_s %> arv-attr-<%= attr %>">
-        <% if attr == 'uuid' %>
-        <%= link_to_if_arvados_object object %>
-        <%= link_to_if_arvados_object(object, { link_text: raw('<i class="icon-hand-right"></i>') }) %>
-        <% else %>
-        <% if object.attribute_editable? attr %>
-        <%= render_editable_attribute object, attr %>
-        <% else %>
-        <%= resource_class_for_uuid(attrvalue, referring_attr: attr, referring_object: @object).to_s %>
-        <%= attrvalue %>
-        <% end %>
-        <%= link_to_if_arvados_object(attrvalue, { referring_object: @object, link_text: raw('<i class="icon-hand-right"></i>') }) if resource_class_for_uuid(attrvalue, {referring_object: @object}) %>
-        <% end %>
-      </td>
-      <% end %>
-      <td>
-        <% if object.editable? %>
-        <%= link_to({action: 'destroy', id: object.uuid}, method: :delete, remote: true, data: {confirm: "You are about to delete #{controller.model_class} #{object.uuid}.\n\nAre you sure?"}) do %>
-        <i class="icon-trash"></i>
-        <% end %>
-        <% end %>
-      </td>
-    </tr>
-    <% end %>
-  </tbody>
-
-  <tfoot>
-  </tfoot>
-</table>
-
-<% end %>
diff --git a/apps/workbench/app/views/application/_show_about.html.erb b/apps/workbench/app/views/application/_show_about.html.erb
new file mode 100644
index 0000000..8da881f
--- /dev/null
+++ b/apps/workbench/app/views/application/_show_about.html.erb
@@ -0,0 +1,15 @@
+<% if @object.respond_to? :properties and @object.properties[:page_content] %>
+<% content_for :page_content do %>
+<h1>
+<%= render_content_from_database(@object.properties[:page_title] || @object.uuid) %>
+</h1>
+
+<% if @object.properties[:page_subtitle] %>
+<h4>
+<%= render_content_from_database @object.properties[:page_subtitle] %>
+</h4>
+<% end %>
+
+<%= render_content_from_database @object.properties[:page_content] %>
+<% end %>
+<% end %>
diff --git a/apps/workbench/app/views/application/_show_api_response.html.erb b/apps/workbench/app/views/application/_show_api_response.html.erb
new file mode 100644
index 0000000..2f0cd21
--- /dev/null
+++ b/apps/workbench/app/views/application/_show_api_response.html.erb
@@ -0,0 +1,3 @@
+<pre>
+<%= JSON.pretty_generate(@object.attributes.reject { |k,v| k == 'id' }) rescue nil %>
+</pre>
diff --git a/apps/workbench/app/views/application/_show_cli_example.html.erb b/apps/workbench/app/views/application/_show_cli_example.html.erb
new file mode 100644
index 0000000..25b772c
--- /dev/null
+++ b/apps/workbench/app/views/application/_show_cli_example.html.erb
@@ -0,0 +1,8 @@
+<pre>
+arv --pretty <%= @object.class.to_s.underscore %> get \
+ --uuid <%= @object.uuid %>
+
+arv <%= @object.class.to_s.underscore %> update \
+ --uuid <%= @object.uuid %> \
+ --<%= @object.class.to_s.underscore.gsub '_', '-' %> '<%= JSON.generate({@object.attributes.keys[-3] => @object.attributes.values[-3]}).gsub("'","'\''") %>'
+</pre>
diff --git a/apps/workbench/app/views/application/_show_curl_example.html.erb b/apps/workbench/app/views/application/_show_curl_example.html.erb
new file mode 100644
index 0000000..230c54d
--- /dev/null
+++ b/apps/workbench/app/views/application/_show_curl_example.html.erb
@@ -0,0 +1,11 @@
+<% if @object.andand.uuid %>
+<pre>
+curl -X PUT \
+ -H "Authorization: OAuth2 $ARVADOS_API_TOKEN" \
+ --data-urlencode <%= @object.class.to_s.underscore %>@/dev/stdin \
+ https://$ARVADOS_API_HOST/arvados/v1/<%= @object.class.to_s.pluralize.underscore %>/<%= @object.uuid %> \
+ <<EOF
+<%= JSON.pretty_generate({@object.attributes.keys[-3] => @object.attributes.values[-3]}) %>
+EOF
+</pre>
+<% end %>
diff --git a/apps/workbench/app/views/application/_show_python_example.html.erb b/apps/workbench/app/views/application/_show_python_example.html.erb
new file mode 100644
index 0000000..07ff855
--- /dev/null
+++ b/apps/workbench/app/views/application/_show_python_example.html.erb
@@ -0,0 +1,5 @@
+<pre>
+import arvados
+
+x = arvados.api().<%= @object.class.to_s.pluralize.underscore %>().get(uuid='<%= @object.uuid %>').execute()
+</pre>
diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb
index 95e0b41..c93af1f 100644
--- a/apps/workbench/app/views/application/index.html.erb
+++ b/apps/workbench/app/views/application/index.html.erb
@@ -2,29 +2,37 @@
 <%= controller.model_class.to_s.pluralize.underscore.capitalize.gsub '_', ' ' %>
 <% end %>
 
-<% if controller.model_class.creatable? %>
-<%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", 
-    { action: 'create', return_to: request.url }, 
-    { class: 'btn btn-primary pull-right' } %>
-<% end %>
-<%= form_tag({action: 'compare', controller: params[:controller], method: 'get'}, {method: 'get', id: 'compare', class: 'pull-right small-form-margin'}) do |f| %>
-<%= submit_tag 'Compare selected', {class: 'btn btn-primary', disabled: true, style: 'display: none'} %>
- 
-<% end rescue nil %>
-
-<% pane_list = controller.index_pane_list rescue %w(recent) %>
-
-<div class="tabbable">
-<ul class="nav nav-tabs">
-  <% pane_list.each_with_index do |pane, i| %>
-  <li class="<%= 'active' if i==0 %>"><a href="#<%= pane %>" data-toggle="tab"><%= pane.capitalize %></a></li>
+<div class="row-fluid">
+<div class="span12 index-table">
+  <% if controller.model_class.creatable? %>
+  <%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", 
+      { action: 'create', return_to: request.url }, 
+      { class: 'btn btn-primary pull-right' } %>
   <% end %>
-</ul>
+  <%= form_tag({action: 'compare', controller: params[:controller], method: 'get'}, {method: 'get', id: 'compare', class: 'pull-right small-form-margin'}) do |f| %>
+  <%= submit_tag 'Compare selected', {class: 'btn btn-primary', disabled: true, style: 'display: none'} %>
+   
+  <% end rescue nil %>
+  <%= render partial: 'index_table' %>
+</div>
+<div class="span4 index-detail" style="display:none">
+  <% panes = Hash[%w(help).map { |pane| [pane, render(partial: 'index_' + pane)] rescue nil }.compact] %>
+  <div class="tabbable">
+    <ul class="nav nav-tabs">
+      <% panes.each_with_index do |(name, content), i| %>
+      <li class="<%= 'active' if i==0 %>"><a href="#index_<%= name %>" data-toggle="tab"><%= name.capitalize.gsub '_', ' ' %></a></li>
+      <% end %>
+      <li><a href="#index_detail" data-toggle="tab">Detail</a></li>
+    </ul>
 
-<div class="tab-content">
-  <% pane_list.each_with_index do |pane, i| %>
-  <div id="<%= pane %>" class="tab-pane fade in <%= 'active' if i==0 %>">
-    <%= render partial: pane %>
+    <div class="tab-content">
+      <% panes.each_with_index do |(name, content), i| %>
+      <div id="index_<%= name %>" class="tab-pane fade in <%= 'active' if i==0 %>">
+        <%= content %>
+      </div>
+      <% end %>
+      <div id="index_detail" class="tab-pane fade in">
+      </div>
+    </div>
   </div>
-  <% end %>
 </div>
diff --git a/apps/workbench/app/views/application/show.html.erb b/apps/workbench/app/views/application/show.html.erb
index 348d9d9..e28031c 100644
--- a/apps/workbench/app/views/application/show.html.erb
+++ b/apps/workbench/app/views/application/show.html.erb
@@ -3,37 +3,22 @@
     @object.friendly_link_name %>
 <% end %>
 
-<% if @object.respond_to? :properties %>
-<% if @object.properties[:page_content] %>
-<% content_for :page_content do %>
-<h1>
-<%= render_content_from_database(@object.properties[:page_title] || @object.uuid) %>
-</h1>
-
-<% if @object.properties[:page_subtitle] %>
-<h4>
-<%= render_content_from_database @object.properties[:page_subtitle] %>
-</h4>
-<% end %>
-
-<%= render_content_from_database @object.properties[:page_content] %>
-<% end %>
-<% end %>
-<% end %>
-
-<% pane_list = controller.show_pane_list rescue %w(attributes) %>
+<%
+   pane_list = controller.show_pane_list rescue %w(Attributes About API_response curl_example CLI_example Python_example)
+   pane_content = Hash[pane_list.map { |pane| [pane, render(partial: 'show_' + pane.downcase)] }.select { |k,v| v.andand.strip.length > 0 }]
+   %>
 
 <div class="tabbable">
 <ul class="nav nav-tabs">
-  <% pane_list.each_with_index do |pane, i| %>
-  <li class="<%= 'active' if i==0 %>"><a href="#<%= pane %>" data-toggle="tab"><%= pane.capitalize.gsub '_', ' ' %></a></li>
+  <% pane_content.each_with_index do |(pane, content), i| %>
+  <li class="<%= 'active' if i==0 %>"><a href="#<%= pane %>" data-toggle="tab"><%= pane.gsub('_', ' ') %></a></li>
   <% end %>
 </ul>
 
 <div class="tab-content">
-  <% pane_list.each_with_index do |pane, i| %>
+  <% pane_content.each_with_index do |(pane, content), i| %>
   <div id="<%= pane %>" class="tab-pane fade in <%= 'active' if i==0 %>">
-    <%= render partial: 'show_' + pane %>
+    <%= content %>
   </div>
   <% end %>
 </div>
diff --git a/apps/workbench/app/views/authorized_keys/_help.html.erb b/apps/workbench/app/views/authorized_keys/_index_help.html.erb
similarity index 100%
rename from apps/workbench/app/views/authorized_keys/_help.html.erb
rename to apps/workbench/app/views/authorized_keys/_index_help.html.erb
diff --git a/apps/workbench/app/views/collections/_recent.html.erb b/apps/workbench/app/views/collections/_index_table.html.erb
similarity index 100%
rename from apps/workbench/app/views/collections/_recent.html.erb
rename to apps/workbench/app/views/collections/_index_table.html.erb
diff --git a/apps/workbench/app/views/jobs/_recent.html.erb b/apps/workbench/app/views/jobs/_index_table.html.erb
similarity index 100%
rename from apps/workbench/app/views/jobs/_recent.html.erb
rename to apps/workbench/app/views/jobs/_index_table.html.erb
diff --git a/apps/workbench/app/views/links/_breadcrumb_page_name.html.erb b/apps/workbench/app/views/links/_breadcrumb_page_name.html.erb
index 8c35905..a31a7c8 100644
--- a/apps/workbench/app/views/links/_breadcrumb_page_name.html.erb
+++ b/apps/workbench/app/views/links/_breadcrumb_page_name.html.erb
@@ -1,3 +1,4 @@
+<%= link_to request.fullpath do %>
 <% if @object %>
 (<%= @object.link_class %>)
 <%= @object.name %>:
@@ -5,4 +6,4 @@
 →
 <%= @object.head_kind.andand.sub 'arvados#', '' %>
 <% end %>
-
+<% end %>
diff --git a/apps/workbench/app/views/links/_recent.html.erb b/apps/workbench/app/views/links/_recent.html.erb
deleted file mode 100644
index 76e959a..0000000
--- a/apps/workbench/app/views/links/_recent.html.erb
+++ /dev/null
@@ -1,57 +0,0 @@
-<table class="table">
-  <thead>
-    <tr class="contain-align-left">
-      <th>
-	id
-      </th><th>
-	class
-      </th><th>
-	name
-      </th><th>
-	tail
-      </th><th>
-	head
-      </th><th>
-	properties
-      </th><th>
-      </th>
-    </tr>
-  </thead>
-  <tbody>
-
-    <% @objects.sort_by { |link| link[:created_at] }.each do |link| %>
-
-    <tr>
-      <td>
-        <%= link_to_if_arvados_object link %>
-      </td><td>
-        <%= render_editable_attribute link, 'link_class' %>
-      </td><td>
-        <%= render_editable_attribute link, 'name' %>
-      </td><td>
-        <%= render_editable_attribute link, 'tail_uuid' %>
-      </td><td>
-        <%= render_editable_attribute link, 'head_uuid' %>
-      </td><td>
-        <%= link.properties %>
-      </td>
-
-      <td>
-        <% if current_user and (current_user.is_admin or current_user.uuid == link.owner_uuid) %>
-        <%= link_to raw('<i class="icon-trash"></i>'), { action: 'destroy', id: link.uuid }, { confirm: 'Delete this link?', method: 'delete' } %>
-        <% end %>
-      </td>
-
-    </tr>
-
-    <% end %>
-    <% if @objects.count == 0 %>
-    <tr>
-      <td colspan="7">
-        (no links)
-      </td>
-    </tr>
-    <% end %>
-
-  </tbody>
-</table>
diff --git a/apps/workbench/app/views/pipeline_instances/_recent.html.erb b/apps/workbench/app/views/pipeline_instances/_index_table.html.erb
similarity index 100%
rename from apps/workbench/app/views/pipeline_instances/_recent.html.erb
rename to apps/workbench/app/views/pipeline_instances/_index_table.html.erb
diff --git a/apps/workbench/app/views/pipeline_templates/_recent.html.erb b/apps/workbench/app/views/pipeline_templates/_index_table.html.erb
similarity index 100%
rename from apps/workbench/app/views/pipeline_templates/_recent.html.erb
rename to apps/workbench/app/views/pipeline_templates/_index_table.html.erb
diff --git a/apps/workbench/app/views/repositories/_help.html.erb b/apps/workbench/app/views/repositories/_index_help.html.erb
similarity index 100%
rename from apps/workbench/app/views/repositories/_help.html.erb
rename to apps/workbench/app/views/repositories/_index_help.html.erb
diff --git a/apps/workbench/app/views/virtual_machines/_help.html.erb b/apps/workbench/app/views/virtual_machines/_index_help.html.erb
similarity index 100%
rename from apps/workbench/app/views/virtual_machines/_help.html.erb
rename to apps/workbench/app/views/virtual_machines/_index_help.html.erb

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list