2872: Fix bugs, tweak formatting
authorTom Clegg <tom@curoverse.com>
Thu, 12 Jun 2014 22:03:26 +0000 (18:03 -0400)
committerTom Clegg <tom@curoverse.com>
Thu, 12 Jun 2014 22:03:26 +0000 (18:03 -0400)
15 files changed:
apps/workbench/app/assets/javascripts/selection.js
apps/workbench/app/assets/stylesheets/application.css.scss
apps/workbench/app/controllers/actions_controller.rb
apps/workbench/app/controllers/collections_controller.rb
apps/workbench/app/controllers/projects_controller.rb
apps/workbench/app/views/application/_content.html.erb
apps/workbench/app/views/application/_selection_checkbox.html.erb
apps/workbench/app/views/collections/show.html.erb
apps/workbench/app/views/layouts/application.html.erb
apps/workbench/app/views/pipeline_instances/_show_components.html.erb
apps/workbench/app/views/pipeline_instances/show.html.erb [changed from symlink to file mode: 0644]
apps/workbench/app/views/projects/_index_jobs_and_pipelines.html.erb
apps/workbench/app/views/projects/_show_contents.html.erb
apps/workbench/app/views/projects/_show_contents_rows.html.erb
apps/workbench/app/views/projects/index.html.erb

index 0fa2e9a0729bf90e9a2759d0c992fd5bf00fc5a7..a313c8b78e17da310ce011745b59599ef92c51d4 100644 (file)
@@ -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()});
     });
index c01195c1d84dc345eef2d5e5bb29628feccce53f..4fea7aebc09261df394dc754437157c9abe24e08 100644 (file)
@@ -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;
 }
index 6fbdf29f46ae4e624ed55752bce9a6a7a8d0ac6e..c1e2617fc7c4d1de73219b646086701bc3c7e3fb 100644 (file)
@@ -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
index 88dadbba626e6adf3329891f66feca27dfdaaedb..fa83714de083b6065297304f76d982ddadbce6d9 100644 (file)
@@ -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
index 89a50b29bf093dac5fb59db3fe4081fa44a5e515..cd32c65e17624fa2c7fd4aed8bed3b026a701b6c 100644 (file)
@@ -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']]]).
index 0cd3a2c21d2fac4b51aacd801fde005984e22d82..bcea4064873bc0926a68bedc8c84cb668becd111 100644 (file)
@@ -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 %>
     <div class="pull-right" style="width: 40%">
       <div class="alert alert-warning alert-dismissable">
         <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
index 9d279bc402fac12dfd433075c5f2876dbaab4394..25aef94cdb0e0ceb3a565d7397e33ffc634a5477 100644 (file)
@@ -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
index bf2e7aa6a7d44c21efb1390af782e94a69aa9056..f3af64efac03b5246f3a431c89f754c65722542c 100644 (file)
@@ -3,22 +3,20 @@
     <div class="panel panel-info">
       <div class="panel-heading">
        <h3 class="panel-title">
-          <% i = 0 %>
-            <% @project_links.each do |l| %>
-              <%= if i > 0 then ', ' end %>
-              <% i += 1 %>
-              <%= l.name %>
-            <% end %>
+         <%= @name_link.andand.name || @object.uuid %>
        </h3>
       </div>
       <div class="panel-body">
         <img src="/favicon.ico" class="pull-right" alt="" style="opacity: 0.3"/>
+       <p><i>Content hash:</i><br />
+         <span class="arvados-uuid"><%= @object.uuid %></span></p>
+
         <% if not (@output_of.andand.any? or @log_of.andand.any?) %>
           <p><i>No source information available.</i></p>
         <% end %>
 
         <% if @output_of.andand.any? %>
-          <p>This collection was the output of:<br />
+          <p><i>This collection was the output of:</i><br />
           <%= 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) %><br />
@@ -27,7 +25,7 @@
         <% end %>
 
         <% if @log_of.andand.any? %>
-          <p>This collection contains log messages from:<br />
+          <p><i>This collection contains log messages from:</i><br />
           <%= 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) %><br />
