From 928565a23bf5ff54fb524b6c38f8e2b0f4b27725 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 6 Feb 2014 15:04:19 -0500 Subject: [PATCH] Harmonized all sections to use the new content template and layout --- .../api_client_authorizations_controller.rb | 5 + .../app/controllers/application_controller.rb | 6 +- .../app/controllers/collections_controller.rb | 6 +- .../app/controllers/jobs_controller.rb | 10 +- .../pipeline_instances_controller.rb | 8 +- .../app/helpers/provenance_helper.rb | 4 +- .../api_client_authorizations/_help.html.erb | 14 -- .../application/_arvados_attr_value.html.erb | 2 +- .../app/views/application/_recent.html.erb | 61 -------- .../views/application/_show_links.html.erb | 40 ----- .../app/views/application/index.html.erb | 26 +--- .../app/views/application/show.html.erb | 49 +++--- .../app/views/authorized_keys/_help.html.erb | 10 -- .../app/views/authorized_keys/index.html.erb | 1 - .../views/collections/_index_tbody.html.erb | 24 ++- .../app/views/collections/_recent.html.erb | 43 ------ .../workbench/app/views/groups/index.html.erb | 42 ------ .../workbench/app/views/jobs/_recent.html.erb | 141 ------------------ .../app/views/layouts/application.html.erb | 17 ++- .../views/pipeline_instances/_recent.html.erb | 85 ----------- .../views/pipeline_instances/compare.html.erb | 88 +---------- .../views/pipeline_templates/_recent.html.erb | 34 ----- .../views/pipeline_templates/show.html.erb | 42 ------ .../app/views/repositories/_help.html.erb | 27 ---- .../app/views/virtual_machines/_help.html.erb | 26 ---- 25 files changed, 91 insertions(+), 720 deletions(-) delete mode 100644 apps/workbench/app/views/api_client_authorizations/_help.html.erb delete mode 100644 apps/workbench/app/views/application/_recent.html.erb delete mode 100644 apps/workbench/app/views/application/_show_links.html.erb delete mode 100644 apps/workbench/app/views/authorized_keys/_help.html.erb delete mode 100644 apps/workbench/app/views/authorized_keys/index.html.erb delete mode 100644 apps/workbench/app/views/collections/_recent.html.erb delete mode 100644 apps/workbench/app/views/groups/index.html.erb delete mode 100644 apps/workbench/app/views/jobs/_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 delete mode 100644 apps/workbench/app/views/pipeline_templates/show.html.erb delete mode 100644 apps/workbench/app/views/repositories/_help.html.erb delete mode 100644 apps/workbench/app/views/virtual_machines/_help.html.erb diff --git a/apps/workbench/app/controllers/api_client_authorizations_controller.rb b/apps/workbench/app/controllers/api_client_authorizations_controller.rb index 1c55b116ef..03f0a040dd 100644 --- a/apps/workbench/app/controllers/api_client_authorizations_controller.rb +++ b/apps/workbench/app/controllers/api_client_authorizations_controller.rb @@ -5,4 +5,9 @@ class ApiClientAuthorizationsController < ApplicationController end super end + + def index_pane_list + %w(recent help) + end + end diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 4c2d6ddf62..02103c08bc 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -142,8 +142,12 @@ class ApplicationController < ActionController::Base (@object.friendly_link_name if @object.respond_to? :friendly_link_name)) end + def index_pane_list + %w(recent) + end + def show_pane_list - %w(attributes links json api) + %w(attributes metadata json api) end protected diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb index c38ca9a98c..d393da0c92 100644 --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@ -3,7 +3,7 @@ class CollectionsController < ApplicationController skip_before_filter :check_user_agreements, :only => [:show_file] def show_pane_list - %w(files attributes provenance_graph used_by) + %w(files attributes metadata provenance_graph used_by json api) end def index if params[:search].andand.length.andand > 0 @@ -102,8 +102,8 @@ class CollectionsController < ApplicationController end Collection.where(uuid: @object.uuid).each do |u| - @prov_svg = ProvenanceHelper::create_provenance_graph u.provenance, "provenance_svg", {:direction => :bottom_up, :combine_jobs => :script_only} - @used_by_svg = ProvenanceHelper::create_provenance_graph u.used_by, "used_by_svg", {:direction => :top_down, :combine_jobs => :script_only, :pdata_only => true} + @prov_svg = ProvenanceHelper::create_provenance_graph u.provenance, "provenance_svg", {:direction => :bottom_up, :combine_jobs => :script_only} rescue nil + @used_by_svg = ProvenanceHelper::create_provenance_graph u.used_by, "used_by_svg", {:direction => :top_down, :combine_jobs => :script_only, :pdata_only => true} rescue nil end end diff --git a/apps/workbench/app/controllers/jobs_controller.rb b/apps/workbench/app/controllers/jobs_controller.rb index 9b52977b6e..be9fe03bf5 100644 --- a/apps/workbench/app/controllers/jobs_controller.rb +++ b/apps/workbench/app/controllers/jobs_controller.rb @@ -31,7 +31,15 @@ class JobsController < ApplicationController generate_provenance([@object]) end + def index_pane_list + if params[:uuid] + %w(recent provenance) + else + %w(recent) + end + end + def show_pane_list - %w(attributes provenance links json api) + %w(attributes provenance metadata json api) end end diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb index b7339c07de..60a380d359 100644 --- a/apps/workbench/app/controllers/pipeline_instances_controller.rb +++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb @@ -121,6 +121,8 @@ class PipelineInstancesController < ApplicationController provenance, pips = graph(@objects) + @pipelines = @objects + @prov_svg = ProvenanceHelper::create_provenance_graph provenance, "provenance_svg", { :all_script_parameters => true, :combine_jobs => :script_and_version, @@ -129,9 +131,13 @@ class PipelineInstancesController < ApplicationController end def show_pane_list - %w(components graph attributes links json api) + %w(components graph attributes metadata json api) end + def compare_pane_list + %w(text_compare graph) + end + protected def for_comparison v if v.is_a? Hash or v.is_a? Array diff --git a/apps/workbench/app/helpers/provenance_helper.rb b/apps/workbench/app/helpers/provenance_helper.rb index ef165e86e9..cb2d9244d9 100644 --- a/apps/workbench/app/helpers/provenance_helper.rb +++ b/apps/workbench/app/helpers/provenance_helper.rb @@ -46,10 +46,10 @@ module ProvenanceHelper #"\"#{uuid}\" [label=\"#{rsc}\\n#{uuid}\",href=\"#{href}\"];\n" if rsc == Collection - puts uuid + #puts uuid if uuid == :"d41d8cd98f00b204e9800998ecf8427e+0" # special case - puts "empty!" + #puts "empty!" return "\"#{uuid}\" [label=\"(empty collection)\"];\n" end if @pdata[uuid] diff --git a/apps/workbench/app/views/api_client_authorizations/_help.html.erb b/apps/workbench/app/views/api_client_authorizations/_help.html.erb deleted file mode 100644 index 1481721535..0000000000 --- a/apps/workbench/app/views/api_client_authorizations/_help.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -
-### Pasting the following lines at a shell prompt will allow Arvados SDKs
-### to authenticate to your account, <%= current_user.email %>
-
-read ARVADOS_API_TOKEN <<EOF
-<%= Thread.current[:arvados_api_token] %>
-EOF
-export ARVADOS_API_TOKEN ARVADOS_API_HOST=<%= current_api_host %>
-<% if Rails.configuration.arvados_insecure_https %>
-export ARVADOS_API_HOST_INSECURE=true
-<% else %>
-unset ARVADOS_API_HOST_INSECURE
-<% 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 cb60714ab9..80dfa33bc8 100644 --- a/apps/workbench/app/views/application/_arvados_attr_value.html.erb +++ b/apps/workbench/app/views/application/_arvados_attr_value.html.erb @@ -16,7 +16,7 @@ <% end %> <% end %> 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 86b6b049f9..0000000000 --- a/apps/workbench/app/views/application/_recent.html.erb +++ /dev/null @@ -1,61 +0,0 @@ -<% if @objects.empty? %> -
-

- No <%= controller.model_class.to_s.pluralize.underscore.gsub '_', ' ' %> to display. -

- -<% else %> - -<% attr_blacklist = ' created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at' %> - - - - - <% @objects.first.attributes_for_display.each do |attr, attrvalue| %> - <% next if attr_blacklist.index(" "+attr) %> - - <% end %> - - - - - - <% @objects.each do |object| %> - - <% object.attributes_for_display.each do |attr, attrvalue| %> - <% next if attr_blacklist.index(" "+attr) %> - - <% end %> - - - <% end %> - - - - -
- <%= controller.model_class.attribute_info[attr.to_sym].andand[:column_heading] or attr.sub /_uuid/, '' %> - - -
- <% if attr == 'uuid' %> - <%= link_to_if_arvados_object object %> - <%= link_to_if_arvados_object(object, { link_text: raw('') }) %> - <% 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('') }) if resource_class_for_uuid(attrvalue, {referring_object: @object}) %> - <% end %> - - <% 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 %> - - <% end %> - <% end %> -
- -<% end %> diff --git a/apps/workbench/app/views/application/_show_links.html.erb b/apps/workbench/app/views/application/_show_links.html.erb deleted file mode 100644 index 8dcf3353ff..0000000000 --- a/apps/workbench/app/views/application/_show_links.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -<% incoming = Link.where(tail_uuid: @object.uuid) %> -<% if incoming.items_available > 0 %> -

