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="">
|
---|
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 | @(role.Name == "OKB User" ? " (OKB Query)" : "")
|
---|
73 | @(role.Name == "OKB Administrator" ? " (OKB manager)" : "")
|
---|
74 | </span>
|
---|
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="role"
|
---|
88 | class="text-center">
|
---|
89 | <br /><br /><br /><br /><br /><br /><br />
|
---|
90 | <i class="fa fa-gavel 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.SelectedRole.Name != "")
|
---|
109 | {
|
---|
110 | <i class="fa fa-gavel "></i> @Model.SelectedRole.Name
|
---|
111 | <span style="color:forestgreen">
|
---|
112 | @(Model.SelectedRole.Name == "Hive User" ? " (access to Hive and job manager)" : "")
|
---|
113 | @(Model.SelectedRole.Name == "Hive Administrator" ? " (access to resources)" : "")
|
---|
114 | @(Model.SelectedRole.Name == "AccessService Administrator" ? " (access to user manager)" : "")
|
---|
115 | @(Model.SelectedRole.Name == "OKB User" ? " (access to OKB Query)" : "")
|
---|
116 | @(Model.SelectedRole.Name == "OKB Administrator" ? " (access to OKB manager)" : "")
|
---|
117 | </span>
|
---|
118 |
|
---|
119 | }
|
---|
120 | else
|
---|
121 | {
|
---|
122 | <i class="fa fa-plus-circle "></i> @("Add new role")
|
---|
123 |
|
---|
124 | }
|
---|
125 | </h2>
|
---|
126 | <form class="form-horizontal"
|
---|
127 | method="post"
|
---|
128 | asp-action="saveRole"
|
---|
129 | asp-controller="User" enctype="multipart/form-data">
|
---|
130 | <div class="form-group">
|
---|
131 | <label class="col-sm-3 control-label">
|
---|
132 | Role name
|
---|
133 | </label>
|
---|
134 | <label class="col-sm-8 control-label"
|
---|
135 | style="text-align:left; @(Model.SelectedRole.Name == "" ? "display:none" : "")">
|
---|
136 | @Model.SelectedRole.Name
|
---|
137 | </label>
|
---|
138 | <div class="col-sm-8"
|
---|
139 | style="@(Model.SelectedRole.Name == "" ? "" : "display:none")">
|
---|
140 | <input type="text"
|
---|
141 | class="form-control"
|
---|
142 | id="inprolename"
|
---|
143 | name="inprolename"
|
---|
144 | placeholder="Role name"
|
---|
145 | value="@Model.SelectedRole.Name"
|
---|
146 | onkeydown="triggerSave()" />
|
---|
147 | </div>
|
---|
148 | </div>
|
---|
149 |
|
---|
150 | @if (Model.SelectedRole.Name == "")
|
---|
151 | {
|
---|
152 | <div class="form-group">
|
---|
153 | <div class="col-sm-offset-3 col-sm-9">
|
---|
154 | <button type="submit"
|
---|
155 | id="inpsaver"
|
---|
156 | disabled
|
---|
157 | class="btn btn-default"
|
---|
158 | onclick="showSaver()">
|
---|
159 | <i class="fa fa-plus-square-o"></i> Add role
|
---|
160 | </button>
|
---|
161 | </div>
|
---|
162 | </div>
|
---|
163 |
|
---|
164 |
|
---|
165 | }
|
---|
166 | else
|
---|
167 | {
|
---|
168 |
|
---|
169 | <div class="form-group">
|
---|
170 | <label class="col-sm-3 control-label">
|
---|
171 | @Model.SelectedRoleEnrolled.Count Users
|
---|
172 | </label>
|
---|
173 | <div class="col-sm-8 control-label" style="text-align:left">
|
---|
174 | @foreach (var us in Model.SelectedRoleEnrolled)
|
---|
175 | {
|
---|
176 | <div class="row">
|
---|
177 | <p class="col-sm-10">
|
---|
178 | <i class="fa fa-user"></i> @(((User)us).UserName) (@(((User)us).FullName))
|
---|
179 | </p>
|
---|
180 | <p class="col-sm-2">
|
---|
181 | <a class="btn btn-danger pull-right"
|
---|
182 | asp-controller="User"
|
---|
183 | asp-action="deleteRoleUser"
|
---|
184 | asp-route-id="@us.Id"
|
---|
185 | asp-route-role="@Model.SelectedRole.Name"
|
---|
186 | onclick="showDeleter()">
|
---|
187 | <i class="fa fa-trash-o"></i>
|
---|
188 | </a>
|
---|
189 | </p>
|
---|
190 |
|
---|
191 | </div>
|
---|
192 | }
|
---|
193 | @if (Model.SelectedRoleEnrolled.Count == 0)
|
---|
194 | {
|
---|
195 | <p>
|
---|
196 | There are currently no users who have this role
|
---|
197 | </p>
|
---|
198 |
|
---|
199 | }
|
---|
200 | </div>
|
---|
201 | </div>
|
---|
202 | <div class="form-group">
|
---|
203 |
|
---|
204 | <div class="col-sm-3">
|
---|
205 | <a class="btn btn-danger pull-right"
|
---|
206 | asp-controller="User"
|
---|
207 | asp-action="deleteRole"
|
---|
208 | asp-route-name="@Model.SelectedRole.Name"
|
---|
209 |
|
---|
210 | onclick="showDeleter()">
|
---|
211 | <i class="fa fa-trash-o"></i> Delete role
|
---|
212 | </a>
|
---|
213 | </div>
|
---|
214 | </div>
|
---|
215 |
|
---|
216 |
|
---|
217 |
|
---|
218 | }
|
---|
219 | <script type="text/javascript">
|
---|
220 | function triggerSave() {
|
---|
221 | if ($("#inprolename").val() != "") {
|
---|
222 | document.getElementById("inpsaver").className = "btn btn-lg btn-success";
|
---|
223 | document.getElementById("inpsaver").disabled = false;
|
---|
224 | }
|
---|
225 | else {
|
---|
226 | document.getElementById("inpsaver").className = "btn btn-default";
|
---|
227 | document.getElementById("inpsaver").disabled = true;
|
---|
228 |
|
---|
229 | }
|
---|
230 |
|
---|
231 | }
|
---|
232 | </script>
|
---|
233 | </form>
|
---|
234 | </div>
|
---|
235 | </div>
|
---|
236 | </div>
|
---|
237 | </div>
|
---|
238 | <script type="text/javascript">
|
---|
239 | function showSaver() {
|
---|
240 | document.getElementById("content").style.display = "none";
|
---|
241 | document.getElementById("saver").style.display = "";
|
---|
242 |
|
---|
243 | }
|
---|
244 | function showRole() {
|
---|
245 | document.getElementById("content").style.display = "none";
|
---|
246 | document.getElementById("role").style.display = "";
|
---|
247 |
|
---|
248 | }
|
---|
249 | function showDeleter() {
|
---|
250 | document.getElementById("content").style.display = "none";
|
---|
251 | document.getElementById("deleter").style.display = "";
|
---|
252 | }
|
---|
253 | </script>
|
---|
254 | </div>
|
---|