[ARVADOS] updated: 1.1.0-65-g6afdf38

Git user git at public.curoverse.com
Fri Oct 20 10:14:02 EDT 2017


Summary of changes:
 apps/workbench/app/views/application/404.html.erb  | 55 +++++++++++++++-------
 .../views/trash_items/_show_trash_rows.html.erb    |  6 +--
 .../app/views/trash_items/_untrash_item.html.erb   |  8 ++--
 3 files changed, 44 insertions(+), 25 deletions(-)

       via  6afdf38337e3278234d03480b64e50beaddcd105 (commit)
      from  656176226eeb75d24c17de792cc090e4862c46f5 (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 6afdf38337e3278234d03480b64e50beaddcd105
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Thu Oct 19 18:01:33 2017 -0400

    12125: 404 page searches owners to find actual trashed object.
    
    Change untrash behavior so that untrash button always directs to 404 page for
    untrash confirmation.  Provides better consistency of UX and ensures that
    multiple levels of trash (such as a trashed collection within a trashed
    project) are handled.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/apps/workbench/app/views/application/404.html.erb b/apps/workbench/app/views/application/404.html.erb
index 2d9b5cf..9750b91 100644
--- a/apps/workbench/app/views/application/404.html.erb
+++ b/apps/workbench/app/views/application/404.html.erb
@@ -19,28 +19,51 @@ SPDX-License-Identifier: AGPL-3.0 %>
   <% if check_trash.andand.any? %>
     <h2>Trashed</h2>
 
-    <p>The <%= req_item %> is in the trash.
-
       <% object = check_trash.first %>
 
-      <% if object.is_trashed
-         untrash_object = object
-         else
-       end %>
+      <% untrash_object = object %>
+      <% while !untrash_object.is_trashed %>
+        <% owner = Group.where(uuid: untrash_object.owner_uuid).include_trash(true).first %>
+        <% if owner.nil? then %>
+          <% break %>
+        <% else %>
+          <% untrash_object = owner %>
+        <% end %>
+      <% end %>
 
-        <% if untrash_object.editable? %>
-          <% msg = "Untrash '" + if !untrash_object.name.blank? then untrash_object.name else untrash_object.uuid end + "'?" %>
-          <%= link_to({action: 'untrash_items', selection: [untrash_object.uuid], controller: :trash_items}, remote: true, method: :post,
-        title: "Untrash", style: 'cursor: pointer;') do %>
+      <% untrash_name = if !untrash_object.name.blank? then
+                 "'#{untrash_object.name}'"
+                 else
+                 untrash_object.uuid
+               end %>
+
+    <p>The <%= req_item %> is
+      <% if untrash_object == object %>
+        in the trash.
+      <% else %>
+        owned by trashed project <%= untrash_name %> (<code><%= untrash_object.uuid %></code>).
+      <% end %>
+    </p>
 
-          <% end %>
 
-          <%= form_tag url_for({action: 'untrash_items', controller: :trash_items}), {method: :post} %>
-          <%= hidden_field_tag :selection, [untrash_object.uuid] %>
-          <button type="submit">Click here to untrash this item <i class="fa fa-fw fa-recycle"></i></button>
+    <p>
+      It will be permanently deleted at <%= render_localized_date(untrash_object.delete_at) %>.
+    </p>
+
+  <p>
+    <% if untrash_object != object %>
+      You must untrash the owner project to access this <%= class_name_h %>.
+    <% end %>
+      <% if untrash_object.editable? %>
+        <% msg = "Untrash '#{untrash_name}'?" %>
+        <%= link_to({action: 'untrash_items', selection: [untrash_object.uuid], controller: :trash_items}, remote: true, method: :post,
+        title: "Untrash", style: 'cursor: pointer;') do %>
+
         <% end %>
-      <% else %>
-        <% %>
+
+        <%= form_tag url_for({action: 'untrash_items', controller: :trash_items}), {method: :post} %>
+        <%= hidden_field_tag :selection, [untrash_object.uuid] %>
+        <button type="submit">Click here to untrash <%= untrash_name %> <i class="fa fa-fw fa-recycle"></i></button>
       <% end %>
     </p>
 
diff --git a/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb b/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb
index ee61e45..7d7bf7b 100644
--- a/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb
@@ -30,7 +30,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
       <td colspan="2" class="trash-project-msg">
         <%= link_to_if_arvados_object @owners[obj.owner_uuid], friendly_name: true %>
         <br>
-        This item is contained within a trashed project.  You must untrash the parent project to recover it.
+        This item is contained within a trashed project.
       </td>
     <% end %>
     <td>
@@ -40,9 +40,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
       <% end %>
     </td>
     <td>
-      <% if obj.is_trashed %>
-        <%= render partial: 'untrash_item', locals: {object:obj} %>
-      <% end %>
+      <%= render partial: 'untrash_item', locals: {object:obj} %>
     </td>
   </tr>
 
diff --git a/apps/workbench/app/views/trash_items/_untrash_item.html.erb b/apps/workbench/app/views/trash_items/_untrash_item.html.erb
index 901d396..50780d9 100644
--- a/apps/workbench/app/views/trash_items/_untrash_item.html.erb
+++ b/apps/workbench/app/views/trash_items/_untrash_item.html.erb
@@ -3,9 +3,7 @@
 SPDX-License-Identifier: AGPL-3.0 %>
 
 <% if object.editable? %>
-  <% msg = "Untrash '" + if !object.name.blank? then object.name else object.uuid end + "'?" %>
-  <%= link_to({action: 'untrash_items', selection: [object.uuid]}, remote: true, method: :post,
-      title: "Untrash", style: 'cursor: pointer;') do %>
-    <i class="fa fa-fw fa-recycle"></i>
-  <% end %>
+    <%= link_to(url_for(object), {title: "Untrash", style: 'cursor: pointer;'}) do %>
+      <i class="fa fa-fw fa-recycle"></i>
+    <% end %>
 <% end %>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list