Incoming Links

- - - - - <% incoming.each do |link| %> - - - - - - - - <% end %> - -
<%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "uuid", attrvalue: link.uuid } %><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "link_class", attrvalue: link.link_class } %><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "name", attrvalue: link.name } %><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "head_uuid", attrvalue: link.head_uuid } %><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "properties", attrvalue: link.properties } %>
-<% end %> - -<% outgoing = Link.where(head_uuid: @object.uuid) %> -<% if outgoing.items_available > 0 %> -

Outgoing Links

- - - - - <% outgoing.each do |link| %> - - - - - - - - <% end %> - -
<%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "uuid", attrvalue: link.uuid } %><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "link_class", attrvalue: link.link_class } %><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "name", attrvalue: link.name } %><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "tail_uuid", attrvalue: link.tail_uuid } %><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "properties", attrvalue: link.properties } %>
-<% end %> - diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb index 26adf59c9f..67b50040a4 100644 --- a/apps/workbench/app/views/application/index.html.erb +++ b/apps/workbench/app/views/application/index.html.erb @@ -1,31 +1,15 @@ <% content_for :page_title do %> -<%= controller.model_class.to_s.pluralize.underscore.capitalize.gsub '_', ' ' %> +<%= controller.model_class.to_s.pluralize.underscore.capitalize.gsub('_', ' ') %> <% end %> +<% content_for :tab_line_buttons do %> + <% 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) %> - - -
-<% pane_list.each_with_index do |pane, i| %> -
-
- <%= render partial: pane %> -
-
<% end %> -
+ +<%= render partial: 'content', layout: 'content_layout', locals: {pane_list: controller.index_pane_list }%> diff --git a/apps/workbench/app/views/application/show.html.erb b/apps/workbench/app/views/application/show.html.erb index 03a8f9bbb0..9da8ea1518 100644 --- a/apps/workbench/app/views/application/show.html.erb +++ b/apps/workbench/app/views/application/show.html.erb @@ -1,40 +1,29 @@ <% content_for :page_title do %> -<%= (@object.respond_to?(:properties) ? @object.properties[:page_title] : nil) || - @object.friendly_link_name %> + <%= (@object.respond_to?(:properties) ? @object.properties[:page_title] : nil) || + @object.friendly_link_name %> <% end %> +<% content_for :content_top do %> + <% if @object.respond_to? :properties %> -<% if @object.properties[:page_content] %> -<% content_for :page_content do %> -

