[ARVADOS] updated: 7488683807205fdfebd3c52e6ba50a0879ef1da7
git at public.curoverse.com
git at public.curoverse.com
Tue Apr 8 13:47:31 EDT 2014
Summary of changes:
discards 0f92cdd76a8ecc456e0ab068abce468e3a169bc0 (commit)
discards fdbdc0cdecb027265dccef0810b189e578cb8c60 (commit)
discards 0b76b475d2e1dc33bd80de9923d99009231e6671 (commit)
discards 4d918da1c7f7499d19491d44ecead48008d2fe1e (commit)
discards 38f8414fb8357b57ab3b859b7721676d62dfe984 (commit)
discards eba6e6988be540b8d6015903e58d8acf71476149 (commit)
discards 7043cad00647bc44f83586d895b70f950d5a26c2 (commit)
discards 043a17b21c0f18eaaddcdd5d1144989c1d48e3e2 (commit)
discards 2c5412052d38751d538696c9d5cbb0b8adbfd1a6 (commit)
discards 4e3dca8c84d77baaa1a58c195204f91da5f4176d (commit)
discards 2c292c1942746dfa7b93411d76a8374e1b0aff16 (commit)
discards c267f657aae5d43389a41861c2b9649c30482468 (commit)
discards b8ee1ea826cd2f02233893e8e06bac5fc44bb473 (commit)
discards 55684214f941cf73ce1eb542943dea24a17d48e5 (commit)
discards cb2c6a830abda3390146a4933b8cd8ce6ed55d31 (commit)
discards 8f8feb2866fd36bbc44188116d3bed6e4a4109a4 (commit)
discards 190fe9cdc4ea41267a89f8c0e54dbc179cd1e4b8 (commit)
discards 9d9b194941e7d3c9b459d27657e3c3c67bf388b8 (commit)
discards 835332abdd0fb8d0046529ff4d2f026f67736418 (commit)
discards e8dea4fda0347c612ba6b0d4a8045916febeb680 (commit)
discards a2164fe94a9909e5b38856b881a1d856f822747d (commit)
discards 47d130ae61a2aa0c637060d4a5be9f3728af30b7 (commit)
discards 4efa06e83f82096b70c03192bce74df96ed230c5 (commit)
discards e6e7736641231fe43b5f68bf4d0653d4321bbc36 (commit)
discards 33d7da6903a0fc2c9570a11c939dce6a4894f66e (commit)
discards 20e876e9d9809d6097da440453c20f737229ee28 (commit)
via 7488683807205fdfebd3c52e6ba50a0879ef1da7 (commit)
via 351718c4524ede8442f1cc078d61ced8839440c5 (commit)
via 0c632a2429105322f793809f1ab5bb158050ed56 (commit)
via da1c3891473b02f891eaa0af3d9d799ec6b6ed54 (commit)
via 6783336d968c8e47ad63e929086aa704299bb403 (commit)
via 3dd13d1a0643fdcc9e4f391b74b2496ca2ebbc7c (commit)
via dcbdaf47dd1486f58893413c07a9cb5c6d180923 (commit)
via c7b2768cd590b633fe4154dedec2d8ad387a9d9b (commit)
via a0d41ce990cf0a6fcd516a6a10f662a85258238c (commit)
via 19d60097652447fe7c71ec78f5c8d52a7002b3b8 (commit)
via 4c179135909d37a6cd9722af909785393d9e117d (commit)
via 64d449da29bbbe6bce2b54a2ed67eb4cb44243c9 (commit)
via c7f17227456c27d71bca83895c84bc83fb3b4ec5 (commit)
via 2908852ef9d52b12eb715474c5f31e35f7c44b18 (commit)
via 11a9f64426c1fc50529e694fead97f81e6eb4457 (commit)
via e9339eb1983e33798270f61f57d90cde4b656bd8 (commit)
via 8ea149362539b3d50e14a7fbd8831c7cbf347446 (commit)
via 847b4a5d6e179dde49295a7118962e764d63e544 (commit)
via 1d6d51202a936a28eee2384ceaa7c725813a2b03 (commit)
via d0dc31b9feb56c026f7c7ae0d46e63434b46742f (commit)
via a6724f72c5a93edf2b8a456783a474024743f1ff (commit)
via cbdb5dc18ccbd8cd2cdc4ebeaace82aa33b36f70 (commit)
via 1418580063cbe02ab3376adb27928c5325ba10b3 (commit)
via a3212e71057712af58a7d2b849d69915b4fd79b1 (commit)
via 59b0a3a8e5209ef85967a93c500167b7cf882757 (commit)
via 9349484f1e607064cf96fa7f7212979d30e58448 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (0f92cdd76a8ecc456e0ab068abce468e3a169bc0)
\
N -- N -- N (7488683807205fdfebd3c52e6ba50a0879ef1da7)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
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 7488683807205fdfebd3c52e6ba50a0879ef1da7
Author: radhika chippada <radhika at curoverse.com>
Date: Tue Apr 8 12:00:32 2014 -0400
Move the javascript into a js file instead of using <script> tag in html file.
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index ac2fd99..f7f7914 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -67,45 +67,3 @@
<% end #form %>
</div>
</div>
-
-<script>
- var $input = $('input:text'),
- $register = $('#register');
-
- var email_disabled = document.forms["setup_form"]["email"].disabled;
- var email_value = document.forms["setup_form"]["email"].value;
- var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
- if ((email_disabled == false) && (email_value == null || email_value == "" ||
- prefix_value == null || prefix_value == "")) {
- $register.attr('disabled', true);
- }
-
- $input.on('keyup paste mouseleave', function() {
- var trigger = false;
-
- var email_disabled = document.forms["setup_form"]["email"].disabled;
- var email_value = document.forms["setup_form"]["email"].value;
- var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
-
- var emailRegExp = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
- var validEmail = false;
- if (emailRegExp.test(email_value )) {
- validEmail = true;
- }
-
- if ((email_disabled == false) && (!validEmail || email_value == null ||
- email_value == "" || prefix_value == null || prefix_value == "")){
- trigger = true;
- }
-
- trigger ? $register.attr('disabled', true) : $register.removeAttr('disabled');
- });
-
- function reset_form() {
- $('#email').val("");
- $('#openid_prefix').val("");
- $('#repo_name').val("");
- $('select').val('')
- }
-
-</script>
diff --git a/apps/workbench/app/views/users/setup_popup.js.erb b/apps/workbench/app/views/users/setup_popup.js.erb
index 77213d4..5671cc2 100644
--- a/apps/workbench/app/views/users/setup_popup.js.erb
+++ b/apps/workbench/app/views/users/setup_popup.js.erb
@@ -1 +1,44 @@
$("#user-setup-modal-window").html("<%= escape_javascript(render partial: 'setup_popup') %>");
+
+// disable the submit button on load
+var $input = $('input:text'),
+$register = $('#register');
+
+var email_disabled = document.forms["setup_form"]["email"].disabled;
+var email_value = document.forms["setup_form"]["email"].value;
+var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
+if ((email_disabled == false) && (email_value == null || email_value == "" ||
+ prefix_value == null || prefix_value == "")) {
+ $register.attr('disabled', true);
+}
+
+// capture events to enable submit button when applicable
+$input.on('keyup paste mouseleave', function() {
+ var trigger = false;
+
+ var email_disabled = document.forms["setup_form"]["email"].disabled;
+ var email_value = document.forms["setup_form"]["email"].value;
+ var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
+
+ var emailRegExp = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
+ var validEmail = false;
+
+ if (emailRegExp.test(email_value )) {
+ validEmail = true;
+ }
+
+ if ((email_disabled == false) && (!validEmail || email_value == null ||
+ email_value == "" || prefix_value == null || prefix_value == "")){
+ trigger = true;
+ }
+
+ trigger ? $register.attr('disabled', true) : $register.removeAttr('disabled');
+});
+
+// reset form input fields, for the next time around
+function reset_form() {
+ $('#email').val("");
+ $('#openid_prefix').val("");
+ $('#repo_name').val("");
+ $('select').val('')
+}
commit 351718c4524ede8442f1cc078d61ced8839440c5
Author: radhika chippada <radhika at curoverse.com>
Date: Tue Apr 8 10:40:31 2014 -0400
Remove trailing white spaces.
diff --git a/apps/workbench/test/integration/users_test.rb b/apps/workbench/test/integration/users_test.rb
index 2472ec8..9ee12d8 100644
--- a/apps/workbench/test/integration/users_test.rb
+++ b/apps/workbench/test/integration/users_test.rb
@@ -46,7 +46,7 @@ class UsersTest < ActionDispatch::IntegrationTest
assert page.has_text? 'zzzzz-tpzed-d9tiejq69daie8f'
click_link 'Add a new user'
-
+
sleep(0.1)
popup = page.driver.browser.window_handles.last
page.within_window popup do
@@ -57,7 +57,7 @@ class UsersTest < ActionDispatch::IntegrationTest
end
sleep(0.1)
-
+
# verify that the new user showed up in the users page
assert page.has_text? 'foo at example.com'
commit 0c632a2429105322f793809f1ab5bb158050ed56
Author: radhika chippada <radhika at curoverse.com>
Date: Tue Apr 8 10:29:40 2014 -0400
Add paste event check for submit button validation
diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb
index 96dc348..3f31240 100644
--- a/apps/workbench/app/views/application/index.html.erb
+++ b/apps/workbench/app/views/application/index.html.erb
@@ -8,12 +8,12 @@
<% if controller.model_class.name == 'User' %>
<%= link_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", setup_user_popup_path,
- {class: 'btn btn-primary pull-right', :remote => true, 'data-toggle' => "modal",
+ {class: 'btn btn-primary pull-right', :remote => true, 'data-toggle' => "modal",
'data-target' => '#user-setup-modal-window', return_to: request.url} %>
<div id="user-setup-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
<% else %>
- <%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}",
- { action: 'create', return_to: request.url },
+ <%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}",
+ { action: 'create', return_to: request.url },
{ class: 'btn btn-primary pull-right' } %>
<% end %>
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index c075ab5..ac2fd99 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -75,12 +75,12 @@
var email_disabled = document.forms["setup_form"]["email"].disabled;
var email_value = document.forms["setup_form"]["email"].value;
var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
- if ((email_disabled == false) && (email_value == null || email_value == "" ||
+ if ((email_disabled == false) && (email_value == null || email_value == "" ||
prefix_value == null || prefix_value == "")) {
$register.attr('disabled', true);
}
- $input.keyup(function() {
+ $input.on('keyup paste mouseleave', function() {
var trigger = false;
var email_disabled = document.forms["setup_form"]["email"].disabled;
@@ -93,7 +93,7 @@
validEmail = true;
}
- if ((email_disabled == false) && (!validEmail || email_value == null ||
+ if ((email_disabled == false) && (!validEmail || email_value == null ||
email_value == "" || prefix_value == null || prefix_value == "")){
trigger = true;
}
commit da1c3891473b02f891eaa0af3d9d799ec6b6ed54
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Apr 8 01:55:17 2014 -0400
Use bootstrap/theme style defaults for user setup modal and form.
diff --git a/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss b/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
deleted file mode 100644
index a16eb32..0000000
--- a/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
+++ /dev/null
@@ -1,100 +0,0 @@
-// Place all the styles related to the bootstrap modal here.
-
-.modal {
- left: 50%;
- bottom: auto;
- right: auto;
- padding: 0;
- width: 400px;
- margin-left: -250px;
- background-color: #ffffff;
- border: 2px solid #999999;
- border-radius: 6px;
- box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
- background-clip: padding-box;
-}
-
-.modal.fade.in {
- top: 10%;
-}
-
-.modal-backdrop,
-.modal-backdrop.fade.in{
- opacity: 0.7;
- background: #fff;
-}
-
-/* Modal Overflow */
-
-.modal-overflow.modal {
-top: 1%;
-}
-
-.modal-overflow.modal.fade {
-top: -100%;
-}
-
-.modal-overflow.modal.fade.in {
-top: 1%;
-}
-
-.modal-overflow .modal-body {
-overflow: auto;
--webkit-overflow-scrolling: touch;
-}
-
-/* Responsive */
-
- at media (min-width: 1200px) {
-.modal.container {
-width: 1170px;
-margin-left: -585px;
-}
-}
-
- at media (max-width: 979px) {
-.modal,
-.modal.container,
-.modal.modal-overflow {
-top: 1%;
-right: 1%;
-left: 1%;
-bottom: auto;
-width: auto !important;
-height: auto !important;
-margin: 0 !important;
-padding: 0 !important;
-}
-
-.modal.fade.in,
-.modal.container.fade.in,
-.modal.modal-overflow.fade.in {
-top: 1%;
-bottom: auto;
-}
-
-.modal-body,
-.modal-overflow .modal-body {
-position: static;
-margin: 0;
-height: auto !important;
-max-height: none !important;
-overflow: visible !important;
-}
-
-.modal-footer,
-.modal-overflow .modal-footer {
-position: static;
-}
-}
-
-.loading-spinner {
-position: absolute;
-top: 50%;
-left: 50%;
-margin: -12px 0 0 -12px;
-}
-
-#user-setup-modal-window{
- overflow: hidden;
-}
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index 63cf67c..724fa9b 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -230,6 +230,7 @@
</div>
</div>
+ <%= yield :footer_html %>
<%= piwik_tracking_tag %>
<%= javascript_tag do %>
<%= yield :footer_js %>
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 784ab6e..c075ab5 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -1,79 +1,72 @@
-<%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get',
- class: 'form-search', remote: true} do %>
+<div class="modal-dialog">
+ <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">×</button>
- <h3 class="modal-title">Setup User</h4>
- </div
+ <%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get',
+ class: 'form-search', remote: true} do %>
- <div class="modal-body">
- <% if @object%>
- <% uuid = @object.uuid %>
- <% email = @object.email %>
- <% end %>
- <% disable_email = uuid != nil %>
- <% identity_url_prefix = @current_selections[:identity_url_prefix] %>
- <% disable_url_prefix = identity_url_prefix != nil %>
- <% selected_repo = @current_selections[:repo_name] %>
- <% selected_vm = @current_selections[:vm_uuid] %>
+ <div class="modal-header">
+ <button type="button" class="close" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">×</button>
+ <h4 class="modal-title">Setup User</h4>
+ </div>
+
+ <div class="modal-body">
+ <% if @object%>
+ <% uuid = @object.uuid %>
+ <% email = @object.email %>
+ <% end %>
+ <% disable_email = uuid != nil %>
+ <% identity_url_prefix = @current_selections[:identity_url_prefix] %>
+ <% disable_url_prefix = identity_url_prefix != nil %>
+ <% selected_repo = @current_selections[:repo_name] %>
+ <% selected_vm = @current_selections[:vm_uuid] %>
<input id="user_uuid" maxlength="250" name="user_uuid" type="hidden" value="<%=uuid%>">
- <div>
- <table><tbody><div class="form-group">
- <tr>
- <% if disable_email %>
- <td> Email </td>
- <td> <input id="email" maxlength="250" name="email" type="text" value="<%=email%>"
- disabled=true > </td>
- <% else %>
- <td> Email </td>
- <td> <input id="email" maxlength="250" name="email" type="text" > </td>
- <% end %>
- </tr>
- <tr>
- <% if disable_url_prefix %>
- <td> Identity URL Prefix   </td>
- <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
- value="<%=identity_url_prefix%>" disabled=true > </td>
- <% else %>
- <td> Openid Prefix </td>
- <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
- value="<%= Rails.configuration.default_openid_prefix %>"> </td>
- <% end %>
- </tr>
- <tr>
- <td> Repository Name </td>
- <td> <input id="repo_name" maxlength="250" name="repo_name" type="text" value="<%=selected_repo%>">
- </tr>
- <tr>
- <td> Virtual Machine </td>
- <td>
- <select name="vm_uuid">
- <% if selected_vm %>
- <option value=""> Choose One: </option>
- <% else %>
- <option value="" selected> Choose One: </option>
- <% end %>
- <% @vms.each do |vm| %>
- <% if selected_vm == vm.uuid %>
- <option value=<%=vm.uuid%> selected> <%=vm.hostname%> </option>
- <% else %>
- <option value=<%=vm.uuid%> > <%=vm.hostname%> </option>
- <% end %>
- <% end %>
- </select>
- </td>
- </tr>
- </div></tbody></table>
+ <div class="form-group">
+ <label for="email">Email</label>
+ <% if disable_email %>
+ <input class="form-control" id="email" maxlength="250" name="email" type="text" value="<%=email%>" disabled>
+ <% else %>
+ <input class="form-control" id="email" maxlength="250" name="email" type="text">
+ <% end %>
</div>
- </div>
+ <div class="form-group">
+ <label for="openid_prefix">Identity URL Prefix</label>
+ <% if disable_url_prefix %>
+ <input class="form-control" id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
+ value="<%=identity_url_prefix%>" disabled=true>
+ <% else %>
+ <input class="form-control" id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
+ value="<%= Rails.configuration.default_openid_prefix %>">
+ <% end %>
+ </div>
+ <div class="form-group">
+ <label for="repo_name">Repository Name</label>
+ <input class="form-control" id="repo_name" maxlength="250" name="repo_name" type="text" value="<%=selected_repo%>">
+ </div>
+ <div class="form-group">
+ <label for="vm_uuid">Virtual Machine</label>
+ <select class="form-control" name="vm_uuid">
+ <option value="" <%= 'selected' unless selected_vm %>>
+ Choose One:
+ </option>
+ <% @vms.each do |vm| %>
+ <option value="<%=vm.uuid%>"
+ <%= 'selected' if selected_vm == vm.uuid %>>
+ <%= vm.hostname %>
+ </option>
+ <% end %>
+ </select>
+ </div>
+ </div>
- <div class="modal-footer">
- <button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
- <button class="btn btn-default" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Cancel</button>
- </div>
+ <div class="modal-footer">
+ <button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
+ <button class="btn btn-default" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Cancel</button>
+ </div>
-<% end %>
+ <% end #form %>
+ </div>
+</div>
<script>
var $input = $('input:text'),
diff --git a/apps/workbench/app/views/users/_show_admin.html.erb b/apps/workbench/app/views/users/_show_admin.html.erb
index 9c803c9..e2f5fdf 100644
--- a/apps/workbench/app/views/users/_show_admin.html.erb
+++ b/apps/workbench/app/views/users/_show_admin.html.erb
@@ -10,7 +10,6 @@ account.</p>
<blockquote>
<%= link_to "Setup #{@object.full_name}", setup_popup_user_url(id: @object.uuid), {class: 'btn btn-primary', :remote => true, 'data-toggle' => "modal", 'data-target' => '#user-setup-modal-window'} %>
-<div id="user-setup-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
</blockquote>
<p>As an admin, you can deactivate and reset this user. This will remove all repository/VM permissions for the user. If you "setup" the user again, the user will have to sign the user agreement again.</p>
@@ -19,3 +18,6 @@ account.</p>
<%= button_to "Deactivate #{@object.full_name}", unsetup_user_url(id: @object.uuid), class: 'btn btn-primary', confirm: "Are you sure you want to deactivate #{@object.full_name}?"%>
</blockquote>
+<% content_for :footer_html do %>
+<div id="user-setup-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
+<% end %>
commit 6783336d968c8e47ad63e929086aa704299bb403
Author: radhika chippada <radhika at radhika.curoverse>
Date: Mon Apr 7 15:04:06 2014 -0400
Reset form fields on cancel.
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index e8a8043..784ab6e 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -2,7 +2,7 @@
class: 'form-search', remote: true} do %>
<div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <button type="button" class="close" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="modal-title">Setup User</h4>
</div
@@ -70,7 +70,7 @@
<div class="modal-footer">
<button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
- <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
+ <button class="btn btn-default" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<% end %>
@@ -107,4 +107,12 @@
trigger ? $register.attr('disabled', true) : $register.removeAttr('disabled');
});
+
+ function reset_form() {
+ $('#email').val("");
+ $('#openid_prefix').val("");
+ $('#repo_name').val("");
+ $('select').val('')
+ }
+
</script>
commit 3dd13d1a0643fdcc9e4f391b74b2496ca2ebbc7c
Author: radhika chippada <radhika at radhika.curoverse>
Date: Mon Apr 7 14:44:49 2014 -0400
Submit
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index a1c3f8a..e8a8043 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -1,3 +1,6 @@
+<%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get',
+ class: 'form-search', remote: true} do %>
+
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="modal-title">Setup User</h4>
@@ -13,12 +16,10 @@
<% disable_url_prefix = identity_url_prefix != nil %>
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
-
- <%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get',
- class: 'form-search', remote: true} do %>
+
<input id="user_uuid" maxlength="250" name="user_uuid" type="hidden" value="<%=uuid%>">
<div>
- <table><tbody>
+ <table><tbody><div class="form-group">
<tr>
<% if disable_email %>
<td> Email </td>
@@ -63,9 +64,8 @@
</select>
</td>
</tr>
- </tbody></table>
+ </div></tbody></table>
</div>
- <% end %>
</div>
<div class="modal-footer">
@@ -73,6 +73,8 @@
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
+<% end %>
+
<script>
var $input = $('input:text'),
$register = $('#register');
commit dcbdaf47dd1486f58893413c07a9cb5c6d180923
Author: radhika chippada <radhika at radhika.curoverse>
Date: Mon Apr 7 14:03:01 2014 -0400
Bootstrap modal css updated to include only what is needed.
diff --git a/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss b/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
index 887065e..a16eb32 100644
--- a/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
+++ b/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
@@ -1,116 +1,27 @@
-/*!
-* Bootstrap Modal
-*
-* Copyright Jordan Schroter
-* Licensed under the Apache License v2.0
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-*/
-
-body.modal-open,
-.modal-open .navbar-fixed-top,
-.modal-open .navbar-fixed-bottom {
- margin-right: 0;
-}
+// Place all the styles related to the bootstrap modal here.
.modal {
left: 50%;
bottom: auto;
right: auto;
padding: 0;
- width: 500px;
+ width: 400px;
margin-left: -250px;
background-color: #ffffff;
- border: 1px solid #999999;
- border: 1px solid rgba(0, 0, 0, 0.2);
+ border: 2px solid #999999;
border-radius: 6px;
- -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
background-clip: padding-box;
}
-.modal.container {
- max-width: none;
-}
-
-
-.modal-open {
-overflow: hidden;
-}
-
-
-/* add a scroll bar to stop page from jerking around */
-.modal-open.page-overflow .page-container,
-.modal-open.page-overflow .page-container .navbar-fixed-top,
-.modal-open.page-overflow .page-container .navbar-fixed-bottom,
-.modal-open.page-overflow .modal-scrollable {
-overflow-y: scroll;
-}
-
-#user-setup-modal-window{
- overflow: hidden;
-}
-
-
- at media (max-width: 979px) {
-.modal-open.page-overflow .page-container .navbar-fixed-top,
-.modal-open.page-overflow .page-container .navbar-fixed-bottom {
-overflow-y: visible;
-}
-}
-
-
-.modal-scrollable {
-position: fixed;
-top: 0;
-bottom: 0;
-left: 0;
-right: 0;
-overflow: auto;
-}
-
-.modal.fade {
-top: -100%;
--webkit-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
--moz-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
--o-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
-}
-
.modal.fade.in {
-top: 50%;
-}
-
-.modal-body {
-max-height: none;
-overflow: visible;
-}
-
-.modal.modal-absolute {
-position: absolute;
-z-index: 950;
-}
-
-.modal .loading-mask {
-position: absolute;
-top: 0;
-bottom: 0;
-left: 0;
-right: 0;
-background: #fff;
-border-radius: 6px;
-}
-
-.modal-backdrop.modal-absolute{
-position: absolute;
-z-index: 940;
+ top: 10%;
}
.modal-backdrop,
.modal-backdrop.fade.in{
-opacity: 0.7;
-filter: alpha(opacity=70);
-background: #fff;
+ opacity: 0.7;
+ background: #fff;
}
/* Modal Overflow */
@@ -183,3 +94,7 @@ top: 50%;
left: 50%;
margin: -12px 0 0 -12px;
}
+
+#user-setup-modal-window{
+ overflow: hidden;
+}
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 412d211..a1c3f8a 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -3,7 +3,7 @@
<h3 class="modal-title">Setup User</h4>
</div
- <div class="modal-body" style="max-height:800px;">
+ <div class="modal-body">
<% if @object%>
<% uuid = @object.uuid %>
<% email = @object.email %>
commit c7b2768cd590b633fe4154dedec2d8ad387a9d9b
Author: radhika chippada <radhika at radhika.curoverse>
Date: Mon Apr 7 11:58:08 2014 -0400
Add header and footer to the setup user modal
diff --git a/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss b/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
index edabb85..887065e 100644
--- a/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
+++ b/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
@@ -47,6 +47,11 @@ overflow: hidden;
overflow-y: scroll;
}
+#user-setup-modal-window{
+ overflow: hidden;
+}
+
+
@media (max-width: 979px) {
.modal-open.page-overflow .page-container .navbar-fixed-top,
.modal-open.page-overflow .page-container .navbar-fixed-bottom {
diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb
index 7108c70..96dc348 100644
--- a/apps/workbench/app/views/application/index.html.erb
+++ b/apps/workbench/app/views/application/index.html.erb
@@ -9,8 +9,8 @@
<% if controller.model_class.name == 'User' %>
<%= link_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", setup_user_popup_path,
{class: 'btn btn-primary pull-right', :remote => true, 'data-toggle' => "modal",
- 'data-target' => '#modal-window', return_to: request.url} %>
- <div id="modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
+ 'data-target' => '#user-setup-modal-window', return_to: request.url} %>
+ <div id="user-setup-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
<% else %>
<%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}",
{ action: 'create', return_to: request.url },
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 90cab2c..412d211 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -1,4 +1,9 @@
- <div class="modal-body">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h3 class="modal-title">Setup User</h4>
+ </div
+
+ <div class="modal-body" style="max-height:800px;">
<% if @object%>
<% uuid = @object.uuid %>
<% email = @object.email %>
@@ -60,14 +65,14 @@
</tr>
</tbody></table>
</div>
- <div align="center">
- <br/>
- <button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
- <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Cancel</button>
- </div>
<% end %>
</div>
+ <div class="modal-footer">
+ <button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
+ <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
+ </div>
+
<script>
var $input = $('input:text'),
$register = $('#register');
diff --git a/apps/workbench/app/views/users/_show_admin.html.erb b/apps/workbench/app/views/users/_show_admin.html.erb
index 072d7ee..9c803c9 100644
--- a/apps/workbench/app/views/users/_show_admin.html.erb
+++ b/apps/workbench/app/views/users/_show_admin.html.erb
@@ -9,8 +9,8 @@ account.</p>
<p>As an admin, you can setup this user. Please input a VM and repository for the user. If you had previously provided any of these items, they are pre-filled for you and you can leave them as is if you would like to reuse them.</p>
<blockquote>
-<%= link_to "Setup #{@object.full_name}", setup_popup_user_url(id: @object.uuid), {class: 'btn btn-primary', :remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %>
-<div id="modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
+<%= link_to "Setup #{@object.full_name}", setup_popup_user_url(id: @object.uuid), {class: 'btn btn-primary', :remote => true, 'data-toggle' => "modal", 'data-target' => '#user-setup-modal-window'} %>
+<div id="user-setup-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
</blockquote>
<p>As an admin, you can deactivate and reset this user. This will remove all repository/VM permissions for the user. If you "setup" the user again, the user will have to sign the user agreement again.</p>
diff --git a/apps/workbench/app/views/users/setup.js.erb b/apps/workbench/app/views/users/setup.js.erb
index 9134623..bce71b4 100644
--- a/apps/workbench/app/views/users/setup.js.erb
+++ b/apps/workbench/app/views/users/setup.js.erb
@@ -1,2 +1,2 @@
-$("#modal-window").modal("hide");
+$("#user-setup-modal-window").modal("hide");
document.location.reload();
diff --git a/apps/workbench/app/views/users/setup_popup.js.erb b/apps/workbench/app/views/users/setup_popup.js.erb
index e725a92..77213d4 100644
--- a/apps/workbench/app/views/users/setup_popup.js.erb
+++ b/apps/workbench/app/views/users/setup_popup.js.erb
@@ -1 +1 @@
-$("#modal-window").html("<%= escape_javascript(render partial: 'setup_popup') %>");
+$("#user-setup-modal-window").html("<%= escape_javascript(render partial: 'setup_popup') %>");
commit a0d41ce990cf0a6fcd516a6a10f662a85258238c
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Apr 4 17:21:45 2014 -0400
Document capybara-webkit qt dependencies, and add phantomjs recipe.
diff --git a/apps/workbench/README.textile b/apps/workbench/README.textile
index ea01724..00588e8 100644
--- a/apps/workbench/README.textile
+++ b/apps/workbench/README.textile
@@ -6,8 +6,22 @@ h2. Running tests
The Workbench application includes a series of integration tests. When you run these, it starts the API server in a test environment, with all of its fixtures loaded, then tests Workbench by starting that server and making requests against it.
+Before running @bundle install@, make sure you install QT development dependencies (otherwise, capybara-webkit installation will fail). For example, on a Debian or Ubuntu system:
+
+<pre>
+arvados/apps/workbench$ sudo apt-get install qt4-qmake libqt4-dev
+arvados/apps/workbench$ RAILS_ENV=test bundle install
+</pre>
+
In addition to bundled gems, running the integration tests requires "PhantomJS":http://phantomjs.org/download.html to test JavaScript elements. The simplest way to get started is to download one of the binary builds provided, and install the executable into one of the directories in your @$PATH at .
+<pre>
+$ cd /tmp
+/tmp$ wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
+/tmp$ tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
+/tmp$ sudo cp -ip phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/
+</pre>
+
If you install the Workbench Bundle in deployment mode, you must also install the API server Bundle in deployment mode, and vice versa. If your Bundle installs have mismatched modes, the integration tests will fail with "Gem not found" errors.
h2. Writing tests
commit 19d60097652447fe7c71ec78f5c8d52a7002b3b8
Author: radhika chippada <radhika at radhika.curoverse>
Date: Fri Apr 4 15:45:53 2014 -0400
Add email format validation to the input text field in the setup modal.
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index aed57da..90cab2c 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -75,7 +75,8 @@
var email_disabled = document.forms["setup_form"]["email"].disabled;
var email_value = document.forms["setup_form"]["email"].value;
var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
- if ((email_disabled == false) && (email_value == null || email_value == "" || prefix_value == null || prefix_value == "")) {
+ if ((email_disabled == false) && (email_value == null || email_value == "" ||
+ prefix_value == null || prefix_value == "")) {
$register.attr('disabled', true);
}
@@ -85,7 +86,15 @@
var email_disabled = document.forms["setup_form"]["email"].disabled;
var email_value = document.forms["setup_form"]["email"].value;
var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
- if ((email_disabled == false) && (email_value == null || email_value == "" || prefix_value == null || prefix_value == "")) {
+
+ var emailRegExp = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
+ var validEmail = false;
+ if (emailRegExp.test(email_value )) {
+ validEmail = true;
+ }
+
+ if ((email_disabled == false) && (!validEmail || email_value == null ||
+ email_value == "" || prefix_value == null || prefix_value == "")){
trigger = true;
}
commit 4c179135909d37a6cd9722af909785393d9e117d
Author: radhika chippada <radhika at radhika.curoverse>
Date: Fri Apr 4 14:53:42 2014 -0400
During setup of an existing user, create oid login permission, if it does not already exist.
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 475b696..aed57da 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -5,6 +5,7 @@
<% end %>
<% disable_email = uuid != nil %>
<% identity_url_prefix = @current_selections[:identity_url_prefix] %>
+ <% disable_url_prefix = identity_url_prefix != nil %>
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
@@ -24,7 +25,7 @@
<% end %>
</tr>
<tr>
- <% if disable_email %>
+ <% if disable_url_prefix %>
<td> Identity URL Prefix   </td>
<td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
value="<%=identity_url_prefix%>" disabled=true > </td>
diff --git a/services/api/app/controllers/arvados/v1/users_controller.rb b/services/api/app/controllers/arvados/v1/users_controller.rb
index fe2d0da..58661a0 100644
--- a/services/api/app/controllers/arvados/v1/users_controller.rb
+++ b/services/api/app/controllers/arvados/v1/users_controller.rb
@@ -124,7 +124,8 @@ class Arvados::V1::UsersController < ApplicationController
end
if object_found
- @response = @object.setup_repo_vm_links params[:repo_name], params[:vm_uuid]
+ @response = @object.setup_repo_vm_links params[:repo_name],
+ params[:vm_uuid], params[:openid_prefix]
else
@response = User.setup @object, params[:openid_prefix],
params[:repo_name], params[:vm_uuid]
diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index 77e9778..e4881ed 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -111,39 +111,17 @@ class User < ArvadosModel
end
def self.setup(user, openid_prefix, repo_name=nil, vm_uuid=nil)
- login_perm_props = {identity_url_prefix: openid_prefix}
-
- # Check oid_login_perm
- oid_login_perms = Link.where(tail_uuid: user.email,
- head_kind: 'arvados#user',
- link_class: 'permission',
- name: 'can_login')
-
- if !oid_login_perms.any?
- # create openid login permission
- oid_login_perm = Link.create(link_class: 'permission',
- name: 'can_login',
- tail_kind: 'email',
- tail_uuid: user.email,
- head_kind: 'arvados#user',
- head_uuid: user.uuid,
- properties: login_perm_props
- )
- logger.info { "openid login permission: " + oid_login_perm[:uuid] }
- else
- oid_login_perm = oid_login_perms.first
- end
-
- return [oid_login_perm] + user.setup_repo_vm_links(repo_name, vm_uuid)
+ return user.setup_repo_vm_links(repo_name, vm_uuid, openid_prefix)
end
# create links
- def setup_repo_vm_links(repo_name, vm_uuid)
+ def setup_repo_vm_links(repo_name, vm_uuid, openid_prefix)
+ oid_login_perm = create_oid_login_perm openid_prefix
repo_perm = create_user_repo_link repo_name
vm_login_perm = create_vm_login_permission_link vm_uuid, repo_name
group_perm = create_user_group_link
- return [repo_perm, vm_login_perm, group_perm, self].compact
+ return [oid_login_perm, repo_perm, vm_login_perm, group_perm, self].compact
end
# delete user signatures, login, repo, and vm perms, and mark as inactive
@@ -270,6 +248,33 @@ class User < ArvadosModel
merged
end
+ def create_oid_login_perm (openid_prefix)
+ login_perm_props = {identity_url_prefix: openid_prefix}
+
+ # Check oid_login_perm
+ oid_login_perms = Link.where(tail_uuid: self.email,
+ head_kind: 'arvados#user',
+ link_class: 'permission',
+ name: 'can_login')
+
+ if !oid_login_perms.any?
+ # create openid login permission
+ oid_login_perm = Link.create(link_class: 'permission',
+ name: 'can_login',
+ tail_kind: 'email',
+ tail_uuid: self.email,
+ head_kind: 'arvados#user',
+ head_uuid: self.uuid,
+ properties: login_perm_props
+ )
+ logger.info { "openid login permission: " + oid_login_perm[:uuid] }
+ else
+ oid_login_perm = oid_login_perms.first
+ end
+
+ return oid_login_perm
+ end
+
def create_user_repo_link(repo_name)
# repo_name is optional
if not repo_name
commit 64d449da29bbbe6bce2b54a2ed67eb4cb44243c9
Author: radhika chippada <radhika at radhika.curoverse>
Date: Fri Apr 4 13:36:01 2014 -0400
Need to remove the user's "all users" group read permission during unsetup.
This shortcoming became apparent during testing when "is_invited" flag is checked.
diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index 6db1d3e..77e9778 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -175,6 +175,19 @@ class User < ArvadosModel
Link.delete perm
end
+ # delete "All users' group read permissions for this user
+ group = Group.where(name: 'All users').select do |g|
+ g[:uuid].match /-f+$/
+ end.first
+ group_perms = Link.where(tail_uuid: self.uuid,
+ head_uuid: group[:uuid],
+ head_kind: 'arvados#group',
+ link_class: 'permission',
+ name: 'can_read')
+ group_perms.each do |perm|
+ Link.delete perm
+ end
+
# delete any signatures by this user
signed_uuids = Link.where(link_class: 'signature',
tail_kind: 'arvados#user',
diff --git a/services/api/test/functional/arvados/v1/users_controller_test.rb b/services/api/test/functional/arvados/v1/users_controller_test.rb
index 2a7f686..e62eff8 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -659,7 +659,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
@vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
- verify_link_existence created['uuid'], created['email'], true, true, true, false
+ verify_link_existence created['uuid'], created['email'], true, true, true, true, false
# now unsetup this user
post :unsetup, uuid: created['uuid']
@@ -669,7 +669,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
assert_not_nil created2['uuid'], 'expected uuid for the newly created user'
assert_equal created['uuid'], created2['uuid'], 'expected uuid not found'
- verify_link_existence created['uuid'], created['email'], false, false, false, false
+ verify_link_existence created['uuid'], created['email'], false, false, false, false, false
end
test "unsetup active user" do
@@ -679,9 +679,10 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
active_user = JSON.parse(@response.body)
assert_not_nil active_user['uuid'], 'expected uuid for the active user'
assert active_user['is_active'], 'expected is_active for active user'
+ assert active_user['is_invited'], 'expected is_invited for active user'
verify_link_existence active_user['uuid'], active_user['email'],
- false, false, false, true
+ false, false, false, true, true
authorize_with :admin
@@ -693,9 +694,10 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
assert_not_nil response_user['uuid'], 'expected uuid for the upsetup user'
assert_equal active_user['uuid'], response_user['uuid'], 'expected uuid not found'
assert !response_user['is_active'], 'expected user to be inactive'
+ assert !response_user['is_invited'], 'expected user to be uninvited'
verify_link_existence response_user['uuid'], response_user['email'],
- false, false, false, false
+ false, false, false, false, false
end
def verify_num_links (original_links, expected_additional_links)
@@ -760,7 +762,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
end
def verify_link_existence uuid, email, expect_oid_login_perms,
- expect_repo_perms, expect_vm_perms, expect_signatures
+ expect_repo_perms, expect_vm_perms, expect_group_perms, expect_signatures
# verify that all links are deleted for the user
oid_login_perms = Link.where(tail_uuid: email,
head_kind: 'arvados#user',
@@ -792,6 +794,20 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
assert !vm_login_perms.any?, "expected all vm_login_perms deleted"
end
+ group = Group.where(name: 'All users').select do |g|
+ g[:uuid].match /-f+$/
+ end.first
+ group_read_perms = Link.where(tail_uuid: uuid,
+ head_uuid: group[:uuid],
+ head_kind: 'arvados#group',
+ link_class: 'permission',
+ name: 'can_read')
+ if expect_group_perms
+ assert group_read_perms.any?, "expected all users group read perms"
+ else
+ assert !group_read_perms.any?, "expected all users group perm deleted"
+ end
+
signed_uuids = Link.where(link_class: 'signature',
tail_kind: 'arvados#user',
tail_uuid: uuid)
commit c7f17227456c27d71bca83895c84bc83fb3b4ec5
Author: radhika chippada <radhika at radhika.curoverse>
Date: Fri Apr 4 10:45:14 2014 -0400
Use webkit driver for Capybara instead of selenium for tests that need dialog handling.
diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index b273d91..1e43d1c 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -28,6 +28,7 @@ group :test do
gem 'selenium-webdriver'
gem 'capybara'
gem 'poltergeist'
+ gem 'capybara-webkit'
end
gem 'jquery-rails'
@@ -59,4 +60,4 @@ gem 'RedCloth'
gem 'piwik_analytics'
gem 'httpclient'
gem 'themes_for_rails'
-gem "deep_merge", :require => 'deep_merge/rails_compat'
\ No newline at end of file
+gem "deep_merge", :require => 'deep_merge/rails_compat'
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index 0c65ca8..0795f75 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -48,6 +48,9 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
+ capybara-webkit (1.1.0)
+ capybara (~> 2.0, >= 2.0.2)
+ json
childprocess (0.5.1)
ffi (~> 1.0, >= 1.0.11)
cliver (0.3.2)
@@ -182,6 +185,7 @@ DEPENDENCIES
bootstrap-sass (~> 3.1.0)
bootstrap-x-editable-rails
capybara
+ capybara-webkit
coffee-rails (~> 3.2.0)
deep_merge
httpclient
diff --git a/apps/workbench/test/integration/users_test.rb b/apps/workbench/test/integration/users_test.rb
index 7555e3a..2472ec8 100644
--- a/apps/workbench/test/integration/users_test.rb
+++ b/apps/workbench/test/integration/users_test.rb
@@ -1,5 +1,4 @@
require 'integration_helper'
-require "selenium-webdriver"
class UsersTest < ActionDispatch::IntegrationTest
test "login as active user but not admin" do
@@ -39,7 +38,7 @@ class UsersTest < ActionDispatch::IntegrationTest
end
test "create a new user" do
- Capybara.current_driver = :selenium
+ Capybara.current_driver = :webkit
visit page_with_token('admin_trustedclient')
click_link 'Users'
@@ -81,7 +80,7 @@ class UsersTest < ActionDispatch::IntegrationTest
end
test "setup the active user" do
- Capybara.current_driver = :selenium
+ Capybara.current_driver = :webkit
visit page_with_token('admin_trustedclient')
click_link 'Users'
@@ -133,7 +132,7 @@ class UsersTest < ActionDispatch::IntegrationTest
end
test "unsetup active user" do
- Capybara.current_driver = :selenium
+ Capybara.current_driver = :webkit
visit page_with_token('admin_trustedclient')
@@ -158,7 +157,6 @@ class UsersTest < ActionDispatch::IntegrationTest
# unsetup user and verify all the above links are deleted
click_link 'Admin'
click_button 'Deactivate Active User'
- page.driver.browser.switch_to.alert.accept
sleep(0.1)
# Should now be back in the Attributes tab for the user
commit 2908852ef9d52b12eb715474c5f31e35f7c44b18
Author: radhika chippada <radhika at radhika.curoverse>
Date: Thu Apr 3 22:41:42 2014 -0400
Added integration tests for create new user, setup and unsetup existing user. The tests use selenium driver without headless. Hence, we see the browser while these tests are running.
Next step is to use headless to hide the browser during test execution.
diff --git a/apps/workbench/test/integration/users_test.rb b/apps/workbench/test/integration/users_test.rb
index 1576c04..7555e3a 100644
--- a/apps/workbench/test/integration/users_test.rb
+++ b/apps/workbench/test/integration/users_test.rb
@@ -1,9 +1,7 @@
require 'integration_helper'
require "selenium-webdriver"
-#require 'headless'
class UsersTest < ActionDispatch::IntegrationTest
-
test "login as active user but not admin" do
Capybara.current_driver = Capybara.javascript_driver
visit page_with_token('active_trustedclient')
@@ -41,7 +39,7 @@ class UsersTest < ActionDispatch::IntegrationTest
end
test "create a new user" do
- Capybara.current_driver = Capybara.javascript_driver
+ Capybara.current_driver = :selenium
visit page_with_token('admin_trustedclient')
click_link 'Users'
@@ -50,64 +48,36 @@ class UsersTest < ActionDispatch::IntegrationTest
click_link 'Add a new user'
- # for now just check that we are back in Users -> List page
- assert page.has_text? 'zzzzz-tpzed-d9tiejq69daie8f'
- end
-
- #@headless
- test "unsetup active user" do
- Capybara.current_driver = Capybara.javascript_driver
- #Capybara.current_driver = :selenium
-
- visit page_with_token('admin_trustedclient')
-
- click_link 'Users'
-
- assert page.has_link? 'zzzzz-tpzed-xurymjxw79nv3jz'
-
- # click on active user
- click_link 'zzzzz-tpzed-xurymjxw79nv3jz'
-
- # Verify that is_active is set
- click_link 'Attributes'
- assert page.has_text? 'modified_by_user_uuid'
- page.within(:xpath, '//a[@data-name="is_active"]') do
- assert_equal "true", text, "Expected user's is_active to be true"
- end
-
- # go to Admin tab
- click_link 'Admin'
- assert page.has_text? 'As an admin, you can deactivate and reset this user'
-
- # Click on Deactivate button
- click_button 'Deactivate Active User'
-
- # Click Ok in the confirm dialog
-=begin
-#use with selenium
- page.driver.browser.switch_to.alert.accept
sleep(0.1)
popup = page.driver.browser.window_handles.last
- #popup = page.driver.browser.window_handle
page.within_window popup do
- assert has_text? 'Are you sure you want to deactivate'
- click_button "OK"
+ assert has_text? 'Virtual Machine'
+ fill_in "email", :with => "foo at example.com"
+ fill_in "repo_name", :with => "test_repo"
+ click_button "Submit"
end
-# use with poltergeist driver
-popup = page.driver.window_handles.last
-page.within_window popup do
- #fill_in "email", :with => "my_email"
- assert has_text? 'Are you sure you want to deactivate'
- click_button "OK"
-end
-=end
+ sleep(0.1)
+
+ # verify that the new user showed up in the users page
+ assert page.has_text? 'foo at example.com'
+
+ page.within(:xpath, '//tr[@data-object-uuid][1]') do
+ assert (text.include? 'foo at example.com false'), 'Expected email'
+ new_user_uuid = text.split[0]
+
+ # go to the new user's page
+ click_link new_user_uuid
+ end
- # Should now be back in the Attributes tab for the user
assert page.has_text? 'modified_by_user_uuid'
page.within(:xpath, '//a[@data-name="is_active"]') do
- assert_equal "false", text, "Expected user's is_active to be false after unsetup"
+ assert_equal "false", text, "Expected new user's is_active to be false"
end
+
+ click_link 'Metadata'
+ assert page.has_text? '(Repository: test_repo)'
+ assert !(page.has_text? '(VirtualMachine:)')
end
test "setup the active user" do
@@ -160,6 +130,30 @@ end
click_link 'Metadata'
assert page.has_text? '(Repository: second_test_repo)'
assert page.has_text? '(VirtualMachine: testvm.shell)'
+ end
+
+ test "unsetup active user" do
+ Capybara.current_driver = :selenium
+
+ visit page_with_token('admin_trustedclient')
+
+ click_link 'Users'
+
+ assert page.has_link? 'zzzzz-tpzed-xurymjxw79nv3jz'
+
+ # click on active user
+ click_link 'zzzzz-tpzed-xurymjxw79nv3jz'
+
+ # Verify that is_active is set
+ click_link 'Attributes'
+ assert page.has_text? 'modified_by_user_uuid'
+ page.within(:xpath, '//a[@data-name="is_active"]') do
+ assert_equal "true", text, "Expected user's is_active to be true"
+ end
+
+ # go to Admin tab
+ click_link 'Admin'
+ assert page.has_text? 'As an admin, you can deactivate and reset this user'
# unsetup user and verify all the above links are deleted
click_link 'Admin'
@@ -167,7 +161,11 @@ end
page.driver.browser.switch_to.alert.accept
sleep(0.1)
-# popup = page.driver.browser.window_handles.last
+ # Should now be back in the Attributes tab for the user
+ assert page.has_text? 'modified_by_user_uuid'
+ page.within(:xpath, '//a[@data-name="is_active"]') do
+ assert_equal "false", text, "Expected user's is_active to be false after unsetup"
+ end
click_link 'Metadata'
assert !(page.has_text? '(Repository: test_repo)')
commit 11a9f64426c1fc50529e694fead97f81e6eb4457
Author: radhika chippada <radhika at radhika.curoverse>
Date: Thu Apr 3 14:23:10 2014 -0400
Integration test for setup user
diff --git a/apps/workbench/test/integration/users_test.rb b/apps/workbench/test/integration/users_test.rb
index 39374e7..1576c04 100644
--- a/apps/workbench/test/integration/users_test.rb
+++ b/apps/workbench/test/integration/users_test.rb
@@ -1,5 +1,5 @@
require 'integration_helper'
-#require "selenium-webdriver"
+require "selenium-webdriver"
#require 'headless'
class UsersTest < ActionDispatch::IntegrationTest
@@ -48,7 +48,7 @@ class UsersTest < ActionDispatch::IntegrationTest
assert page.has_text? 'zzzzz-tpzed-d9tiejq69daie8f'
- click_on 'Add a new user'
+ click_link 'Add a new user'
# for now just check that we are back in Users -> List page
assert page.has_text? 'zzzzz-tpzed-d9tiejq69daie8f'
@@ -111,7 +111,7 @@ end
end
test "setup the active user" do
- Capybara.current_driver = Capybara.javascript_driver
+ Capybara.current_driver = :selenium
visit page_with_token('admin_trustedclient')
click_link 'Users'
@@ -121,29 +121,77 @@ end
# click on active user
click_link 'zzzzz-tpzed-xurymjxw79nv3jz'
- # go to Admin tab
+ # Setup user
click_link 'Admin'
- assert page.has_text? 'As an admin, you can deactivate and reset this user'
+ assert page.has_text? 'As an admin, you can setup'
-=begin
- # Click on Setup button
- click_button 'Setup Active User'
+ click_link 'Setup Active User'
- # Click Ok in the confirm dialog
sleep(0.1)
+ popup = page.driver.browser.window_handles.last
+ page.within_window popup do
+ assert has_text? 'Virtual Machine'
+ fill_in "repo_name", :with => "test_repo"
+ click_button "Submit"
+ end
- popup = page.driver.window_handles.last
+ sleep(0.1)
+ assert page.has_text? 'modified_by_client_uuid'
+
+ click_link 'Metadata'
+ assert page.has_text? '(Repository: test_repo)'
+ assert !(page.has_text? '(VirtualMachine:)')
+
+ # Click on Setup button again and this time also choose a VM
+ click_link 'Admin'
+ click_link 'Setup Active User'
+
+ sleep(0.1)
+ popup = page.driver.browser.window_handles.last
page.within_window popup do
- assert has_text? 'Are you sure you want to deactivate Active User'
- fill_in "email", :with => "test at example.com"
- click_button "Ok"
+ fill_in "repo_name", :with => "second_test_repo"
+ select("testvm.shell", :from => 'vm_uuid')
+ click_button "Submit"
end
- # Should now be back in the Attributes tab for the user
+ sleep(0.1)
assert page.has_text? 'modified_by_client_uuid'
- puts "\n\n************* page now = \n#{page.body}"
-=end
+ click_link 'Metadata'
+ assert page.has_text? '(Repository: second_test_repo)'
+ assert page.has_text? '(VirtualMachine: testvm.shell)'
+
+ # unsetup user and verify all the above links are deleted
+ click_link 'Admin'
+ click_button 'Deactivate Active User'
+ page.driver.browser.switch_to.alert.accept
+ sleep(0.1)
+
+# popup = page.driver.browser.window_handles.last
+
+ click_link 'Metadata'
+ assert !(page.has_text? '(Repository: test_repo)')
+ assert !(page.has_text? '(Repository: second_test_repo)')
+ assert !(page.has_text? '(VirtualMachine: testvm.shell)')
+
+ # setup user again and verify links present
+ click_link 'Admin'
+ click_link 'Setup Active User'
+
+ sleep(0.1)
+ popup = page.driver.browser.window_handles.last
+ page.within_window popup do
+ fill_in "repo_name", :with => "second_test_repo"
+ select("testvm.shell", :from => 'vm_uuid')
+ click_button "Submit"
+ end
+
+ sleep(0.1)
+ assert page.has_text? 'modified_by_client_uuid'
+
+ click_link 'Metadata'
+ assert page.has_text? '(Repository: second_test_repo)'
+ assert page.has_text? '(VirtualMachine: testvm.shell)'
end
end
commit e9339eb1983e33798270f61f57d90cde4b656bd8
Author: radhika chippada <radhika at radhika.curoverse>
Date: Thu Apr 3 11:05:47 2014 -0400
Submit button enabling revisited
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 28b2f42..475b696 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -84,9 +84,7 @@
var email_disabled = document.forms["setup_form"]["email"].disabled;
var email_value = document.forms["setup_form"]["email"].value;
var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
- if (email_disabled == true) {
- trigger = false;
- } else if (email_value == null || email_value == "" || prefix_value == null || prefix_value == "") {
+ if ((email_disabled == false) && (email_value == null || email_value == "" || prefix_value == null || prefix_value == "")) {
trigger = true;
}
commit 8ea149362539b3d50e14a7fbd8831c7cbf347446
Author: radhika chippada <radhika at radhika.curoverse>
Date: Thu Apr 3 07:39:06 2014 -0400
Submit button enabled when existing user
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 1995388..28b2f42 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -5,7 +5,6 @@
<% end %>
<% disable_email = uuid != nil %>
<% identity_url_prefix = @current_selections[:identity_url_prefix] %>
- <% disable_url_prefix = (identity_url_prefix != nil) %>
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
@@ -25,7 +24,7 @@
<% end %>
</tr>
<tr>
- <% if disable_url_prefix %>
+ <% if disable_email %>
<td> Identity URL Prefix   </td>
<td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
value="<%=identity_url_prefix%>" disabled=true > </td>
@@ -72,18 +71,22 @@
var $input = $('input:text'),
$register = $('#register');
+ var email_disabled = document.forms["setup_form"]["email"].disabled;
var email_value = document.forms["setup_form"]["email"].value;
var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
- if (email_value == null || email_value == "" || prefix_value == null || prefix_value == "") {
+ if ((email_disabled == false) && (email_value == null || email_value == "" || prefix_value == null || prefix_value == "")) {
$register.attr('disabled', true);
}
$input.keyup(function() {
var trigger = false;
+ var email_disabled = document.forms["setup_form"]["email"].disabled;
var email_value = document.forms["setup_form"]["email"].value;
var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
- if (email_value == null || email_value == "" || prefix_value == null || prefix_value == "") {
+ if (email_disabled == true) {
+ trigger = false;
+ } else if (email_value == null || email_value == "" || prefix_value == null || prefix_value == "") {
trigger = true;
}
commit 847b4a5d6e179dde49295a7118962e764d63e544
Author: radhika chippada <radhika at radhika.curoverse>
Date: Thu Apr 3 07:17:03 2014 -0400
popup submit button
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index e7e9990..1995388 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -70,14 +70,19 @@
<script>
var $input = $('input:text'),
- $register = $('#register');
- $register.attr('disabled', true);
+ $register = $('#register');
+
+ var email_value = document.forms["setup_form"]["email"].value;
+ var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
+ if (email_value == null || email_value == "" || prefix_value == null || prefix_value == "") {
+ $register.attr('disabled', true);
+ }
+
$input.keyup(function() {
var trigger = false;
var email_value = document.forms["setup_form"]["email"].value;
var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
-
if (email_value == null || email_value == "" || prefix_value == null || prefix_value == "") {
trigger = true;
}
commit 1d6d51202a936a28eee2384ceaa7c725813a2b03
Author: radhika chippada <radhika at radhika.curoverse>
Date: Wed Apr 2 21:08:03 2014 -0400
Get the default openid_prefix from config.
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 9a1f22b..e7e9990 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -9,14 +9,16 @@
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
- <%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get', class: 'form-search', remote: true} do %>
+ <%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get',
+ class: 'form-search', remote: true} do %>
<input id="user_uuid" maxlength="250" name="user_uuid" type="hidden" value="<%=uuid%>">
<div>
<table><tbody>
<tr>
<% if disable_email %>
<td> Email </td>
- <td> <input id="email" maxlength="250" name="email" type="text" value="<%=email%>" disabled=true > </td>
+ <td> <input id="email" maxlength="250" name="email" type="text" value="<%=email%>"
+ disabled=true > </td>
<% else %>
<td> Email </td>
<td> <input id="email" maxlength="250" name="email" type="text" > </td>
@@ -25,10 +27,12 @@
<tr>
<% if disable_url_prefix %>
<td> Identity URL Prefix   </td>
- <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text" value="<%=identity_url_prefix%>" disabled=true > </td>
+ <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
+ value="<%=identity_url_prefix%>" disabled=true > </td>
<% else %>
<td> Openid Prefix </td>
- <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text" value="https://www.google.com/accounts/o8/id"> </td>
+ <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"
+ value="<%= Rails.configuration.default_openid_prefix %>"> </td>
<% end %>
</tr>
<tr>
diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index bbed01e..dfc4f03 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -72,3 +72,4 @@ common:
arvados_theme: default
show_user_agreement_inline: false
secret_token: ~
+ default_openid_prefix: https://www.google.com/accounts/o8/id
commit d0dc31b9feb56c026f7c7ae0d46e63434b46742f
Author: radhika chippada <radhika at radhika.curoverse>
Date: Wed Apr 2 20:56:54 2014 -0400
Look for repo_name in VM link
diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index 497a693..6db1d3e 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -320,7 +320,16 @@ class User < ArvadosModel
head_kind: 'arvados#virtualMachine',
link_class: 'permission',
name: 'can_login')
- if !login_perms.any?
+
+ perm_exists = false
+ login_perms.each do |perm|
+ if perm.properties[:username] == repo_name
+ perm_exists = true
+ break
+ end
+ end
+
+ if !perm_exists
login_perm = Link.create(tail_kind: 'arvados#user',
tail_uuid: self.uuid,
head_kind: 'arvados#virtualMachine',
commit a6724f72c5a93edf2b8a456783a474024743f1ff
Author: radhika chippada <radhika at radhika.curoverse>
Date: Wed Apr 2 20:28:14 2014 -0400
Require only email and openid prefix in the setup popup. The other fields are optional.
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index f1c15db..9a1f22b 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -9,7 +9,6 @@
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
-<% puts "\n\n **************** setup_user_url = #{setup_user_url.inspect}" %>
<%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get', class: 'form-search', remote: true} do %>
<input id="user_uuid" maxlength="250" name="user_uuid" type="hidden" value="<%=uuid%>">
<div>
@@ -69,14 +68,16 @@
var $input = $('input:text'),
$register = $('#register');
$register.attr('disabled', true);
-
$input.keyup(function() {
var trigger = false;
- $input.each(function() {
- if (!$(this).val()) {
- trigger = true;
- }
- });
+
+ var email_value = document.forms["setup_form"]["email"].value;
+ var prefix_value = document.forms["setup_form"]["openid_prefix"].value;
+
+ if (email_value == null || email_value == "" || prefix_value == null || prefix_value == "") {
+ trigger = true;
+ }
+
trigger ? $register.attr('disabled', true) : $register.removeAttr('disabled');
});
</script>
commit cbdb5dc18ccbd8cd2cdc4ebeaace82aa33b36f70
Author: radhika chippada <radhika at radhika.curoverse>
Date: Wed Apr 2 19:51:45 2014 -0400
New user creation using setup action is working
diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb
index d456443..7108c70 100644
--- a/apps/workbench/app/views/application/index.html.erb
+++ b/apps/workbench/app/views/application/index.html.erb
@@ -4,18 +4,20 @@
<% content_for :tab_line_buttons do %>
-<% if controller.model_class.creatable? %>
- <% if controller.model_class.name != 'User' %>
- <%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}",
- { action: 'create', return_to: request.url },
- { class: 'btn btn-primary pull-right' } %>
- <% else %>
- <%= link_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", setup_user_popup_path,
- {class: 'btn btn-primary pull-right', :remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %>
- <div id="modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
- <% end %>
+ <% if controller.model_class.creatable? %>
-<% end %>
+ <% if controller.model_class.name == 'User' %>
+ <%= link_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", setup_user_popup_path,
+ {class: 'btn btn-primary pull-right', :remote => true, 'data-toggle' => "modal",
+ 'data-target' => '#modal-window', return_to: request.url} %>
+ <div id="modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
+ <% else %>
+ <%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}",
+ { action: 'create', return_to: request.url },
+ { class: 'btn btn-primary pull-right' } %>
+ <% end %>
+
+ <% end %>
<% end %>
diff --git a/apps/workbench/app/views/users/setup.js.erb b/apps/workbench/app/views/users/setup.js.erb
index c4059f0..9134623 100644
--- a/apps/workbench/app/views/users/setup.js.erb
+++ b/apps/workbench/app/views/users/setup.js.erb
@@ -1 +1,2 @@
$("#modal-window").modal("hide");
+document.location.reload();
commit 1418580063cbe02ab3376adb27928c5325ba10b3
Author: radhika chippada <radhika at radhika.curoverse>
Date: Wed Apr 2 18:52:04 2014 -0400
"Add a new user" link uses setup method to create a "loaded" user.
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 3696ecc..5ace8d6 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -149,13 +149,16 @@ class UsersController < ApplicationController
respond_to do |format|
if current_user.andand.is_admin
setup_params = {}
- if params['uuid'] && params['uuid'].size>0
- setup_params[:uuid] = params['uuid']
+ if params['user_uuid'] && params['user_uuid'].size>0
+ setup_params[:uuid] = params['user_uuid']
end
if params['email'] && params['email'].size>0
- user = {email: params['email'], openid_prefix: params['openid_prefix']}
+ user = {email: params['email']}
setup_params[:user] = user
end
+ if params['openid_prefix'] && params['openid_prefix'].size>0
+ setup_params[:openid_prefix] = params['openid_prefix']
+ end
if params['repo_name'] && params['repo_name'].size>0
setup_params[:repo_name] = params['repo_name']
end
diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb
index 67b5004..d456443 100644
--- a/apps/workbench/app/views/application/index.html.erb
+++ b/apps/workbench/app/views/application/index.html.erb
@@ -5,9 +5,16 @@
<% content_for :tab_line_buttons do %>
<% if controller.model_class.creatable? %>
-<%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}",
- { action: 'create', return_to: request.url },
- { class: 'btn btn-primary pull-right' } %>
+ <% if controller.model_class.name != 'User' %>
+ <%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}",
+ { action: 'create', return_to: request.url },
+ { class: 'btn btn-primary pull-right' } %>
+ <% else %>
+ <%= link_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", setup_user_popup_path,
+ {class: 'btn btn-primary pull-right', :remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %>
+ <div id="modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
+ <% end %>
+
<% end %>
<% end %>
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 5711d95..f1c15db 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -1,18 +1,23 @@
<div class="modal-body">
- <% uuid = @object.uuid %>
- <% disable_email = @object.uuid? %>
+ <% if @object%>
+ <% uuid = @object.uuid %>
+ <% email = @object.email %>
+ <% end %>
+ <% disable_email = uuid != nil %>
<% identity_url_prefix = @current_selections[:identity_url_prefix] %>
<% disable_url_prefix = (identity_url_prefix != nil) %>
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
- <%= form_tag setup_user_url(id: uuid), {id: 'setup_form', name: 'setup_form', method: 'get', class: 'form-search', remote: true, onSubmit: "validate(); return false;"} do %>
+<% puts "\n\n **************** setup_user_url = #{setup_user_url.inspect}" %>
+ <%= form_tag setup_user_path, {id: 'setup_form', name: 'setup_form', method: 'get', class: 'form-search', remote: true} do %>
+ <input id="user_uuid" maxlength="250" name="user_uuid" type="hidden" value="<%=uuid%>">
<div>
<table><tbody>
<tr>
<% if disable_email %>
<td> Email </td>
- <td> <input id="email" maxlength="250" name="email" type="text" value="<%=@object.email%>" disabled=true > </td>
+ <td> <input id="email" maxlength="250" name="email" type="text" value="<%=email%>" disabled=true > </td>
<% else %>
<td> Email </td>
<td> <input id="email" maxlength="250" name="email" type="text" > </td>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 43e9bfa..8c89238 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -7,6 +7,8 @@ ArvadosWorkbench::Application.routes.draw do
get 'signatures', on: :collection
end
get '/user_agreements/signatures' => 'user_agreements#signatures'
+ get "users/setup_popup" => 'users#setup_popup', :as => :setup_user_popup
+ get "users/setup" => 'users#setup', :as => :setup_user
resources :nodes
resources :humans
resources :traits
@@ -24,7 +26,6 @@ ArvadosWorkbench::Application.routes.draw do
get 'activity', :on => :collection
post 'sudo', :on => :member
post 'unsetup', :on => :member
- get 'setup', :on => :member
get 'setup_popup', :on => :member
end
resources :logs
commit a3212e71057712af58a7d2b849d69915b4fd79b1
Author: radhika chippada <radhika at radhika.curoverse>
Date: Wed Apr 2 12:57:13 2014 -0400
Minor UI tweaks
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 8d44e90..5711d95 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -2,6 +2,7 @@
<% uuid = @object.uuid %>
<% disable_email = @object.uuid? %>
<% identity_url_prefix = @current_selections[:identity_url_prefix] %>
+ <% disable_url_prefix = (identity_url_prefix != nil) %>
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
@@ -11,16 +12,16 @@
<tr>
<% if disable_email %>
<td> Email </td>
- <td> <input id="email" maxlength="250" name="email" type="text" value="<%=@object.email%>" disabled=<%=disable_email%> > </td>
+ <td> <input id="email" maxlength="250" name="email" type="text" value="<%=@object.email%>" disabled=true > </td>
<% else %>
<td> Email </td>
<td> <input id="email" maxlength="250" name="email" type="text" > </td>
<% end %>
</tr>
<tr>
- <% if disable_email %>
- <td> Identity URL Prefix </td>
- <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text" value="<%=identity_url_prefix%>" disabled=<%=disable_email%> > </td>
+ <% if disable_url_prefix %>
+ <td> Identity URL Prefix   </td>
+ <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text" value="<%=identity_url_prefix%>" disabled=true > </td>
<% else %>
<td> Openid Prefix </td>
<td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text" value="https://www.google.com/accounts/o8/id"> </td>
@@ -34,6 +35,11 @@
<td> Virtual Machine </td>
<td>
<select name="vm_uuid">
+ <% if selected_vm %>
+ <option value=""> Choose One: </option>
+ <% else %>
+ <option value="" selected> Choose One: </option>
+ <% end %>
<% @vms.each do |vm| %>
<% if selected_vm == vm.uuid %>
<option value=<%=vm.uuid%> selected> <%=vm.hostname%> </option>
@@ -46,7 +52,8 @@
</tr>
</tbody></table>
</div>
- <div align="left">
+ <div align="center">
+ <br/>
<button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
diff --git a/apps/workbench/app/views/users/_show_admin.html.erb b/apps/workbench/app/views/users/_show_admin.html.erb
index d9db19c..072d7ee 100644
--- a/apps/workbench/app/views/users/_show_admin.html.erb
+++ b/apps/workbench/app/views/users/_show_admin.html.erb
@@ -6,15 +6,16 @@ account.</p>
<%= button_to "Log in as #{@object.full_name}", sudo_user_url(id: @object.uuid), class: 'btn btn-primary' %>
</blockquote>
-<p>As an admin, you can deactivate and reset this user. This will remove all repository/VM permissions for the user. If you "setup" the user again, the user will have to sign the user agreement again.</p>
+<p>As an admin, you can setup this user. Please input a VM and repository for the user. If you had previously provided any of these items, they are pre-filled for you and you can leave them as is if you would like to reuse them.</p>
<blockquote>
-<%= button_to "Deactivate #{@object.full_name}", unsetup_user_url(id: @object.uuid), class: 'btn btn-primary', confirm: "Are you sure you want to deactivate #{@object.full_name}?"%>
+<%= link_to "Setup #{@object.full_name}", setup_popup_user_url(id: @object.uuid), {class: 'btn btn-primary', :remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %>
+<div id="modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
</blockquote>
-<p>As an admin, you can setup this user. Please input a VM and repository for the user. If you had previously provided any of these items, they are pre-filled for you and you can leave them as is if you would like to reuse them.</p>
+<p>As an admin, you can deactivate and reset this user. This will remove all repository/VM permissions for the user. If you "setup" the user again, the user will have to sign the user agreement again.</p>
<blockquote>
-<%= link_to "Setup #{@object.full_name}", setup_popup_user_url(id: @object.uuid), {class: 'btn btn-primary', :remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %>
-<div id="modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
+<%= button_to "Deactivate #{@object.full_name}", unsetup_user_url(id: @object.uuid), class: 'btn btn-primary', confirm: "Are you sure you want to deactivate #{@object.full_name}?"%>
</blockquote>
+
commit 59b0a3a8e5209ef85967a93c500167b7cf882757
Author: radhika chippada <radhika at radhika.curoverse>
Date: Wed Apr 2 00:04:16 2014 -0400
Disable submit button until all input fields are filled in.
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 3a5c2b3..3696ecc 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -201,8 +201,8 @@ class UsersController < ApplicationController
name: 'can_login')
if oid_login_perms.any?
- identiry_url_prefix = oid_login_perms.first.identity_url_prefix
- current_selections[:identiry_url_prefix] = identiry_url_prefix
+ prefix_properties = oid_login_perms.first.properties
+ current_selections[:identity_url_prefix] = prefix_properties[:identity_url_prefix]
end
# repo perm
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index f27b474..8d44e90 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -1,15 +1,11 @@
- <div class="modal-header">
- <h3 id="myModalLabel">Information you had already provided is prefilled for you. You may change it as needed.</h3>
- </div>
-
<div class="modal-body">
<% uuid = @object.uuid %>
- <% disable_email = @object.uuid? %>
- <% identity_url_prefix = @current_selections[:identiry_url_prefix] %>
+ <% disable_email = @object.uuid? %>
+ <% identity_url_prefix = @current_selections[:identity_url_prefix] %>
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
-
- <%= form_tag setup_user_url(id: uuid), method: 'get', remote: true, class: 'form-search' do %>
+
+ <%= form_tag setup_user_url(id: uuid), {id: 'setup_form', name: 'setup_form', method: 'get', class: 'form-search', remote: true, onSubmit: "validate(); return false;"} do %>
<div>
<table><tbody>
<tr>
@@ -27,7 +23,7 @@
<td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text" value="<%=identity_url_prefix%>" disabled=<%=disable_email%> > </td>
<% else %>
<td> Openid Prefix </td>
- <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text"> </td>
+ <td> <input id="openid_prefix" maxlength="250" name="openid_prefix" type="text" value="https://www.google.com/accounts/o8/id"> </td>
<% end %>
</tr>
<tr>
@@ -51,8 +47,24 @@
</tbody></table>
</div>
<div align="left">
- <button type="submit" class="btn btn-primary" autofocus>Submit</button>
+ <button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<% end %>
</div>
+
+<script>
+ var $input = $('input:text'),
+ $register = $('#register');
+ $register.attr('disabled', true);
+
+ $input.keyup(function() {
+ var trigger = false;
+ $input.each(function() {
+ if (!$(this).val()) {
+ trigger = true;
+ }
+ });
+ trigger ? $register.attr('disabled', true) : $register.removeAttr('disabled');
+ });
+</script>
commit 9349484f1e607064cf96fa7f7212979d30e58448
Author: radhika chippada <radhika at radhika.curoverse>
Date: Tue Apr 1 17:21:12 2014 -0400
Added bootstrap css
diff --git a/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss b/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
new file mode 100644
index 0000000..edabb85
--- /dev/null
+++ b/apps/workbench/app/assets/stylesheets/bootstrap-modal.css.scss
@@ -0,0 +1,180 @@
+/*!
+* Bootstrap Modal
+*
+* Copyright Jordan Schroter
+* Licensed under the Apache License v2.0
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+*/
+
+body.modal-open,
+.modal-open .navbar-fixed-top,
+.modal-open .navbar-fixed-bottom {
+ margin-right: 0;
+}
+
+.modal {
+ left: 50%;
+ bottom: auto;
+ right: auto;
+ padding: 0;
+ width: 500px;
+ margin-left: -250px;
+ background-color: #ffffff;
+ border: 1px solid #999999;
+ border: 1px solid rgba(0, 0, 0, 0.2);
+ border-radius: 6px;
+ -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
+ box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
+ background-clip: padding-box;
+}
+
+.modal.container {
+ max-width: none;
+}
+
+
+.modal-open {
+overflow: hidden;
+}
+
+
+/* add a scroll bar to stop page from jerking around */
+.modal-open.page-overflow .page-container,
+.modal-open.page-overflow .page-container .navbar-fixed-top,
+.modal-open.page-overflow .page-container .navbar-fixed-bottom,
+.modal-open.page-overflow .modal-scrollable {
+overflow-y: scroll;
+}
+
+ at media (max-width: 979px) {
+.modal-open.page-overflow .page-container .navbar-fixed-top,
+.modal-open.page-overflow .page-container .navbar-fixed-bottom {
+overflow-y: visible;
+}
+}
+
+
+.modal-scrollable {
+position: fixed;
+top: 0;
+bottom: 0;
+left: 0;
+right: 0;
+overflow: auto;
+}
+
+.modal.fade {
+top: -100%;
+-webkit-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
+-moz-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
+-o-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
+transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
+}
+
+.modal.fade.in {
+top: 50%;
+}
+
+.modal-body {
+max-height: none;
+overflow: visible;
+}
+
+.modal.modal-absolute {
+position: absolute;
+z-index: 950;
+}
+
+.modal .loading-mask {
+position: absolute;
+top: 0;
+bottom: 0;
+left: 0;
+right: 0;
+background: #fff;
+border-radius: 6px;
+}
+
+.modal-backdrop.modal-absolute{
+position: absolute;
+z-index: 940;
+}
+
+.modal-backdrop,
+.modal-backdrop.fade.in{
+opacity: 0.7;
+filter: alpha(opacity=70);
+background: #fff;
+}
+
+/* Modal Overflow */
+
+.modal-overflow.modal {
+top: 1%;
+}
+
+.modal-overflow.modal.fade {
+top: -100%;
+}
+
+.modal-overflow.modal.fade.in {
+top: 1%;
+}
+
+.modal-overflow .modal-body {
+overflow: auto;
+-webkit-overflow-scrolling: touch;
+}
+
+/* Responsive */
+
+ at media (min-width: 1200px) {
+.modal.container {
+width: 1170px;
+margin-left: -585px;
+}
+}
+
+ at media (max-width: 979px) {
+.modal,
+.modal.container,
+.modal.modal-overflow {
+top: 1%;
+right: 1%;
+left: 1%;
+bottom: auto;
+width: auto !important;
+height: auto !important;
+margin: 0 !important;
+padding: 0 !important;
+}
+
+.modal.fade.in,
+.modal.container.fade.in,
+.modal.modal-overflow.fade.in {
+top: 1%;
+bottom: auto;
+}
+
+.modal-body,
+.modal-overflow .modal-body {
+position: static;
+margin: 0;
+height: auto !important;
+max-height: none !important;
+overflow: visible !important;
+}
+
+.modal-footer,
+.modal-overflow .modal-footer {
+position: static;
+}
+}
+
+.loading-spinner {
+position: absolute;
+top: 50%;
+left: 50%;
+margin: -12px 0 0 -12px;
+}
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 0fc0110..f27b474 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -3,11 +3,11 @@
</div>
<div class="modal-body">
- <%= uuid = @object.uuid %>
- <%= disable_email = @object.uuid? %>
- <%= identity_url_prefix = @current_selections[:identiry_url_prefix] %>
- <%= selected_repo = @current_selections[:repo_name] %>
- <%= selected_vm = @current_selections[:vm_uuid] %>
+ <% uuid = @object.uuid %>
+ <% disable_email = @object.uuid? %>
+ <% identity_url_prefix = @current_selections[:identiry_url_prefix] %>
+ <% selected_repo = @current_selections[:repo_name] %>
+ <% selected_vm = @current_selections[:vm_uuid] %>
<%= form_tag setup_user_url(id: uuid), method: 'get', remote: true, class: 'form-search' do %>
<div>
@@ -51,8 +51,8 @@
</tbody></table>
</div>
<div align="left">
- <button type="submit" class="btn">Submit</button>
- <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
+ <button type="submit" class="btn btn-primary" autofocus>Submit</button>
+ <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<% end %>
</div>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list