[ARVADOS] updated: 5ec73064459a57d987226cdc29b3e0233e8c33cd

git at public.curoverse.com git at public.curoverse.com
Mon Mar 30 16:07:23 EDT 2015


Summary of changes:
 .../app/assets/javascripts/add_repository.js       | 35 ++++++++++++++
 .../app/views/users/_add_repository_modal.html.erb | 39 +++++++++++++++
 .../app/views/users/_manage_account.html.erb       | 56 +++++-----------------
 .../app/views/users/_manage_current_token.html.erb | 12 +++++
 .../app/views/users/_manage_repositories.html.erb  | 17 ++++++-
 .../app/views/users/_manage_ssh_keys.html.erb      | 17 ++++++-
 .../views/users/_manage_virtual_machines.html.erb  | 12 ++++-
 .../test/integration/user_manage_account_test.rb   | 10 ++++
 8 files changed, 152 insertions(+), 46 deletions(-)
 create mode 100644 apps/workbench/app/assets/javascripts/add_repository.js
 create mode 100644 apps/workbench/app/views/users/_add_repository_modal.html.erb

       via  5ec73064459a57d987226cdc29b3e0233e8c33cd (commit)
       via  271063891be573762ad2e8e48d3ba69368d34883 (commit)
      from  6c6a37bf3d37e3116ae39536b1ea56b077de9dd1 (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 5ec73064459a57d987226cdc29b3e0233e8c33cd
Author: Brett Smith <brett at curoverse.com>
Date:   Mon Mar 30 16:06:38 2015 -0400

    4253: Add Workbench interface to create repositories.

diff --git a/apps/workbench/app/assets/javascripts/add_repository.js b/apps/workbench/app/assets/javascripts/add_repository.js
new file mode 100644
index 0000000..f7e3e5f
--- /dev/null
+++ b/apps/workbench/app/assets/javascripts/add_repository.js
@@ -0,0 +1,35 @@
+$(document).on('submit', '#add-repository-form', function(event) {
+    var $form = $(event.target),
+    $submit = $(':submit', $form),
+    $error = $('#add-repository-error', $form),
+    repo_owner_uuid = $('input[name="add_repo_owner_uuid"]', $form).val(),
+    repo_prefix = $('input[name="add_repo_prefix"]', $form).val(),
+    repo_basename = $('input[name="add_repo_basename"]', $form).val();
+
+    $submit.prop('disabled', true);
+    $error.toggleClass('hidden', true);
+    $.ajax('/repositories',
+           {method: 'POST',
+            dataType: 'json',
+            data: {repository: {owner_uuid: repo_owner_uuid,
+                                name: repo_prefix + repo_basename}},
+            context: $form}).
+        done(function(data, status, jqxhr) {
+            location.reload();
+        }).
+        fail(function(jqxhr, status, error) {
+            var errlist = jqxhr.responseJSON.errors;
+            var errmsg;
+            if (Array.isArray(errlist)) {
+                errmsg = errlist.join();
+            } else {
+                errmsg = ("The server returned an error when making " +
+                          "this repository (status " + jqxhr.status +
+                          ": " + errlist + ").");
+            }
+            $error.text(errmsg);
+            $error.toggleClass('hidden', false);
+            $submit.prop('disabled', false);
+        });
+    return false;
+});
\ No newline at end of file
diff --git a/apps/workbench/app/views/users/_add_repository_modal.html.erb b/apps/workbench/app/views/users/_add_repository_modal.html.erb
new file mode 100644
index 0000000..aea49bf
--- /dev/null
+++ b/apps/workbench/app/views/users/_add_repository_modal.html.erb
@@ -0,0 +1,39 @@
+<%
+   if current_user.uuid.ends_with?("-000000000000000")
+     repo_prefix = ""
+   else
+     repo_prefix = current_user.username + "/"
+   end
+-%>
+<div class="modal" id="add-repository-modal" tabindex="-1" role="dialog" aria-labelledby="add-repository-label" aria-hidden="true">
+  <div class="modal-dialog">
+    <div class="modal-content">
+      <form id="add-repository-form">
+        <input type="hidden" id="add_repo_owner_uuid" name="add_repo_owner_uuid" value="<%= current_user.uuid %>">
+        <input type="hidden" id="add_repo_prefix" name="add_repo_prefix" value="<%= repo_prefix %>">
+        <div class="modal-header">
+          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+          <h4 class="modal-title" id="add-repository-label">Add new repository</h4>
+        </div>
+        <div class="modal-body form-horizontal">
+          <div class="form-group">
+            <label for="add_repo_basename" class="col-sm-2 control-label">Name</label>
+            <div class="col-sm-10">
+              <div class="input-group arvados-uuid">
+                <% unless repo_prefix.empty? %>
+                  <span class="input-group-addon"><%= repo_prefix %></span>
+                <% end %>
+                <input type="text" class="form-control" id="add_repo_basename" name="add_repo_basename">
+              </div>
+            </div>
+          </div>
+          <div id="add-repository-error" class="hidden alert alert-danger"></div>
+        </div>
+        <div class="modal-footer">
+          <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+          <input type="submit" class="btn btn-primary" id="add-repository-submit" name="submit" value="Create">
+        </div>
+      </form>
+    </div>
+  </div>
+</div>
diff --git a/apps/workbench/app/views/users/_manage_account.html.erb b/apps/workbench/app/views/users/_manage_account.html.erb
index 2d36b30..4a362cd 100644
--- a/apps/workbench/app/views/users/_manage_account.html.erb
+++ b/apps/workbench/app/views/users/_manage_account.html.erb
@@ -18,4 +18,5 @@
     </div>
   </div>
   <div id="add-ssh-key-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
+  <%= render partial: "add_repository_modal" %>
 </div>
diff --git a/apps/workbench/app/views/users/_manage_repositories.html.erb b/apps/workbench/app/views/users/_manage_repositories.html.erb
index 62c8e8d..bcf0d64 100644
--- a/apps/workbench/app/views/users/_manage_repositories.html.erb
+++ b/apps/workbench/app/views/users/_manage_repositories.html.erb
@@ -1,5 +1,10 @@
 <div class="panel panel-default">
   <div class="panel-heading">
+    <div class="pull-right">
+      <%= link_to raw('<i class="fa fa-plus"></i> Add new repository'), "#",
+                   {class: 'btn btn-xs btn-primary', 'data-toggle' => "modal",
+                    'data-target' => '#add-repository-modal'}  %>
+    </div>
     <h4 class="panel-title">
       <a data-parent="#arv-adv-accordion" href="#manage_repositories">
         Repositories
diff --git a/apps/workbench/test/integration/user_manage_account_test.rb b/apps/workbench/test/integration/user_manage_account_test.rb
index 9b5e5d6..6d680e2 100644
--- a/apps/workbench/test/integration/user_manage_account_test.rb
+++ b/apps/workbench/test/integration/user_manage_account_test.rb
@@ -171,4 +171,14 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
     assert_text 'A request for shell access was sent on '
     assert_selector 'a', text: 'Send request for shell access'
   end
+
+  test "create new repository" do
+    visit page_with_token("active_trustedclient", "/manage_account")
+    click_on "Add new repository"
+    within ".modal-dialog" do
+      fill_in "Name", with: "workbenchtest"
+      click_on "Create"
+    end
+    assert_text ":active/workbenchtest.git"
+  end
 end

commit 271063891be573762ad2e8e48d3ba69368d34883
Author: Brett Smith <brett at curoverse.com>
Date:   Mon Mar 30 14:28:40 2015 -0400

    4253: Let Workbench Manage Account partials render their whole pane.
    
    I'm about to add another "Add" button to the Repositories pane, so I'd
    rather do it this way than try to maintain a generic loop inside
    _manage_account.html.erb.

diff --git a/apps/workbench/app/views/users/_manage_account.html.erb b/apps/workbench/app/views/users/_manage_account.html.erb
index 5024fce..2d36b30 100644
--- a/apps/workbench/app/views/users/_manage_account.html.erb
+++ b/apps/workbench/app/views/users/_manage_account.html.erb
@@ -1,52 +1,21 @@
 <div class="col-sm-6">
   <div class="panel-group" id="arv-adv-accordion">
-    <% ['Virtual Machines',
-       'Repositories'].each do |section| %>
-      <% section_id = section.gsub(" ","_").downcase %>
-      <div class="panel panel-default">
-        <div class="panel-heading">
-          <h4 class="panel-title">
-            <a data-parent="#arv-adv-accordion" href="#manage_<%=section_id%>">
-              <%= section %>
-            </a>
-          </h4>
-        </div>
-        <div id="manage_<%=section_id%>">
-          <div class="panel-body">
-            <%= render partial: "manage_#{section_id}" %>
-          </div>
-        </div>
-      </div>
-    <% end %>
+    <div class="panel panel-default">
+      <%= render partial: "manage_virtual_machines" %>
+    </div>
+    <div class="panel panel-default">
+      <%= render partial: "manage_repositories" %>
+    </div>
   </div>
 </div>
 <div class="col-sm-6">
   <div class="panel-group" id="arv-adv-accordion">
-    <% ['SSH Keys',
-      'Current Token'].each do |section| %>
-      <% section_id = section.gsub(" ","_").downcase %>
-      <div class="panel panel-default">
-        <div class="panel-heading">
-          <% if section_id == 'ssh_keys' %>
-            <div class="pull-right">
-              <%= link_to raw('<i class="fa fa-plus"></i>' " Add new SSH key"), add_ssh_key_popup_url,
-                           {class: 'btn btn-xs btn-primary', :remote => true, 'data-toggle' =>  "modal",
-                            'data-target' => '#add-ssh-key-modal-window'}  %>
-            </div>
-          <% end %>
-          <h4 class="panel-title">
-            <a data-parent="#arv-adv-accordion" href="#manage_<%=section_id%>">
-              <%= section %>
-            </a>
-          </h4>
-        </div>
-        <div id="manage_<%=section_id%>">
-          <div class="panel-body">
-            <%= render partial: "manage_#{section_id}" %>
-          </div>
-        </div>
-      </div>
-    <% end %>
+    <div class="panel panel-default">
+      <%= render partial: "manage_ssh_keys" %>
+    </div>
+    <div class="panel panel-default">
+      <%= render partial: "manage_current_token" %>
+    </div>
   </div>
   <div id="add-ssh-key-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
 </div>
diff --git a/apps/workbench/app/views/users/_manage_current_token.html.erb b/apps/workbench/app/views/users/_manage_current_token.html.erb
index 71c6bd2..f4436ba 100644
--- a/apps/workbench/app/views/users/_manage_current_token.html.erb
+++ b/apps/workbench/app/views/users/_manage_current_token.html.erb
@@ -1,3 +1,13 @@
+<div class="panel panel-default">
+  <div class="panel-heading">
+    <h4 class="panel-title">
+      <a data-parent="#arv-adv-accordion" href="#manage_current_token">
+        Current Token
+      </a>
+    </h4>
+  </div>
+
+<div id="#manage_current_token" class="panel-body">
 <p>The Arvados API token is a secret key that enables the Arvados SDKs to access Arvados with the proper permissions. For more information see <%= link_to raw('Getting an API token'), "#{Rails.configuration.arvados_docsite}/user/reference/api-tokens.html", target: "_blank"%>.</p>
 <p>Paste the following lines at a shell prompt to set up the necessary environment for Arvados SDKs to authenticate to your account, <b><%= current_user.email %></b></p>
 
@@ -11,3 +21,5 @@ export ARVADOS_API_HOST_INSECURE=true
 unset ARVADOS_API_HOST_INSECURE
 <% end %>
 </pre>
+</div>
+</div>
diff --git a/apps/workbench/app/views/users/_manage_repositories.html.erb b/apps/workbench/app/views/users/_manage_repositories.html.erb
index e7c6d24..62c8e8d 100644
--- a/apps/workbench/app/views/users/_manage_repositories.html.erb
+++ b/apps/workbench/app/views/users/_manage_repositories.html.erb
@@ -1,4 +1,13 @@
-<div>
+<div class="panel panel-default">
+  <div class="panel-heading">
+    <h4 class="panel-title">
+      <a data-parent="#arv-adv-accordion" href="#manage_repositories">
+        Repositories
+      </a>
+    </h4>
+  </div>
+
+<div id="manage_repositories" class="panel-body">
   <p>
     For more information see <%= link_to raw('Writing a pipeline'),
     "#{Rails.configuration.arvados_docsite}/user/tutorials/tutorial-firstscript.html", target: "_blank"%>.
@@ -45,3 +54,4 @@
     </table>
   <% end %>
 </div>
+</div>
diff --git a/apps/workbench/app/views/users/_manage_ssh_keys.html.erb b/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
index 1ea8f0b..951b79c 100644
--- a/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
+++ b/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
@@ -1,4 +1,18 @@
-<div>
+<div class="panel panel-default">
+  <div class="panel-heading">
+    <div class="pull-right">
+      <%= link_to raw('<i class="fa fa-plus"></i>' " Add new SSH key"), add_ssh_key_popup_url,
+                   {class: 'btn btn-xs btn-primary', :remote => true, 'data-toggle' =>  "modal",
+                    'data-target' => '#add-ssh-key-modal-window'}  %>
+    </div>
+    <h4 class="panel-title">
+      <a data-parent="#arv-adv-accordion" href="#manage_ssh_keys">
+        SSH Keys
+      </a>
+    </h4>
+  </div>
+
+<div id="manage_ssh_keys" class="panel-body">
   <% if !@my_ssh_keys.any? %>
      <p> You have not yet set up an SSH public key for use with Arvados. </p>
      <p>  <%= link_to "Click here",
@@ -53,3 +67,4 @@
     </table>
   <% end %>
 </div>
+</div>
diff --git a/apps/workbench/app/views/users/_manage_virtual_machines.html.erb b/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
index 43f2b77..d5d9f52 100644
--- a/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
+++ b/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
@@ -1,4 +1,13 @@
-<div>
+<div class="panel panel-default">
+  <div class="panel-heading">
+    <h4 class="panel-title">
+      <a data-parent="#arv-adv-accordion" href="#manage_virtual_machines">
+        Virtual Machines
+      </a>
+    </h4>
+  </div>
+
+<div id="manage_virtual_machines" class="panel-body">
   <p>
     For more information see <%= link_to raw('Arvados Docs → User Guide → SSH access'),
   "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
@@ -88,3 +97,4 @@
     </pre>
   <% end %>
 </div>
+</div>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list