-<%= render_content_from_database(@object.properties[:page_title] || @object.uuid) %> -

+ <% if @object.properties[:page_content] %> + <% content_for :page_content do %> +

+ <%= render_content_from_database(@object.properties[:page_title] || @object.uuid) %> +

+ + <% if @object.properties[:page_subtitle] %> +

+ <%= render_content_from_database @object.properties[:page_subtitle] %> +

+ <% end %> -<% if @object.properties[:page_subtitle] %> -

-<%= render_content_from_database @object.properties[:page_subtitle] %> -

+ <%= render_content_from_database @object.properties[:page_content] %> + <% end %> + <% end %> <% end %> -<%= render_content_from_database @object.properties[:page_content] %> -<% end %> -<% end %> <% end %> -<% pane_list = controller.show_pane_list %> +<%= render partial: 'content', layout: 'content_layout', locals: {pane_list: controller.show_pane_list }%> - - -
- <% pane_list.each_with_index do |pane, i| %> -
-
- <%= render partial: 'show_' + pane %> -
-
- <% end %> -
diff --git a/apps/workbench/app/views/authorized_keys/_help.html.erb b/apps/workbench/app/views/authorized_keys/_help.html.erb deleted file mode 100644 index db4d4dc440..0000000000 --- a/apps/workbench/app/views/authorized_keys/_help.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

- More information about how to log in to VMs: -

