[ARVADOS] updated: 9fd96762299e182afbf69e76e0560c748591af47
git at public.curoverse.com
git at public.curoverse.com
Sat Feb 1 18:31:12 EST 2014
Summary of changes:
.../app/assets/stylesheets/application.css | 3 +
.../app/controllers/application_controller.rb | 5 ++
.../controllers/pipeline_instances_controller.rb | 75 ++++++++++++++++++++
apps/workbench/app/helpers/application_helper.rb | 6 +-
.../app/helpers/pipeline_instances_helper.rb | 42 +++++++----
apps/workbench/app/models/arvados_base.rb | 4 +-
apps/workbench/app/models/node.rb | 2 +-
apps/workbench/app/models/user.rb | 6 ++-
apps/workbench/app/models/virtual_machine.rb | 2 +-
.../views/application/_arvados_attr_value.html.erb | 3 +-
.../app/views/application/_arvados_object.html.erb | 2 +-
.../application/_arvados_object_attr.html.erb | 5 +-
.../application/_breadcrumb_page_name.html.erb | 1 +
.../app/views/application/_breadcrumbs.html.erb | 20 +++++
.../app/views/application/_index.html.erb | 4 -
apps/workbench/app/views/application/show.html.erb | 2 +-
apps/workbench/app/views/jobs/index.html.erb | 4 +-
apps/workbench/app/views/jobs/show.html.erb | 1 -
.../app/views/layouts/application.html.erb | 1 +
.../app/views/links/_breadcrumb_page_name.html.erb | 8 ++
.../app/views/pipeline_instances/compare.html.erb | 73 +++++++++++++++++++
.../app/views/pipeline_instances/show.html.erb | 2 +-
.../app/views/user_agreements/index.html.erb | 2 +
apps/workbench/app/views/users/_home.html.erb | 1 +
apps/workbench/app/views/users/_tables.html.erb | 2 +-
apps/workbench/app/views/users/index.html.erb | 62 ----------------
apps/workbench/app/views/users/welcome.html.erb | 2 +
apps/workbench/config/routes.rb | 1 +
28 files changed, 240 insertions(+), 101 deletions(-)
create mode 100644 apps/workbench/app/views/application/_breadcrumb_page_name.html.erb
create mode 100644 apps/workbench/app/views/application/_breadcrumbs.html.erb
delete mode 100644 apps/workbench/app/views/jobs/show.html.erb
create mode 100644 apps/workbench/app/views/links/_breadcrumb_page_name.html.erb
create mode 100644 apps/workbench/app/views/pipeline_instances/compare.html.erb
delete mode 100644 apps/workbench/app/views/users/index.html.erb
via 9fd96762299e182afbf69e76e0560c748591af47 (commit)
via 4e92e5890ae7b44545052db029863e886a36cc79 (commit)
via 2ecdb027a8866550d923c702fbbef888b76e6702 (commit)
via 9b78ee7e66152bda07daf881d1f9305a11100ce6 (commit)
via 4e501ab0ba22d9d34d478d32638d53e99ecb9a6c (commit)
via 4f9c8ded1490b6b2376b426a131d403f817e7549 (commit)
via e4ef3bbeb9d89946ee88aa031204e76156bb9d57 (commit)
from 5de6e729142a497ecb6e6dc40e2239cae07cd18d (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 9fd96762299e182afbf69e76e0560c748591af47
Author: Tom Clegg <tom at curoverse.com>
Date: Sat Feb 1 15:17:10 2014 -0800
Remove extra breadcrumbs bar.
diff --git a/apps/workbench/app/views/pipeline_instances/compare.html.erb b/apps/workbench/app/views/pipeline_instances/compare.html.erb
index 7f90064..cf1aa5f 100644
--- a/apps/workbench/app/views/pipeline_instances/compare.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/compare.html.erb
@@ -11,11 +11,6 @@
}
<% end %>
-<ul class="breadcrumb">
- <li><%= link_to 'Pipeline instances', pipeline_instances_path %> <span class="divider">/</span></li>
- <li class="active">Compare</li>
-</ul>
-
<% pi_span = [(10.0/(@objects.count)).floor,1].max %>
<div>
<% [['Instance', :uuid], ['Template', :pipeline_template_uuid]].each do |label, attr| %>
commit 4e92e5890ae7b44545052db029863e886a36cc79
Author: Tom Clegg <tom at curoverse.com>
Date: Sat Feb 1 15:16:52 2014 -0800
Allow controller to override page name for breadcrumbs.
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 201c063..8d23c71 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -129,6 +129,11 @@ class ApplicationController < ActionController::Base
controller_name.classify.constantize
end
+ def breadcrumb_page_name
+ (@breadcrumb_page_name ||
+ (@object.friendly_link_name if @object.respond_to? :friendly_link_name))
+ end
+
protected
def find_object_by_uuid
diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb
index 99a4ddd..507131f 100644
--- a/apps/workbench/app/controllers/pipeline_instances_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb
@@ -4,6 +4,8 @@ class PipelineInstancesController < ApplicationController
include PipelineInstancesHelper
def compare
+ @breadcrumb_page_name = 'compare'
+
@rows = [] # each is {name: S, components: [...]}
# Build a table: x=pipeline y=component
diff --git a/apps/workbench/app/models/link.rb b/apps/workbench/app/models/link.rb
index 07de447..899a800 100644
--- a/apps/workbench/app/models/link.rb
+++ b/apps/workbench/app/models/link.rb
@@ -4,8 +4,4 @@ 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}) #{tail_kind.sub 'arvados#', ' '} #{name} #{head_kind.sub 'arvados#', ' '}"
- end
end
diff --git a/apps/workbench/app/views/application/_breadcrumb_page_name.html.erb b/apps/workbench/app/views/application/_breadcrumb_page_name.html.erb
new file mode 100644
index 0000000..67387fd
--- /dev/null
+++ b/apps/workbench/app/views/application/_breadcrumb_page_name.html.erb
@@ -0,0 +1 @@
+<%= controller.breadcrumb_page_name %>
diff --git a/apps/workbench/app/views/application/_breadcrumbs.html.erb b/apps/workbench/app/views/application/_breadcrumbs.html.erb
index fe1c12a..26709ad 100644
--- a/apps/workbench/app/views/application/_breadcrumbs.html.erb
+++ b/apps/workbench/app/views/application/_breadcrumbs.html.erb
@@ -13,7 +13,8 @@
url_for({controller: params[:controller]})) %>
<span class="divider">/</span>
</li>
- <li class="active"><%= @object.andand.friendly_link_name %>
+ <li class="active">
+ <%= render partial: 'breadcrumb_page_name' %>
</li>
<% end %>
</ul>
diff --git a/apps/workbench/app/views/links/_breadcrumb_page_name.html.erb b/apps/workbench/app/views/links/_breadcrumb_page_name.html.erb
new file mode 100644
index 0000000..00acb84
--- /dev/null
+++ b/apps/workbench/app/views/links/_breadcrumb_page_name.html.erb
@@ -0,0 +1,8 @@
+<% if @object %>
+(<%= @object.link_class %>)
+<%= @object.name %>:
+<%= @object.tail_kind.sub 'arvados#', ' ' %>
+→
+<%= @object.head_kind.sub 'arvados#', ' ' %>
+<% end %>
+
commit 2ecdb027a8866550d923c702fbbef888b76e6702
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Jan 31 13:59:33 2014 -0800
Add breadcrumbs bar to #index and #show pages.
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index fe7012a..a42016b 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -56,10 +56,7 @@ module ApplicationHelper
if opts[:friendly_name]
begin
- friendly_name = resource_class.find(link_uuid).friendly_link_name
- if friendly_name and not friendly_name.empty?
- link_name = friendly_name
- end
+ link_name = resource_class.find(link_uuid).friendly_link_name
rescue RuntimeError
# If that lookup failed, the link will too. So don't make one.
return attrvalue
diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index 5c7e44f..6b5ee81 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -262,9 +262,7 @@ class ArvadosBase < ActiveRecord::Base
end
def friendly_link_name
- if self.class.column_names.include? 'name'
- self.name
- end
+ (name if self.respond_to? :name) || uuid
end
protected
diff --git a/apps/workbench/app/models/link.rb b/apps/workbench/app/models/link.rb
index 899a800..07de447 100644
--- a/apps/workbench/app/models/link.rb
+++ b/apps/workbench/app/models/link.rb
@@ -4,4 +4,8 @@ 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}) #{tail_kind.sub 'arvados#', ' '} #{name} #{head_kind.sub 'arvados#', ' '}"
+ end
end
diff --git a/apps/workbench/app/models/node.rb b/apps/workbench/app/models/node.rb
index 0a324ff..6518047 100644
--- a/apps/workbench/app/models/node.rb
+++ b/apps/workbench/app/models/node.rb
@@ -3,6 +3,6 @@ class Node < ArvadosBase
current_user and current_user.is_admin
end
def friendly_link_name
- self.hostname
+ (hostname && !hostname.empty?) ? hostname : uuid
end
end
diff --git a/apps/workbench/app/models/virtual_machine.rb b/apps/workbench/app/models/virtual_machine.rb
index 5f6131e..5ff7798 100644
--- a/apps/workbench/app/models/virtual_machine.rb
+++ b/apps/workbench/app/models/virtual_machine.rb
@@ -16,6 +16,6 @@ class VirtualMachine < ArvadosBase
super]
end
def friendly_link_name
- self.hostname
+ (hostname && !hostname.empty?) ? hostname : uuid
end
end
diff --git a/apps/workbench/app/views/application/_arvados_attr_value.html.erb b/apps/workbench/app/views/application/_arvados_attr_value.html.erb
index e04fe45..cb60714 100644
--- a/apps/workbench/app/views/application/_arvados_attr_value.html.erb
+++ b/apps/workbench/app/views/application/_arvados_attr_value.html.erb
@@ -6,7 +6,8 @@
<% if obj.attribute_editable?(attr) %>
<%= render_editable_attribute obj, attr %>
<% if resource_class_for_uuid(attrvalue, {referring_object: obj, referring_attr: attr}) %>
- (<%= link_to_if_arvados_object attrvalue, {referring_attr: attr, referring_object: obj, with_class_name: true, friendly_name: true} %>)
+ <br />
+ (<%= link_to_if_arvados_object attrvalue, {referring_attr: attr, referring_object: obj, with_class_name: true, friendly_name: true} %>)
<% end %>
<% elsif attr == 'uuid' %>
<%= link_to_if_arvados_object attrvalue, {referring_attr: attr, referring_object: obj, with_class_name: false, friendly_name: false} %>
diff --git a/apps/workbench/app/views/application/_arvados_object.html.erb b/apps/workbench/app/views/application/_arvados_object.html.erb
index c41fa18..d04ca84 100644
--- a/apps/workbench/app/views/application/_arvados_object.html.erb
+++ b/apps/workbench/app/views/application/_arvados_object.html.erb
@@ -1,5 +1,5 @@
<% content_for :arvados_object_table do %>
-<h2><%= @object.class %> <%= @object.uuid %></h2>
+
<%= form_for @object do |f| %>
<table class="table topalign">
<thead>
diff --git a/apps/workbench/app/views/application/_breadcrumbs.html.erb b/apps/workbench/app/views/application/_breadcrumbs.html.erb
new file mode 100644
index 0000000..fe1c12a
--- /dev/null
+++ b/apps/workbench/app/views/application/_breadcrumbs.html.erb
@@ -0,0 +1,19 @@
+<ul class="breadcrumb">
+ <li>
+ <%= link_to((Rails.configuration.site_name rescue Rails.application.class.parent_name), '/') %>
+ <span class="divider">/</span>
+ </li>
+ <% if params[:action] == 'index' %>
+ <li class="active">
+ <%= controller.model_class.to_s.pluralize.underscore.gsub '_', ' ' %>
+ </li>
+ <% else %>
+ <li><%= link_to(
+ controller.model_class.to_s.pluralize.underscore.gsub('_', ' '),
+ url_for({controller: params[:controller]})) %>
+ <span class="divider">/</span>
+ </li>
+ <li class="active"><%= @object.andand.friendly_link_name %>
+ </li>
+ <% end %>
+</ul>
diff --git a/apps/workbench/app/views/application/_index.html.erb b/apps/workbench/app/views/application/_index.html.erb
index 4c1fdc3..02a1aa1 100644
--- a/apps/workbench/app/views/application/_index.html.erb
+++ b/apps/workbench/app/views/application/_index.html.erb
@@ -1,13 +1,9 @@
-
-<h2 class="pull-left"><%= controller.model_class.to_s.pluralize.underscore.capitalize.gsub '_', ' ' %></h2>
-<br/>
<% 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 %>
-
<% if @objects.empty? %>
<br/>
<p style="text-align: center">
diff --git a/apps/workbench/app/views/application/show.html.erb b/apps/workbench/app/views/application/show.html.erb
index ad7e53c..e8a15f3 100644
--- a/apps/workbench/app/views/application/show.html.erb
+++ b/apps/workbench/app/views/application/show.html.erb
@@ -1,7 +1,7 @@
<% if @object.respond_to? :properties %>
<% content_for :page_title do %>
-<%= @object.properties[:page_title] || @object.uuid %>
+<%= @object.properties[:page_title] || @object.friendly_link_name %>
<% end %>
<% if @object.properties[:page_content] %>
diff --git a/apps/workbench/app/views/jobs/index.html.erb b/apps/workbench/app/views/jobs/index.html.erb
index 2188a3b..99bb9dd 100644
--- a/apps/workbench/app/views/jobs/index.html.erb
+++ b/apps/workbench/app/views/jobs/index.html.erb
@@ -1,12 +1,10 @@
-<% content_for :head do %>
-<style>
+<% content_for :css do %>
table.topalign>tbody>tr>td {
vertical-align: top;
}
table.topalign>thead>tr>td {
vertical-align: bottom;
}
-</style>
<% end %>
<table class="topalign table">
diff --git a/apps/workbench/app/views/jobs/show.html.erb b/apps/workbench/app/views/jobs/show.html.erb
deleted file mode 100644
index 9079085..0000000
--- a/apps/workbench/app/views/jobs/show.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= render :partial => 'application/arvados_object' %>
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index 1def50e..3d2c6fa 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -112,6 +112,7 @@
<div class="container">
+ <%= content_for?(:breadcrumbs) ? yield(:breadcrumbs) : render(partial: 'breadcrumbs') %>
<%= yield %>
</div> <!-- /container -->
diff --git a/apps/workbench/app/views/user_agreements/index.html.erb b/apps/workbench/app/views/user_agreements/index.html.erb
index ed758af..acd5ba1 100644
--- a/apps/workbench/app/views/user_agreements/index.html.erb
+++ b/apps/workbench/app/views/user_agreements/index.html.erb
@@ -1,3 +1,5 @@
+<% content_for :breadcrumbs do '' end %>
+
<% n_files = @required_user_agreements.collect(&:files).flatten(1).count %>
<% content_for :page_title do %>
<% if n_files == 1 %>
diff --git a/apps/workbench/app/views/users/_home.html.erb b/apps/workbench/app/views/users/_home.html.erb
index 9ec9d80..f59e65e 100644
--- a/apps/workbench/app/views/users/_home.html.erb
+++ b/apps/workbench/app/views/users/_home.html.erb
@@ -1,3 +1,4 @@
+<% content_for :breadcrumbs do raw '<!-- -->' end %>
<% content_for :css do %>
.dash-list {
padding: 9px 0;
diff --git a/apps/workbench/app/views/users/welcome.html.erb b/apps/workbench/app/views/users/welcome.html.erb
index b782108..4fe5518 100644
--- a/apps/workbench/app/views/users/welcome.html.erb
+++ b/apps/workbench/app/views/users/welcome.html.erb
@@ -1,3 +1,5 @@
+<% content_for :breadcrumbs do raw '<!-- -->' end %>
+
<%= image_tag "dax.png", style: "float: left; max-width: 25%; margin-right: 2em" %>
<h1>Hi there! Please log in to use <%= Rails.configuration.site_name %>.</h1>
<div class="row-fluid">
commit 9b78ee7e66152bda07daf881d1f9305a11100ce6
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Jan 31 13:32:39 2014 -0800
Use generic index page for /users
diff --git a/apps/workbench/app/models/user.rb b/apps/workbench/app/models/user.rb
index 7ab532d..cc9b9bb 100644
--- a/apps/workbench/app/models/user.rb
+++ b/apps/workbench/app/models/user.rb
@@ -27,7 +27,11 @@ class User < ArvadosBase
{}))
end
- def attribute_editable?(attr)
+ def attributes_for_display
+ super.reject { |k,v| %w(owner_uuid default_owner_uuid identity_url prefs).index k }
+ end
+
+ def attribute_editable?(attr)
(not (self.uuid.andand.match(/000000000000000$/) and self.is_admin)) and super(attr)
end
diff --git a/apps/workbench/app/views/users/index.html.erb b/apps/workbench/app/views/users/index.html.erb
deleted file mode 100644
index e29aad5..0000000
--- a/apps/workbench/app/views/users/index.html.erb
+++ /dev/null
@@ -1,62 +0,0 @@
-<table class="table">
- <thead>
- <tr class="contain-align-left">
- <th>
- id
- </th><th>
- name
- </th><th>
- email
- </th><th>
- active?
- </th><th>
- admin?
- </th><th>
- owner
- </th><th>
- default group
- </th><th>
- </th>
- </tr>
- </thead>
- <tbody>
-
- <% @objects.sort_by { |u| u[:created_at] }.each do |u| %>
-
- <tr>
- <td>
- <%= link_to_if_arvados_object u %>
- </td><td>
- <%= render_editable_attribute u, 'first_name' %>
- <%= render_editable_attribute u, 'last_name' %>
- </td><td>
- <%= render_editable_attribute u, 'email' %>
- </td><td>
- <%= render_editable_attribute u, 'is_active', u.is_active ? 'Active' : 'No', "data-type" => "select", "data-source" => '[{value:1,text:"Active"},{value:0,text:"No"}]', "data-value" => u.is_active ? "1" : "0" %>
- </td><td>
- <%= render_editable_attribute u, 'is_admin', u.is_admin ? 'Admin' : 'No', "data-type" => "select", "data-source" => '[{value:1,text:"admin"},{value:0,text:"No"}]', "data-value" => u.is_admin ? "1" : "0" %>
- </td><td>
- <%= render_editable_attribute u, 'owner_uuid' %>
- </td><td>
- <%= render_editable_attribute u, 'default_owner_uuid' %>
- </td>
-
- <td>
- <% if current_user and current_user.is_admin %>
- <%= link_to raw('<i class="icon-trash"></i>'), { action: 'destroy', id: u.uuid }, { confirm: 'Delete this user?', method: 'delete' } %>
- <% end %>
- </td>
-
- </tr>
-
- <% end %>
- <% if @objects.count == 0 %>
- <tr>
- <td colspan="7">
- (no users)
- </td>
- </tr>
- <% end %>
-
- </tbody>
-</table>
commit 4e501ab0ba22d9d34d478d32638d53e99ecb9a6c
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Jan 28 18:15:43 2014 -0800
Show condensed data about pipeline instances side by side on "compare"
page.
refs #1978
diff --git a/apps/workbench/app/assets/stylesheets/application.css b/apps/workbench/app/assets/stylesheets/application.css
index 9c67653..d2993be 100644
--- a/apps/workbench/app/assets/stylesheets/application.css
+++ b/apps/workbench/app/assets/stylesheets/application.css
@@ -75,3 +75,6 @@ form input.search-mini {
form.small-form-margin {
margin-bottom: 2px;
}
+.nowrap {
+ white-space: nowrap;
+}
diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb
index f3932bf..99a4ddd 100644
--- a/apps/workbench/app/controllers/pipeline_instances_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb
@@ -1,12 +1,75 @@
class PipelineInstancesController < ApplicationController
skip_before_filter :find_object_by_uuid, only: :compare
before_filter :find_objects_by_uuid, only: :compare
+ include PipelineInstancesHelper
def compare
+ @rows = [] # each is {name: S, components: [...]}
+
+ # Build a table: x=pipeline y=component
+ @objects.each_with_index do |pi, pi_index|
+ pipeline_jobs(pi).each do |component|
+ # Find a cell with the same name as this component but no
+ # entry for this pipeline
+ target_row = nil
+ @rows.each_with_index do |row, row_index|
+ if row[:name] == component[:name] and !row[:components][pi_index]
+ target_row = row
+ end
+ end
+ if !target_row
+ target_row = {name: component[:name], components: []}
+ @rows << target_row
+ end
+ target_row[:components][pi_index] = component
+ end
+ end
+
+ @rows.each do |row|
+ # Build a "normal" pseudo-component for this row by picking the
+ # most common value for each attribute. If all values are
+ # equally common, there is no "normal".
+ normal = {} # attr => most common value
+ highscore = {} # attr => how common "normal" is
+ score = {} # attr => { value => how common }
+ row[:components].each do |pj|
+ pj.each do |k,v|
+ vstr = for_comparison v
+ score[k] ||= {}
+ score[k][vstr] = (score[k][vstr.to_s] || 0) + 1
+ highscore[k] ||= 0
+ if score[k][vstr] == highscore[k]
+ # tie for first place = no "normal"
+ normal.delete k
+ elsif score[k][vstr] == highscore[k] + 1
+ # more pipelines have v than anything else
+ highscore[k] = score[k][vstr]
+ normal[k] = vstr
+ end
+ end
+ end
+
+ # Add a hash in component[:is_normal]: { attr => is_the_value_normal? }
+ row[:components].each do |pj|
+ pj[:is_normal] = {}
+ pj.each do |k,v|
+ pj[:is_normal][k] = (normal.has_key?(k) && normal[k] == for_comparison(v))
+ end
+ end
+ end
end
protected
+ def for_comparison v
+ if v.is_a? Hash or v.is_a? Array
+ v.to_json
+ else
+ v.to_s
+ end
+ end
+
def find_objects_by_uuid
- @objects = model_class.where(uuid: params[:uuid])
+ @objects = model_class.where(uuid: params[:uuid].split('/'))
end
+
end
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 5500938..fe7012a 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -69,6 +69,7 @@ module ApplicationHelper
link_name = "#{resource_class.to_s}: #{link_name}"
end
end
+ style_opts[:class] = (style_opts[:class] || '') + ' nowrap'
link_to link_name, { controller: resource_class.to_s.underscore.pluralize, action: 'show', id: link_uuid }, style_opts
else
attrvalue
diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index c792db8..f314c65 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -1,18 +1,36 @@
module PipelineInstancesHelper
- def pipeline_jobs
- if @object.components[:steps].is_a? Array
- pipeline_jobs_oldschool
- elsif @object.components.is_a? Hash
- pipeline_jobs_newschool
+ def pipeline_jobs object=nil
+ object ||= @object
+ if object.components[:steps].is_a? Array
+ pipeline_jobs_oldschool object
+ elsif object.components.is_a? Hash
+ pipeline_jobs_newschool object
end
end
+ def render_pipeline_jobs
+ pipeline_jobs.collect do |pj|
+ render_pipeline_job pj
+ end
+ end
+
+ def render_pipeline_job pj
+ if pj[:percent_done]
+ pj[:progress_bar] = raw("<div class=\"progress\" style=\"width:100px\"><div class=\"bar bar-success\" style=\"width:#{pj[:percent_done]}%\"></div><div class=\"bar\" style=\"width:#{pj[:percent_running]}%\"></div></div>")
+ elsif pj[:progress]
+ raw("<div class=\"progress\" style=\"width:100px\"><div class=\"bar\" style=\"width:#{pj[:progress]*100}%\"></div></div>")
+ end
+ pj[:output_link] = link_to_if_arvados_object pj[:output]
+ pj[:job_link] = link_to_if_arvados_object pj[:job][:uuid]
+ pj
+ end
+
protected
- def pipeline_jobs_newschool
+ def pipeline_jobs_newschool object
ret = []
i = -1
- @object.components.each do |cname, c|
+ object.components.each do |cname, c|
i += 1
pj = {index: i, name: cname}
pj[:job] = c[:job].is_a?(Hash) ? c[:job] : {}
@@ -58,20 +76,18 @@ module PipelineInstancesHelper
end
end
pj[:job_id] = pj[:job][:uuid]
- pj[:job_link] = link_to_if_arvados_object pj[:job][:uuid]
+ pj[:script] = pj[:job][:script]
pj[:script_version] = pj[:job][:script_version]
pj[:output] = pj[:job][:output]
pj[:finished_at] = (Time.parse(pj[:job][:finished_at]) rescue nil)
- pj[:progress_bar] = raw("<div class=\"progress\" style=\"width:100px\"><div class=\"bar bar-success\" style=\"width:#{pj[:percent_done]}%\"></div><div class=\"bar\" style=\"width:#{pj[:percent_running]}%\"></div></div>")
- pj[:output_link] = link_to_if_arvados_object pj[:output]
ret << pj
end
ret
end
- def pipeline_jobs_oldschool
+ def pipeline_jobs_oldschool object
ret = []
- @object.components[:steps].each_with_index do |step, i|
+ object.components[:steps].each_with_index do |step, i|
pj = {index: i, name: step[:name]}
if step[:complete] and step[:complete] != 0
if step[:output_data_locator]
@@ -112,8 +128,6 @@ module PipelineInstancesHelper
pj[:script_version] = (step[:warehousejob][:revision] rescue nil)
pj[:output] = step[:output_data_locator]
pj[:finished_at] = (Time.parse(step[:warehousejob][:finishtime]) rescue nil)
- pj[:progress_bar] = raw("<div class=\"progress\" style=\"width:100px\"><div class=\"bar\" style=\"width:#{pj[:progress]*100}%\"></div></div>")
- pj[:output_link] = link_to_if_arvados_object pj[:output]
ret << pj
end
ret
diff --git a/apps/workbench/app/views/application/_arvados_object_attr.html.erb b/apps/workbench/app/views/application/_arvados_object_attr.html.erb
index ec2ac36..d7e126e 100644
--- a/apps/workbench/app/views/application/_arvados_object_attr.html.erb
+++ b/apps/workbench/app/views/application/_arvados_object_attr.html.erb
@@ -1,8 +1,9 @@
+<% object ||= @object %>
<% if attrvalue.is_a? Hash then attrvalue.each do |infokey, infocontent| %>
<tr class="info">
<td><%= attr %>[<%= infokey %>]</td>
<td>
- <%= render partial: 'application/arvados_attr_value', locals: { obj: @object, attr: nil, attrvalue: infocontent } %>
+ <%= render partial: 'application/arvados_attr_value', locals: { obj: object, attr: nil, attrvalue: infocontent } %>
</td>
</tr>
<% end %>
@@ -10,7 +11,7 @@
<tr class="<%= 'info' if %w(uuid owner_uuid created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at).index(attr.to_s).nil? %>">
<td><%= attr %></td>
<td>
- <%= render partial: 'application/arvados_attr_value', locals: { obj: @object, attr: attr, attrvalue: attrvalue } %>
+ <%= render partial: 'application/arvados_attr_value', locals: { obj: object, attr: attr, attrvalue: attrvalue } %>
</td>
</tr>
<% end %>
diff --git a/apps/workbench/app/views/pipeline_instances/compare.html.erb b/apps/workbench/app/views/pipeline_instances/compare.html.erb
index f75f32a..7f90064 100644
--- a/apps/workbench/app/views/pipeline_instances/compare.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/compare.html.erb
@@ -1,44 +1,78 @@
-<table class="table table-condensed table-hover topalign">
- <thead>
- </thead>
- <tbody>
- <tr>
- <% @objects.each do |object| %>
- <td>
+<% content_for :css do %>
+.notnormal {
+ background: #ffffaa;
+}
+.headrow div {
+ padding-top: .5em;
+ padding-bottom: .5em;
+}
+.headrow:first-child {
+ border-bottom: 1px solid black;
+}
+<% end %>
- <table class="table table-condensed table-hover topalign">
- <thead>
- </thead>
- <tbody>
- <% object.attributes_for_display.each do |attr, attrvalue| %>
- <% if attr == 'components' and attrvalue.is_a? Hash %>
+<ul class="breadcrumb">
+ <li><%= link_to 'Pipeline instances', pipeline_instances_path %> <span class="divider">/</span></li>
+ <li class="active">Compare</li>
+</ul>
- <tr class="info"><td><%= attr %></td><td>
- <table class="table">
- <% pipeline_jobs.each do |pj| %>
- <tr><% %w(index name result job_link script script_version progress_detail progress_bar output_link).each do |key| %>
- <td>
- <% if key == 'script_version' %>
- <%= pj[key.to_sym][0..6] rescue '' %>
- <% else %>
- <%= pj[key.to_sym] %>
- <% end %>
- </td>
- <% end %>
- </tr>
- <% end %>
- </table>
- </td></tr>
+<% pi_span = [(10.0/(@objects.count)).floor,1].max %>
+<div>
+<% [['Instance', :uuid], ['Template', :pipeline_template_uuid]].each do |label, attr| %>
+<div class="row headrow">
+ <div class="span2">
+ <%# label %>
+ </div>
+ <% @objects.each do |object| %>
+ <div class="span<%= pi_span %>">
+ <%= render partial: 'application/arvados_attr_value', locals: { obj: object, attr: attr, attrvalue: object.send(attr.to_sym) } %>
+ </div>
+ <% end %>
+</div>
+<% end %>
+</div>
- <% else %>
- <%= render partial: 'application/arvados_object_attr', locals: { attr: attr, attrvalue: attrvalue } %>
- <% end %>
- <% end %>
- </tbody>
- </table>
+<% @rows.each do |row| %>
+<div class="row">
+ <div class="span2">
+ <%= row[:name] %>
+ </div>
+ <% @objects.each_with_index do |_, x| %>
+ <div class="span<%= pi_span %>">
+ <div class="row">
- </td>
- <% end %>
- </tr>
- </tbody>
-</table>
+ <% if row[:components][x] %>
+ <% pj = render_pipeline_job row[:components][x] %>
+
+ <div class="span3">
+ <%= link_to_if_arvados_object pj[:job_id], {friendly_name: true, with_class_name: true}, {class: 'deemphasize'} %>
+ </div>
+
+ <% %w(script script_version script_parameters output).each do |key| %>
+ <div class="span3">
+ <% unless key=='output' and pj[:result] != 'complete' %>
+ <% val = pj[key.to_sym] || pj[:job].andand[key.to_sym] %>
+ <% link_name = case
+ when key == 'script_version' && val.match(/^[0-9a-f]{7,}$/)
+ val = val[0..7] # TODO: leave val alone, make link_to handle git commits
+ when key == 'output'
+ val.sub! /\+K.*$/, ''
+ val[0..12]
+ when key == 'script_parameters'
+ val = val.keys.sort.join(', ')
+ end
+ %>
+ <span class="deemphasize"><%= key %>:</span> <span class="<%= 'notnormal' if !pj[:is_normal][key.to_sym] %>"><%= link_to_if_arvados_object val, {friendly_name: true, link_text: link_name} %></span>
+ <% end %>
+ </div>
+ <% end %>
+ <% else %>
+ None
+ <% end %>
+ </div>
+ </div>
+ <% end %>
+</div>
+<div class="row" style="padding: .5em">
+</div>
+<% end %>
diff --git a/apps/workbench/app/views/pipeline_instances/show.html.erb b/apps/workbench/app/views/pipeline_instances/show.html.erb
index 74c090d..a36412e 100644
--- a/apps/workbench/app/views/pipeline_instances/show.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/show.html.erb
@@ -7,7 +7,7 @@
<tr class="info"><td><%= attr %></td><td>
<table class="table">
- <% pipeline_jobs.each do |pj| %>
+ <% render_pipeline_jobs.each do |pj| %>
<tr><% %w(index name result job_link script script_version progress_detail progress_bar output_link).each do |key| %>
<td>
<% if key == 'script_version' %>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index a035535..c9bf19b 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -26,9 +26,8 @@ ArvadosWorkbench::Application.routes.draw do
resources :groups
resources :specimens
resources :pipeline_templates
- resources :pipeline_instances do
- get 'compare/*uuid' => 'pipeline_instances#compare'
- end
+ resources :pipeline_instances
+ get '/pipeline_instances/compare/*uuid' => 'pipeline_instances#compare'
resources :links
match '/collections/graph' => 'collections#graph'
resources :collections
commit 4f9c8ded1490b6b2376b426a131d403f817e7549
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Jan 28 07:57:47 2014 -0800
Add pipeline_instances/compare page
diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb
index afb9949..f3932bf 100644
--- a/apps/workbench/app/controllers/pipeline_instances_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb
@@ -1,2 +1,12 @@
class PipelineInstancesController < ApplicationController
+ skip_before_filter :find_object_by_uuid, only: :compare
+ before_filter :find_objects_by_uuid, only: :compare
+
+ def compare
+ end
+
+ protected
+ def find_objects_by_uuid
+ @objects = model_class.where(uuid: params[:uuid])
+ end
end
diff --git a/apps/workbench/app/views/pipeline_instances/compare.html.erb b/apps/workbench/app/views/pipeline_instances/compare.html.erb
new file mode 100644
index 0000000..f75f32a
--- /dev/null
+++ b/apps/workbench/app/views/pipeline_instances/compare.html.erb
@@ -0,0 +1,44 @@
+<table class="table table-condensed table-hover topalign">
+ <thead>
+ </thead>
+ <tbody>
+ <tr>
+ <% @objects.each do |object| %>
+ <td>
+
+ <table class="table table-condensed table-hover topalign">
+ <thead>
+ </thead>
+ <tbody>
+ <% object.attributes_for_display.each do |attr, attrvalue| %>
+ <% if attr == 'components' and attrvalue.is_a? Hash %>
+
+ <tr class="info"><td><%= attr %></td><td>
+ <table class="table">
+ <% pipeline_jobs.each do |pj| %>
+ <tr><% %w(index name result job_link script script_version progress_detail progress_bar output_link).each do |key| %>
+ <td>
+ <% if key == 'script_version' %>
+ <%= pj[key.to_sym][0..6] rescue '' %>
+ <% else %>
+ <%= pj[key.to_sym] %>
+ <% end %>
+ </td>
+ <% end %>
+ </tr>
+ <% end %>
+ </table>
+ </td></tr>
+
+ <% else %>
+ <%= render partial: 'application/arvados_object_attr', locals: { attr: attr, attrvalue: attrvalue } %>
+ <% end %>
+ <% end %>
+ </tbody>
+ </table>
+
+ </td>
+ <% end %>
+ </tr>
+ </tbody>
+</table>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index f2480c6..a035535 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -26,7 +26,9 @@ ArvadosWorkbench::Application.routes.draw do
resources :groups
resources :specimens
resources :pipeline_templates
- resources :pipeline_instances
+ resources :pipeline_instances do
+ get 'compare/*uuid' => 'pipeline_instances#compare'
+ end
resources :links
match '/collections/graph' => 'collections#graph'
resources :collections
commit e4ef3bbeb9d89946ee88aa031204e76156bb9d57
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Jan 31 12:50:35 2014 -0800
Fix "show all pipeline templates" link target on dashboard page.
diff --git a/apps/workbench/app/views/users/_tables.html.erb b/apps/workbench/app/views/users/_tables.html.erb
index 47498d3..3bf5023 100644
--- a/apps/workbench/app/views/users/_tables.html.erb
+++ b/apps/workbench/app/views/users/_tables.html.erb
@@ -89,7 +89,7 @@
<div>
<strong>Recent pipeline instances</strong>
- <%= link_to raw("Show all pipeline instances →"), jobs_path, class: 'pull-right' %>
+ <%= link_to raw("Show all pipeline instances →"), pipeline_instances_path, class: 'pull-right' %>
<% if not current_user.andand.is_active or @my_pipelines.empty? %>
<p>(None)</p>
<% else %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list