1 | @using HeuristicLab.Clients.Hive.WebJobManager.ViewModels.User;
|
---|
2 | @using HeuristicLab.Clients.Access;
|
---|
3 | @model UserViewModel
|
---|
4 |
|
---|
5 | <div class="animated fadeIn">
|
---|
6 |
|
---|
7 | @Html.Partial("Navbar", new HeuristicLab.Clients.Hive.WebJobManager.ViewModels.NavbarViewModel("User", Model.User))
|
---|
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="active">
|
---|
19 | <a asp-controller="User"
|
---|
20 | asp-action="Groups">
|
---|
21 | <i class="fa fa-group"></i> Groups
|
---|
22 | </a>
|
---|
23 | </li>
|
---|
24 | <li role="presentation"
|
---|
25 | class="">
|
---|
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 |
|
---|
34 | <div class="row"
|
---|
35 | style="padding:10px; margin-right:0px!important">
|
---|
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-group"></i> @Model.ugroups.Count Group@(Model.ugroups.Count != 1 ? "s" : "")
|
---|
44 | </a>
|
---|
45 | <a class="btn btn-success btn-block
|
---|
46 | @(Model.SelectedGroup.Id == Guid.Empty ? "active" : "")
|
---|
47 | "
|
---|
48 | asp-controller="User"
|
---|
49 | asp-action="SelectGroup"
|
---|
50 | asp-route-id="@Guid.Empty"
|
---|
51 | onclick="showGroup()"
|
---|
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 group in Model.ugroups.OrderBy(x => x.Name))
|
---|
60 | {
|
---|
61 | <a class="btn btn-default @( group.Id == Model.SelectedGroup.Id ? "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="SelectGroup"
|
---|
65 | asp-route-id="@group.Id"
|
---|
66 | onclick="showGroup()">
|
---|
67 | @group.Name
|
---|
68 | </a>
|
---|
69 | }
|
---|
70 | </div>
|
---|
71 | </div>
|
---|
72 | <p style="display:none"
|
---|
73 | id="saver"
|
---|
74 | class="text-center">
|
---|
75 | <br /><br /><br /><br /><br /><br /><br />
|
---|
76 | <i class="fa fa-save fa-spin fa-5x" id="spinner">
|
---|
77 | </i>
|
---|
78 | </p>
|
---|
79 | <p style="display:none"
|
---|
80 | id="group"
|
---|
81 | class="text-center">
|
---|
82 | <br /><br /><br /><br /><br /><br /><br />
|
---|
83 | <i class="fa fa-group fa-spin fa-5x" id="spinner">
|
---|
84 | </i>
|
---|
85 | </p>
|
---|
86 | <p style="display:none"
|
---|
87 | id="deleter"
|
---|
88 | class="text-center">
|
---|
89 | <br /><br /><br /><br /><br /><br /><br />
|
---|
90 | <i class="fa fa-trash-o fa-spin fa-5x" id="spinner">
|
---|
91 | </i>
|
---|
92 | </p>
|
---|
93 |
|
---|
94 | <div class="col-sm-8"
|
---|
95 | id="content"
|
---|
96 | style="padding:5px; padding-left:10px;">
|
---|
97 | @if (Model.SelectedGroup != null)
|
---|
98 | {
|
---|
99 | <div class="panel panel-default"
|
---|
100 | style="border-width:2px!important;padding:17px;
|
---|
101 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
|
---|
102 | <div class="row">
|
---|
103 | <h2 style="padding-left:20px">
|
---|
104 | @if (Model.SelectedGroup.Id != Guid.Empty)
|
---|
105 | {
|
---|
106 | <i class="fa fa-group"></i> @Model.SelectedGroup.Name
|
---|
107 | }
|
---|
108 | else
|
---|
109 | {
|
---|
110 | <i class='fa fa-plus-circle'></i> @("Add new group")
|
---|
111 |
|
---|
112 | }
|
---|
113 | </h2>
|
---|
114 | <form class="form-horizontal"
|
---|
115 | method="post"
|
---|
116 | asp-action="saveGroup"
|
---|
117 | asp-controller="User" enctype="multipart/form-data">
|
---|
118 | <div class="form-group">
|
---|
119 | <label for="inpgroupname"
|
---|
120 | class="col-sm-3 control-label">
|
---|
121 | Group name
|
---|
122 | </label>
|
---|
123 | <div class="col-sm-8">
|
---|
124 | <input type="text"
|
---|
125 | class="form-control"
|
---|
126 | id="inpgroupname"
|
---|
127 | name="inpgroupname"
|
---|
128 | placeholder="Group name"
|
---|
129 | onkeydown="triggerSave()"
|
---|
130 | value="@Model.SelectedGroup.Name">
|
---|
131 | </div>
|
---|
132 | </div>
|
---|
133 | <input type="text"
|
---|
134 | style="display:none"
|
---|
135 | id="u"
|
---|
136 | name="u"
|
---|
137 | value="@Model.SelectedGroup.Id" />
|
---|
138 |
|
---|
139 | @if (Model.SelectedGroup.Id != Guid.Empty)
|
---|
140 | {
|
---|
141 | <div class="form-group">
|
---|
142 | <label class="col-sm-3 control-label">
|
---|
143 | Group id
|
---|
144 | </label>
|
---|
145 | <label class="col-sm-8 control-label" style="text-align:left">
|
---|
146 | @Model.SelectedGroup.Id
|
---|
147 | </label>
|
---|
148 | <input type="text"
|
---|
149 | style="display:none"
|
---|
150 | id="u"
|
---|
151 | name="u"
|
---|
152 | value="@Model.SelectedGroup.Id" />
|
---|
153 | </div>
|
---|
154 | <div class="form-group">
|
---|
155 | <label class="col-sm-3 control-label">
|
---|
156 | @Model.SelectedGroupMembers.Count members
|
---|
157 | </label>
|
---|
158 | <div class="col-sm-8 control-label" >
|
---|
159 |
|
---|
160 | @foreach (var member in Model.SelectedGroupMembers)
|
---|
161 | {
|
---|
162 | <div class="row">
|
---|
163 | <p class="col-sm-10" style="text-align:left">
|
---|
164 |
|
---|
165 | @if (member is User)
|
---|
166 | {
|
---|
167 | var umember = (User)member;
|
---|
168 | <i class="fa fa-user"></i> @(umember.UserName + "(" + umember.FullName + ")")
|
---|
169 |
|
---|
170 |
|
---|
171 | }
|
---|
172 | else if (member is UserGroup)
|
---|
173 | {
|
---|
174 | var gmember = (UserGroup)member;
|
---|
175 | <i class="fa fa-group"></i> @(gmember.Name)
|
---|
176 |
|
---|
177 | }
|
---|
178 |
|
---|
179 | </p>
|
---|
180 | <p class="col-sm-2">
|
---|
181 | <a class="btn btn-danger"
|
---|
182 | asp-controller="User"
|
---|
183 | asp-action="deleteMember"
|
---|
184 | asp-route-g="@Model.SelectedGroup.Id"
|
---|
185 | asp-route-m="@member.Id"
|
---|
186 | onclick="showDeleter()">
|
---|
187 | <i class="fa fa-trash-o"></i>
|
---|
188 | </a>
|
---|
189 | </p>
|
---|
190 | </div>
|
---|
191 | }
|
---|
192 | @if (Model.SelectedGroupMembers.Count == 0)
|
---|
193 | {
|
---|
194 | <p style="text-align:left">This group currently has no members</p>
|
---|
195 |
|
---|
196 | }
|
---|
197 | </div>
|
---|
198 | </div>
|
---|
199 | }
|
---|
200 | <div class="row" style="margin-left:10px;margin-right:10px;margin-top:-10px">
|
---|
201 | <a class="btn btn-primary"
|
---|
202 | data-toggle="collapse"
|
---|
203 | href="#addmembers"
|
---|
204 | aria-expanded="false"
|
---|
205 | aria-controls="addmembers"
|
---|
206 | style="margin:10px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
207 | text-shadow:2px 2px black;">
|
---|
208 | Add members
|
---|
209 | </a>
|
---|
210 | <div class="collapse"
|
---|
211 | id="addmembers">
|
---|
212 | <div class="panel panel-primary col-sm-6" style="padding:0px">
|
---|
213 | <div class="panel-heading">
|
---|
214 | <p>
|
---|
215 | <i class="fa fa-user"></i> Users
|
---|
216 | <button class="btn btn-sm btn-default"
|
---|
217 | type="button"
|
---|
218 | onclick="selectAll('userstoadd'); triggerSave()">
|
---|
219 | Select all
|
---|
220 | </button>
|
---|
221 | <button class="btn btn-sm btn-default"
|
---|
222 | type="button"
|
---|
223 | onclick="deselectAll('userstoadd'); triggerSave()">
|
---|
224 | Deselect all
|
---|
225 | </button>
|
---|
226 | </p>
|
---|
227 | </div>
|
---|
228 | <div class="panel-body">
|
---|
229 | @foreach (var user in Model.users)
|
---|
230 | {
|
---|
231 | <div class="checkbox">
|
---|
232 | <label>
|
---|
233 | <input type="checkbox"
|
---|
234 | name="userstoadd"
|
---|
235 | @(Model.SelectedGroupMembers.Contains(user) ? "checked disabled" : "")
|
---|
236 | value="@user.Id"
|
---|
237 | onclick="triggerSave()">
|
---|
238 | @user.UserName (@user.FullName)
|
---|
239 | </label>
|
---|
240 | </div>
|
---|
241 |
|
---|
242 | }
|
---|
243 | </div>
|
---|
244 | </div>
|
---|
245 | <div class="panel panel-primary col-sm-6" style="padding:0px">
|
---|
246 | <div class="panel-heading">
|
---|
247 | <p>
|
---|
248 | <i class="fa fa-group"></i> Groups
|
---|
249 |
|
---|
250 | <button class="btn btn-sm btn-default"
|
---|
251 | type="button"
|
---|
252 | onclick="selectAll('groupstoadd'); triggerSave()">
|
---|
253 | Select all
|
---|
254 | </button>
|
---|
255 | <button class="btn btn-sm btn-default"
|
---|
256 | type="button"
|
---|
257 | onclick="deselectAll('groupstoadd'); triggerSave()">
|
---|
258 | Deselect all
|
---|
259 | </button>
|
---|
260 | </p>
|
---|
261 | </div>
|
---|
262 | <div class="panel-body">
|
---|
263 | @foreach (var group in Model.ugroups)
|
---|
264 | {
|
---|
265 | <div class="checkbox">
|
---|
266 | <label>
|
---|
267 | <input type="checkbox"
|
---|
268 | name="groupstoadd"
|
---|
269 | @(Model.SelectedGroupMembers.Contains(group) ||
|
---|
270 | Model.SelectedGroup.Id == group.Id ? "checked disabled" : "")
|
---|
271 | value="@group.Id"
|
---|
272 | onclick="triggerSave()">
|
---|
273 | @group.Name @( Model.SelectedGroup.Id == group.Id ? "(selected group)" : "")
|
---|
274 | </label>
|
---|
275 | </div>
|
---|
276 |
|
---|
277 | }
|
---|
278 | </div>
|
---|
279 | </div>
|
---|
280 | </div>
|
---|
281 | </div>
|
---|
282 | @if (Model.SelectedGroup.Id == Guid.Empty)
|
---|
283 | {//New goup
|
---|
284 | <div class="form-group">
|
---|
285 | <div class="col-sm-offset-3 col-sm-9">
|
---|
286 | <button type="submit"
|
---|
287 | id="inpsaver"
|
---|
288 | disabled
|
---|
289 | class="btn btn-default"
|
---|
290 | onclick="showSaver()">
|
---|
291 | <i class="fa fa-plus-circle"></i> Add group
|
---|
292 | </button>
|
---|
293 | </div>
|
---|
294 | </div>
|
---|
295 |
|
---|
296 |
|
---|
297 | }
|
---|
298 | else
|
---|
299 | {//Changing an existing group
|
---|
300 |
|
---|
301 | <div class="form-group">
|
---|
302 | <div class="col-sm-offset-3 col-sm-3">
|
---|
303 | <button type="submit"
|
---|
304 | id="inpsaver"
|
---|
305 | disabled
|
---|
306 | class="btn btn-default"
|
---|
307 | onclick="showSaver()">
|
---|
308 | <i class="fa fa-save"></i> Save changes
|
---|
309 | </button>
|
---|
310 | </div>
|
---|
311 | <div class="col-sm-5">
|
---|
312 | <a class="btn btn-danger pull-right"
|
---|
313 | asp-controller="User"
|
---|
314 | asp-action="deleteGroup"
|
---|
315 | asp-route-id="@Model.SelectedGroup.Id"
|
---|
316 | onclick="showDeleter()">
|
---|
317 | <i class="fa fa-trash-o"></i> Delete group
|
---|
318 | </a>
|
---|
319 | </div>
|
---|
320 | </div>
|
---|
321 |
|
---|
322 |
|
---|
323 |
|
---|
324 | }
|
---|
325 | <script type="text/javascript">
|
---|
326 | function triggerSave() {
|
---|
327 | if ($("#inpgroupname").val() != "") {
|
---|
328 | document.getElementById("inpsaver").className = "btn btn-lg btn-success";
|
---|
329 | document.getElementById("inpsaver").disabled = false;
|
---|
330 | }
|
---|
331 | else {
|
---|
332 | document.getElementById("inpsaver").className = "btn btn-default";
|
---|
333 | document.getElementById("inpsaver").disabled = true;
|
---|
334 |
|
---|
335 | }
|
---|
336 |
|
---|
337 | }
|
---|
338 | </script>
|
---|
339 | </form>
|
---|
340 |
|
---|
341 | </div>
|
---|
342 | </div>
|
---|
343 |
|
---|
344 | }
|
---|
345 | </div>
|
---|
346 | </div>
|
---|
347 | <script type="text/javascript">
|
---|
348 | function showSaver() {
|
---|
349 | document.getElementById("content").style.display = "none";
|
---|
350 | document.getElementById("saver").style.display = "";
|
---|
351 |
|
---|
352 | }
|
---|
353 | function showGroup() {
|
---|
354 | document.getElementById("content").style.display = "none";
|
---|
355 | document.getElementById("group").style.display = "";
|
---|
356 |
|
---|
357 | }
|
---|
358 | function showDeleter() {
|
---|
359 | document.getElementById("content").style.display = "none";
|
---|
360 | document.getElementById("deleter").style.display = "";
|
---|
361 | }
|
---|
362 | function selectAll(name) {
|
---|
363 | checkboxes = document.getElementsByName(name);
|
---|
364 | for (var i = 0, n = checkboxes.length; i < n; i++) {
|
---|
365 | checkboxes[i].checked = true;
|
---|
366 | }
|
---|
367 | }
|
---|
368 | function deselectAll(name) {
|
---|
369 | checkboxes = document.getElementsByName(name);
|
---|
370 | for (var i = 0, n = checkboxes.length; i < n; i++) {
|
---|
371 | if (checkboxes[i].disabled == false)
|
---|
372 | checkboxes[i].checked = false;
|
---|
373 | }
|
---|
374 | }
|
---|
375 | </script>
|
---|
376 | </div>
|
---|