1 | @using HeuristicLab.Clients.Hive.WebJobManager.ViewModels.User;
|
---|
2 | @model UserViewModel
|
---|
3 | <div id="userId" style="display:none">@ViewBag.SessionId</div>
|
---|
4 | <div>
|
---|
5 |
|
---|
6 | @Html.Partial("Navbar", new HeuristicLab.Clients.Hive.WebJobManager.ViewModels.NavbarViewModel("User"))
|
---|
7 |
|
---|
8 | <ul class="nav nav-pills nav-justified">
|
---|
9 | <li role="presentation"
|
---|
10 | class="active">
|
---|
11 | <a asp-controller="User"
|
---|
12 | asp-action="Index">
|
---|
13 | <i class="fa fa-user"></i> Users
|
---|
14 | </a>
|
---|
15 | </li>
|
---|
16 | <li role="presentation"
|
---|
17 | class="">
|
---|
18 | <a asp-controller="User"
|
---|
19 | asp-action="Groups">
|
---|
20 | <i class="fa fa-group"></i> Groups
|
---|
21 | </a>
|
---|
22 | </li>
|
---|
23 | <li role="presentation"
|
---|
24 | class="">
|
---|
25 | <a asp-controller="User"
|
---|
26 | asp-action="Roles">
|
---|
27 | <i class="fa fa-gavel"></i> Roles
|
---|
28 | </a>
|
---|
29 | </li>
|
---|
30 | </ul>
|
---|
31 | <div class="row"
|
---|
32 | style="text-align:center">
|
---|
33 | @Model.message
|
---|
34 | </div>
|
---|
35 | <div class="row"
|
---|
36 | style="padding:10px; margin-right:0px!important">
|
---|
37 | @if (Model.users.Count == 0)
|
---|
38 | {
|
---|
39 | <div>
|
---|
40 | <p style="text-align:center">
|
---|
41 | No users found
|
---|
42 | </p>
|
---|
43 | </div>
|
---|
44 |
|
---|
45 | }
|
---|
46 | else
|
---|
47 | {
|
---|
48 | <div class="col-sm-4">
|
---|
49 | <div class="btn-group-vertical btn-block">
|
---|
50 | <a class="btn btn-info btn-lg btn-block disabled"
|
---|
51 | style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
52 | text-shadow:2px 2px black;">
|
---|
53 | <i class="fa fa-user"></i> @Model.users.Count User@(Model.users.Count != 1 ? "s" : "")
|
---|
54 | </a>
|
---|
55 | <a class="btn btn-success btn-block
|
---|
56 | @(Model.SelectedUser.Id == Guid.Empty ? "active" : "")
|
---|
57 | "
|
---|
58 | asp-controller="User"
|
---|
59 | asp-action="SelectUser"
|
---|
60 | asp-route-id="@Guid.Empty"
|
---|
61 | onclick="showUser()"
|
---|
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 | text-shadow:2px 2px black;">
|
---|
64 | <i class="fa fa-user-plus"></i> Add new user
|
---|
65 | </a>
|
---|
66 | @foreach (var user in Model.users)
|
---|
67 | {
|
---|
68 | <a class="btn btn-default @( user.Id == Model.SelectedUser.Id ? "active" : "" )"
|
---|
69 | style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);"
|
---|
70 | asp-controller="User"
|
---|
71 | asp-action="SelectUser"
|
---|
72 | asp-route-id="@user.Id"
|
---|
73 | onclick="showUser()">
|
---|
74 | @user.UserName (@user.FullName)
|
---|
75 | </a>
|
---|
76 | }
|
---|
77 | </div>
|
---|
78 | </div>
|
---|
79 | <p style="display:none"
|
---|
80 | id="saver"
|
---|
81 | class="text-center">
|
---|
82 | <br /><br /><br /><br /><br /><br /><br />
|
---|
83 | <i class="fa fa-save fa-spin fa-5x" id="spinner">
|
---|
84 | </i>
|
---|
85 | </p>
|
---|
86 | <p style="display:none"
|
---|
87 | id="user"
|
---|
88 | class="text-center">
|
---|
89 | <br /><br /><br /><br /><br /><br /><br />
|
---|
90 | <i class="fa fa-user fa-spin fa-5x" id="spinner">
|
---|
91 | </i>
|
---|
92 | </p>
|
---|
93 | <p style="display:none"
|
---|
94 | id="deleter"
|
---|
95 | class="text-center">
|
---|
96 | <br /><br /><br /><br /><br /><br /><br />
|
---|
97 | <i class="fa fa-trash-o fa-spin fa-5x" id="spinner">
|
---|
98 | </i>
|
---|
99 | </p>
|
---|
100 | <div class="col-sm-8"
|
---|
101 | id="content"
|
---|
102 | style="padding:5px; padding-left:10px;">
|
---|
103 | <div class="panel panel-default"
|
---|
104 | style="border-width:2px!important;padding:17px;
|
---|
105 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
|
---|
106 | <div class="row">
|
---|
107 | <h2 style="padding-left:20px">
|
---|
108 | @if (Model.SelectedUser.Id != Guid.Empty)
|
---|
109 | {
|
---|
110 | <i class="fa fa-user "></i> @Model.SelectedUser.UserName;
|
---|
111 | }
|
---|
112 | else
|
---|
113 | {
|
---|
114 | <i class="fa fa-user-plus "></i> @("Add new user")
|
---|
115 |
|
---|
116 | }
|
---|
117 | </h2>
|
---|
118 | <form class="form-horizontal"
|
---|
119 | method="post"
|
---|
120 | asp-action="saveUser"
|
---|
121 | asp-controller="User"
|
---|
122 | enctype="multipart/form-data"
|
---|
123 | onsubmit="showSaver()">
|
---|
124 | <div class="form-group" style="@(Model.SelectedUser.Id == Guid.Empty ? "" : "display:none")">
|
---|
125 | <label for="inpusername"
|
---|
126 | class="col-sm-3 control-label">
|
---|
127 | Username
|
---|
128 | </label>
|
---|
129 | <div class="col-sm-8">
|
---|
130 | <input type="text"
|
---|
131 | class="form-control"
|
---|
132 | id="inpusername"
|
---|
133 | name="inpusername"
|
---|
134 | placeholder="Username"
|
---|
135 | onkeydown="triggerSave()"
|
---|
136 | value="@Model.SelectedUser.UserName">
|
---|
137 | </div>
|
---|
138 | </div>
|
---|
139 | <div class="form-group">
|
---|
140 | <label for="inpfullname"
|
---|
141 | class="col-sm-3 control-label">
|
---|
142 | Full name
|
---|
143 | </label>
|
---|
144 | <div class="col-sm-8">
|
---|
145 | <input type="text"
|
---|
146 | class="form-control"
|
---|
147 | id="inpfullname"
|
---|
148 | name="inpfullname"
|
---|
149 | placeholder="Full name"
|
---|
150 | onkeydown="triggerSave()"
|
---|
151 | value="@Model.SelectedUser.FullName">
|
---|
152 | </div>
|
---|
153 | </div>
|
---|
154 | <div class="form-group">
|
---|
155 | <label for="inpemail"
|
---|
156 | class="col-sm-3 control-label">
|
---|
157 | Email
|
---|
158 | </label>
|
---|
159 | <div class="col-sm-8">
|
---|
160 | <input type="email"
|
---|
161 | class="form-control"
|
---|
162 | id="inpemail"
|
---|
163 | name="inpemail"
|
---|
164 | placeholder="Email"
|
---|
165 | onkeydown="triggerSave()"
|
---|
166 | value="@Model.SelectedUser.Email">
|
---|
167 | </div>
|
---|
168 | </div>
|
---|
169 | <input type="text"
|
---|
170 | style="display:none"
|
---|
171 | id="u"
|
---|
172 | name="u"
|
---|
173 | value="@Model.SelectedUser.Id" />
|
---|
174 | @if (Model.SelectedUser.Id != Guid.Empty)
|
---|
175 | {
|
---|
176 | <div class="form-group">
|
---|
177 | <label class="col-sm-3 control-label">
|
---|
178 | User id
|
---|
179 | </label>
|
---|
180 | <label class="col-sm-8 control-label" style="text-align:left">
|
---|
181 | @Model.SelectedUser.Id
|
---|
182 | </label>
|
---|
183 |
|
---|
184 | </div>
|
---|
185 | <div class="form-group">
|
---|
186 | <label class="col-sm-3 control-label">
|
---|
187 | User created
|
---|
188 | </label>
|
---|
189 | <label class="col-sm-8 control-label" style="text-align:left">
|
---|
190 | @Model.SelectedUser.CreationDate.AddHours(2).ToString();
|
---|
191 | </label>
|
---|
192 | </div>
|
---|
193 | <div class="form-group">
|
---|
194 | <label class="col-sm-3 control-label">
|
---|
195 | Last activity
|
---|
196 | </label>
|
---|
197 | <label class="col-sm-8 control-label" style="text-align:left">
|
---|
198 | @Model.SelectedUser.LastActivityDate.AddHours(2).ToString()
|
---|
199 | </label>
|
---|
200 | </div>
|
---|
201 | <div class="form-group">
|
---|
202 | <label class="col-sm-3 control-label">
|
---|
203 | Password
|
---|
204 | </label>
|
---|
205 | <div id="inppassreset" class="col-sm-8">
|
---|
206 | Last change: @Model.SelectedUser.LastPasswordChangedDate.ToShortDateString()
|
---|
207 | <button type="button"
|
---|
208 | onclick="resetPass('@(Model.SelectedUser.Id)')"
|
---|
209 | class="btn btn-default">
|
---|
210 | <i class="fa fa-unlock"></i> Reset password
|
---|
211 | </button>
|
---|
212 | </div>
|
---|
213 | </div>
|
---|
214 |
|
---|
215 | <div class="form-group">
|
---|
216 | <label class="col-sm-3 control-label">
|
---|
217 | Member of
|
---|
218 | </label>
|
---|
219 | <div class="col-sm-8 control-label" style="text-align:left">
|
---|
220 | @if (Model.SelectedUserSubscriptions.Count > 0)
|
---|
221 | {
|
---|
222 | @foreach (var g in Model.SelectedUserSubscriptions)
|
---|
223 | {
|
---|
224 | <div class="row">
|
---|
225 | <p class="col-sm-10"><i class="fa fa-group"></i> @g.Name</p>
|
---|
226 | <p class="col-sm-2">
|
---|
227 | <a class="btn btn-danger pull-right"
|
---|
228 | asp-controller="User"
|
---|
229 | asp-action="deleteUserGroup"
|
---|
230 | asp-route-id="@Model.SelectedUser.Id"
|
---|
231 | asp-route-group="@g.Id"
|
---|
232 | onclick="showDeleter()">
|
---|
233 | <i class="fa fa-trash-o"></i>
|
---|
234 | </a>
|
---|
235 | </p>
|
---|
236 | </div>
|
---|
237 | }
|
---|
238 | }
|
---|
239 | else
|
---|
240 | {
|
---|
241 | <p>Not a member of any groups</p>
|
---|
242 | }
|
---|
243 | </div>
|
---|
244 | </div>
|
---|
245 | }
|
---|
246 |
|
---|
247 | <div class="row" style="margin-left:10px;margin-right:10px;margin-top:-10px">
|
---|
248 | <a class="btn btn-primary col-sm-3"
|
---|
249 | data-toggle="collapse"
|
---|
250 | href="#addgroups"
|
---|
251 | aria-expanded="false"
|
---|
252 | aria-controls="addgroups"
|
---|
253 | 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);
|
---|
254 | text-shadow:2px 2px black;">
|
---|
255 | @(Model.SelectedUser.Id == Guid.Empty ? "Set groups" : "Add groups")
|
---|
256 | </a>
|
---|
257 | <div class="collapse col-sm-12"
|
---|
258 | id="addgroups">
|
---|
259 | <div class="panel panel-primary" style="padding:0px">
|
---|
260 | <div class="panel-heading">
|
---|
261 | <p>
|
---|
262 | <i class="fa fa-group"></i> Groups
|
---|
263 | </p>
|
---|
264 | </div>
|
---|
265 | <div class="panel-body">
|
---|
266 | @foreach (var group in Model.ugroups)
|
---|
267 | {
|
---|
268 | <div class="checkbox">
|
---|
269 | <label>
|
---|
270 | <input type="checkbox"
|
---|
271 | name="groupstoadd"
|
---|
272 | @(Model.SelectedUserSubscriptions.Contains(group) ? "checked disabled" : "")
|
---|
273 | value="@group.Id"
|
---|
274 | onclick="triggerSave()">
|
---|
275 | @group.Name
|
---|
276 | </label>
|
---|
277 | </div>
|
---|
278 |
|
---|
279 | }
|
---|
280 | </div>
|
---|
281 | </div>
|
---|
282 | </div>
|
---|
283 | </div>
|
---|
284 |
|
---|
285 | @if (Model.SelectedUser.Id != Guid.Empty)
|
---|
286 | {
|
---|
287 | <div class="form-group">
|
---|
288 | <label class="col-sm-3 control-label">
|
---|
289 | Roles
|
---|
290 | </label>
|
---|
291 | <div class="col-sm-8 control-label" style="text-align:left">
|
---|
292 | @if (Model.SelectedUserRoles.Count > 0)
|
---|
293 | {
|
---|
294 | @foreach (var r in Model.SelectedUserRoles)
|
---|
295 | {
|
---|
296 | <div class="row">
|
---|
297 |
|
---|
298 | <p class="col-sm-10"><i class="fa fa-gavel"></i> @r.Name</p>
|
---|
299 | <p class="col-sm-2">
|
---|
300 | <a class="btn btn-danger pull-right"
|
---|
301 | asp-controller="User"
|
---|
302 | asp-action="deleteUserRole"
|
---|
303 | asp-route-id="@Model.SelectedUser.Id"
|
---|
304 | asp-route-role="@r.Name"
|
---|
305 | onclick="showDeleter()">
|
---|
306 | <i class="fa fa-trash-o"></i>
|
---|
307 | </a>
|
---|
308 | </p>
|
---|
309 | </div>
|
---|
310 | }
|
---|
311 | }
|
---|
312 | else
|
---|
313 | {
|
---|
314 | <p>User has no roles</p>
|
---|
315 | }
|
---|
316 | </div>
|
---|
317 | </div>
|
---|
318 | }
|
---|
319 | <div class="row" style="margin-left:10px;margin-right:10px;">
|
---|
320 | <a class="btn btn-primary col-sm-3"
|
---|
321 | data-toggle="collapse"
|
---|
322 | href="#addroles"
|
---|
323 | aria-expanded="false"
|
---|
324 | aria-controls="addroles"
|
---|
325 | 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);
|
---|
326 | text-shadow:2px 2px black;">
|
---|
327 | @(Model.SelectedUser.Id == Guid.Empty ? "Set roles" : "Add roles")
|
---|
328 | </a>
|
---|
329 | <div class="collapse col-sm-12"
|
---|
330 | id="addroles">
|
---|
331 | <div class="panel panel-primary" style="padding:0px">
|
---|
332 | <div class="panel-heading">
|
---|
333 | <p>
|
---|
334 | <i class="fa fa-gavel"></i> Roles
|
---|
335 | </p>
|
---|
336 | </div>
|
---|
337 | <div class="panel-body">
|
---|
338 | @foreach (var role in Model.roles)
|
---|
339 | {
|
---|
340 | <div class="checkbox">
|
---|
341 | <label>
|
---|
342 | <input type="checkbox"
|
---|
343 | name="rolestoadd"
|
---|
344 | @(Model.SelectedUserRoles.Contains(role) ? "checked disabled" : "")
|
---|
345 | value="@role.Name"
|
---|
346 | onclick="triggerSave()">
|
---|
347 | @role.Name
|
---|
348 | </label>
|
---|
349 | </div>
|
---|
350 |
|
---|
351 | }
|
---|
352 | </div>
|
---|
353 | </div>
|
---|
354 | </div>
|
---|
355 | </div>
|
---|
356 | <div class="form-group">
|
---|
357 | <div class="col-sm-offset-3 col-sm-3">
|
---|
358 | <button type="submit"
|
---|
359 | id="inpsaver"
|
---|
360 | disabled
|
---|
361 | class="btn btn-default"
|
---|
362 | >
|
---|
363 | <i class="fa fa-save"></i>
|
---|
364 | @(Model.SelectedUser.Id != Guid.Empty ? "Save changes" : "Add user")
|
---|
365 | </button>
|
---|
366 | </div>
|
---|
367 | @if (Model.SelectedUser.Id != Guid.Empty)
|
---|
368 | {
|
---|
369 | <div class="col-sm-5">
|
---|
370 | <a class="btn btn-danger pull-right"
|
---|
371 | asp-controller="User"
|
---|
372 | asp-action="deleteUser"
|
---|
373 | asp-route-id="@Model.SelectedUser.Id"
|
---|
374 | onclick="showDeleter()">
|
---|
375 | <i class="fa fa-trash-o"></i> Delete user
|
---|
376 | </a>
|
---|
377 | </div>
|
---|
378 | }
|
---|
379 | </div>
|
---|
380 |
|
---|
381 |
|
---|
382 |
|
---|
383 |
|
---|
384 | <script type="text/javascript">
|
---|
385 | function triggerSave() {
|
---|
386 | if ($("#inpfullname").val() != "" &&
|
---|
387 | $("#inpemail").val() != "") {
|
---|
388 | document.getElementById("inpsaver").className = "btn btn-lg btn-success";
|
---|
389 | document.getElementById("inpsaver").disabled = false;
|
---|
390 | }
|
---|
391 | else {
|
---|
392 | document.getElementById("inpsaver").className = "btn btn-default";
|
---|
393 | document.getElementById("inpsaver").disabled = true;
|
---|
394 |
|
---|
395 | }
|
---|
396 |
|
---|
397 | }
|
---|
398 | </script>
|
---|
399 | </form>
|
---|
400 |
|
---|
401 | </div>
|
---|
402 |
|
---|
403 | </div>
|
---|
404 |
|
---|
405 |
|
---|
406 |
|
---|
407 |
|
---|
408 |
|
---|
409 | </div>
|
---|
410 | }
|
---|
411 | </div>
|
---|
412 |
|
---|
413 | <script src="~/js/hubs/userinfohubber.js"></script>
|
---|
414 | <script type="text/javascript">
|
---|
415 | function showSaver() {
|
---|
416 | document.getElementById("content").style.display = "none";
|
---|
417 | document.getElementById("saver").style.display = "";
|
---|
418 |
|
---|
419 | }
|
---|
420 | function showUser() {
|
---|
421 | document.getElementById("content").style.display = "none";
|
---|
422 | document.getElementById("user").style.display = "";
|
---|
423 |
|
---|
424 | }
|
---|
425 | function showDeleter() {
|
---|
426 | document.getElementById("content").style.display = "none";
|
---|
427 | document.getElementById("deleter").style.display = "";
|
---|
428 | }
|
---|
429 | </script>
|
---|
430 | </div>
|
---|