[ARVADOS] updated: 4e624965e369180dfb971bf3a53ae2b4d726f271
git at public.curoverse.com
git at public.curoverse.com
Thu Oct 9 13:05:23 EDT 2014
Summary of changes:
apps/workbench/app/assets/javascripts/infinite_scroll.js | 4 ++--
apps/workbench/app/controllers/application_controller.rb | 11 +++++------
.../app/views/projects/_show_jobs_and_pipelines.html.erb | 3 ++-
apps/workbench/app/views/projects/_show_tab_contents.html.erb | 11 +++++++++--
4 files changed, 18 insertions(+), 11 deletions(-)
via 4e624965e369180dfb971bf3a53ae2b4d726f271 (commit)
from 70609f51a1124be1704f4a61aad9a597c961c0e8 (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 4e624965e369180dfb971bf3a53ae2b4d726f271
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date: Thu Oct 9 13:05:19 2014 -0400
3618: now can use a list of sort columns if there are multiple models involved
(but note that still there can only be one sort column at a time per model)
diff --git a/apps/workbench/app/assets/javascripts/infinite_scroll.js b/apps/workbench/app/assets/javascripts/infinite_scroll.js
index 4c177e1..1f947e1 100644
--- a/apps/workbench/app/assets/javascripts/infinite_scroll.js
+++ b/apps/workbench/app/assets/javascripts/infinite_scroll.js
@@ -182,8 +182,8 @@ $(document).
var $target = $(this).closest('table').find('[data-infinite-content-params-attr]');
var params_attr = 'infinite-content-params-' + $target.data('infinite-content-params-attr');
var params = $target.data(params_attr) || {};
- params.order = $(this).data('sort-order') + ' ' + direction;
- $target.data('params_attr', params);
+ params.order = $(this).data('sort-order').split(",").join( ' ' + direction + ', ' ) + ' ' + direction;
+ $target.data(params_attr, params);
$target.trigger('refresh-content');
}).
on('ready arv:pane:loaded refresh-content', function() {
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index a027e2e..1b87cea 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -107,20 +107,19 @@ class ApplicationController < ActionController::Base
# params[:order]:
#
- # The order can be unspecified, or it can be a column name.
+ # The order can be left empty to allow it to default.
+ # Or it can be a comma separated list of real database column names, one per model.
# Column names should always be qualified by a table name and a direction is optional, defaulting to asc
# (e.g. "collections.name" or "collections.name desc").
# If a column name is specified, that table will be sorted by that column.
# If there are objects from different models that will be shown (such as in Jobs and Pipelines tab),
- # then a sort column name can optionally be specified for each model, passed as an array (e.g. "['jobs.description', 'pipeline_instances.name']")
+ # then a sort column name can optionally be specified for each model, passed as an comma-separated list (e.g. "jobs.script, pipeline_instances.name")
# Currently only one sort column name and direction can be specified for each model.
def load_filters_and_paging_params
if params[:order].blank?
@order = 'created_at desc'
- elsif params[:order].starts_with? '['
- @order = Oj.load params[:order]
- else
- @order = params[:order]
+ elsif !params[:order].is_a? Array
+ @order = params[:order].split(',')
end
@order = [@order] unless @order.is_a? Array
diff --git a/apps/workbench/app/views/projects/_show_jobs_and_pipelines.html.erb b/apps/workbench/app/views/projects/_show_jobs_and_pipelines.html.erb
index df31fec..9f6e523 100644
--- a/apps/workbench/app/views/projects/_show_jobs_and_pipelines.html.erb
+++ b/apps/workbench/app/views/projects/_show_jobs_and_pipelines.html.erb
@@ -1,3 +1,4 @@
<%= render_pane 'tab_contents', to_string: true, locals: {
- filters: [['uuid', 'is_a', ["arvados#job", "arvados#pipelineInstance"]]]
+ filters: [['uuid', 'is_a', ["arvados#job", "arvados#pipelineInstance"]]],
+ sortable_columns: { 'name' => 'jobs.script, pipeline_instances.name' }
}.merge(local_assigns) %>
diff --git a/apps/workbench/app/views/projects/_show_tab_contents.html.erb b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
index 7254d9c..af634bf 100644
--- a/apps/workbench/app/views/projects/_show_tab_contents.html.erb
+++ b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
@@ -85,10 +85,17 @@
<th></th>
<th></th>
<% sort_order = sortable_columns['name'] %>
- <th <%= raw sort_order.nil? ? "" : "data-sort-order='#{sort_order}'" %>>
+ <th <% if !sort_order.nil? %>
+ data-sort-order='<%= raw sort_order %>'
+ <% end %> >
name
</th>
- <th>description</th>
+ <% sort_order = sortable_columns['description'] %>
+ <th <% if !sort_order.nil? %>
+ data-sort-order='<%= raw sort_order %>'
+ <% end %> >
+ description
+ </th>
</tr>
</thead>
</table>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list