Merge branch '8784-dir-listings'
[arvados.git] / apps / workbench / app / views / users / _setup_popup.html.erb
index aed57da978c70317de1d8a54c61c484723eab0c0..3b3794bf50a8b791e23ef006d623c5ff121ca66a 100644 (file)
@@ -1,94 +1,77 @@
-  <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] %>
-    
-    <%= 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%>">
+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
+<div class="modal-dialog modal-with-loading-spinner">
+  <div class="modal-content">
+
+    <%= 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" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">&times;</button>
       <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>
-            <% 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 &nbsp </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>
-        </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 class="col-sm-6"> <h4 class="modal-title">Setup Shell Account</h4> </div>
+        <div class="spinner spinner-32px spinner-h-center col-sm-1" hidden="true"></div>
       </div>
-    <% end %>
-  </div>
+      <br/>
+    </div>
 
-<script>
-  var $input = $('input:text'),
-  $register = $('#register');
+    <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_vm = @current_selections[:vm_uuid] %>
+      <% groups = @current_selections[:groups] %>
 
-  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.keyup(function() {
-    var trigger = false;
+      <input id="user_uuid" maxlength="250" name="user_uuid" type="hidden" value="<%=uuid%>">
+      <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 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="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 class="groups-group">
+        <label for="groups">Groups for virtual machine (comma separated list)</label>
+        <input class="form-control" id="groups" maxlength="250" name="groups" type="text" value="<%=groups%>">
+      </div>
+    </div>
 
-    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 == "")) {
-      trigger = true;
-    }
+    <div class="modal-footer">
+      <button class="btn btn-default" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Cancel</button>
+      <button type="submit" id="register" class="btn btn-primary" autofocus>Submit</button>
+    </div>
 
-    trigger ? $register.attr('disabled', true) : $register.removeAttr('disabled');
-  });
-</script>
+    <% end #form %>
+  </div>
+</div>