- diff --git a/apps/workbench/app/views/authorized_keys/index.html.erb b/apps/workbench/app/views/authorized_keys/index.html.erb deleted file mode 100644 index 37e8fce13e..0000000000 --- a/apps/workbench/app/views/authorized_keys/index.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render template: 'application/index' %> diff --git a/apps/workbench/app/views/collections/_index_tbody.html.erb b/apps/workbench/app/views/collections/_index_tbody.html.erb index f8fbcdc833..b41234505e 100644 --- a/apps/workbench/app/views/collections/_index_tbody.html.erb +++ b/apps/workbench/app/views/collections/_index_tbody.html.erb @@ -3,17 +3,29 @@ <%= link_to_if_arvados_object c.uuid %> - - <% c.files.each do |file| %> - <%= file[0] == '.' ? file[1] : "#{file[0]}/#{file[1]}" %> + + + <% i = 0 %> + <% while i < 3 and i < c.files.length %> + <% file = c.files[i] %> + <% file_path = "#{file[0]}/#{file[1]}" %> + <%= link_to file[1], {controller: 'collections', action: 'show_file', uuid: c.uuid, file: file_path, size: file[2], disposition: 'inline'}, {title: 'View in browser'} %>
+ <% i += 1 %> + <% end %> + <% if i < c.files.length %> + ⋮ <% end %> - + + <%= render partial: 'application/arvados_attr_value', locals: { obj: c, attr: "owner_uuid", attrvalue: c.owner_uuid } %> + <%= raw(distance_of_time_in_words(c.created_at, Time.now).sub('about ','~').sub(' ',' ')) if c.created_at %> - + + <% if @collection_info[c.uuid] %> <%= @collection_info[c.uuid][:tags].uniq.join ', ' %> <% end %> - + + <% if @collection_info[c.uuid][:wanted_by_me] %> <% elsif @collection_info[c.uuid][:wanted] %> diff --git a/apps/workbench/app/views/collections/_recent.html.erb b/apps/workbench/app/views/collections/_recent.html.erb deleted file mode 100644 index 4f383f3f3a..0000000000 --- a/apps/workbench/app/views/collections/_recent.html.erb +++ /dev/null @@ -1,43 +0,0 @@ -
- <%= form_tag collections_path, method: 'get', remote: true, class: 'form-search' do %> -
- <%= text_field_tag :search, params[:search], class: 'search-query' %> - <%= submit_tag "Search", name: nil, class: 'btn btn-info' %> -
- <% end %> -
- - - - - - - - - - - - - - - - <%= render partial: 'index_tbody' %> - -
- uuid - - contents - - age - - tags - - storage -
- -<% content_for :js do %> -$(document).on('click', 'form[data-remote] input[type=submit]', function() { - $('table#collections-index tbody').fadeTo(200, 0.3); - return true; -}); -<% end %> diff --git a/apps/workbench/app/views/groups/index.html.erb b/apps/workbench/app/views/groups/index.html.erb deleted file mode 100644 index 1e81518169..0000000000 --- a/apps/workbench/app/views/groups/index.html.erb +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - <% @groups.sort_by { |g| g[:created_at] }.reverse.each do |g| %> - - - - - - <% end %> - - -
- id - - name - - owner - - incoming permissions - - outgoing permissions - - owned -
- <%= link_to_if_arvados_object g %> - - <%= g.name %> - - <%= g.owner_uuid %> - - <%= @links_to.select { |x| x.head_uuid == g.uuid }.collect(&:tail_uuid).uniq.count %> - - <%= @links_from.select { |x| x.tail_uuid == g.uuid }.collect(&:head_uuid).uniq.count %> - - <%= @owned_users.select { |x| x.owner_uuid == g.uuid }.count %> users
-
diff --git a/apps/workbench/app/views/jobs/_recent.html.erb b/apps/workbench/app/views/jobs/_recent.html.erb deleted file mode 100644 index 2f1639132e..0000000000 --- a/apps/workbench/app/views/jobs/_recent.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 %> - - - - - - - - - - <% @jobs.sort_by { |j| j[:created_at] }.reverse.each do |j| %> - - - - - - - - - - - - - - - <% end %> - - -
- - status - - progress - - uuid - - script - - version - - output -
- - - <% if j.success == false %> - - <% elsif j.success %> - - <% elsif j.running %> - - <% else %> - - <% end %> - - <% 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 %> -
-
-
-
- <% end %> -
- <%= link_to_if_arvados_object j.uuid %> - - <%= j.script %> - - <%= j.script_version.andand[0..8] %> - - <%= link_to_if_arvados_object j.output %> -
- -<%= render partial: 'application/svg_div', locals: { - divId: "provenance_graph", - svgId: "provenance_svg", - svg: @svg } %> - diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb index 2e2fb84882..f186fda148 100644 --- a/apps/workbench/app/views/layouts/application.html.erb +++ b/apps/workbench/app/views/layouts/application.html.erb @@ -102,6 +102,7 @@ + + +