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