[ARVADOS] created: 6be1049f8864afbbdb7f3745359417c06d30081b
Git user
git at public.curoverse.com
Tue Oct 3 13:36:49 EDT 2017
at 6be1049f8864afbbdb7f3745359417c06d30081b (commit)
commit 6be1049f8864afbbdb7f3745359417c06d30081b
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue Oct 3 13:17:00 2017 -0400
12125: Adjust table layout
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
Reviewed-by: Peter Amstutz <peter.amstutz at curoverse.com>
diff --git a/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb
index aaa2936..0cb941c 100644
--- a/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb
@@ -43,7 +43,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
<th></th>
<th>Name</th>
<th>Date trashed /<br />to be deleted</th>
- <th>Owner</th>
+ <th>Parent project</th>
<th>UUID /<br />Content address (PDH)</th>
<th>Contents</th>
<th></th>
diff --git a/apps/workbench/app/views/trash_items/_show_trashed_project_rows.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_project_rows.html.erb
index 1937bcf..ef3a478 100644
--- a/apps/workbench/app/views/trash_items/_show_trashed_project_rows.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trashed_project_rows.html.erb
@@ -3,7 +3,7 @@
SPDX-License-Identifier: AGPL-3.0 %>
<% @objects.each do |obj| %>
- <tr data-object-uuid="<%= obj.uuid %>" data-kind="<%= obj.kind %>" >
+ <tr data-object-uuid="<%= obj.uuid %>" data-kind="<%= obj.kind %>" >
<td>
<% if obj.editable? %>
<%= check_box_tag 'uuids[]', obj.uuid, false, :class => 'persistent-selection', style: 'cursor: pointer;' %>
@@ -11,16 +11,21 @@ SPDX-License-Identifier: AGPL-3.0 %>
</td>
<td>
<%= if !obj.name.blank? then obj.name else obj.uuid end %>
+ </td>
<td>
- <%= render_localized_date(obj.trash_at) if obj.trash_at %>
- <td>
- <%= render_localized_date(obj.delete_at) if obj.delete_at %>
+ <% if obj.trash_at %>
+ <%= render_localized_date(obj.trash_at) %>
+ <% end %>
+ <br />
+ <% if obj.delete_at %>
+ <%= render_localized_date(obj.delete_at) %>
+ <% end %>
</td>
<td>
<%= link_to_if_arvados_object obj.owner_uuid, friendly_name: true %>
</td>
<td>
-
+ <%= obj.uuid %>
</td>
<td>
<%= render partial: 'untrash_item', locals: {object:obj} %>
diff --git a/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
index ef782d6..2882814 100644
--- a/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
@@ -29,23 +29,21 @@ SPDX-License-Identifier: AGPL-3.0 %>
<div>
<table id="trash-index" class="topalign table table-condensed table-fixedlayout">
<colgroup>
- <col width="5%" />
- <col width="20%" />
- <col width="15%" />
- <col width="15%" />
<col width="10%" />
- <col width="30%" />
- <col width="5%" />
+ <col width="21%" />
+ <col width="21%" />
+ <col width="21%" />
+ <col width="21%" />
+ <col width="6%" />
</colgroup>
<thead>
<tr class="contain-align-left">
<th></th>
<th>Name</th>
- <th>Trashed at</th>
- <th title="After this time, no longer available to be recovered from Trash">Permanently<br/>Deleted At</th>
- <th>Owner</th>
- <th></th>
+ <th>Date trashed /<br />to be deleted</th>
+ <th>Parent project</th>
+ <th>UUID</th>
<th></th>
</tr>
</thead>
commit 5464b33b8ee78e9f87d60a3ecec6b53b9415185f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue Oct 3 10:06:24 2017 -0400
12125: Missing file
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/apps/workbench/app/views/trash_items/_show_trashed_project_rows.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_project_rows.html.erb
new file mode 100644
index 0000000..1937bcf
--- /dev/null
+++ b/apps/workbench/app/views/trash_items/_show_trashed_project_rows.html.erb
@@ -0,0 +1,29 @@
+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
+<% @objects.each do |obj| %>
+ <tr data-object-uuid="<%= obj.uuid %>" data-kind="<%= obj.kind %>" >
+ <td>
+ <% if obj.editable? %>
+ <%= check_box_tag 'uuids[]', obj.uuid, false, :class => 'persistent-selection', style: 'cursor: pointer;' %>
+ <% end %>
+ </td>
+ <td>
+ <%= if !obj.name.blank? then obj.name else obj.uuid end %>
+ <td>
+ <%= render_localized_date(obj.trash_at) if obj.trash_at %>
+ <td>
+ <%= render_localized_date(obj.delete_at) if obj.delete_at %>
+ </td>
+ <td>
+ <%= link_to_if_arvados_object obj.owner_uuid, friendly_name: true %>
+ </td>
+ <td>
+
+ </td>
+ <td>
+ <%= render partial: 'untrash_item', locals: {object:obj} %>
+ </td>
+ </tr>
+<% end %>
commit aaca4448e766c5c228e24d37f0558969141403de
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Sep 18 09:55:07 2017 -0400
12125: Restore "move trashed items to home" behavior for now.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index a2ed89b..4a7563a 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -134,8 +134,31 @@ class ProjectsController < ApplicationController
@removed_uuids = []
links = []
params[:item_uuids].collect { |uuid| ArvadosBase.find uuid }.each do |item|
- item.destroy
- @removed_uuids << item.uuid
+ if item.class == Collection or item.class == Group
+ # Use delete API on collections and projects/groups
+ item.destroy
+ @removed_uuids << item.uuid
+ elsif item.owner_uuid == @object.uuid
+ # Object is owned by this project. Remove it from the project by
+ # changing owner to the current user.
+ begin
+ item.update_attributes owner_uuid: current_user.uuid
+ @removed_uuids << item.uuid
+ rescue ArvadosApiClient::ApiErrorResponseException => e
+ if e.message.include? '_owner_uuid_'
+ rename_to = item.name + ' removed from ' +
+ (@object.name ? @object.name : @object.uuid) +
+ ' at ' + Time.now.to_s
+ updates = {}
+ updates[:name] = rename_to
+ updates[:owner_uuid] = current_user.uuid
+ item.update_attributes updates
+ @removed_uuids << item.uuid
+ else
+ raise
+ end
+ end
+ end
end
end
commit 8dddc763727a072862b2481d988d4a84fe896a45
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Fri Sep 15 08:33:22 2017 -0400
12125: Fix 404 page when not showing a specific object.
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 31462ef..ee72ccd 100644
--- a/apps/workbench/app/views/application/404.html.erb
+++ b/apps/workbench/app/views/application/404.html.erb
@@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
end
%>
- <% if check_trash.any? %>
+ <% if check_trash.andand.any? %>
<h2>Trashed</h2>
<p>The <%= req_item %> is in the trash.
commit 9974e20557cad0890ca5dcf8944b2dbb856851c5
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Sep 14 22:11:22 2017 -0400
12125: Workbench 404 page checks if item is in the trash.
Provides a convenient button to untrash it.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/apps/workbench/app/controllers/trash_items_controller.rb b/apps/workbench/app/controllers/trash_items_controller.rb
index 27cbb32..4aac884 100644
--- a/apps/workbench/app/controllers/trash_items_controller.rb
+++ b/apps/workbench/app/controllers/trash_items_controller.rb
@@ -86,15 +86,24 @@ class TrashItemsController < ApplicationController
updates = {trash_at: nil}
- klass = resource_class_for_uuid(params[:selection][0])
+ if params[:selection].is_a? Array
+ klass = resource_class_for_uuid(params[:selection][0])
+ else
+ klass = resource_class_for_uuid(params[:selection])
+ end
+ first = nil
klass.include_trash(1).where(uuid: params[:selection]).each do |c|
+ first = c
c.untrash
@untrashed_uuids << c.uuid
end
respond_to do |format|
format.js
+ format.html do
+ redirect_to first
+ end
end
end
end
diff --git a/apps/workbench/app/views/application/404.html.erb b/apps/workbench/app/views/application/404.html.erb
index e02d0b3..31462ef 100644
--- a/apps/workbench/app/views/application/404.html.erb
+++ b/apps/workbench/app/views/application/404.html.erb
@@ -4,10 +4,11 @@ SPDX-License-Identifier: AGPL-3.0 %>
<%
if (controller.andand.action_name == 'show') and params[:uuid]
+ check_trash = controller.model_class.include_trash(true).where(uuid: params[:uuid], is_trashed: true)
class_name = controller.model_class.to_s.underscore
class_name_h = class_name.humanize(capitalize: false)
req_item = safe_join([class_name_h, " with UUID ",
- raw("<code>"), params[:uuid], raw("</code>")], "")
+ raw("<code>"), params[:uuid], raw("</code>")], "")
req_item_plain_text = safe_join([class_name_h, " with UUID ", params[:uuid]])
else
req_item = "page you requested"
@@ -15,6 +16,27 @@ SPDX-License-Identifier: AGPL-3.0 %>
end
%>
+ <% if check_trash.any? %>
+ <h2>Trashed</h2>
+
+ <p>The <%= req_item %> is in the trash.
+
+ <% object = check_trash.first %>
+ <% if object.editable? %>
+ <% msg = "Untrash '" + if !object.name.blank? then object.name else object.uuid end + "'?" %>
+ <%= link_to({action: 'untrash_items', selection: [object.uuid], controller: :trash_items}, remote: true, method: :post,
+ title: "Untrash", style: 'cursor: pointer;') do %>
+
+ <% end %>
+
+ <%= form_tag url_for({action: 'untrash_items', controller: :trash_items}), {method: :post} %>
+ <%= hidden_field_tag :selection, [object.uuid] %>
+ <button type="submit">Click here to untrash this item <i class="fa fa-fw fa-recycle"></i></button>
+ <% end %>
+ </p>
+
+ <% else %>
+
<h2>Not Found</h2>
<p>The <%= req_item %> was not found.</p>
@@ -39,5 +61,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
<% end %>
+<% end %>
+
<% error_message = "The #{req_item_plain_text} was not found." %>
<%= render :partial => "report_error", :locals => {error_message: error_message, error_type: '404'} %>
commit f842e707a67ecbd9bc9a85a556967340152bdf65
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Sep 14 21:35:40 2017 -0400
12125: Can browse trashed projects & untrash them.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index c010123..a2ed89b 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -134,50 +134,8 @@ class ProjectsController < ApplicationController
@removed_uuids = []
links = []
params[:item_uuids].collect { |uuid| ArvadosBase.find uuid }.each do |item|
- if (item.class == Link and
- item.link_class == 'name' and
- item.tail_uuid == @object.uuid)
- # Given uuid is a name link, linking an object to this
- # project. First follow the link to find the item we're removing,
- # then delete the link.
- links << item
- item = ArvadosBase.find item.head_uuid
- else
- # Given uuid is an object. Delete all names.
- links += Link.where(tail_uuid: @object.uuid,
- head_uuid: item.uuid,
- link_class: 'name')
- end
- links.each do |link|
- @removed_uuids << link.uuid
- link.destroy
- end
-
- if item.class == Collection
- # Use delete API on collections
- item.destroy
- @removed_uuids << item.uuid
- elsif item.owner_uuid == @object.uuid
- # Object is owned by this project. Remove it from the project by
- # changing owner to the current user.
- begin
- item.update_attributes owner_uuid: current_user.uuid
- @removed_uuids << item.uuid
- rescue ArvadosApiClient::ApiErrorResponseException => e
- if e.message.include? '_owner_uuid_'
- rename_to = item.name + ' removed from ' +
- (@object.name ? @object.name : @object.uuid) +
- ' at ' + Time.now.to_s
- updates = {}
- updates[:name] = rename_to
- updates[:owner_uuid] = current_user.uuid
- item.update_attributes updates
- @removed_uuids << item.uuid
- else
- raise
- end
- end
- end
+ item.destroy
+ @removed_uuids << item.uuid
end
end
@@ -337,7 +295,7 @@ class ProjectsController < ApplicationController
def public # Yes 'public' is the name of the action for public projects
return render_not_found if not Rails.configuration.anonymous_user_token or not Rails.configuration.enable_public_projects_page
@objects = using_specific_api_token Rails.configuration.anonymous_user_token do
- Group.where(group_class: 'project').order("updated_at DESC")
+ Group.where(group_class: 'project').order("modified_at DESC")
end
end
end
diff --git a/apps/workbench/app/controllers/trash_items_controller.rb b/apps/workbench/app/controllers/trash_items_controller.rb
index b957798..27cbb32 100644
--- a/apps/workbench/app/controllers/trash_items_controller.rb
+++ b/apps/workbench/app/controllers/trash_items_controller.rb
@@ -22,7 +22,7 @@ class TrashItemsController < ApplicationController
if @objects.any?
@objects = @objects.sort_by { |obj| obj.trash_at }.reverse
@next_page_filters = next_page_filters('<=')
- @next_page_href = url_for(partial: :trash_rows,
+ @next_page_href = url_for(partial: params[:partial],
filters: @next_page_filters.to_json)
else
@next_page_href = nil
@@ -55,13 +55,19 @@ class TrashItemsController < ApplicationController
end
def trashed_items
+ if params[:partial] == "trashed_collection_rows"
+ query_on = Collection
+ elsif params[:partial] == "trashed_project_rows"
+ query_on = Group
+ end
+
# API server index doesn't return manifest_text by default, but our
# callers want it unless otherwise specified.
- @select ||= Collection.columns.map(&:name)
+ @select ||= query_on.columns.map(&:name) - %w(id updated_at)
limit = if params[:limit] then params[:limit].to_i else 100 end
offset = if params[:offset] then params[:offset].to_i else 0 end
- base_search = Collection.select(@select).include_trash(true).where(is_trashed: true)
+ base_search = query_on.select(@select).include_trash(true).where(is_trashed: true)
base_search = base_search.filter(params[:filters]) if params[:filters]
if params[:search].andand.length.andand > 0
@@ -80,7 +86,9 @@ class TrashItemsController < ApplicationController
updates = {trash_at: nil}
- Collection.include_trash(1).where(uuid: params[:selection]).each do |c|
+ klass = resource_class_for_uuid(params[:selection][0])
+
+ klass.include_trash(1).where(uuid: params[:selection]).each do |c|
c.untrash
@untrashed_uuids << c.uuid
end
diff --git a/apps/workbench/app/models/group.rb b/apps/workbench/app/models/group.rb
index 523e5e9..08b13bf 100644
--- a/apps/workbench/app/models/group.rb
+++ b/apps/workbench/app/models/group.rb
@@ -40,4 +40,8 @@ class Group < ArvadosBase
def self.creatable?
false
end
+
+ def untrash
+ arvados_api_client.api(self.class, "/#{self.uuid}/untrash", {"ensure_unique_name" => true})
+ end
end
diff --git a/apps/workbench/app/views/trash_items/_show_trash_rows.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_collection_rows.html.erb
similarity index 100%
rename from apps/workbench/app/views/trash_items/_show_trash_rows.html.erb
rename to apps/workbench/app/views/trash_items/_show_trashed_collection_rows.html.erb
diff --git a/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb
index c534e52..aaa2936 100644
--- a/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb
@@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
<div class="col-md-4 pull-right">
<input type="text" class="form-control filterable-control recent-trash-items"
placeholder="Search trash"
- data-filterable-target="#recent-trash-items"
+ data-filterable-target="#recent-collection-trash-items"
value="<%= params[:search] %>" />
</div>
@@ -50,8 +50,8 @@ SPDX-License-Identifier: AGPL-3.0 %>
</tr>
</thead>
- <tbody data-infinite-scroller="#recent-trash-items" id="recent-trash-items"
- data-infinite-content-href="<%= url_for partial: :trash_rows %>" >
+ <tbody data-infinite-scroller="#recent-collection-trash-items" id="recent-collection-trash-items"
+ data-infinite-content-href="<%= url_for partial: :trashed_collection_rows %>" >
</tbody>
</table>
</div>
diff --git a/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
index a78b02f..ef782d6 100644
--- a/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
@@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
<div class="col-md-4 pull-right">
<input type="text" class="form-control filterable-control recent-trash-items"
placeholder="Search trash"
- data-filterable-target="#recent-trash-items"
+ data-filterable-target="#recent-project-trash-items"
value="<%= params[:search] %>" />
</div>
@@ -45,13 +45,13 @@ SPDX-License-Identifier: AGPL-3.0 %>
<th>Trashed at</th>
<th title="After this time, no longer available to be recovered from Trash">Permanently<br/>Deleted At</th>
<th>Owner</th>
- <th>Contents</th>
+ <th></th>
<th></th>
</tr>
</thead>
- <tbody data-infinite-scroller="#recent-trash-items" id="recent-trash-items"
- data-infinite-content-href="<%= url_for partial: :trash_rows %>" >
+ <tbody data-infinite-scroller="#recent-project-trash-items" id="recent-project-trash-items"
+ data-infinite-content-href="<%= url_for partial: :trashed_project_rows %>" >
</tbody>
</table>
</div>
commit ac19c757678be40d6ed08bacd66a0688093dcc07
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Sep 14 20:36:24 2017 -0400
12125: Initial work, separate collection and project trash tabs.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/apps/workbench/app/controllers/trash_items_controller.rb b/apps/workbench/app/controllers/trash_items_controller.rb
index 3604e78..b957798 100644
--- a/apps/workbench/app/controllers/trash_items_controller.rb
+++ b/apps/workbench/app/controllers/trash_items_controller.rb
@@ -8,7 +8,7 @@ class TrashItemsController < ApplicationController
end
def index_pane_list
- %w(Recent_trash)
+ %w(Trashed_collections Trashed_projects)
end
def find_objects_for_index
diff --git a/apps/workbench/app/views/trash_items/_show_recent_trash.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb
similarity index 100%
copy from apps/workbench/app/views/trash_items/_show_recent_trash.html.erb
copy to apps/workbench/app/views/trash_items/_show_trashed_collections.html.erb
diff --git a/apps/workbench/app/views/trash_items/_show_recent_trash.html.erb b/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
similarity index 87%
rename from apps/workbench/app/views/trash_items/_show_recent_trash.html.erb
rename to apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
index c534e52..a78b02f 100644
--- a/apps/workbench/app/views/trash_items/_show_recent_trash.html.erb
+++ b/apps/workbench/app/views/trash_items/_show_trashed_projects.html.erb
@@ -29,12 +29,12 @@ SPDX-License-Identifier: AGPL-3.0 %>
<div>
<table id="trash-index" class="topalign table table-condensed table-fixedlayout">
<colgroup>
- <col width="2%" />
+ <col width="5%" />
<col width="20%" />
- <col width="13%" />
<col width="15%" />
- <col width="20%" />
- <col width="25%" />
+ <col width="15%" />
+ <col width="10%" />
+ <col width="30%" />
<col width="5%" />
</colgroup>
@@ -42,9 +42,9 @@ SPDX-License-Identifier: AGPL-3.0 %>
<tr class="contain-align-left">
<th></th>
<th>Name</th>
- <th>Date trashed /<br />to be deleted</th>
+ <th>Trashed at</th>
+ <th title="After this time, no longer available to be recovered from Trash">Permanently<br/>Deleted At</th>
<th>Owner</th>
- <th>UUID /<br />Content address (PDH)</th>
<th>Contents</th>
<th></th>
</tr>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list