From bf43b9c625657fa745bbb237248f7d33ccb4cd2b Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 12 Jun 2014 18:03:26 -0400 Subject: [PATCH] 2872: Fix bugs, tweak formatting --- .../app/assets/javascripts/selection.js | 3 + .../assets/stylesheets/application.css.scss | 2 +- .../app/controllers/actions_controller.rb | 2 +- .../app/controllers/collections_controller.rb | 2 +- .../app/controllers/projects_controller.rb | 15 +++++ .../app/views/application/_content.html.erb | 2 +- .../application/_selection_checkbox.html.erb | 2 +- .../app/views/collections/show.html.erb | 16 +++--- .../app/views/layouts/application.html.erb | 21 +++---- .../_show_components.html.erb | 54 ------------------ .../views/pipeline_instances/show.html.erb | 56 ++++++++++++++++++- .../_index_jobs_and_pipelines.html.erb | 4 +- .../views/projects/_show_contents.html.erb | 16 +++--- .../projects/_show_contents_rows.html.erb | 2 +- .../app/views/projects/index.html.erb | 2 +- 15 files changed, 105 insertions(+), 94 deletions(-) mode change 120000 => 100644 apps/workbench/app/views/pipeline_instances/show.html.erb diff --git a/apps/workbench/app/assets/javascripts/selection.js b/apps/workbench/app/assets/javascripts/selection.js index 0fa2e9a072..a313c8b78e 100644 --- a/apps/workbench/app/assets/javascripts/selection.js +++ b/apps/workbench/app/assets/javascripts/selection.js @@ -186,6 +186,9 @@ function dispatch_selection_action() { var data = []; var param_name = $(this).attr('data-selection-param-name'); var href = $(this).attr('data-href'); + if ($(this).closest('.disabled').length > 0) { + return false; + } $('.persistent-selection:checkbox:checked').each(function() { data.push({name: param_name, value: $(this).val()}); }); diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss index c01195c1d8..4fea7aebc0 100644 --- a/apps/workbench/app/assets/stylesheets/application.css.scss +++ b/apps/workbench/app/assets/stylesheets/application.css.scss @@ -211,7 +211,7 @@ div#wrapper { padding-bottom: 1em; } .arv-description-in-table { - max-height: 3.5em; + height: 4em; overflow-x: hidden; overflow-y: hidden; } diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb index 6fbdf29f46..c1e2617fc7 100644 --- a/apps/workbench/app/controllers/actions_controller.rb +++ b/apps/workbench/app/controllers/actions_controller.rb @@ -39,7 +39,7 @@ class ActionsController < ApplicationController tail_uuid: @object.uuid, head_uuid: src.uuid, link_class: 'name', - name: @object.uuid) + name: src.uuid) else case action when :copy diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb index 88dadbba62..fa83714de0 100644 --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@ -162,7 +162,7 @@ class CollectionsController < ApplicationController @project_links = Link.limit(RELATION_LIMIT).order("modified_at DESC") .where(head_uuid: @object.uuid, link_class: 'name').results project_hash = Group.where(uuid: @project_links.map(&:tail_uuid)).to_hash - @projects = @project_links.map { |link| project_hash[link.tail_uuid] } + @projects = project_hash.values @permissions = Link.limit(RELATION_LIMIT).order("modified_at DESC") .where(head_uuid: @object.uuid, link_class: 'permission', name: 'can_read').results diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb index 89a50b29bf..cd32c65e17 100644 --- a/apps/workbench/app/controllers/projects_controller.rb +++ b/apps/workbench/app/controllers/projects_controller.rb @@ -48,6 +48,21 @@ class ProjectsController < ApplicationController end end + def destroy + while (objects = Link.filter([['owner_uuid','=',@object.uuid], + ['tail_uuid','=',@object.uuid]])).any? + objects.each do |object| + object.destroy + end + end + while (objects = @object.contents(include_linked: false)).any? + objects.each do |object| + object.update_attributes! owner_uuid: current_user.uuid + end + end + super + end + def find_objects_for_index @objects = Group. filter([['group_class','in',['project','folder']]]). diff --git a/apps/workbench/app/views/application/_content.html.erb b/apps/workbench/app/views/application/_content.html.erb index 0cd3a2c21d..bcea406487 100644 --- a/apps/workbench/app/views/application/_content.html.erb +++ b/apps/workbench/app/views/application/_content.html.erb @@ -1,5 +1,5 @@ <% content_for :content_top do %> - <% if @object and not @object.is_a?(Group) and @object.class.goes_in_projects? and @object.owner_uuid == current_user.uuid %> + <% if @object and not @object.is_a?(Group) and @object.class.goes_in_projects? and @object.owner_uuid == current_user.uuid and not @name_link %>
diff --git a/apps/workbench/app/views/application/_selection_checkbox.html.erb b/apps/workbench/app/views/application/_selection_checkbox.html.erb index 9d279bc402..25aef94cdb 100644 --- a/apps/workbench/app/views/application/_selection_checkbox.html.erb +++ b/apps/workbench/app/views/application/_selection_checkbox.html.erb @@ -1,4 +1,4 @@ -<%if object and object.class.goes_in_projects? %> +<%if object and (object.class.goes_in_projects? or (object.is_a?(Link) and ArvadosBase::resource_class_for_uuid(object.head_uuid).to_s == 'Collection')) %> <% fn = if defined? friendly_name friendly_name else diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb index bf2e7aa6a7..f3af64efac 100644 --- a/apps/workbench/app/views/collections/show.html.erb +++ b/apps/workbench/app/views/collections/show.html.erb @@ -3,22 +3,20 @@

- <% i = 0 %> - <% @project_links.each do |l| %> - <%= if i > 0 then ', ' end %> - <% i += 1 %> - <%= l.name %> - <% end %> + <%= @name_link.andand.name || @object.uuid %>

+

Content hash:
+ <%= @object.uuid %>

+ <% if not (@output_of.andand.any? or @log_of.andand.any?) %>

No source information available.

<% end %> <% if @output_of.andand.any? %> -

This collection was the output of:
+

This collection was the output of:
<%= render_arvados_object_list_start(@output_of, 'Show all jobs', jobs_path(filter: [['output', '=', @object.uuid]].to_json)) do |job| %> <%= link_to_if_arvados_object(job, friendly_name: true) %>
@@ -27,7 +25,7 @@ <% end %> <% if @log_of.andand.any? %> -

This collection contains log messages from:
+

This collection contains log messages from:
<%= render_arvados_object_list_start(@log_of, 'Show all jobs', jobs_path(filter: [['log', '=', @object.uuid]].to_json)) do |job| %> <%= link_to_if_arvados_object(job, friendly_name: true) %>
@@ -93,7 +91,7 @@ <%= render_arvados_object_list_start(@projects, 'Show all projects', links_path(filter: [['head_uuid', '=', @object.uuid], ['link_class', '=', 'name']].to_json)) do |project| %> - <%= link_to_if_arvados_object(project, friendly_name: true) %>
+ <%= link_to_if_arvados_object(project, friendly_name: true) %>
<% end %>

<% end %> diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb index c42abfe118..ef9bdee3dd 100644 --- a/apps/workbench/app/views/layouts/application.html.erb +++ b/apps/workbench/app/views/layouts/application.html.erb @@ -173,19 +173,21 @@ <% end %> My projects - <% my_projects.each do |p| %> -
  • - <%= link_to(p.name, project_path(p.uuid)) %> + <% @my_project_tree.each do |pnode| %> + <% next if pnode[:object].class != Group %> +
  • + <%= link_to(pnode[:object].name, project_path(pnode[:object].uuid)) %>
  • <% end %>
  • - <% projects_shared_with_me.each do |p| %> -
  • - <%= link_to project_path(p.uuid) do %> - <%= p.name %> + <% @shared_project_tree.each do |pnode| %> + <% next if pnode[:object].class != Group %> +
  • + <%= link_to project_path(pnode[:object].uuid) do %> + <%= pnode[:object].name %> <% end %>
  • <% end %> @@ -199,11 +201,6 @@ <%= link_to(p.name, project_path(p.uuid), data: {object_uuid: p.uuid, name: 'name'}) %> <% end %> - <% if current_project_uuid.andand != @object.andand.uuid %> - - <% end %> <% end %> diff --git a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb index d7b86bf1fb..86582195a5 100644 --- a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb +++ b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb @@ -1,46 +1,5 @@ -<% template = PipelineTemplate.find(@object.pipeline_template_uuid) rescue nil %> -<%= content_for :content_top do %> -

    - <%= render_editable_attribute @object, 'name', nil %> -

    - <% if template %> -
    From template:
    - <%= link_to_if_arvados_object template, friendly_name: true %>
    - <%= template.description %> -
    - <% end %> -<% end %> - -<% content_for :tab_line_buttons do %> - <%= link_to(copy_pipeline_instance_path('id' => @object.uuid, 'pipeline_instance[state]' => 'New'), - class: 'btn btn-primary', - #data: {toggle: :tooltip, placement: :top}, title: 'copy and modify', - method: :post, - ) do %> - Clone and edit - <% end %> -<% end %> - <% if !@object.state.in? ['New', 'Ready'] %> - <% content_for :tab_line_buttons do %> - <% if @object.state.in? ['RunningOnClient', 'RunningOnServer'] %> - <%= link_to(url_for('pipeline_instance[state]' => 'Paused'), - class: 'btn btn-primary run-pipeline-button', - method: :patch - ) do %> - Stop - <% end %> - <% elsif @object.state == 'Paused' %> - <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'), - class: 'btn btn-primary run-pipeline-button', - method: :patch - ) do %> - Resume - <% end %> - <% end %> - <% end %> - <% pipeline_job_uuids = [] %>
    @@ -117,10 +76,6 @@ <% if @object.state.in? %w(RunningOnServer RunningOnClient) %> - <% content_for :js do %> - setInterval(function(){$('a.refresh').click()}, 15000); - <% end %> - <% if !pipeline_job_uuids.empty? %>

    Log messages from running jobs

    <% log_history = pipeline_log_history(pipeline_job_uuids) %> @@ -140,15 +95,6 @@

    Here are all of the pipeline's components (jobs that will need to run in order to complete the pipeline). If you know what you're doing (or you're experimenting) you can modify these parameters before starting the pipeline. Usually, you only need to edit the settings presented on the "Inputs" tab above.

    <% end %> - <% content_for :tab_line_buttons do %> - <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'), - class: 'btn btn-primary run-pipeline-button', - method: :patch - ) do %> - Run - <% end %> - <% end %> - <% if @object.state.in? ['New', 'Ready'] %> <%= render partial: 'show_components_editable', locals: {editable: true} %> <% else %> diff --git a/apps/workbench/app/views/pipeline_instances/show.html.erb b/apps/workbench/app/views/pipeline_instances/show.html.erb deleted file mode 120000 index 4316b101cd..0000000000 --- a/apps/workbench/app/views/pipeline_instances/show.html.erb +++ /dev/null @@ -1 +0,0 @@ -../application/show.html.erb \ No newline at end of file diff --git a/apps/workbench/app/views/pipeline_instances/show.html.erb b/apps/workbench/app/views/pipeline_instances/show.html.erb new file mode 100644 index 0000000000..28972a4beb --- /dev/null +++ b/apps/workbench/app/views/pipeline_instances/show.html.erb @@ -0,0 +1,55 @@ +<% template = PipelineTemplate.find?(@object.pipeline_template_uuid) %> +<%= content_for :content_top do %> +

    + <%= render_editable_attribute @object, 'name', nil %> +

    + <% if template %> +
    From template:
    + <%= link_to_if_arvados_object template, friendly_name: true %>
    + <%= template.description %> +
    + <% end %> +<% end %> + +<% content_for :tab_line_buttons do %> + <%= link_to(copy_pipeline_instance_path('id' => @object.uuid, 'pipeline_instance[state]' => 'New'), + class: 'btn btn-primary', + #data: {toggle: :tooltip, placement: :top}, title: 'copy and modify', + method: :post, + ) do %> + Clone and edit + <% end %> + + <% if @object.state.in? ['New', 'Ready'] %> + <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'), + class: 'btn btn-primary run-pipeline-button', + method: :patch + ) do %> + Run + <% end %> + <% else %> + <% if @object.state.in? ['RunningOnClient', 'RunningOnServer'] %> + <%= link_to(url_for('pipeline_instance[state]' => 'Paused'), + class: 'btn btn-primary run-pipeline-button', + method: :patch + ) do %> + Stop + <% end %> + <% elsif @object.state == 'Paused' %> + <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'), + class: 'btn btn-primary run-pipeline-button', + method: :patch + ) do %> + Resume + <% end %> + <% end %> + <% end %> +<% end %> + +<% if @object.state.in? %w(RunningOnServer RunningOnClient) %> + <% content_for :js do %> + setInterval(function(){$('a.refresh').click()}, 15000); + <% end %> +<% end %> + +<%= render partial: 'content', layout: 'content_layout', locals: {pane_list: controller.show_pane_list }%> diff --git a/apps/workbench/app/views/projects/_index_jobs_and_pipelines.html.erb b/apps/workbench/app/views/projects/_index_jobs_and_pipelines.html.erb index 4c066f9d73..fb9a30593a 100644 --- a/apps/workbench/app/views/projects/_index_jobs_and_pipelines.html.erb +++ b/apps/workbench/app/views/projects/_index_jobs_and_pipelines.html.erb @@ -2,11 +2,11 @@ <% any = false %> <% recent_jobs_and_pipelines[0..9].each do |object| %> <% any = true %> -
    +
    <%= render :partial => "show_object_button", :locals => {object: object, size: 'xs'} %> <% if object.respond_to?(:name) %> - <%= render_editable_attribute object, 'name', nil, {tiptitle: 'rename', btnplacement: :left} %> + <%= render_editable_attribute object, 'name', nil, {tiptitle: 'rename'} %> <% else %> <%= object.class_for_display %> <%= object.uuid %> <% end %> diff --git a/apps/workbench/app/views/projects/_show_contents.html.erb b/apps/workbench/app/views/projects/_show_contents.html.erb index 3b21b405a8..bfd63ddb05 100644 --- a/apps/workbench/app/views/projects/_show_contents.html.erb +++ b/apps/workbench/app/views/projects/_show_contents.html.erb @@ -21,7 +21,7 @@ action_method: 'post', action_data: {selection_param: 'selection[]', copy_selections_into_project: @object.uuid, success: 'page-refresh'}.to_json), { class: "btn btn-primary btn-sm", remote: true, method: 'get', data: {'event-after-select' => 'page-refresh'} }) do %> - Add data + Add data... <% end %> <%= link_to( choose_pipeline_templates_path( @@ -31,9 +31,9 @@ action_method: 'post', action_data: {'selection_param' => 'pipeline_instance[pipeline_template_uuid]', 'pipeline_instance[owner_uuid]' => @object.uuid, 'success' => 'redirect-to-created-object'}.to_json), { class: "btn btn-primary btn-sm", remote: true, method: 'get' }) do %> - Run a pipeline + Run a pipeline... <% end %> - <%= link_to projects_path(method: 'post', owner_uuid: @object.uuid), class: 'btn btn-sm btn-primary' do %> + <%= link_to projects_path('project[owner_uuid]' => @object.uuid), method: 'post', class: 'btn btn-sm btn-primary' do %> Add a subproject <% end %> @@ -46,12 +46,10 @@ action_method: 'put', action_data: {selection_param: 'project[owner_uuid]', success: 'page-refresh'}.to_json), { class: "btn btn-sm btn-primary arv-move-to-project", remote: true, method: 'get' }) do %> - Move to... + Move project... <% end %> - <% if @objects_and_names.empty? %> - <%= button_to(project_path(id: @object.uuid, return_to: projects_path), method: 'delete', class: 'btn btn-sm btn-primary', data: {confirm: "Really delete project '#{@object.name}'?"}) do %> - Delete project - <% end %> + <%= link_to(project_path(id: @object.uuid, return_to: projects_path), method: 'delete', class: 'btn btn-sm btn-primary', data: {confirm: "Really delete project '#{@object.name}'?"}) do %> + Delete project <% end %> <% end %> <% end %> @@ -60,7 +58,7 @@
    - +