@tager/admin-administrators 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/App.vue.d.ts +4 -3
- package/dist/index.mjs +560 -634
- package/dist/services/requests.d.ts +8 -8
- package/dist/style.css +1 -1
- package/dist/typings/model.d.ts +5 -5
- package/dist/views/AdminForm/AdminForm.helpers.d.ts +6 -6
- package/dist/views/AdminForm/AdminForm.vue.d.ts +1847 -372
- package/dist/views/AdminList/AdminList.vue.d.ts +5 -4
- package/dist/views/RoleForm/RoleForm.helpers.d.ts +5 -5
- package/dist/views/RoleForm/RoleForm.vue.d.ts +6 -5
- package/dist/views/RoleList/RoleList.vue.d.ts +7 -7
- package/package.json +20 -24
- package/src/dev/App.vue +2 -3
- package/src/dev/env.ts +11 -11
- package/src/services/requests.ts +5 -5
- package/src/typings/model.ts +1 -1
- package/src/views/AdminForm/AdminForm.helpers.ts +6 -6
- package/src/views/AdminForm/AdminForm.vue +11 -11
- package/src/views/AdminList/AdminList.vue +4 -4
- package/src/views/RoleForm/RoleForm.helpers.ts +5 -5
- package/src/views/RoleForm/RoleForm.vue +7 -10
- package/src/views/RoleList/RoleList.vue +2 -3
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { i18n, request, useI18n, useResourceDelete, createId, useToast, useResource, notEmpty, navigateBack, convertRequestErrorToMap } from "@tager/admin-services";
|
|
2
|
-
import { defineComponent, onMounted, resolveComponent, openBlock, createBlock, withCtx, createVNode, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useRoute, useRouter } from "vue-router";
|
|
8
|
-
const
|
|
1
|
+
import { i18n as te, request as h, useI18n as q, useResourceDelete as ne, createId as Ie, useToast as re, useResource as P, notEmpty as $e, navigateBack as se, convertRequestErrorToMap as ie } from "@tager/admin-services";
|
|
2
|
+
import { defineComponent as z, onMounted as H, resolveComponent as l, openBlock as i, createBlock as S, withCtx as b, createVNode as g, createCommentVNode as I, createElementVNode as C, createElementBlock as F, Fragment as k, renderList as V, toDisplayString as w, computed as R, ref as D, watch as Z, withModifiers as le } from "vue";
|
|
3
|
+
import { EditIcon as de, DeleteIcon as ue, BaseButton as me, DataTable as ce, useDataTable as pe, FormFieldMultiSelect as fe, FormField as ge, FormFooter as ve, TabList as Ee } from "@tager/admin-ui";
|
|
4
|
+
import { Page as j } from "@tager/admin-layout";
|
|
5
|
+
import { universalFieldUtils as be, DynamicField as Me } from "@tager/admin-dynamic-field";
|
|
6
|
+
import { compile as Re } from "path-to-regexp";
|
|
7
|
+
import { useRoute as Le, useRouter as he } from "vue-router";
|
|
8
|
+
const Ue = {
|
|
9
9
|
home: "Home",
|
|
10
10
|
administrators: "Administrators",
|
|
11
11
|
role: "Role",
|
|
@@ -48,244 +48,233 @@ const EN = {
|
|
|
48
48
|
general: "General",
|
|
49
49
|
params: "Template"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
andMorePrivilege: "\u0438 \u0435\u0449\u0435 {{count}} \u043F\u0440\u0438\u0432\u0438\u043B\u0435\u0433\u0438\u0439...",
|
|
51
|
+
}, we = {
|
|
52
|
+
home: "Главная",
|
|
53
|
+
administrators: "Администраторы",
|
|
54
|
+
role: "Роль",
|
|
55
|
+
roles: "Роли",
|
|
56
|
+
admin: "Админ",
|
|
57
|
+
admins: "Админы",
|
|
58
|
+
createRole: "Создать роль",
|
|
59
|
+
createAdmin: "Создать админа",
|
|
60
|
+
createAdministrator: "Создать администратора",
|
|
61
|
+
edit: "Редактировать",
|
|
62
|
+
delete: "Удалить",
|
|
63
|
+
email: "Электронная почта",
|
|
64
|
+
actions: "Действия",
|
|
65
|
+
updateRole: "Обновить роль",
|
|
66
|
+
updateAdmin: "Обновить администратора",
|
|
67
|
+
password: "Пароль",
|
|
68
|
+
newPassword: "Новый пароль",
|
|
69
|
+
name: "Имя",
|
|
70
|
+
success: "Успех",
|
|
71
|
+
adminSuccessfullyCreated: "Админ успешно создан",
|
|
72
|
+
adminSuccessfullyUpdated: "Админ успешно обновлен",
|
|
73
|
+
error: "Ошибка",
|
|
74
|
+
adminCreationError: "Ошибка создания администратора",
|
|
75
|
+
adminUpdateError: "Ошибка обновления администратора",
|
|
76
|
+
listOfRoles: "Список ролей",
|
|
77
|
+
addRole: "Добавить роль",
|
|
78
|
+
noPrivileges: "Без привилегий",
|
|
79
|
+
privileges: "Привилегии",
|
|
80
|
+
all: "Все",
|
|
81
|
+
roleSuccessfullyCreated: "Роль успешно создана",
|
|
82
|
+
roleSuccessfullyUpdate: "Роль успешно обновлена",
|
|
83
|
+
roleCreationError: "Ошибка создания роли",
|
|
84
|
+
roleUpdateError: "Ошибка обновления роли",
|
|
85
|
+
adminList: "Список администраторов",
|
|
86
|
+
adminForm: "Форма администратора",
|
|
87
|
+
roleList: "Список ролей",
|
|
88
|
+
roleForm: "Форма роли",
|
|
89
|
+
andMorePrivilege: "и еще {{count}} привилегий...",
|
|
91
90
|
tabs: {
|
|
92
|
-
general: "
|
|
93
|
-
params: "
|
|
91
|
+
general: "Основное",
|
|
92
|
+
params: "Параметры"
|
|
94
93
|
}
|
|
95
94
|
};
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
i18n.addTranslations("ru", "administrators", RU);
|
|
95
|
+
function Ce() {
|
|
96
|
+
te.addTranslations("en", "administrators", Ue), te.addTranslations("ru", "administrators", we);
|
|
99
97
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
98
|
+
function Oe() {
|
|
99
|
+
return h.get({ path: "/admin/admins/fields" });
|
|
102
100
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
101
|
+
function ye() {
|
|
102
|
+
return h.get({ path: "/admin/rbac/roles" });
|
|
105
103
|
}
|
|
106
|
-
function
|
|
107
|
-
return
|
|
104
|
+
function Pe(e) {
|
|
105
|
+
return h.get({ path: `/admin/rbac/roles/${e}` });
|
|
108
106
|
}
|
|
109
|
-
function
|
|
110
|
-
return
|
|
107
|
+
function ke(e) {
|
|
108
|
+
return h.post({ path: "/admin/rbac/roles", body: e });
|
|
111
109
|
}
|
|
112
|
-
function
|
|
113
|
-
return
|
|
110
|
+
function Be(e, t) {
|
|
111
|
+
return h.put({ path: `/admin/rbac/roles/${e}`, body: t });
|
|
114
112
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
113
|
+
function Ne(e) {
|
|
114
|
+
return h.delete({ path: `/admin/rbac/roles/${e}` });
|
|
117
115
|
}
|
|
118
|
-
function
|
|
119
|
-
return
|
|
116
|
+
function _e() {
|
|
117
|
+
return h.get({ path: "/admin/rbac/scopes" });
|
|
120
118
|
}
|
|
121
|
-
function
|
|
122
|
-
return
|
|
119
|
+
function Ve() {
|
|
120
|
+
return h.get({ path: "/admin/admins" });
|
|
123
121
|
}
|
|
124
|
-
function
|
|
125
|
-
return
|
|
122
|
+
function qe(e) {
|
|
123
|
+
return h.get({ path: `/admin/admins/${e}` });
|
|
126
124
|
}
|
|
127
|
-
function
|
|
128
|
-
return
|
|
125
|
+
function ze(e) {
|
|
126
|
+
return h.post({ path: "/admin/admins", body: e });
|
|
129
127
|
}
|
|
130
|
-
function
|
|
131
|
-
return
|
|
128
|
+
function He(e, t) {
|
|
129
|
+
return h.put({ path: `/admin/admins/${e}`, body: t });
|
|
132
130
|
}
|
|
133
|
-
function
|
|
134
|
-
return
|
|
131
|
+
function je(e) {
|
|
132
|
+
return h.delete({ path: `/admin/admins/${e}` });
|
|
135
133
|
}
|
|
136
|
-
const
|
|
134
|
+
const L = {
|
|
137
135
|
ROLE_LIST: "/roles",
|
|
138
136
|
ROLE_FORM: "/roles/:roleId",
|
|
139
137
|
ADMIN_LIST: "/admins",
|
|
140
138
|
ADMIN_FORM: "/admins/:adminId"
|
|
141
139
|
};
|
|
142
|
-
function
|
|
143
|
-
return
|
|
140
|
+
function ae() {
|
|
141
|
+
return L.ROLE_LIST;
|
|
144
142
|
}
|
|
145
|
-
function
|
|
146
|
-
return
|
|
143
|
+
function Fe(e) {
|
|
144
|
+
return Re(L.ROLE_FORM)(e);
|
|
147
145
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
146
|
+
function oe() {
|
|
147
|
+
return L.ADMIN_LIST;
|
|
150
148
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
149
|
+
function Ae(e) {
|
|
150
|
+
return Re(L.ADMIN_FORM)(e);
|
|
153
151
|
}
|
|
154
|
-
|
|
155
|
-
const target = sfc.__vccOpts || sfc;
|
|
156
|
-
for (const [key, val] of props) {
|
|
157
|
-
target[key] = val;
|
|
158
|
-
}
|
|
159
|
-
return target;
|
|
160
|
-
};
|
|
161
|
-
const _sfc_main$3 = defineComponent({
|
|
152
|
+
const Je = z({
|
|
162
153
|
name: "AdminList",
|
|
163
154
|
components: {
|
|
164
|
-
Page,
|
|
165
|
-
DataTable,
|
|
166
|
-
BaseButton,
|
|
167
|
-
DeleteIcon,
|
|
168
|
-
EditIcon
|
|
155
|
+
Page: j,
|
|
156
|
+
DataTable: ce,
|
|
157
|
+
BaseButton: me,
|
|
158
|
+
DeleteIcon: ue,
|
|
159
|
+
EditIcon: de
|
|
169
160
|
},
|
|
170
161
|
setup() {
|
|
171
|
-
const { t } =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
fetchEntityList: () => getAdminList(),
|
|
162
|
+
const { t: e } = q(), {
|
|
163
|
+
fetchEntityList: t,
|
|
164
|
+
isLoading: r,
|
|
165
|
+
rowData: m,
|
|
166
|
+
errorMessage: d
|
|
167
|
+
} = pe({
|
|
168
|
+
fetchEntityList: () => Ve(),
|
|
179
169
|
initialValue: [],
|
|
180
170
|
resourceName: "Admin list",
|
|
181
171
|
pageSize: 100
|
|
182
172
|
});
|
|
183
|
-
|
|
184
|
-
|
|
173
|
+
H(() => {
|
|
174
|
+
t();
|
|
185
175
|
});
|
|
186
176
|
const {
|
|
187
|
-
handleResourceDelete:
|
|
188
|
-
isDeleting
|
|
189
|
-
} =
|
|
190
|
-
deleteResource:
|
|
177
|
+
handleResourceDelete: s,
|
|
178
|
+
isDeleting: c
|
|
179
|
+
} = ne({
|
|
180
|
+
deleteResource: je,
|
|
191
181
|
resourceName: "Admin",
|
|
192
|
-
onSuccess:
|
|
182
|
+
onSuccess: t
|
|
193
183
|
});
|
|
194
|
-
function
|
|
195
|
-
return
|
|
184
|
+
function n(f) {
|
|
185
|
+
return c(f) || r.value;
|
|
196
186
|
}
|
|
197
|
-
const
|
|
187
|
+
const p = [
|
|
198
188
|
{
|
|
199
189
|
id: 1,
|
|
200
|
-
name:
|
|
190
|
+
name: e("administrators:admin"),
|
|
201
191
|
field: "name"
|
|
202
192
|
},
|
|
203
193
|
{
|
|
204
194
|
id: 2,
|
|
205
|
-
name:
|
|
195
|
+
name: e("administrators:email"),
|
|
206
196
|
field: "email"
|
|
207
197
|
},
|
|
208
198
|
{
|
|
209
199
|
id: 3,
|
|
210
|
-
name:
|
|
200
|
+
name: e("administrators:roles"),
|
|
211
201
|
field: "roles"
|
|
212
202
|
},
|
|
213
203
|
{
|
|
214
204
|
id: 4,
|
|
215
|
-
name:
|
|
205
|
+
name: e("administrators:actions"),
|
|
216
206
|
field: "actions",
|
|
217
207
|
style: { width: "180px", textAlign: "center", whiteSpace: "nowrap" },
|
|
218
208
|
headStyle: { width: "180px", textAlign: "center" }
|
|
219
209
|
}
|
|
220
210
|
];
|
|
221
211
|
return {
|
|
222
|
-
t,
|
|
223
|
-
columnDefs,
|
|
224
|
-
rowData:
|
|
225
|
-
isRowDataLoading:
|
|
226
|
-
errorMessage:
|
|
227
|
-
isBusy,
|
|
228
|
-
handleAdminDelete,
|
|
229
|
-
getAdminFormUrl
|
|
212
|
+
t: e,
|
|
213
|
+
columnDefs: p,
|
|
214
|
+
rowData: m,
|
|
215
|
+
isRowDataLoading: r,
|
|
216
|
+
errorMessage: d,
|
|
217
|
+
isBusy: n,
|
|
218
|
+
handleAdminDelete: s,
|
|
219
|
+
getAdminFormUrl: Ae
|
|
230
220
|
};
|
|
231
221
|
}
|
|
232
|
-
})
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
222
|
+
}), J = (e, t) => {
|
|
223
|
+
const r = e.__vccOpts || e;
|
|
224
|
+
for (const [m, d] of t)
|
|
225
|
+
r[m] = d;
|
|
226
|
+
return r;
|
|
227
|
+
};
|
|
228
|
+
function Ke(e, t, r, m, d, s) {
|
|
229
|
+
const c = l("EditIcon"), n = l("BaseButton"), p = l("DeleteIcon"), f = l("DataTable"), v = l("Page");
|
|
230
|
+
return i(), S(v, {
|
|
231
|
+
title: e.$i18n.t("administrators:administrators"),
|
|
241
232
|
"header-buttons": [
|
|
242
233
|
{
|
|
243
|
-
text:
|
|
244
|
-
href:
|
|
234
|
+
text: e.$i18n.t("administrators:createAdministrator"),
|
|
235
|
+
href: e.getAdminFormUrl({ adminId: "create" })
|
|
245
236
|
}
|
|
246
237
|
]
|
|
247
238
|
}, {
|
|
248
|
-
default:
|
|
249
|
-
|
|
250
|
-
"column-defs":
|
|
251
|
-
"row-data":
|
|
252
|
-
loading:
|
|
253
|
-
"error-message":
|
|
239
|
+
default: b(() => [
|
|
240
|
+
g(f, {
|
|
241
|
+
"column-defs": e.columnDefs,
|
|
242
|
+
"row-data": e.rowData,
|
|
243
|
+
loading: e.isRowDataLoading,
|
|
244
|
+
"error-message": e.errorMessage
|
|
254
245
|
}, {
|
|
255
|
-
"cell(roles)":
|
|
256
|
-
|
|
257
|
-
(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}, toDisplayString(role.name), 1);
|
|
261
|
-
}), 128))
|
|
246
|
+
"cell(roles)": b(({ row: a }) => [
|
|
247
|
+
C("ul", null, [
|
|
248
|
+
(i(!0), F(k, null, V(a.roles, (o) => (i(), F("li", {
|
|
249
|
+
key: o.id
|
|
250
|
+
}, w(o.name), 1))), 128))
|
|
262
251
|
])
|
|
263
252
|
]),
|
|
264
|
-
"cell(actions)":
|
|
265
|
-
|
|
253
|
+
"cell(actions)": b(({ row: a }) => [
|
|
254
|
+
a.isSelf ? I("", !0) : (i(), S(n, {
|
|
266
255
|
key: 0,
|
|
267
256
|
variant: "icon",
|
|
268
|
-
title:
|
|
269
|
-
disabled:
|
|
270
|
-
href:
|
|
257
|
+
title: e.$i18n.t("administrators:edit"),
|
|
258
|
+
disabled: e.isBusy(a.id),
|
|
259
|
+
href: e.getAdminFormUrl({ adminId: a.id })
|
|
271
260
|
}, {
|
|
272
|
-
default:
|
|
273
|
-
|
|
261
|
+
default: b(() => [
|
|
262
|
+
g(c)
|
|
274
263
|
]),
|
|
275
264
|
_: 2
|
|
276
|
-
}, 1032, ["title", "disabled", "href"]))
|
|
277
|
-
!
|
|
265
|
+
}, 1032, ["title", "disabled", "href"])),
|
|
266
|
+
!a.isSuperAdmin || !a.isSelf ? (i(), S(n, {
|
|
278
267
|
key: 1,
|
|
279
268
|
variant: "icon",
|
|
280
|
-
title:
|
|
281
|
-
disabled:
|
|
282
|
-
onClick: (
|
|
269
|
+
title: e.$i18n.t("administrators:delete"),
|
|
270
|
+
disabled: e.isBusy(a.id),
|
|
271
|
+
onClick: (o) => e.handleAdminDelete(a.id)
|
|
283
272
|
}, {
|
|
284
|
-
default:
|
|
285
|
-
|
|
273
|
+
default: b(() => [
|
|
274
|
+
g(p)
|
|
286
275
|
]),
|
|
287
276
|
_: 2
|
|
288
|
-
}, 1032, ["title", "disabled", "onClick"])) :
|
|
277
|
+
}, 1032, ["title", "disabled", "onClick"])) : I("", !0)
|
|
289
278
|
]),
|
|
290
279
|
_: 1
|
|
291
280
|
}, 8, ["column-defs", "row-data", "loading", "error-message"])
|
|
@@ -293,417 +282,370 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
293
282
|
_: 1
|
|
294
283
|
}, 8, ["title", "header-buttons"]);
|
|
295
284
|
}
|
|
296
|
-
|
|
297
|
-
function
|
|
298
|
-
if (!
|
|
285
|
+
const Qe = /* @__PURE__ */ J(Je, [["render", Ke]]);
|
|
286
|
+
function X(e, t) {
|
|
287
|
+
if (!e)
|
|
299
288
|
return {
|
|
300
289
|
name: "",
|
|
301
290
|
email: "",
|
|
302
|
-
password:
|
|
291
|
+
password: Ie(),
|
|
303
292
|
roles: []
|
|
304
293
|
};
|
|
305
|
-
|
|
306
|
-
|
|
294
|
+
const r = t.filter(
|
|
295
|
+
(m) => e.roles.some((d) => d.id === m.value)
|
|
296
|
+
);
|
|
307
297
|
return {
|
|
308
|
-
name:
|
|
309
|
-
email:
|
|
298
|
+
name: e.name,
|
|
299
|
+
email: e.email,
|
|
310
300
|
password: "",
|
|
311
|
-
roles:
|
|
301
|
+
roles: r
|
|
312
302
|
};
|
|
313
303
|
}
|
|
314
|
-
function
|
|
304
|
+
function Se(e, t = []) {
|
|
315
305
|
return {
|
|
316
|
-
name:
|
|
317
|
-
email:
|
|
318
|
-
roles:
|
|
319
|
-
password:
|
|
320
|
-
params:
|
|
321
|
-
value:
|
|
322
|
-
name:
|
|
306
|
+
name: e.name,
|
|
307
|
+
email: e.email,
|
|
308
|
+
roles: e.roles.map((r) => r.value),
|
|
309
|
+
password: e.password,
|
|
310
|
+
params: t.map((r) => ({
|
|
311
|
+
value: be.getOutgoingValue(r),
|
|
312
|
+
name: r.config.name
|
|
323
313
|
}))
|
|
324
314
|
};
|
|
325
315
|
}
|
|
326
|
-
function
|
|
316
|
+
function We(e, t = []) {
|
|
327
317
|
return {
|
|
328
|
-
...
|
|
318
|
+
...Se(e, t)
|
|
329
319
|
};
|
|
330
320
|
}
|
|
331
|
-
function
|
|
332
|
-
return
|
|
333
|
-
value:
|
|
334
|
-
label:
|
|
321
|
+
function Xe(e) {
|
|
322
|
+
return e.map((t) => ({
|
|
323
|
+
value: t.id,
|
|
324
|
+
label: t.name
|
|
335
325
|
}));
|
|
336
326
|
}
|
|
337
|
-
const
|
|
327
|
+
const Ye = z({
|
|
338
328
|
name: "AdminForm",
|
|
339
329
|
components: {
|
|
340
|
-
DynamicField,
|
|
341
|
-
TabList,
|
|
342
|
-
Page,
|
|
343
|
-
FormFooter,
|
|
344
|
-
FormField,
|
|
345
|
-
FormFieldMultiSelect
|
|
330
|
+
DynamicField: Me,
|
|
331
|
+
TabList: Ee,
|
|
332
|
+
Page: j,
|
|
333
|
+
FormFooter: ve,
|
|
334
|
+
FormField: ge,
|
|
335
|
+
FormFieldMultiSelect: fe
|
|
346
336
|
},
|
|
347
337
|
setup() {
|
|
348
|
-
const { t } =
|
|
349
|
-
|
|
350
|
-
const router = useRouter();
|
|
351
|
-
const toast = useToast();
|
|
352
|
-
const adminId = computed(() => route.params.adminId);
|
|
353
|
-
const isCreation = computed(() => adminId.value === "create");
|
|
354
|
-
const [fetchAdmin, { data: admin, loading: isAdminLoading }] = useResource({
|
|
355
|
-
fetchResource: () => getAdmin(adminId.value),
|
|
338
|
+
const { t: e } = q(), t = Le(), r = he(), m = re(), d = R(() => t.params.adminId), s = R(() => d.value === "create"), [c, { data: n, loading: p }] = P({
|
|
339
|
+
fetchResource: () => qe(d.value),
|
|
356
340
|
initialValue: null,
|
|
357
341
|
resourceName: "Admin"
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
fetchResource: getRoleList,
|
|
342
|
+
}), [f, { data: v, loading: a }] = P({
|
|
343
|
+
fetchResource: ye,
|
|
361
344
|
initialValue: [],
|
|
362
345
|
resourceName: "Role List"
|
|
363
|
-
})
|
|
364
|
-
|
|
365
|
-
fetchResource: getFieldList,
|
|
346
|
+
}), [o, { data: u, loading: A }] = P({
|
|
347
|
+
fetchResource: Oe,
|
|
366
348
|
initialValue: [],
|
|
367
349
|
resourceName: "Field List"
|
|
368
350
|
});
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
fetchFieldList();
|
|
372
|
-
updateTemplateValues();
|
|
373
|
-
if (isCreation.value)
|
|
374
|
-
return;
|
|
375
|
-
fetchAdmin();
|
|
351
|
+
H(() => {
|
|
352
|
+
f(), o(), x(), !s.value && c();
|
|
376
353
|
});
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
354
|
+
const y = R(
|
|
355
|
+
() => Xe(v.value)
|
|
356
|
+
), T = D(
|
|
357
|
+
X(n.value, y.value)
|
|
358
|
+
), O = D({}), B = D(!1);
|
|
359
|
+
Z([n, y], () => {
|
|
360
|
+
T.value = X(
|
|
361
|
+
n.value,
|
|
362
|
+
y.value
|
|
363
|
+
);
|
|
383
364
|
});
|
|
384
|
-
function
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
if (event.type === "create_exit" || event.type === "save_exit") {
|
|
396
|
-
navigateBack(router, getAdminListUrl());
|
|
397
|
-
}
|
|
398
|
-
if (event.type === "create_create-another") {
|
|
399
|
-
values.value = convertAdminToFormValues(null, roleOptionList.value);
|
|
400
|
-
}
|
|
401
|
-
toast.show({
|
|
365
|
+
function M(U) {
|
|
366
|
+
if (n.value && n.value.isSelf) return;
|
|
367
|
+
const _ = We(
|
|
368
|
+
T.value,
|
|
369
|
+
N.value
|
|
370
|
+
), W = Se(
|
|
371
|
+
T.value,
|
|
372
|
+
N.value
|
|
373
|
+
);
|
|
374
|
+
(s.value ? ze(_) : He(d.value, W)).then(({ data: E }) => {
|
|
375
|
+
O.value = {}, U.type === "create" && r.push(Ae({ adminId: E.id })), (U.type === "create_exit" || U.type === "save_exit") && se(r, oe()), U.type === "create_create-another" && (T.value = X(null, y.value)), m.show({
|
|
402
376
|
variant: "success",
|
|
403
|
-
title:
|
|
404
|
-
body:
|
|
377
|
+
title: e("administrators:success"),
|
|
378
|
+
body: s.value ? e("administrators:adminSuccessfullyCreated") : e("administrators:adminSuccessfullyUpdated")
|
|
405
379
|
});
|
|
406
|
-
}).catch((
|
|
407
|
-
console.error(
|
|
408
|
-
errors.value = convertRequestErrorToMap(error);
|
|
409
|
-
toast.show({
|
|
380
|
+
}).catch((E) => {
|
|
381
|
+
console.error(E), O.value = ie(E), m.show({
|
|
410
382
|
variant: "danger",
|
|
411
|
-
title:
|
|
412
|
-
body:
|
|
383
|
+
title: e("administrators:error"),
|
|
384
|
+
body: s.value ? e("administrators:adminCreationError") : e("administrators:adminUpdateError")
|
|
413
385
|
});
|
|
414
386
|
}).finally(() => {
|
|
415
|
-
|
|
387
|
+
B.value = !1;
|
|
416
388
|
});
|
|
417
389
|
}
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
390
|
+
const K = R(() => s.value ? e("administrators:createAdmin") : `${e("administrators:updateAdmin")} "${T.value.name}"`), Q = R(
|
|
391
|
+
() => p.value || a.value || A.value
|
|
392
|
+
), G = R(
|
|
393
|
+
() => u.value.length > 0
|
|
394
|
+
), $ = R(() => [
|
|
395
|
+
{ id: "general", label: e("administrators:tabs.general") },
|
|
396
|
+
G.value ? { id: "params", label: e("administrators:tabs.params") } : null
|
|
397
|
+
].filter($e)), De = D($.value[0].id), N = D([]);
|
|
398
|
+
function x() {
|
|
399
|
+
var _;
|
|
400
|
+
const U = ((_ = n.value) == null ? void 0 : _.params) ?? [];
|
|
401
|
+
N.value = u.value.map(
|
|
402
|
+
(W, ee) => {
|
|
403
|
+
var E;
|
|
404
|
+
return be.createFormField(
|
|
405
|
+
W,
|
|
406
|
+
(E = U[ee]) == null ? void 0 : E.value
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
);
|
|
438
410
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
})
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
templateValues
|
|
411
|
+
return Z([n, u], () => {
|
|
412
|
+
x();
|
|
413
|
+
}), {
|
|
414
|
+
t: e,
|
|
415
|
+
backButtonUrl: oe(),
|
|
416
|
+
values: T,
|
|
417
|
+
errors: O,
|
|
418
|
+
isSubmitting: B,
|
|
419
|
+
submitForm: M,
|
|
420
|
+
isContentLoading: Q,
|
|
421
|
+
admin: n,
|
|
422
|
+
pageTitle: K,
|
|
423
|
+
isCreation: s,
|
|
424
|
+
roleOptionList: y,
|
|
425
|
+
tabList: $,
|
|
426
|
+
selectedTabId: De,
|
|
427
|
+
templateValues: N
|
|
457
428
|
};
|
|
458
429
|
}
|
|
459
430
|
});
|
|
460
|
-
function
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
const _component_FormFooter = resolveComponent("FormFooter");
|
|
466
|
-
const _component_Page = resolveComponent("Page");
|
|
467
|
-
return openBlock(), createBlock(_component_Page, {
|
|
468
|
-
title: _ctx.pageTitle,
|
|
469
|
-
"is-content-loading": _ctx.isContentLoading
|
|
431
|
+
function Ze(e, t, r, m, d, s) {
|
|
432
|
+
const c = l("TabList"), n = l("FormField"), p = l("FormFieldMultiSelect"), f = l("DynamicField"), v = l("FormFooter"), a = l("Page");
|
|
433
|
+
return i(), S(a, {
|
|
434
|
+
title: e.pageTitle,
|
|
435
|
+
"is-content-loading": e.isContentLoading
|
|
470
436
|
}, {
|
|
471
|
-
footer:
|
|
472
|
-
|
|
473
|
-
"back-href":
|
|
474
|
-
"is-submitting":
|
|
475
|
-
"is-creation":
|
|
476
|
-
"can-create-another":
|
|
477
|
-
onSubmit:
|
|
437
|
+
footer: b(() => [
|
|
438
|
+
g(v, {
|
|
439
|
+
"back-href": e.backButtonUrl,
|
|
440
|
+
"is-submitting": e.isSubmitting,
|
|
441
|
+
"is-creation": e.isCreation,
|
|
442
|
+
"can-create-another": e.isCreation,
|
|
443
|
+
onSubmit: e.submitForm
|
|
478
444
|
}, null, 8, ["back-href", "is-submitting", "is-creation", "can-create-another", "onSubmit"])
|
|
479
445
|
]),
|
|
480
|
-
default:
|
|
481
|
-
|
|
446
|
+
default: b(() => [
|
|
447
|
+
C("form", {
|
|
482
448
|
novalidate: "",
|
|
483
|
-
onSubmit:
|
|
449
|
+
onSubmit: t[5] || (t[5] = le(() => {
|
|
484
450
|
}, ["prevent"]))
|
|
485
451
|
}, [
|
|
486
|
-
|
|
487
|
-
"tab-id":
|
|
488
|
-
"onUpdate:tab-id":
|
|
489
|
-
"tab-list":
|
|
452
|
+
g(c, {
|
|
453
|
+
"tab-id": e.selectedTabId,
|
|
454
|
+
"onUpdate:tab-id": t[0] || (t[0] = (o) => e.selectedTabId = o),
|
|
455
|
+
"tab-list": e.tabList
|
|
490
456
|
}, null, 8, ["tab-id", "tab-list"]),
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
value:
|
|
494
|
-
"onUpdate:value":
|
|
457
|
+
e.selectedTabId === "general" ? (i(), F(k, { key: 0 }, [
|
|
458
|
+
g(n, {
|
|
459
|
+
value: e.values.name,
|
|
460
|
+
"onUpdate:value": t[1] || (t[1] = (o) => e.values.name = o),
|
|
495
461
|
name: "name",
|
|
496
|
-
error:
|
|
497
|
-
label:
|
|
462
|
+
error: e.errors.name,
|
|
463
|
+
label: e.$i18n.t("administrators:name")
|
|
498
464
|
}, null, 8, ["value", "error", "label"]),
|
|
499
|
-
|
|
500
|
-
value:
|
|
501
|
-
"onUpdate:value":
|
|
465
|
+
g(n, {
|
|
466
|
+
value: e.values.email,
|
|
467
|
+
"onUpdate:value": t[2] || (t[2] = (o) => e.values.email = o),
|
|
502
468
|
name: "email",
|
|
503
|
-
error:
|
|
504
|
-
label:
|
|
469
|
+
error: e.errors.email,
|
|
470
|
+
label: e.$i18n.t("administrators:email")
|
|
505
471
|
}, null, 8, ["value", "error", "label"]),
|
|
506
|
-
|
|
507
|
-
"selected-options":
|
|
508
|
-
"onUpdate:selected-options":
|
|
472
|
+
g(p, {
|
|
473
|
+
"selected-options": e.values.roles,
|
|
474
|
+
"onUpdate:selected-options": t[3] || (t[3] = (o) => e.values.roles = o),
|
|
509
475
|
name: "roles",
|
|
510
|
-
label:
|
|
511
|
-
options:
|
|
512
|
-
error:
|
|
476
|
+
label: e.$i18n.t("administrators:roles"),
|
|
477
|
+
options: e.roleOptionList,
|
|
478
|
+
error: e.errors.roles
|
|
513
479
|
}, null, 8, ["selected-options", "label", "options", "error"]),
|
|
514
|
-
|
|
515
|
-
value:
|
|
516
|
-
"onUpdate:value":
|
|
480
|
+
g(n, {
|
|
481
|
+
value: e.values.password,
|
|
482
|
+
"onUpdate:value": t[4] || (t[4] = (o) => e.values.password = o),
|
|
517
483
|
name: "password",
|
|
518
|
-
error:
|
|
519
|
-
label:
|
|
484
|
+
error: e.errors.password,
|
|
485
|
+
label: e.isCreation ? e.$i18n.t("administrators:password") : e.$i18n.t("administrators:newPassword")
|
|
520
486
|
}, null, 8, ["value", "error", "label"])
|
|
521
|
-
], 64)) :
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
}, null, 8, ["field"]);
|
|
527
|
-
}), 128)) : createCommentVNode("", true)
|
|
487
|
+
], 64)) : I("", !0),
|
|
488
|
+
e.selectedTabId === "params" ? (i(!0), F(k, { key: 1 }, V(e.templateValues, (o) => (i(), S(f, {
|
|
489
|
+
key: o.config.name,
|
|
490
|
+
field: o
|
|
491
|
+
}, null, 8, ["field"]))), 128)) : I("", !0)
|
|
528
492
|
], 32)
|
|
529
493
|
]),
|
|
530
494
|
_: 1
|
|
531
495
|
}, 8, ["title", "is-content-loading"]);
|
|
532
496
|
}
|
|
533
|
-
|
|
534
|
-
var RoleList_vue_vue_type_style_index_0_lang = "";
|
|
535
|
-
const _sfc_main$1 = defineComponent({
|
|
497
|
+
const Ge = /* @__PURE__ */ J(Ye, [["render", Ze]]), xe = z({
|
|
536
498
|
name: "RoleList",
|
|
537
499
|
components: {
|
|
538
|
-
Page,
|
|
539
|
-
DeleteIcon,
|
|
540
|
-
EditIcon,
|
|
541
|
-
DataTable,
|
|
542
|
-
BaseButton
|
|
500
|
+
Page: j,
|
|
501
|
+
DeleteIcon: ue,
|
|
502
|
+
EditIcon: de,
|
|
503
|
+
DataTable: ce,
|
|
504
|
+
BaseButton: me
|
|
543
505
|
},
|
|
544
506
|
setup() {
|
|
545
|
-
const { t } =
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
fetchEntityList: (params) => getRoleList(),
|
|
507
|
+
const { t: e } = q(), {
|
|
508
|
+
fetchEntityList: t,
|
|
509
|
+
isLoading: r,
|
|
510
|
+
rowData: m,
|
|
511
|
+
errorMessage: d
|
|
512
|
+
} = pe({
|
|
513
|
+
fetchEntityList: (a) => ye(),
|
|
553
514
|
initialValue: [],
|
|
554
515
|
resourceName: "Role list",
|
|
555
516
|
pageSize: 100
|
|
556
517
|
});
|
|
557
|
-
|
|
558
|
-
|
|
518
|
+
H(() => {
|
|
519
|
+
t();
|
|
559
520
|
});
|
|
560
521
|
const {
|
|
561
|
-
handleResourceDelete:
|
|
562
|
-
isDeleting
|
|
563
|
-
} =
|
|
564
|
-
deleteResource:
|
|
522
|
+
handleResourceDelete: s,
|
|
523
|
+
isDeleting: c
|
|
524
|
+
} = ne({
|
|
525
|
+
deleteResource: Ne,
|
|
565
526
|
resourceName: "Role",
|
|
566
|
-
onSuccess:
|
|
527
|
+
onSuccess: t
|
|
567
528
|
});
|
|
568
|
-
function
|
|
569
|
-
return
|
|
529
|
+
function n(a) {
|
|
530
|
+
return c(a) || r.value;
|
|
570
531
|
}
|
|
571
|
-
function
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
});
|
|
580
|
-
return Array.from(map.entries()).map(([key, value]) => ({
|
|
581
|
-
module: key,
|
|
582
|
-
scopes: value
|
|
532
|
+
function p(a) {
|
|
533
|
+
const o = /* @__PURE__ */ new Map();
|
|
534
|
+
return a.forEach((u) => {
|
|
535
|
+
const A = u.module, y = o.get(A) ?? [];
|
|
536
|
+
y.push(u), o.set(A, y);
|
|
537
|
+
}), Array.from(o.entries()).map(([u, A]) => ({
|
|
538
|
+
module: u,
|
|
539
|
+
scopes: A
|
|
583
540
|
}));
|
|
584
541
|
}
|
|
585
|
-
function
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
}
|
|
589
|
-
if (restPrivilegesCount > 1) {
|
|
590
|
-
return t("administrators:andMorePrivilege", {
|
|
591
|
-
count: restPrivilegesCount
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
return "";
|
|
542
|
+
function f(a) {
|
|
543
|
+
return a === 1 ? e("administrators:andMorePrivilege", { count: 1 }) : a > 1 ? e("administrators:andMorePrivilege", {
|
|
544
|
+
count: a
|
|
545
|
+
}) : "";
|
|
595
546
|
}
|
|
596
|
-
const columnDefs = [
|
|
597
|
-
{
|
|
598
|
-
id: 1,
|
|
599
|
-
name: t("administrators:role"),
|
|
600
|
-
field: "name"
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
id: 2,
|
|
604
|
-
name: t("administrators:privileges"),
|
|
605
|
-
field: "scope"
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
id: 3,
|
|
609
|
-
name: t("administrators:actions"),
|
|
610
|
-
field: "actions",
|
|
611
|
-
style: { width: "180px", textAlign: "center", whiteSpace: "nowrap" },
|
|
612
|
-
headStyle: { width: "180px", textAlign: "center" }
|
|
613
|
-
}
|
|
614
|
-
];
|
|
615
547
|
return {
|
|
616
|
-
columnDefs
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
548
|
+
columnDefs: [
|
|
549
|
+
{
|
|
550
|
+
id: 1,
|
|
551
|
+
name: e("administrators:role"),
|
|
552
|
+
field: "name"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
id: 2,
|
|
556
|
+
name: e("administrators:privileges"),
|
|
557
|
+
field: "scope"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
id: 3,
|
|
561
|
+
name: e("administrators:actions"),
|
|
562
|
+
field: "actions",
|
|
563
|
+
style: { width: "180px", textAlign: "center", whiteSpace: "nowrap" },
|
|
564
|
+
headStyle: { width: "180px", textAlign: "center" }
|
|
565
|
+
}
|
|
566
|
+
],
|
|
567
|
+
rowData: m,
|
|
568
|
+
isRowDataLoading: r,
|
|
569
|
+
errorMessage: d,
|
|
570
|
+
isBusy: n,
|
|
571
|
+
handleRoleDelete: s,
|
|
572
|
+
getRoleFormUrl: Fe,
|
|
573
|
+
getScopeGroupList: p,
|
|
574
|
+
getRestScopesText: f,
|
|
625
575
|
scopesPerModuleCount: 3
|
|
626
576
|
};
|
|
627
577
|
}
|
|
628
|
-
})
|
|
629
|
-
const _hoisted_1 = {
|
|
578
|
+
}), et = {
|
|
630
579
|
key: 0,
|
|
631
580
|
class: "no-scopes"
|
|
632
|
-
}
|
|
633
|
-
const _hoisted_2 = { key: 1 };
|
|
634
|
-
const _hoisted_3 = { class: "module-name" };
|
|
635
|
-
const _hoisted_4 = { class: "scope-list" };
|
|
636
|
-
const _hoisted_5 = {
|
|
581
|
+
}, tt = { key: 1 }, at = { class: "module-name" }, ot = { class: "scope-list" }, nt = {
|
|
637
582
|
key: 0,
|
|
638
583
|
class: "rest-scopes-text"
|
|
639
584
|
};
|
|
640
|
-
function
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
const _component_DataTable = resolveComponent("DataTable");
|
|
645
|
-
const _component_Page = resolveComponent("Page");
|
|
646
|
-
return openBlock(), createBlock(_component_Page, {
|
|
647
|
-
title: _ctx.$i18n.t("administrators:listOfRoles"),
|
|
585
|
+
function rt(e, t, r, m, d, s) {
|
|
586
|
+
const c = l("EditIcon"), n = l("BaseButton"), p = l("DeleteIcon"), f = l("DataTable"), v = l("Page");
|
|
587
|
+
return i(), S(v, {
|
|
588
|
+
title: e.$i18n.t("administrators:listOfRoles"),
|
|
648
589
|
"header-buttons": [
|
|
649
590
|
{
|
|
650
|
-
text:
|
|
651
|
-
href:
|
|
591
|
+
text: e.$i18n.t("administrators:addRole"),
|
|
592
|
+
href: e.getRoleFormUrl({ roleId: "create" })
|
|
652
593
|
}
|
|
653
594
|
]
|
|
654
595
|
}, {
|
|
655
|
-
default:
|
|
656
|
-
|
|
657
|
-
"column-defs":
|
|
658
|
-
"row-data":
|
|
659
|
-
loading:
|
|
660
|
-
"error-message":
|
|
596
|
+
default: b(() => [
|
|
597
|
+
g(f, {
|
|
598
|
+
"column-defs": e.columnDefs,
|
|
599
|
+
"row-data": e.rowData,
|
|
600
|
+
loading: e.isRowDataLoading,
|
|
601
|
+
"error-message": e.errorMessage
|
|
661
602
|
}, {
|
|
662
|
-
"cell(scope)":
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
603
|
+
"cell(scope)": b(({ row: a }) => [
|
|
604
|
+
a.scopes.length === 0 ? (i(), F("span", et, w(e.$i18n.t("administrators:noPrivileges")), 1)) : I("", !0),
|
|
605
|
+
a.isSuperAdmin ? (i(), F("span", tt, w(e.$i18n.t("administrators:all")), 1)) : (i(!0), F(k, { key: 2 }, V(e.getScopeGroupList(a.scopes), (o) => (i(), F("div", {
|
|
606
|
+
key: o.module,
|
|
607
|
+
class: "scope-group"
|
|
608
|
+
}, [
|
|
609
|
+
C("span", at, w(o.module), 1),
|
|
610
|
+
C("ul", ot, [
|
|
611
|
+
(i(!0), F(k, null, V(o.scopes.slice(
|
|
612
|
+
0,
|
|
613
|
+
e.scopesPerModuleCount
|
|
614
|
+
), (u) => (i(), F("li", {
|
|
615
|
+
key: u.value
|
|
616
|
+
}, [
|
|
617
|
+
C("span", null, "— " + w(u.label), 1)
|
|
618
|
+
]))), 128))
|
|
619
|
+
]),
|
|
620
|
+
o.scopes.length > e.scopesPerModuleCount ? (i(), F("span", nt, w(e.getRestScopesText(
|
|
621
|
+
o.scopes.length - e.scopesPerModuleCount
|
|
622
|
+
)), 1)) : I("", !0)
|
|
623
|
+
]))), 128))
|
|
682
624
|
]),
|
|
683
|
-
"cell(actions)":
|
|
684
|
-
|
|
625
|
+
"cell(actions)": b(({ row: a }) => [
|
|
626
|
+
g(n, {
|
|
685
627
|
variant: "icon",
|
|
686
|
-
title:
|
|
687
|
-
disabled:
|
|
688
|
-
href:
|
|
628
|
+
title: e.$i18n.t("administrators:edit"),
|
|
629
|
+
disabled: e.isBusy(a.id),
|
|
630
|
+
href: e.getRoleFormUrl({ roleId: a.id })
|
|
689
631
|
}, {
|
|
690
|
-
default:
|
|
691
|
-
|
|
632
|
+
default: b(() => [
|
|
633
|
+
g(c)
|
|
692
634
|
]),
|
|
693
635
|
_: 2
|
|
694
636
|
}, 1032, ["title", "disabled", "href"]),
|
|
695
|
-
|
|
637
|
+
a.isSuperAdmin ? I("", !0) : (i(), S(n, {
|
|
696
638
|
key: 0,
|
|
697
639
|
variant: "icon",
|
|
698
|
-
title:
|
|
699
|
-
disabled:
|
|
700
|
-
onClick: (
|
|
640
|
+
title: e.$i18n.t("administrators:delete"),
|
|
641
|
+
disabled: e.isBusy(a.id),
|
|
642
|
+
onClick: (o) => e.handleRoleDelete(a.id)
|
|
701
643
|
}, {
|
|
702
|
-
default:
|
|
703
|
-
|
|
644
|
+
default: b(() => [
|
|
645
|
+
g(p)
|
|
704
646
|
]),
|
|
705
647
|
_: 2
|
|
706
|
-
}, 1032, ["title", "disabled", "onClick"]))
|
|
648
|
+
}, 1032, ["title", "disabled", "onClick"]))
|
|
707
649
|
]),
|
|
708
650
|
_: 1
|
|
709
651
|
}, 8, ["column-defs", "row-data", "loading", "error-message"])
|
|
@@ -711,230 +653,214 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
711
653
|
_: 1
|
|
712
654
|
}, 8, ["title", "header-buttons"]);
|
|
713
655
|
}
|
|
714
|
-
|
|
715
|
-
function
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
name: role.name,
|
|
725
|
-
scopes: role.scopes,
|
|
726
|
-
isSuperAdmin: role.isSuperAdmin
|
|
656
|
+
const st = /* @__PURE__ */ J(xe, [["render", rt]]);
|
|
657
|
+
function Y(e) {
|
|
658
|
+
return e ? {
|
|
659
|
+
name: e.name,
|
|
660
|
+
scopes: e.scopes,
|
|
661
|
+
isSuperAdmin: e.isSuperAdmin
|
|
662
|
+
} : {
|
|
663
|
+
name: "",
|
|
664
|
+
scopes: [],
|
|
665
|
+
isSuperAdmin: !1
|
|
727
666
|
};
|
|
728
667
|
}
|
|
729
|
-
function
|
|
668
|
+
function Te(e) {
|
|
730
669
|
return {
|
|
731
|
-
name:
|
|
732
|
-
scopes:
|
|
670
|
+
name: e.name,
|
|
671
|
+
scopes: e.scopes.map((t) => t.value)
|
|
733
672
|
};
|
|
734
673
|
}
|
|
735
|
-
function
|
|
674
|
+
function it(e) {
|
|
736
675
|
return {
|
|
737
|
-
...
|
|
676
|
+
...Te(e)
|
|
738
677
|
};
|
|
739
678
|
}
|
|
740
|
-
function
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
679
|
+
function lt(e) {
|
|
680
|
+
return e ? e.groups.map(
|
|
681
|
+
(t) => t.scopes.map((r) => ({
|
|
682
|
+
value: r.value,
|
|
683
|
+
label: `${t.name}: ${r.label}`
|
|
684
|
+
}))
|
|
685
|
+
).flat() : [];
|
|
747
686
|
}
|
|
748
|
-
|
|
749
|
-
const _sfc_main = defineComponent({
|
|
687
|
+
const dt = z({
|
|
750
688
|
name: "RoleForm",
|
|
751
|
-
components: { Page, FormFooter, FormField, FormFieldMultiSelect },
|
|
689
|
+
components: { Page: j, FormFooter: ve, FormField: ge, FormFieldMultiSelect: fe },
|
|
752
690
|
setup() {
|
|
753
|
-
const { t } =
|
|
754
|
-
|
|
755
|
-
const router = useRouter();
|
|
756
|
-
const toast = useToast();
|
|
757
|
-
const roleId = computed(() => route.params.roleId);
|
|
758
|
-
const isCreation = computed(() => roleId.value === "create");
|
|
759
|
-
const [fetchRole, { data: role, loading: isRoleLoading }] = useResource({
|
|
760
|
-
fetchResource: () => getRole(roleId.value),
|
|
691
|
+
const { t: e } = q(), t = Le(), r = he(), m = re(), d = R(() => t.params.roleId), s = R(() => d.value === "create"), [c, { data: n, loading: p }] = P({
|
|
692
|
+
fetchResource: () => Pe(d.value),
|
|
761
693
|
initialValue: null,
|
|
762
694
|
resourceName: "Role"
|
|
763
|
-
})
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
fetchResource: getScopes,
|
|
695
|
+
}), [
|
|
696
|
+
f,
|
|
697
|
+
{ data: v, loading: a }
|
|
698
|
+
] = P({
|
|
699
|
+
fetchResource: _e,
|
|
769
700
|
initialValue: null,
|
|
770
701
|
resourceName: "Scope list"
|
|
771
702
|
});
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
if (isCreation.value)
|
|
775
|
-
return;
|
|
776
|
-
fetchRole();
|
|
703
|
+
H(() => {
|
|
704
|
+
f(), !s.value && c();
|
|
777
705
|
});
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
values.value = convertRoleToFormValues(role.value);
|
|
706
|
+
const o = R(
|
|
707
|
+
() => lt(v.value)
|
|
708
|
+
), u = D(Y(n.value)), A = D({}), y = D(!1);
|
|
709
|
+
Z(n, () => {
|
|
710
|
+
u.value = Y(n.value);
|
|
784
711
|
});
|
|
785
|
-
function
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
requestPromise.then(({ data }) => {
|
|
790
|
-
errors.value = {};
|
|
791
|
-
if (event.type === "create") {
|
|
792
|
-
router.push(getRoleFormUrl({ roleId: data.id }));
|
|
793
|
-
}
|
|
794
|
-
if (event.type === "create_exit" || event.type === "save_exit") {
|
|
795
|
-
navigateBack(router, getRoleListUrl());
|
|
796
|
-
}
|
|
797
|
-
if (event.type === "create_create-another") {
|
|
798
|
-
values.value = convertRoleToFormValues(null);
|
|
799
|
-
}
|
|
800
|
-
toast.show({
|
|
712
|
+
function T(M) {
|
|
713
|
+
const K = Te(u.value), Q = it(u.value);
|
|
714
|
+
(s.value ? ke(K) : Be(d.value, Q)).then(({ data: $ }) => {
|
|
715
|
+
A.value = {}, M.type === "create" && r.push(Fe({ roleId: $.id })), (M.type === "create_exit" || M.type === "save_exit") && se(r, ae()), M.type === "create_create-another" && (u.value = Y(null)), m.show({
|
|
801
716
|
variant: "success",
|
|
802
|
-
title:
|
|
803
|
-
body:
|
|
717
|
+
title: e("administrators:success"),
|
|
718
|
+
body: s.value ? e("administrators:roleSuccessfullyCreated") : e("administrators:roleSuccessfullyUpdate")
|
|
804
719
|
});
|
|
805
|
-
}).catch((
|
|
806
|
-
console.error(
|
|
807
|
-
errors.value = convertRequestErrorToMap(error);
|
|
808
|
-
toast.show({
|
|
720
|
+
}).catch(($) => {
|
|
721
|
+
console.error($), A.value = ie($), m.show({
|
|
809
722
|
variant: "danger",
|
|
810
|
-
title:
|
|
811
|
-
body:
|
|
723
|
+
title: e("administrators:error"),
|
|
724
|
+
body: s.value ? e("administrators:roleCreationError") : e("administrators:roleUpdateError")
|
|
812
725
|
});
|
|
813
726
|
}).finally(() => {
|
|
814
|
-
|
|
727
|
+
y.value = !1;
|
|
815
728
|
});
|
|
816
729
|
}
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
const isContentLoading = computed(() => isRoleLoading.value || isScopeDataLoading.value);
|
|
730
|
+
const O = R(() => s.value ? e("administrators:createRole") : `${e("administrators:updateRole")} "${u.value.name}"`), B = R(
|
|
731
|
+
() => p.value || a.value
|
|
732
|
+
);
|
|
821
733
|
return {
|
|
822
|
-
backButtonUrl:
|
|
823
|
-
values,
|
|
824
|
-
errors,
|
|
825
|
-
isSubmitting,
|
|
826
|
-
submitForm,
|
|
827
|
-
isContentLoading,
|
|
828
|
-
role,
|
|
829
|
-
pageTitle,
|
|
830
|
-
isCreation,
|
|
831
|
-
scopeOptionList
|
|
734
|
+
backButtonUrl: ae(),
|
|
735
|
+
values: u,
|
|
736
|
+
errors: A,
|
|
737
|
+
isSubmitting: y,
|
|
738
|
+
submitForm: T,
|
|
739
|
+
isContentLoading: B,
|
|
740
|
+
role: n,
|
|
741
|
+
pageTitle: O,
|
|
742
|
+
isCreation: s,
|
|
743
|
+
scopeOptionList: o
|
|
832
744
|
};
|
|
833
745
|
}
|
|
834
746
|
});
|
|
835
|
-
function
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
return openBlock(), createBlock(_component_Page, {
|
|
841
|
-
title: _ctx.pageTitle,
|
|
842
|
-
"is-content-loading": _ctx.isContentLoading
|
|
747
|
+
function ut(e, t, r, m, d, s) {
|
|
748
|
+
const c = l("FormField"), n = l("FormFieldMultiSelect"), p = l("FormFooter"), f = l("Page");
|
|
749
|
+
return i(), S(f, {
|
|
750
|
+
title: e.pageTitle,
|
|
751
|
+
"is-content-loading": e.isContentLoading
|
|
843
752
|
}, {
|
|
844
|
-
footer:
|
|
845
|
-
|
|
846
|
-
"back-href":
|
|
847
|
-
|
|
848
|
-
"is-
|
|
849
|
-
"
|
|
850
|
-
|
|
851
|
-
}, null, 8, ["back-href", "
|
|
753
|
+
footer: b(() => [
|
|
754
|
+
g(p, {
|
|
755
|
+
"back-href": e.backButtonUrl,
|
|
756
|
+
"is-submitting": e.isSubmitting,
|
|
757
|
+
"is-creation": e.isCreation,
|
|
758
|
+
"can-create-another": e.isCreation,
|
|
759
|
+
onSubmit: e.submitForm
|
|
760
|
+
}, null, 8, ["back-href", "is-submitting", "is-creation", "can-create-another", "onSubmit"])
|
|
852
761
|
]),
|
|
853
|
-
default:
|
|
854
|
-
|
|
762
|
+
default: b(() => [
|
|
763
|
+
C("form", {
|
|
855
764
|
novalidate: "",
|
|
856
|
-
onSubmit:
|
|
765
|
+
onSubmit: t[2] || (t[2] = le(() => {
|
|
857
766
|
}, ["prevent"]))
|
|
858
767
|
}, [
|
|
859
|
-
|
|
860
|
-
value:
|
|
861
|
-
"onUpdate:value":
|
|
768
|
+
g(c, {
|
|
769
|
+
value: e.values.name,
|
|
770
|
+
"onUpdate:value": t[0] || (t[0] = (v) => e.values.name = v),
|
|
862
771
|
name: "name",
|
|
863
|
-
error:
|
|
864
|
-
label:
|
|
772
|
+
error: e.errors.name,
|
|
773
|
+
label: e.$i18n.t("administrators:name")
|
|
865
774
|
}, null, 8, ["value", "error", "label"]),
|
|
866
|
-
|
|
775
|
+
e.values.isSuperAdmin ? I("", !0) : (i(), S(n, {
|
|
867
776
|
key: 0,
|
|
868
|
-
"selected-options":
|
|
869
|
-
"onUpdate:selected-options":
|
|
777
|
+
"selected-options": e.values.scopes,
|
|
778
|
+
"onUpdate:selected-options": t[1] || (t[1] = (v) => e.values.scopes = v),
|
|
870
779
|
name: "scopes",
|
|
871
|
-
label:
|
|
872
|
-
options:
|
|
873
|
-
error:
|
|
874
|
-
}, null, 8, ["selected-options", "label", "options", "error"]))
|
|
780
|
+
label: e.$i18n.t("administrators:privileges"),
|
|
781
|
+
options: e.scopeOptionList,
|
|
782
|
+
error: e.errors.scopes
|
|
783
|
+
}, null, 8, ["selected-options", "label", "options", "error"]))
|
|
875
784
|
], 32)
|
|
876
785
|
]),
|
|
877
786
|
_: 1
|
|
878
787
|
}, 8, ["title", "is-content-loading"]);
|
|
879
788
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
component: AdminList,
|
|
789
|
+
const mt = /* @__PURE__ */ J(dt, [["render", ut], ["__scopeId", "data-v-2e498e82"]]), Lt = {
|
|
790
|
+
path: L.ADMIN_LIST,
|
|
791
|
+
component: Qe,
|
|
884
792
|
name: "AdminList",
|
|
885
793
|
meta: {
|
|
886
|
-
getBreadcrumbs: (
|
|
887
|
-
{ url: "/", text:
|
|
794
|
+
getBreadcrumbs: (e, t) => [
|
|
795
|
+
{ url: "/", text: t.t("administrators:home") },
|
|
888
796
|
{
|
|
889
|
-
url:
|
|
890
|
-
text:
|
|
797
|
+
url: L.ADMIN_LIST,
|
|
798
|
+
text: t.t("administrators:adminList")
|
|
891
799
|
}
|
|
892
800
|
]
|
|
893
801
|
}
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
component: AdminForm,
|
|
802
|
+
}, ht = {
|
|
803
|
+
path: L.ADMIN_FORM,
|
|
804
|
+
component: Ge,
|
|
898
805
|
name: "AdminForm",
|
|
899
806
|
meta: {
|
|
900
|
-
getBreadcrumbs: (
|
|
901
|
-
{ url: "/", text:
|
|
807
|
+
getBreadcrumbs: (e, t) => [
|
|
808
|
+
{ url: "/", text: t.t("administrators:home") },
|
|
902
809
|
{
|
|
903
|
-
url:
|
|
904
|
-
text:
|
|
810
|
+
url: L.ADMIN_LIST,
|
|
811
|
+
text: t.t("administrators:adminList")
|
|
905
812
|
},
|
|
906
|
-
{ url:
|
|
813
|
+
{ url: e.path, text: t.t("administrators:adminForm") }
|
|
907
814
|
]
|
|
908
815
|
}
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
component: RoleList,
|
|
816
|
+
}, yt = {
|
|
817
|
+
path: L.ROLE_LIST,
|
|
818
|
+
component: st,
|
|
913
819
|
name: "RoleList",
|
|
914
820
|
meta: {
|
|
915
|
-
getBreadcrumbs: (
|
|
916
|
-
{ url: "/", text:
|
|
821
|
+
getBreadcrumbs: (e, t) => [
|
|
822
|
+
{ url: "/", text: t.t("administrators:home") },
|
|
917
823
|
{
|
|
918
|
-
url:
|
|
919
|
-
text:
|
|
824
|
+
url: L.ROLE_LIST,
|
|
825
|
+
text: t.t("administrators:roleList")
|
|
920
826
|
}
|
|
921
827
|
]
|
|
922
828
|
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
component: RoleForm,
|
|
829
|
+
}, Ft = {
|
|
830
|
+
path: L.ROLE_FORM,
|
|
831
|
+
component: mt,
|
|
927
832
|
name: "RoleForm",
|
|
928
833
|
meta: {
|
|
929
|
-
getBreadcrumbs: (
|
|
930
|
-
{ url: "/", text:
|
|
834
|
+
getBreadcrumbs: (e, t) => [
|
|
835
|
+
{ url: "/", text: t.t("administrators:home") },
|
|
931
836
|
{
|
|
932
|
-
url:
|
|
933
|
-
text:
|
|
837
|
+
url: L.ROLE_LIST,
|
|
838
|
+
text: t.t("administrators:roleList")
|
|
934
839
|
},
|
|
935
|
-
{ url:
|
|
840
|
+
{ url: e.path, text: t.t("administrators:roleForm") }
|
|
936
841
|
]
|
|
937
842
|
}
|
|
938
843
|
};
|
|
939
|
-
|
|
940
|
-
export {
|
|
844
|
+
Ce();
|
|
845
|
+
export {
|
|
846
|
+
ht as ADMIN_FORM_ROUTE,
|
|
847
|
+
Lt as ADMIN_LIST_ROUTE,
|
|
848
|
+
Ft as ROLE_FORM_ROUTE,
|
|
849
|
+
yt as ROLE_LIST_ROUTE,
|
|
850
|
+
ze as createAdmin,
|
|
851
|
+
ke as createRole,
|
|
852
|
+
je as deleteAdmin,
|
|
853
|
+
Ne as deleteRole,
|
|
854
|
+
qe as getAdmin,
|
|
855
|
+
Ae as getAdminFormUrl,
|
|
856
|
+
Ve as getAdminList,
|
|
857
|
+
oe as getAdminListUrl,
|
|
858
|
+
Oe as getFieldList,
|
|
859
|
+
Pe as getRole,
|
|
860
|
+
Fe as getRoleFormUrl,
|
|
861
|
+
ye as getRoleList,
|
|
862
|
+
ae as getRoleListUrl,
|
|
863
|
+
_e as getScopes,
|
|
864
|
+
He as updateAdmin,
|
|
865
|
+
Be as updateRole
|
|
866
|
+
};
|