[ARVADOS] updated: 4e3ac7f8bafde72ae397f79bfc36409e682b13e5

git at public.curoverse.com git at public.curoverse.com
Tue Apr 29 13:02:46 EDT 2014


Summary of changes:
 .../app/assets/javascripts/collections.js          |   42 +++++----
 .../app/assets/stylesheets/collections.css.scss    |    8 +-
 apps/workbench/app/helpers/application_helper.rb   |   18 ++--
 .../app/views/collections/_show_recent.html.erb    |    4 +-
 .../app/views/collections/_toggle_persist.html.erb |    9 +--
 apps/workbench/app/views/users/_tables.html.erb    |    4 +-
 .../pipeline_instances_controller_test.rb          |   18 +++-
 .../workbench/test/integration/collections_test.rb |   13 +--
 .../api/app/controllers/application_controller.rb  |   17 ++--
 .../v1/api_client_authorizations_controller.rb     |   32 +++++--
 .../arvados/v1/keep_disks_controller.rb            |    2 +-
 .../app/controllers/arvados/v1/nodes_controller.rb |    2 +-
 .../controllers/arvados/v1/schema_controller.rb    |    6 +-
 .../arvados/v1/virtual_machines_controller.rb      |   16 ---
 services/api/app/controllers/static_controller.rb  |    2 +-
 .../app/controllers/user_sessions_controller.rb    |    2 +-
 .../20140421151939_rename_auth_keys_user_index.rb  |   11 ++
 .../db/migrate/20140423133559_new_scope_format.rb  |   48 +++++++++
 services/api/db/schema.rb                          |    4 +-
 services/api/lib/current_api_client.rb             |   19 ++--
 .../test/fixtures/api_client_authorizations.yml    |   37 +++++++
 services/api/test/fixtures/links.yml               |   14 +++
 .../api_client_authorizations_controller_test.rb   |   30 ++++++-
 .../api_client_authorizations_scopes_test.rb       |  103 ++++++++++++++++++++
 24 files changed, 360 insertions(+), 101 deletions(-)
 create mode 100644 services/api/db/migrate/20140421151939_rename_auth_keys_user_index.rb
 create mode 100644 services/api/db/migrate/20140423133559_new_scope_format.rb
 create mode 100644 services/api/test/integration/api_client_authorizations_scopes_test.rb

       via  4e3ac7f8bafde72ae397f79bfc36409e682b13e5 (commit)
       via  7b9cff04eb463c666b8126ebc6c4dfcc00a536c0 (commit)
       via  03e570095885982d23e234bce8e1c068314b63af (commit)
       via  5c2758ca38d01a905253f86e63be3a5fe03a3871 (commit)
       via  52c4f2b7fe631f3d7ad16105cb2f86cf6c004fc8 (commit)
       via  e54bdba73b65e31b03fd1d43bfe69d0f43bbd8d8 (commit)
       via  0eb59e3acf9f13e89bd010f7f65a4d31554183fc (commit)
       via  915de6c854cd559ebd029b24939149e37b18c8cf (commit)
       via  71b1b7b045419817d1c9dc62a3a296b746d9117c (commit)
       via  7fbcd989af9949b11ddfec0c9ebfaa96a655eef4 (commit)
       via  c3457ad20bfd00c99facef396f1dbdbcbdbad241 (commit)
      from  4fa5a3d3958eae7ecce681e0ea7a4ac8cc43e48d (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 4e3ac7f8bafde72ae397f79bfc36409e682b13e5
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Apr 29 13:02:28 2014 -0400

    Replace radio button group with a single click-to-toggle button.

diff --git a/apps/workbench/app/assets/javascripts/collections.js b/apps/workbench/app/assets/javascripts/collections.js
index 806ee6d..7f4b510 100644
--- a/apps/workbench/app/assets/javascripts/collections.js
+++ b/apps/workbench/app/assets/javascripts/collections.js
@@ -1,47 +1,53 @@
 jQuery(function($){
-    $(document).on('change', '.toggle-persist input[name=wants]', function() {
+    $(document).on('click', '.toggle-persist button', function() {
         var toggle_group = $(this).parents('[data-remote-href]').first();
-        if (toggle_group.attr('data-persistent-state') == $(this).val()) {
-            // When the user clicks the already-selected choice, or
-            // the fail() handler below reverts state to the existing
-            // state, don't start an AJAX request.
-            return;
-        }
+        var want_persist = !toggle_group.find('button').hasClass('active');
+        var want_state = want_persist ? 'persistent' : 'cache';
+        console.log(want_persist);
+        toggle_group.find('button').
+            toggleClass('active', want_persist).
+            html(want_persist ? 'Persistent' : 'Cache');
         $.ajax(toggle_group.attr('data-remote-href'),
                {dataType: 'json',
                 type: 'POST',
                 data: {
-                    value: $(this).val()
+                    value: want_state
                 },
                 context: {
                     toggle_group: toggle_group,
-                    input: this
+                    want_state: want_state,
+                    button: this
                 }
                }).
             done(function(data, status, jqxhr) {
                 var context = this;
                 $(document).trigger('ajax:complete');
                 // Remove "danger" status in case a previous action failed
-                $('label.btn-danger', context.toggle_group).
+                $('.btn-danger', context.toggle_group).
                     addClass('btn-info').
                     removeClass('btn-danger');
                 // Update last-saved-state
                 context.toggle_group.
-                    attr('data-persistent-state', $(context.input).val());
+                    attr('data-persistent-state', context.want_state);
             }).
             fail(function(jqxhr, status, error) {
                 var context = this;
+                var saved_state;
                 $(document).trigger('ajax:complete');
                 // Add a visual indication that something failed
-                $('label.btn', context.toggle_group).
+                $(context.button).
                     addClass('btn-danger').
                     removeClass('btn-info');
-                // Select the button reflecting the last-saved-state
-                $('label.btn input[value=' +
-                  context.toggle_group.attr('data-persistent-state') +
-                  ']', context.toggle_group).
-                    button('toggle');
-                if (jqxhr.responseJSON && jqxhr.responseJSON.errors) {
+                // Change to the last-saved-state
+                saved_state = context.toggle_group.attr('data-persistent-state');
+                $(context.button).
+                    toggleClass('active', saved_state == 'persistent').
+                    html(saved_state == 'persistent' ? 'Persistent' : 'Cache');
+
+                if (jqxhr.readyState == 0 || jqxhr.status == 0) {
+                    // Request cancelled due to page reload.
+                    // Displaying an alert would be rather annoying.
+                } else if (jqxhr.responseJSON && jqxhr.responseJSON.errors) {
                     window.alert("Request failed: " +
                                  jqxhr.responseJSON.errors.join("; "));
                 } else {
diff --git a/apps/workbench/app/assets/stylesheets/collections.css.scss b/apps/workbench/app/assets/stylesheets/collections.css.scss
index 2edd683..24b08fa 100644
--- a/apps/workbench/app/assets/stylesheets/collections.css.scss
+++ b/apps/workbench/app/assets/stylesheets/collections.css.scss
@@ -6,11 +6,13 @@
 $inactive-bg: #5bc0de;
 $active-bg: #39b3d7;
 
-.btn-group[data-toggle=buttons] label {
+.btn-group.toggle-persist .btn {
+    width: 6em;
+}
+.btn-group.toggle-persist .btn-info {
     background-color: lighten($inactive-bg, 15%);
 }
 
-.btn-group[data-toggle=buttons] label.active {
+.btn-group.toggle-persist .btn-info.active {
     background-color: $active-bg;
-    opacity: 1;
 }
diff --git a/apps/workbench/app/views/collections/_show_recent.html.erb b/apps/workbench/app/views/collections/_show_recent.html.erb
index a4ab51c..2f4ab64 100644
--- a/apps/workbench/app/views/collections/_show_recent.html.erb
+++ b/apps/workbench/app/views/collections/_show_recent.html.erb
@@ -25,8 +25,8 @@
     <col width="10%" />
     <col width="34%" />
     <col width="15%" />
-    <col width="18%" />
-    <col width="23%" />
+    <col width="12%" />
+    <col width="29%" />
   </colgroup>
   <thead>
     <tr class="contain-align-left">
diff --git a/apps/workbench/app/views/collections/_toggle_persist.html.erb b/apps/workbench/app/views/collections/_toggle_persist.html.erb
index eaca3f4..aa6ed81 100644
--- a/apps/workbench/app/views/collections/_toggle_persist.html.erb
+++ b/apps/workbench/app/views/collections/_toggle_persist.html.erb
@@ -1,8 +1,3 @@
-<div class="btn-group btn-group-xs toggle-persist fill" data-toggle="buttons" data-remote-href="<%= set_persistent_collection_path(id: uuid) %>" data-persistent-state="<%= current_state %>">
-  <label class="btn btn-info <%= 'active' if current_state=='persistent' %>">
-    <input type="radio" name="wants" value="persistent">Persistent
-  </label>
-  <label class="btn btn-info <%= 'active' if current_state=='cache' %>">
-    <input type="radio" name="wants" value="cache">Cache
-  </label>
+<div class="btn-group btn-group-xs toggle-persist" data-remote-href="<%= set_persistent_collection_path(id: uuid) %>" data-persistent-state="<%= current_state %>">
+  <button type="button" class="btn btn-info <%= 'active' if current_state == 'persistent' %>"><%= current_state.capitalize %></button>
 </div>
diff --git a/apps/workbench/app/views/users/_tables.html.erb b/apps/workbench/app/views/users/_tables.html.erb
index 2fd5bba..10592f5 100644
--- a/apps/workbench/app/views/users/_tables.html.erb
+++ b/apps/workbench/app/views/users/_tables.html.erb
@@ -169,9 +169,9 @@
     <table class="table table-bordered table-condensed table-fixedlayout">
       <colgroup>
         <col width="46%" />
-        <col width="24%" />
+        <col width="32%" />
         <col width="10%" />
-        <col width="20%" />
+        <col width="12%" />
       </colgroup>
 
       <tr>
diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb
index 2eb10d6..bd426f7 100644
--- a/apps/workbench/test/integration/collections_test.rb
+++ b/apps/workbench/test/integration/collections_test.rb
@@ -6,15 +6,12 @@ class CollectionsTest < ActionDispatch::IntegrationTest
 
   def change_persist oldstate, newstate
     find "div[data-persistent-state='#{oldstate}']"
-    assert_raises Capybara::ElementNotFound do
-      find "div[data-persistent-state='#{newstate}']"
-    end
-    find('label', text: newstate.capitalize).click
-    find 'label.active', text: newstate.capitalize
+    page.assert_no_selector "div[data-persistent-state='#{newstate}']"
+    find('.btn', text: oldstate.capitalize).click
+    find '.btn', text: newstate.capitalize
+    page.assert_no_selector '.btn', text: oldstate.capitalize
     find "div[data-persistent-state='#{newstate}']"
-    assert_raises Capybara::ElementNotFound do
-      find "div[data-persistent-state='#{oldstate}']"
-    end
+    page.assert_no_selector "div[data-persistent-state='#{oldstate}']"
   end
 
   ['/collections', '/'].each do |path|

commit 7b9cff04eb463c666b8126ebc6c4dfcc00a536c0
Merge: 4fa5a3d 03e5700
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Apr 29 11:58:33 2014 -0400

    Merge branch 'master' into 1969-persistent-switch


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list