1 | @using HeuristicLab.Clients.Hive.WebJobManager.ViewModels.User;
|
---|
2 | @using HeuristicLab.Clients.Access;
|
---|
3 | @model UserViewModel
|
---|
4 |
|
---|
5 | <div>
|
---|
6 |
|
---|
7 | @Html.Partial("Navbar", new HeuristicLab.Clients.Hive.WebJobManager.ViewModels.NavbarViewModel("User", Model.currentUser))
|
---|
8 |
|
---|
9 | <ul class="nav nav-pills nav-justified">
|
---|
10 | <li role="presentation"
|
---|
11 | class="">
|
---|
12 | <a asp-controller="User"
|
---|
13 | asp-action="Index">
|
---|
14 | <i class="fa fa-user"></i> Users
|
---|
15 | </a>
|
---|
16 | </li>
|
---|
17 | <li role="presentation"
|
---|
18 | class="">
|
---|
19 | <a asp-controller="User"
|
---|
20 | asp-action="Groups">
|
---|
21 | <i class="fa fa-users"></i> Groups
|
---|
22 | </a>
|
---|
23 | </li>
|
---|
24 | <li role="presentation"
|
---|
25 | class="active">
|
---|
26 | <a asp-controller="User"
|
---|
27 | asp-action="Roles">
|
---|
28 | <i class="fa fa-gavel"></i> Roles
|
---|
29 | </a>
|
---|
30 | </li>
|
---|
31 | </ul>
|
---|
32 | @Html.Partial("_ErrorMessage", Model.message)
|
---|
33 | <div class="row"
|
---|
34 | style="padding:10px; margin-right:0px!important">
|
---|
35 |
|
---|
36 | <div class="col-sm-4">
|
---|
37 | <div class="btn-group btn-group-justified btn-block"
|
---|
38 | role="group" style="margin-bottom:-4px">
|
---|
39 |
|
---|
40 | <a class="btn btn-info btn-lg btn-block disabled"
|
---|
41 | style="width:6%;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
42 | text-shadow:2px 2px black;">
|
---|
43 | <i class="fa fa-gavel"></i> @Model.roles.Count Role@(Model.roles.Count != 1 ? "s" : "")
|
---|
44 | </a>
|
---|
45 | <a class="btn btn-success btn-block
|
---|
46 | @(Model.SelectedRole.Name == "" ? "active" : "")
|
---|
47 | "
|
---|
48 | asp-controller="User"
|
---|
49 | asp-action="SelectRole"
|
---|
50 | asp-route-name=""
|
---|
51 | onclick="showRole()"
|
---|
52 | style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
53 | text-shadow:2px 2px black;">
|
---|
54 | <i class="fa fa-plus-circle"></i>
|
---|
55 | </a>
|
---|
56 | </div>
|
---|
57 | <div class="btn-group-vertical btn-block">
|
---|
58 |
|
---|
59 | @foreach (var role in Model.roles.OrderBy(x => x.Name))
|
---|
60 | {
|
---|
61 | <a class="btn btn-default @( role.Name == Model.SelectedRole.Name ? "active" : "" )"
|
---|
62 | style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);"
|
---|
63 | asp-controller="User"
|
---|
64 | asp-action="SelectRole"
|
---|
65 | asp-route-name="@role.Name"
|
---|
66 | onclick="showRole()">
|
---|
67 | @role.Name
|
---|
68 | <span style="color:forestgreen">
|
---|
69 | @(role.Name == "Hive User" ? " (Hive + job manager)" : "")
|
---|
70 | @(role.Name == "Hive Administrator" ? " (Resources)" : "")
|
---|
71 | @(role.Name == "AccessService Administrator" ? " (User manager)" : "")
|
---|
72 | </span>
|
---|
73 | </a>
|
---|
74 | }
|
---|
75 | </div>
|
---|
76 | </div>
|
---|
77 | <p style="display:none"
|
---|
78 | id="saver"
|
---|
79 | class="text-center">
|
---|
80 | <br /><br /><br /><br /><br /><br /><br />
|
---|
81 | <i class="fa fa-save fa-spin fa-5x" id="spinner">
|
---|
82 | </i>
|
---|
83 | </p>
|
---|
84 | <p style="display:none"
|
---|
85 | id="role"
|
---|
86 | class="text-center">
|
---|
87 | <br /><br /><br /><br /><br /><br /><br />
|
---|
88 | <i class="fa fa-gavel fa-spin fa-5x" id="spinner">
|
---|
89 | </i>
|
---|
90 | </p>
|
---|
91 | <p style="display:none"
|
---|
92 | id="deleter"
|
---|
93 | class="text-center">
|
---|
94 | <br /><br /><br /><br /><br /><br /><br />
|
---|
95 | <i class="fa fa-trash-o fa-spin fa-5x" id="spinner">
|
---|
96 | </i>
|
---|
97 | </p>
|
---|
98 | <div class="col-sm-8"
|
---|
99 | id="content"
|
---|
100 | style="padding:5px; padding-left:10px;">
|
---|
101 | <div class="panel panel-default"
|
---|
102 | style="border-width:2px!important;padding:17px;
|
---|
103 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
|
---|
104 | <div class="row">
|
---|
105 | <h2 style="padding-left:20px">
|
---|
106 | @if (Model.SelectedRole.Name != "")
|
---|
107 | {
|
---|
108 | <i class="fa fa-gavel "></i> @Model.SelectedRole.Name
|
---|
109 | <span style="color:forestgreen">
|
---|
110 | @(Model.SelectedRole.Name == "Hive User" ? " (access to Hive and job manager)" : "")
|
---|
111 | @(Model.SelectedRole.Name == "Hive Administrator" ? " (access to resources)" : "")
|
---|
112 | @(Model.SelectedRole.Name == "AccessService Administrator" ? " (access to user manager)" : "")
|
---|
113 | </span>
|
---|
114 |
|
---|
115 | }
|
---|
116 | else
|
---|
117 | {
|
---|
118 | <i class="fa fa-plus-circle "></i> @("Add new role")
|
---|
119 |
|
---|
120 | }
|
---|
121 | </h2>
|
---|
122 | <form class="form-horizontal"
|
---|
123 | method="post"
|
---|
124 | asp-action="saveRole"
|
---|
125 | asp-controller="User" enctype="multipart/form-data">
|
---|
126 | <div class="form-group">
|
---|
127 | <label class="col-sm-3 control-label">
|
---|
128 | Role name
|
---|
129 | </label>
|
---|
130 | <label class="col-sm-8 control-label"
|
---|
131 | style="text-align:left; @(Model.SelectedRole.Name == "" ? "display:none" : "")">
|
---|
132 | @Model.SelectedRole.Name
|
---|
133 | </label>
|
---|
134 | <div class="col-sm-8"
|
---|
135 | style="@(Model.SelectedRole.Name == "" ? "" : "display:none")">
|
---|
136 | <input type="text"
|
---|
137 | class="form-control"
|
---|
138 | id="inprolename"
|
---|
139 | name="inprolename"
|
---|
140 | placeholder="Role name"
|
---|
141 | value="@Model.SelectedRole.Name"
|
---|
142 | onkeydown="triggerSave()" />
|
---|
143 | </div>
|
---|
144 | </div>
|
---|
145 |
|
---|
146 | @if (Model.SelectedRole.Name == "")
|
---|
147 | {
|
---|
148 | <div class="form-group">
|
---|
149 | <div class="col-sm-offset-3 col-sm-9">
|
---|
150 | <button type="submit"
|
---|
151 | id="inpsaver"
|
---|
152 | disabled
|
---|
153 | class="btn btn-default"
|
---|
154 | onclick="showSaver()">
|
---|
155 | <i class="fa fa-plus-square-o"></i> Add role
|
---|
156 | </button>
|
---|
157 | </div>
|
---|
158 | </div>
|
---|
159 |
|
---|
160 |
|
---|
161 | }
|
---|
162 | else
|
---|
163 | {
|
---|
164 |
|
---|
165 | <div class="form-group">
|
---|
166 | <label class="col-sm-3 control-label">
|
---|
167 | @Model.SelectedRoleEnrolled.Count Users
|
---|
168 | </label>
|
---|
169 | <div class="col-sm-8 control-label" style="text-align:left">
|
---|
170 | @foreach (var us in Model.SelectedRoleEnrolled)
|
---|
171 | {
|
---|
172 | <div class="row">
|
---|
173 | <p class="col-sm-10">
|
---|
174 | <i class="fa fa-user"></i> @(((User)us).UserName) (@(((User)us).FullName))
|
---|
175 | </p>
|
---|
176 | <p class="col-sm-2">
|
---|
177 | <a class="btn btn-danger pull-right"
|
---|
178 | asp-controller="User"
|
---|
179 | asp-action="deleteRoleUser"
|
---|
180 | asp-route-id="@us.Id"
|
---|
181 | asp-route-role="@Model.SelectedRole.Name"
|
---|
182 | onclick="showDeleter()">
|
---|
183 | <i class="fa fa-trash-o"></i>
|
---|
184 | </a>
|
---|
185 | </p>
|
---|
186 |
|
---|
187 | </div>
|
---|
188 | }
|
---|
189 | @if (Model.SelectedRoleEnrolled.Count == 0)
|
---|
190 | {
|
---|
191 | <p>
|
---|
192 | There are currently no users who have this role
|
---|
193 | </p>
|
---|
194 |
|
---|
195 | }
|
---|
196 | </div>
|
---|
197 | </div>
|
---|
198 | <div class="form-group">
|
---|
199 |
|
---|
200 | <div class="col-sm-3">
|
---|
201 | <a class="btn btn-danger pull-right"
|
---|
202 | asp-controller="User"
|
---|
203 | asp-action="deleteRole"
|
---|
204 | asp-route-name="@Model.SelectedRole.Name"
|
---|
205 |
|
---|
206 | onclick="showDeleter()">
|
---|
207 | <i class="fa fa-trash-o"></i> Delete role
|
---|
208 | </a>
|
---|
209 | </div>
|
---|
210 | </div>
|
---|
211 |
|
---|
212 |
|
---|
213 |
|
---|
214 | }
|
---|
215 | <script type="text/javascript">
|
---|
216 | function triggerSave() {
|
---|
217 | if ($("#inprolename").val() != "") {
|
---|
218 | document.getElementById("inpsaver").className = "btn btn-lg btn-success";
|
---|
219 | document.getElementById("inpsaver").disabled = false;
|
---|
220 | }
|
---|
221 | else {
|
---|
222 | document.getElementById("inpsaver").className = "btn btn-default";
|
---|
223 | document.getElementById("inpsaver").disabled = true;
|
---|
224 |
|
---|
225 | }
|
---|
226 |
|
---|
227 | }
|
---|
228 | </script>
|
---|
229 | </form>
|
---|
230 | </div>
|
---|
231 | </div>
|
---|
232 | </div>
|
---|
233 | </div>
|
---|
234 | <script type="text/javascript">
|
---|
235 | function showSaver() {
|
---|
236 | document.getElementById("content").style.display = "none";
|
---|
237 | document.getElementById("saver").style.display = "";
|
---|
238 |
|
---|
239 | }
|
---|
240 | function showRole() {
|
---|
241 | document.getElementById("content").style.display = "none";
|
---|
242 | document.getElementById("role").style.display = "";
|
---|
243 |
|
---|
244 | }
|
---|
245 | function showDeleter() {
|
---|
246 | document.getElementById("content").style.display = "none";
|
---|
247 | document.getElementById("deleter").style.display = "";
|
---|
248 | }
|
---|
249 | </script>
|
---|
250 | </div>
|
---|