[ARVADOS] updated: 993f62a209b5f9ec12779aed46d25e18e48cbbba
git at public.curoverse.com
git at public.curoverse.com
Tue Dec 31 13:02:12 EST 2013
Summary of changes:
apps/workbench/app/models/arvados_api_client.rb | 7 ++++++-
apps/workbench/app/models/arvados_resource_list.rb | 4 ++++
.../app/views/users/_notifications.html.erb | 17 +++++++----------
3 files changed, 17 insertions(+), 11 deletions(-)
via 993f62a209b5f9ec12779aed46d25e18e48cbbba (commit)
from c68407dea1a6474450bbeccdd52d8305a8bbc75a (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 993f62a209b5f9ec12779aed46d25e18e48cbbba
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Dec 31 10:01:48 2013 -0800
Use items_available in API response instead of retrieving all items.
diff --git a/apps/workbench/app/models/arvados_api_client.rb b/apps/workbench/app/models/arvados_api_client.rb
index 1504fdc..9c5fab9 100644
--- a/apps/workbench/app/models/arvados_api_client.rb
+++ b/apps/workbench/app/models/arvados_api_client.rb
@@ -77,7 +77,12 @@ class ArvadosApiClient
def unpack_api_response(j, kind=nil)
if j.is_a? Hash and j[:items].is_a? Array and j[:kind].match(/(_list|List)$/)
- j[:items].collect { |x| unpack_api_response x, j[:kind] }
+ ary = j[:items].collect { |x| unpack_api_response x, j[:kind] }
+ if j[:items_available]
+ (class << ary; self; end).class_eval { attr_accessor :items_available }
+ ary.items_available = j[:items_available]
+ end
+ ary
elsif j.is_a? Hash and (kind || j[:kind])
oclass = self.kind_class(kind || j[:kind])
if oclass
diff --git a/apps/workbench/app/models/arvados_resource_list.rb b/apps/workbench/app/models/arvados_resource_list.rb
index b1c1561..72495cf 100644
--- a/apps/workbench/app/models/arvados_resource_list.rb
+++ b/apps/workbench/app/models/arvados_resource_list.rb
@@ -104,4 +104,8 @@ class ArvadosResourceList
def empty?
results.empty?
end
+
+ def items_available
+ results.items_available if results.respond_to? :items_available
+ end
end
diff --git a/apps/workbench/app/views/users/_notifications.html.erb b/apps/workbench/app/views/users/_notifications.html.erb
index 37636c6..78ee276 100644
--- a/apps/workbench/app/views/users/_notifications.html.erb
+++ b/apps/workbench/app/views/users/_notifications.html.erb
@@ -83,19 +83,16 @@
<td>
<span style="margin-right: 2em">
<a href="/<%= raw(aclass.to_s.pluralize.underscore) %>">
- <%= raw(aclass.to_s.pluralize.underscore.capitalize.gsub '_', ' ') %>
- </a>
+ <%= raw(aclass.to_s.pluralize.underscore.capitalize.gsub '_', ' ') %>
+ </a>
</span>
- </td>
+ </td>
<td>
- <% if aclass == 'File' %>
- <%= Collection.limit(4000).where({}).collect(&:files).flatten(1).count %>
- <% else %>
- <%= aclass.limit(4000).where({}).count %>
- <% end %>
- </td>
+ <%= aclass.limit(0).where({}).items_available ||
+ aclass.limit(4000).where({}).count %>
+ </td>
</tr>
<% end %>
- </table>
+ </table>
</div>
<% end %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list