@@ -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) %><br />
+            <%= link_to_if_arvados_object(project, friendly_name: true) %><br />
           <% end %>
           </p>
         <% end %>
index c42abfe11857c239a3b3d3700ac8aaf1655f76fd..ef9bdee3dda62584c4b88fca16786911bf57e31b 100644 (file)
                 <% end %>
                 My projects
               </li>
-              <% my_projects.each do |p| %>
-                <li>
-                  <%= link_to(p.name, project_path(p.uuid)) %>
+              <% @my_project_tree.each do |pnode| %>
+                <% next if pnode[:object].class != Group %>
+                <li style="padding-left: <%= pnode[:depth]-1 %>em">
+                  <%= link_to(pnode[:object].name, project_path(pnode[:object].uuid)) %>
                 </li>
               <% end %>
               <li class="divider">
               <li role="presentation" class="dropdown-header">
                 Projects shared with me
               </li>
-              <% projects_shared_with_me.each do |p| %>
-                <li>
-                  <%= link_to project_path(p.uuid) do %>
-                    <i class="fa fa-fw fa-share-alt"></i> <%= p.name %>
+              <% @shared_project_tree.each do |pnode| %>
+                <% next if pnode[:object].class != Group %>
+                <li style="padding-left: <%= pnode[:depth]-1 %>em">
+                  <%= link_to project_path(pnode[:object].uuid) do %>
+                    <i class="fa fa-fw fa-share-alt" style="color:#aaa"></i> <%= pnode[:object].name %>
                   <% end %>
                 </li>
               <% end %>
               <%= link_to(p.name, project_path(p.uuid), data: {object_uuid: p.uuid, name: 'name'}) %>
             </li>
           <% end %>
-          <% if current_project_uuid.andand != @object.andand.uuid %>
-            <li class="nav-separator">
-              <i class="fa fa-lg fa-angle-double-right"></i>
-            </li>
-          <% end %>
         </ul>
       </nav>
     <% end %>
index d7b86bf1fb3b930fdbc178329c0f8988d9d301d4..86582195a562f46c0d1a4e51253bff3decca26ee 100644 (file)
@@ -1,46 +1,5 @@
-<% template = PipelineTemplate.find(@object.pipeline_template_uuid) rescue nil %>
-<%= content_for :content_top do %>
-  <h2>
-    <%= render_editable_attribute @object, 'name', nil %>
-  </h2>
-  <% if template %>
-  <blockquote><span class="deemphasize">From template:</span><br />
-    <%= link_to_if_arvados_object template, friendly_name: true %><br />
-    <%= template.description %>
-  </blockquote>
-  <% 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 <i class="fa fa-fw fa-copy"></i>
-  <% 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 <i class="fa fa-fw fa-stop"></i>
-      <% end %>
-    <% elsif @object.state == 'Paused' %>
-      <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'),
-          class: 'btn btn-primary run-pipeline-button',
-          method: :patch
-          ) do %>
-        Resume <i class="fa fa-fw fa-play"></i>
-      <% end %>
-    <% end %>
-  <% end %>
-
   <% pipeline_job_uuids = [] %>
 
   <div class="pull-right">
 
   <% if @object.state.in? %w(RunningOnServer RunningOnClient) %>
 
-    <% content_for :js do %>
-      setInterval(function(){$('a.refresh').click()}, 15000);
-    <% end %>
-
     <% if !pipeline_job_uuids.empty? %>
       <h4>Log messages from running jobs</h4>
       <% log_history = pipeline_log_history(pipeline_job_uuids) %>
     <p><i>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.</i></p>
   <% 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 <i class="fa fa-fw fa-play"></i>
-    <% end %>
-  <% end %>
-
   <% if @object.state.in? ['New', 'Ready'] %>
     <%= render partial: 'show_components_editable', locals: {editable: true} %>
   <% else %>
