[ARVADOS] updated: a5e1609e6f34ee041a92fa089ccf0ed66448bf15
git at public.curoverse.com
git at public.curoverse.com
Tue Jun 17 17:04:48 EDT 2014
Summary of changes:
.../app/assets/javascripts/application.js | 8 ++++
.../app/assets/javascripts/collections.js | 3 --
.../app/assets/javascripts/infinite_scroll.js | 1 -
.../app/assets/stylesheets/application.css.scss | 9 ++++
.../app/assets/stylesheets/select_modal.css.scss | 1 +
.../app/controllers/application_controller.rb | 2 +-
.../app/controllers/collections_controller.rb | 16 +++++--
apps/workbench/app/models/arvados_base.rb | 4 ++
.../app/views/application/_choose.html.erb | 51 +++++++++++++++-------
.../workbench/app/views/application/_choose.js.erb | 22 +++++++++-
.../app/views/application/_content.html.erb | 2 -
.../views/application/_projects_tree_menu.html.erb | 31 +++++++++++++
.../app/views/collections/_choose_rows.html.erb | 3 ++
apps/workbench/app/views/collections/index.js.erb | 1 -
.../app/views/layouts/application.html.erb | 39 ++++-------------
.../app/views/pipeline_instances/show.js.erb | 1 -
apps/workbench/app/views/users/home.js.erb | 1 -
.../controllers/arvados/v1/groups_controller.rb | 3 ++
18 files changed, 138 insertions(+), 60 deletions(-)
create mode 100644 apps/workbench/app/views/application/_projects_tree_menu.html.erb
via a5e1609e6f34ee041a92fa089ccf0ed66448bf15 (commit)
from 3f9aa0401350fc8a41a2dce81151da4aa050e771 (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 a5e1609e6f34ee041a92fa089ccf0ed66448bf15
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue Jun 17 17:04:42 2014 -0400
2884: Can now choose a specific folder to browse in the file selector modal.
diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js
index e35e93c..1a8b990 100644
--- a/apps/workbench/app/assets/javascripts/application.js
+++ b/apps/workbench/app/assets/javascripts/application.js
@@ -58,6 +58,14 @@ jQuery(function($){
$('.loading').fadeOut('fast', 0);
}
}).
+ on('ajaxSend', function(e, xhr) {
+ // map jquery event to rails event
+ $(document).trigger('ajax:send');
+ }).
+ on('ajaxComplete', function(e, xhr) {
+ // map jquery event to rails event
+ $(document).trigger('ajax:complete');
+ }).
on('click', '.removable-tag a', function(e) {
var tag_span = $(this).parents('[data-tag-link-uuid]').eq(0)
tag_span.fadeTo('fast', 0.2);
diff --git a/apps/workbench/app/assets/javascripts/collections.js b/apps/workbench/app/assets/javascripts/collections.js
index e957835..865f121 100644
--- a/apps/workbench/app/assets/javascripts/collections.js
+++ b/apps/workbench/app/assets/javascripts/collections.js
@@ -20,7 +20,6 @@ jQuery(function($){
}).
done(function(data, status, jqxhr) {
var context = this;
- $(document).trigger('ajax:complete');
// Remove "danger" status in case a previous action failed
$('.btn-danger', context.toggle_group).
addClass('btn-info').
@@ -32,7 +31,6 @@ jQuery(function($){
fail(function(jqxhr, status, error) {
var context = this;
var saved_state;
- $(document).trigger('ajax:complete');
// Add a visual indication that something failed
$(context.button).
addClass('btn-danger').
@@ -53,6 +51,5 @@ jQuery(function($){
window.alert("Request failed.");
}
});
- $(document).trigger('ajax:send');
});
});
diff --git a/apps/workbench/app/assets/javascripts/infinite_scroll.js b/apps/workbench/app/assets/javascripts/infinite_scroll.js
index 64a90e2..498f10a 100644
--- a/apps/workbench/app/assets/javascripts/infinite_scroll.js
+++ b/apps/workbench/app/assets/javascripts/infinite_scroll.js
@@ -34,7 +34,6 @@ function maybe_load_more_content() {
done(function(data, status, jqxhr) {
$(this.container).append(data.content);
$(this.container).attr('data-infinite-content-href', data.next_page_href);
- $(document).trigger('ajax:complete');
});
}
}
diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index 4fea7ae..a50a34e 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -115,6 +115,15 @@ nav.navbar-fixed-top {
.navbar.breadcrumbs .nav > li.nav-separator > i {
color: #bbb;
}
+.navbar.breadcrumbs .navbar-form {
+ margin-top: 0px;
+ margin-bottom: 0px;
+}
+.navbar.breadcrumbs .navbar-text {
+ margin-top: 0px;
+ margin-bottom: 0px;
+}
+
nav.navbar-fixed-top .navbar-nav.navbar-right > li.open > a,
nav.navbar-fixed-top .navbar-nav.navbar-right > li.open > a:focus,
nav.navbar-fixed-top .navbar-nav.navbar-right > li.open > a:hover {
diff --git a/apps/workbench/app/assets/stylesheets/select_modal.css.scss b/apps/workbench/app/assets/stylesheets/select_modal.css.scss
index 5aab669..0901769 100644
--- a/apps/workbench/app/assets/stylesheets/select_modal.css.scss
+++ b/apps/workbench/app/assets/stylesheets/select_modal.css.scss
@@ -5,6 +5,7 @@
}
.selectable.active, .selectable:hover {
background: #d9edf7;
+ cursor: pointer;
}
.selectable.active,
.selectable.active *,
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index ebd8661..02b9501 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -12,7 +12,7 @@ class ApplicationController < ActionController::Base
around_filter :thread_with_optional_api_token
before_filter :check_user_agreements, except: ERROR_ACTIONS
before_filter :check_user_notifications, except: ERROR_ACTIONS
- before_filter :find_object_by_uuid, except: [:index] + ERROR_ACTIONS
+ before_filter :find_object_by_uuid, except: [:index, :choose] + ERROR_ACTIONS
theme :select_theme
begin
diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 3017be9..593b3f8 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -44,13 +44,23 @@ class CollectionsController < ApplicationController
def choose
params[:limit] ||= 20
- @objects = Link.
- filter([['link_class','=','name'],
- ['head_uuid','is_a','arvados#collection']])
+
+ filter = [['link_class','=','name'],
+ ['head_uuid','is_a','arvados#collection']]
+
+ if params[:project_uuid] and !params[:project_uuid].empty?
+ filter << ['tail_uuid', '=', params[:project_uuid]]
+ end
+
+ @objects = Link.filter(filter)
+
find_objects_for_index
@next_page_href = (next_page_offset and
url_for(offset: next_page_offset, partial: true))
@name_links = @objects
+
+ puts "and the result is (1) ", @name_links.results
+
@objects = Collection.
filter([['uuid','in', at name_links.collect(&:head_uuid)]])
super
diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index aca8786..3b5ac86 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -295,6 +295,10 @@ class ArvadosBase < ActiveRecord::Base
self.class.to_s.underscore.humanize
end
+ def self.class_for_display
+ self.to_s.underscore.humanize
+ end
+
def self.creatable?
current_user
end
diff --git a/apps/workbench/app/views/application/_choose.html.erb b/apps/workbench/app/views/application/_choose.html.erb
index 5c2aa96..fdd3d3c 100644
--- a/apps/workbench/app/views/application/_choose.html.erb
+++ b/apps/workbench/app/views/application/_choose.html.erb
@@ -3,31 +3,50 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">×</button>
- <h4 class="modal-title"><%= params[:title] || "Choose #{@objects.first.class_for_display}" %></h4>
+ <h4 class="modal-title"><%= params[:title] || "Choose #{@objects.first.andand.class_for_display}" %></h4>
</div>
<div class="modal-body">
- <div>
- <div class="row">
- <div class="col-sm-6">
- </div>
- <div class="col-sm-6">
- <input type="text" class="form-control filterable-control" placeholder="Search" data-filterable-target=".modal.arv-choose .selectable-container"/>
- </div>
+ <nav class="navbar navbar-default breadcrumbs" role="navigation">
+ <ul class="nav navbar-nav navbar-left">
+ <li class="dropdown">
+ <%= render partial: "projects_tree_menu", locals: {
+ :project_link_to => Proc.new do |pnode, &block|
+ link_to "#", {"class" => "chooser-show-project", "data-project-uuid" => pnode[:object].uuid }, &block
+ end,
+ :top_button => Proc.new do %>
+ <% link_to "#", {"class" => "chooser-show-project btn btn-xs btn-default pull-right" } do %>
+ All <%= controller.model_class.class_for_display.pluralize.downcase %>
+ <% end %>
+ <% end %>
+ <% } %>
+ </li>
+ <li class="nav-separator">
+ <i class="fa fa-lg fa-angle-double-right"></i>
+ </li>
+ <li><p class="navbar-text" id="chooser-breadcrumb">All <%= controller.model_class.class_for_display.pluralize.downcase %></span></li>
+ </ul>
+ <div class="navbar-form navbar-right">
+ <input type="text" class="form-control filterable-control" placeholder="Search" data-filterable-target=".modal.arv-choose .selectable-container"/>
</div>
- </div>
+ </nav>
<div class="row" style="height: 20em">
- <div class="col-sm-6 container-fluid arv-filterable-list selectable-container" style="height: 100%; overflow-y: scroll" data-infinite-scroller="#choose-scroll" id="choose-scroll" data-infinite-content-href="<%= @next_page_href %>">
- <%= render partial: 'choose_rows', locals: {multiple: multiple} %>
+ <div class="col-sm-6 container-fluid arv-filterable-list selectable-container"
+ style="height: 100%; overflow-y: scroll"
+ data-infinite-scroller="#choose-scroll"
+ id="choose-scroll"
+ data-infinite-content-href="<%= @next_page_href %>">
+ <%= render partial: 'choose_rows', locals: {multiple: multiple} %>
</div>
<div class="col-sm-6 modal-dialog-preview-pane" style="height: 100%; overflow-y: scroll">
</div>
- </div>
+ </div>
- <div class="modal-footer">
- <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
- <button class="btn btn-primary" aria-hidden="true" data-enable-if-selection disabled><%= raw(params[:action_name]) || 'Select' %></button>
- <div class="modal-error hide" style="text-align: left; margin-top: 1em;">
+ <div class="modal-footer">
+ <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
+ <button class="btn btn-primary" aria-hidden="true" data-enable-if-selection disabled><%= raw(params[:action_name]) || 'Select' %></button>
+ <div class="modal-error hide" style="text-align: left; margin-top: 1em;">
+ </div>
</div>
</div>
</div>
diff --git a/apps/workbench/app/views/application/_choose.js.erb b/apps/workbench/app/views/application/_choose.js.erb
index 3bb3694..14de170 100644
--- a/apps/workbench/app/views/application/_choose.js.erb
+++ b/apps/workbench/app/views/application/_choose.js.erb
@@ -5,4 +5,24 @@ $('body > .modal-container .modal .modal-footer .btn-primary').
attr('data-action-href', '<%= j params[:action_href] %>').
attr('data-method', '<%= j params[:action_method] %>').
data('action-data', <%= raw params[:action_data] %>);
-$(document).trigger('ajax:complete');
+$(".chooser-show-project").on("click", function() {
+ $("#choose-scroll").html("<%=j image_tag 'ajax-loader.gif' %>");
+ var t = $(this);
+ var d = {
+ partial: true,
+ multiple: <%= multiple %>
+ };
+ if (t.attr("data-project-uuid") != null) {
+ d.project_uuid = t.attr("data-project-uuid");
+ }
+ $.ajax('<%=j url_for %>', {
+ dataType: "json",
+ type: "GET",
+ data: d
+ }).done(function(data, status, jqxhr) {
+ console.log(data);
+ $("#chooser-breadcrumb").text(t.text());
+ $("#choose-scroll").html(data.content);
+ $("#choose-scroll").prop("data-infinite-content-href", "next_page_href");
+ });
+});
diff --git a/apps/workbench/app/views/application/_content.html.erb b/apps/workbench/app/views/application/_content.html.erb
index 418923c..02f2e6f 100644
--- a/apps/workbench/app/views/application/_content.html.erb
+++ b/apps/workbench/app/views/application/_content.html.erb
@@ -25,11 +25,9 @@
function ajaxRefreshTabPane(pane) {
if (!tab_pane_valid_state[pane]) {
tab_pane_valid_state[pane] = true;
- $(document).trigger('ajax:send');
$.ajax('<%=j url_for() %>?<%= raw(controller.request.query_string) %>&tab_pane='+pane, {dataType: 'html', type: 'GET'}).
done(function(data, status, jqxhr) {
$('#' + pane + ' > div > div').html(data);
- $(document).trigger('ajax:complete');
ajaxRefreshTabPane(pane);
});
}
diff --git a/apps/workbench/app/views/application/_projects_tree_menu.html.erb b/apps/workbench/app/views/application/_projects_tree_menu.html.erb
new file mode 100644
index 0000000..390ef77
--- /dev/null
+++ b/apps/workbench/app/views/application/_projects_tree_menu.html.erb
@@ -0,0 +1,31 @@
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="projects-menu">
+ <i class="fa fa-lg fa-fw fa-home"></i>
+ Projects
+ <span class="caret"></span>
+ </a>
+ <ul class="dropdown-menu" role="menu">
+ <li role="presentation" class="dropdown-header">
+ <%= top_button.call %>
+ My projects
+ </li>
+ <% my_project_tree.each do |pnode| %>
+ <% next if pnode[:object].class != Group %>
+ <li style="padding-left: <%= pnode[:depth]-1 %>em">
+ <%= project_link_to.call pnode do %>
+ <%= pnode[:object].name %>
+ <% end %>
+ </li>
+ <% end %>
+ <li class="divider">
+ <li role="presentation" class="dropdown-header">
+ Projects shared with me
+ </li>
+ <% shared_project_tree.each do |pnode| %>
+ <% next if pnode[:object].class != Group %>
+ <li style="padding-left: <%= pnode[:depth]-1 %>em">
+ <%= project_link_to.call pnode do %>
+ <i class="fa fa-fw fa-share-alt" style="color:#aaa"></i> <%= pnode[:object].name %>
+ <% end %>
+ </li>
+ <% end %>
+ </ul>
diff --git a/apps/workbench/app/views/collections/_choose_rows.html.erb b/apps/workbench/app/views/collections/_choose_rows.html.erb
index d87f56f..170ce77 100644
--- a/apps/workbench/app/views/collections/_choose_rows.html.erb
+++ b/apps/workbench/app/views/collections/_choose_rows.html.erb
@@ -1,5 +1,8 @@
+<% puts "and the result is (2) ", @name_links.results, "objects is #{@objects}" %>
<% @name_links.each do |name_link| %>
+ <% puts "looking up #{name_link.head_uuid}" %>
<% if (object = get_object(name_link.head_uuid)) %>
+ <% puts "got #{object}" %>
<div class="row filterable selectable <%= 'multiple' if multiple %>" data-object-uuid="<%= name_link.uuid %>"
data-preview-href="<%= url_for object %>?tab_pane=chooser_preview"
style="margin-left: 1em; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #DDDDDD">
diff --git a/apps/workbench/app/views/collections/index.js.erb b/apps/workbench/app/views/collections/index.js.erb
index 46f7d17..44839f4 100644
--- a/apps/workbench/app/views/collections/index.js.erb
+++ b/apps/workbench/app/views/collections/index.js.erb
@@ -2,4 +2,3 @@ if(history.replaceState)
history.replaceState(null, null, "<%= escape_javascript(@request_url) %>");
$('table#collections-index tbody').html("<%= escape_javascript(render partial: 'index_tbody') %>");
$('table#collections-index tbody').fadeTo(200, 1.0);
-$(document).trigger('ajax:complete');
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index 778268e..23e0715 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -161,37 +161,16 @@
<nav class="navbar navbar-default breadcrumbs" role="navigation">
<ul class="nav navbar-nav navbar-left">
<li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="projects-menu">
- <i class="fa fa-lg fa-fw fa-home"></i>
- Projects
- <span class="caret"></span>
- </a>
- <ul class="dropdown-menu" role="menu">
- <li role="presentation" class="dropdown-header">
- <%= link_to projects_path('project[owner_uuid]' => current_project_uuid), method: 'post', class: 'btn btn-xs btn-default pull-right' do %>
- <i class="fa fa-plus"></i> New project
- <% end %>
- My projects
- </li>
- <% 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), data: {object_uuid: pnode[:object].uuid, name: 'name'}) %>
- </li>
- <% end %>
- <li class="divider">
- <li role="presentation" class="dropdown-header">
- Projects shared with me
- </li>
- <% 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), data: {object_uuid: pnode[:object].uuid, name: 'name'} do %>
- <i class="fa fa-fw fa-share-alt" style="color:#aaa"></i> <%= pnode[:object].name %>
+ <%= render partial: "projects_tree_menu", locals: {
+ :project_link_to => Proc.new do |pnode, &block|
+ link_to(project_path(pnode[:object].uuid), data: {object_uuid: pnode[:object].uuid, name: 'name'}, &block)
+ end,
+ :top_button => Proc.new do %>
+ <% link_to projects_path('project[owner_uuid]' => current_project_uuid), method: 'post', class: 'btn btn-xs btn-default pull-right' do %>
+ <i class="fa fa-plus"></i> New project
+ <% end %>
<% end %>
- </li>
- <% end %>
- </ul>
+ <% } %>
</li>
<% project_breadcrumbs.each do |p| %>
<li class="nav-separator">
diff --git a/apps/workbench/app/views/pipeline_instances/show.js.erb b/apps/workbench/app/views/pipeline_instances/show.js.erb
index bdb703e..8ab1e8f 100644
--- a/apps/workbench/app/views/pipeline_instances/show.js.erb
+++ b/apps/workbench/app/views/pipeline_instances/show.js.erb
@@ -13,4 +13,3 @@ if ($('div#page-wrapper').html() != new_content) {
$('.nav-tabs li a[href="' + href + '"]').tab('show');
});
}
-$(document).trigger('ajax:complete');
diff --git a/apps/workbench/app/views/users/home.js.erb b/apps/workbench/app/views/users/home.js.erb
index b67a933..d845186 100644
--- a/apps/workbench/app/views/users/home.js.erb
+++ b/apps/workbench/app/views/users/home.js.erb
@@ -1,4 +1,3 @@
var new_content = "<%= escape_javascript(render partial: 'tables') %>";
if ($('div#home-tables').html() != new_content)
$('div#home-tables').html(new_content);
-$(document).trigger('ajax:complete');
diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb
index da82e81..d7b330d 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -24,6 +24,9 @@ class Arvados::V1::GroupsController < ApplicationController
Job, PipelineInstance, PipelineTemplate,
Collection,
Human, Specimen, Trait].each do |klass|
+ if params[:object_kind] and klass.kind != params[:object_kind]
+ continue
+ end
@objects = klass.readable_by(*@read_users)
cond_sql = "#{klass.table_name}.owner_uuid = ?"
cond_params = [@object.uuid]
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list