deleted file mode 120000 (symlink)
index 4316b101cda63c6d90259792c85a25b3879b12f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../application/show.html.erb
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..28972a4bebc5f7a39f9298428b1a1559e17f13e4
--- /dev/null
@@ -0,0 +1,55 @@
+<% template = PipelineTemplate.find?(@object.pipeline_template_uuid) %>
+<%= content_for :content_top do %>
+  <h2>
+    <%= render_editable_attribute @object, 'name', nil %>
+  </h2>
+  <% if template %>
+  <blockquote><span class="deemphasize">From template:</span><br />
+    <%= link_to_if_arvados_object template, friendly_name: true %><br />
+    <%= template.description %>
+  </blockquote>
+  <% 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 <i class="fa fa-fw fa-copy"></i>
+  <% 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 <i class="fa fa-fw fa-play"></i>
+    <% 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 <i class="fa fa-fw fa-stop"></i>
+      <% end %>
+    <% elsif @object.state == 'Paused' %>
+      <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'),
+          class: 'btn btn-primary run-pipeline-button',
+          method: :patch
+          ) do %>
+        Resume <i class="fa fa-fw fa-play"></i>
+      <% 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 }%>
index 4c066f9d736b243842920760b04234349c3e10df..fb9a30593adb5682be73b4e6eab48c47f0176dd6 100644 (file)
@@ -2,11 +2,11 @@
   <% any = false %>
   <% recent_jobs_and_pipelines[0..9].each do |object| %>
     <% any = true %>
-    <div class="row">
+    <div class="row" style="height: 4.5em">
       <div class="col-sm-4">
         <%= 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 %>
index 3b21b405a82a7b766b2715e892225a3802954a8c..bfd63ddb05a85f303e0eb70923d1e7cce41e38c2 100644 (file)
@@ -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 %>
-      <i class="fa fa-fw fa-plus"></i> Add data
+      <i class="fa fa-fw fa-plus"></i> 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 %>
-      <i class="fa fa-fw fa-gear"></i> Run a pipeline
+      <i class="fa fa-fw fa-gear"></i> 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 %>
       <i class="fa fa-fw fa-plus"></i>
       Add a subproject
     <% end %>
         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 %>
-      <i class="fa fa-fw fa-truck"></i> Move to...
+      <i class="fa fa-fw fa-truck"></i> 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 %>
-       <i class="fa fa-fw fa-trash-o"></i> 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 %>
+      <i class="fa fa-fw fa-trash-o"></i> Delete project
     <% end %>
   <% end %>
 <% end %>
@@ -60,7 +58,7 @@
   <div class="row">
     <div class="col-sm-5">
       <div class="btn-group btn-group-sm">
-        <button type="button" class="btn btn-default">Selection...</button>
+        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Selection...</button>
         <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
           <span class="caret"></span>
           <span class="sr-only">Toggle Dropdown</span>
index 68561f8d65409eec1a3ca69f56f74e5d92a01574..b690a1bf8f621b53556bf5480f3c536eba6e55be 100644 (file)
@@ -5,7 +5,7 @@
       data-kind="<%= object.kind %>"
       >
     <td>
-      <%= render partial: 'selection_checkbox', locals: {object: object, friendly_name: ((name_object.name rescue '') || '')} %>
+      <%= render partial: 'selection_checkbox', locals: {object: name_object, friendly_name: ((name_object.name rescue '') || '')} %>
 
       <% if project.editable? %>
         <%= link_to({action: 'remove_item', id: project.uuid, item_uuid: ((name_link && name_link.uuid) || object.uuid)}, method: :delete, remote: true, data: {confirm: "Remove #{object.class_for_display.downcase} #{name_object.name rescue object.uuid} from this project?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-sm btn-default btn-nodecorate', title: 'remove') do %>
index 6d79bc4ed994e03d674e56787d143caf57c9e7d6..832b5d41d40b8904d2456d0ea8f4a1047a42ce9a 100644 (file)
@@ -45,7 +45,7 @@
       <div class="panel panel-default">
         <div class="panel-heading">
           <h3 class="panel-title">
-            Shared projects
+            Projects shared with me
           </h3>
         </div>
         <div class="panel-body scroll-20em">