@deviceinsight/ng-ui-scale-lib 9.14.0
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/README.md +194 -0
- package/dist/AccessEditModal-a5347dbd.js +91 -0
- package/dist/BundleManagementContainer-842bd582.js +17 -0
- package/dist/BundlesContainer-44da5cdf.js +908 -0
- package/dist/ContextBarContext-f745a63a.js +95534 -0
- package/dist/DatapointImport-139761c5.js +860 -0
- package/dist/FileUploadInput-6dc037cb.js +44 -0
- package/dist/Files-cd57769d.js +360 -0
- package/dist/GlobalPowerBiReports-b5b89de7.js +11078 -0
- package/dist/Graph-c912ea08.js +25009 -0
- package/dist/JsonSettingWidget-3d9a995d.js +54 -0
- package/dist/LicensesEditPage-22cc7d68.js +143 -0
- package/dist/LicensesList-1f3f08e2.js +146 -0
- package/dist/PropertiesEditPage-c84dc0d9.js +370 -0
- package/dist/PropertiesList-fe8aa64d.js +265 -0
- package/dist/TemplateEditPage-f163ea2f.js +505 -0
- package/dist/TemplateTextInput-1ba4e19b.js +47 -0
- package/dist/TemplatesListPage-a11b0d84.js +326 -0
- package/dist/UserGroupAssignments-8710d8e3.js +293 -0
- package/dist/UserGroupTheme-0d0d7d48.js +280 -0
- package/dist/api.js +84 -0
- package/dist/consts-012135e5.js +33 -0
- package/dist/customFileCategories-1b64ed45.js +11 -0
- package/dist/extends-0a3e0827.js +13 -0
- package/dist/index-4f55daa8.js +18658 -0
- package/dist/index.js +17373 -0
- package/dist/react-router-f15627c1.js +1152 -0
- package/dist/setupRuntimeEnv.js +27 -0
- package/dist/style.css +1 -0
- package/dist/useCanDeleteBundleVersion-64f35949.js +45 -0
- package/package.json +161 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { at as e, ag as s, aU as y, db as B, a_ as P, ah as F, bL as V, bs as z, aj as N, d8 as W, dc as $ } from "./ContextBarContext-f745a63a.js";
|
|
2
|
+
import { useContext as H, useState as T, useCallback as q, useEffect as Y } from "react";
|
|
3
|
+
import { Link as J, useLocation as Q } from "react-router-dom";
|
|
4
|
+
import { fetchUserGroupById as O, fetchEmailTemplates as _, fetchEmailTemplateAccessById as X, updateEmailTemplate as Z, deleteEmailTemplate as ee } from "@deviceinsight/ng-ui-api-client";
|
|
5
|
+
import { Label as G, Button as C, Icon as te, Modal as ae, withConfirm as ne } from "@deviceinsight/ng-ui-basic-components";
|
|
6
|
+
import { MultiMenu as oe, MultiMenuItem as se, InfoBox as ie, messageBoxError as S, ContentHeader as le } from "@deviceinsight/ng-ui-components";
|
|
7
|
+
import { A as re } from "./AccessEditModal-a5347dbd.js";
|
|
8
|
+
import "react-dom";
|
|
9
|
+
function ce(r, l, c, h, u) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
name: "displayName",
|
|
13
|
+
label: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.columns.name", children: "Name" }),
|
|
14
|
+
width: "10%",
|
|
15
|
+
sortable: !0,
|
|
16
|
+
filterable: {
|
|
17
|
+
filterType: "text",
|
|
18
|
+
filterFn: (t, n) => (t.displayName || t.name).toLowerCase().indexOf(n.toLowerCase()) >= 0
|
|
19
|
+
},
|
|
20
|
+
render: (t) => t.id ? /* @__PURE__ */ e.jsx(J, { to: `./${t.id}`, children: t.displayName || t.name }) : "-"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "message",
|
|
24
|
+
label: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.columns.message", children: "Message" }),
|
|
25
|
+
width: "40%",
|
|
26
|
+
sortable: !0,
|
|
27
|
+
whiteSpace: "normal",
|
|
28
|
+
render: ({ text: t }) => t
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "subject",
|
|
32
|
+
label: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.columns.subject", children: "Subject" }),
|
|
33
|
+
width: "20%",
|
|
34
|
+
sortable: !0,
|
|
35
|
+
whiteSpace: "normal",
|
|
36
|
+
render: ({ subject: t }) => /* @__PURE__ */ e.jsx("span", { children: t }) || /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.noSubject", children: "None" })
|
|
37
|
+
},
|
|
38
|
+
y(["READ_ACCOUNT_GROUP"]) ? {
|
|
39
|
+
name: "userGroups",
|
|
40
|
+
label: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.columns.userGroups", children: "Authorised User Groups" }),
|
|
41
|
+
width: "10%",
|
|
42
|
+
whiteSpace: "normal",
|
|
43
|
+
filterable: {
|
|
44
|
+
filterType: "text",
|
|
45
|
+
filterFn: (t, n) => t.name.toLowerCase().includes(n.toLowerCase())
|
|
46
|
+
},
|
|
47
|
+
render: (t) => {
|
|
48
|
+
const { accountGroupsWithAccess: n } = t;
|
|
49
|
+
if (!n || !n.length)
|
|
50
|
+
return null;
|
|
51
|
+
function g(i) {
|
|
52
|
+
return u.find((d) => d.id === i) || {
|
|
53
|
+
displayName: "-",
|
|
54
|
+
id: i
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (n.length > 1)
|
|
58
|
+
return /* @__PURE__ */ e.jsx(
|
|
59
|
+
oe,
|
|
60
|
+
{
|
|
61
|
+
menuButton: /* @__PURE__ */ e.jsx(G, { text: `${n.length} User Groups` }),
|
|
62
|
+
children: n.map((i) => {
|
|
63
|
+
const d = g(i), x = n.filter(
|
|
64
|
+
(A) => A !== d.id
|
|
65
|
+
);
|
|
66
|
+
return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx(
|
|
67
|
+
G,
|
|
68
|
+
{
|
|
69
|
+
text: d.displayName || d.name,
|
|
70
|
+
onDelete: () => l(x, t)
|
|
71
|
+
}
|
|
72
|
+
) }, d.id);
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
{
|
|
77
|
+
const i = g(n[0]);
|
|
78
|
+
return /* @__PURE__ */ e.jsx(
|
|
79
|
+
G,
|
|
80
|
+
{
|
|
81
|
+
text: i.displayName || i.name,
|
|
82
|
+
onDelete: () => h(t)
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} : null,
|
|
88
|
+
y([["DELETE_NOTIFICATION_TEMPLATE"], ["READ_ACCOUNT_GROUP"]]) ? {
|
|
89
|
+
name: "actions",
|
|
90
|
+
label: "",
|
|
91
|
+
width: "10%",
|
|
92
|
+
align: "right",
|
|
93
|
+
render: (t) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
94
|
+
y([["READ_ACCOUNT_GROUP"]]) && /* @__PURE__ */ e.jsx(
|
|
95
|
+
C,
|
|
96
|
+
{
|
|
97
|
+
naked: !0,
|
|
98
|
+
onClick: () => c(t),
|
|
99
|
+
"data-testid": "edit-notification-template-access-button",
|
|
100
|
+
children: /* @__PURE__ */ e.jsx("img", { className: "di icon", src: B, alt: "key" })
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
y(["DELETE_NOTIFICATION_TEMPLATE"]) && /* @__PURE__ */ e.jsx(
|
|
104
|
+
C,
|
|
105
|
+
{
|
|
106
|
+
naked: !0,
|
|
107
|
+
onClick: () => r(t),
|
|
108
|
+
"data-testid": "delete-notification-template-button",
|
|
109
|
+
children: /* @__PURE__ */ e.jsx(te, { del: !0 })
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] })
|
|
113
|
+
} : null
|
|
114
|
+
].filter(P);
|
|
115
|
+
}
|
|
116
|
+
function ue({ onCancel: r, onSave: l, template: c }) {
|
|
117
|
+
const { t: h } = F(), u = y(["ACCESS_TO_ALL_NOTIFICATION_TEMPLATES"]), t = u ? h("notificationTemplate.access.delete.authorized", {
|
|
118
|
+
defaultValue: "You are about to remove all User Groups from a Template. Please note that for all other Users who don't have such Authorities like you (ACCESS_TO_ALL_NOTIFICATION_TEMPLATES), this Template will then be completely hidden!"
|
|
119
|
+
}) : h("notificationTemplate.access.delete.unauthorized", {
|
|
120
|
+
defaultValue: "You are about ot remove the last User Groups from a Template. Please note that you wouldn't be able to see it as you do not have the required Authorities. Please contact your Administrator."
|
|
121
|
+
});
|
|
122
|
+
return /* @__PURE__ */ e.jsx(
|
|
123
|
+
ae,
|
|
124
|
+
{
|
|
125
|
+
onOutsideClick: r,
|
|
126
|
+
header: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplate.access.delete.modal.title", children: "Remove all authorised User Groups from this Template" }),
|
|
127
|
+
content: /* @__PURE__ */ e.jsx(ie, { type: u ? "warning" : "error", icon: V, message: t }),
|
|
128
|
+
footer: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
129
|
+
u && /* @__PURE__ */ e.jsx(C, { onClick: () => l([], c), children: /* @__PURE__ */ e.jsx(s, { i18nKey: "general.actions.save", children: "Save" }) }),
|
|
130
|
+
/* @__PURE__ */ e.jsx(C, { onClick: () => r(), children: /* @__PURE__ */ e.jsx(s, { i18nKey: "general.actions.cancel", children: "Cancel" }) })
|
|
131
|
+
] })
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
const de = {
|
|
136
|
+
page: 0,
|
|
137
|
+
size: 10,
|
|
138
|
+
sort: {
|
|
139
|
+
property: "name",
|
|
140
|
+
direction: "ASC"
|
|
141
|
+
}
|
|
142
|
+
}, me = {
|
|
143
|
+
locale: "null",
|
|
144
|
+
page: 0,
|
|
145
|
+
size: 2e3
|
|
146
|
+
};
|
|
147
|
+
async function pe() {
|
|
148
|
+
const r = await _(me);
|
|
149
|
+
return await Promise.all(
|
|
150
|
+
r.map(async (l) => {
|
|
151
|
+
const { accountGroupIds: c } = await X(l.id);
|
|
152
|
+
return Promise.resolve({
|
|
153
|
+
...l,
|
|
154
|
+
accountGroupsWithAccess: c,
|
|
155
|
+
type: "email"
|
|
156
|
+
});
|
|
157
|
+
})
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
function fe({ confirm: r }) {
|
|
161
|
+
const { setContextInfo: l } = H(z), { pathname: c } = Q(), [h, u] = T([]), [t, n] = T(!0), [g, i] = T(!1), [d, x] = T(!1), [A, I] = T([]), [j, L] = T(), M = /* @__PURE__ */ e.jsx(s, { i18nKey: "portalAdmin.sidebarElements.templates.create", children: "Create new notification template" }), w = q(
|
|
162
|
+
(a) => {
|
|
163
|
+
l({
|
|
164
|
+
type: "search",
|
|
165
|
+
elements: a.length,
|
|
166
|
+
totalElements: a.length,
|
|
167
|
+
totalElementsAccurate: void 0,
|
|
168
|
+
context: "notificationtemplates",
|
|
169
|
+
pathname: c
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
[c, l]
|
|
173
|
+
);
|
|
174
|
+
async function D(a) {
|
|
175
|
+
n(!0);
|
|
176
|
+
try {
|
|
177
|
+
const o = await _({
|
|
178
|
+
name: a.name,
|
|
179
|
+
page: 0,
|
|
180
|
+
size: 2e3
|
|
181
|
+
});
|
|
182
|
+
await Promise.all(o.map((p) => ee(p.id)));
|
|
183
|
+
const m = A.filter((p) => p.name !== a.name);
|
|
184
|
+
I(m), w(m);
|
|
185
|
+
} catch (o) {
|
|
186
|
+
console.error("error occured while trying to delete the template", o), S(
|
|
187
|
+
/* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplate.list.deleteTemplate.error", children: "An error occurred while trying to delete the template" })
|
|
188
|
+
);
|
|
189
|
+
} finally {
|
|
190
|
+
n(!1);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function U(a) {
|
|
194
|
+
r(
|
|
195
|
+
{
|
|
196
|
+
id: "notificationTemplate.list.confirmDeleteTitle",
|
|
197
|
+
defaultValue: "Delete template"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "notificationTemplate.list.confirmDeleteMessage",
|
|
201
|
+
defaultValue: "Do you really want to delete this template?"
|
|
202
|
+
}
|
|
203
|
+
).then(() => D(a));
|
|
204
|
+
}
|
|
205
|
+
async function b(a, o) {
|
|
206
|
+
if (o) {
|
|
207
|
+
n(!0);
|
|
208
|
+
try {
|
|
209
|
+
const m = await _({
|
|
210
|
+
name: o.name,
|
|
211
|
+
page: 0,
|
|
212
|
+
size: 2e3
|
|
213
|
+
}), p = { ...o, accountGroupsWithAccess: a }, f = N.unionBy([p], A, "id");
|
|
214
|
+
await Promise.all(
|
|
215
|
+
m.map(
|
|
216
|
+
(E) => Z({
|
|
217
|
+
...E,
|
|
218
|
+
accountGroupsWithAccess: a
|
|
219
|
+
})
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
const R = [
|
|
223
|
+
...new Set(
|
|
224
|
+
N.flatten(
|
|
225
|
+
f.map(({ accountGroupsWithAccess: E }) => E).filter(Boolean)
|
|
226
|
+
)
|
|
227
|
+
)
|
|
228
|
+
], k = await Promise.all(R.map((E) => O(E)));
|
|
229
|
+
I(f), u(k), w(f);
|
|
230
|
+
} catch (m) {
|
|
231
|
+
console.error("error occured while trying to save access on template: ", m), S(
|
|
232
|
+
/* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplate.list.updateTemplate.error", children: "An error occured while trying to save access" })
|
|
233
|
+
);
|
|
234
|
+
} finally {
|
|
235
|
+
n(!1), x(!1), i(!1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function v(a) {
|
|
240
|
+
L(a), i(!0);
|
|
241
|
+
}
|
|
242
|
+
function K(a) {
|
|
243
|
+
L(a), x(!0);
|
|
244
|
+
}
|
|
245
|
+
return Y(() => {
|
|
246
|
+
let a = !1;
|
|
247
|
+
return (async () => {
|
|
248
|
+
try {
|
|
249
|
+
const o = await pe();
|
|
250
|
+
if (a)
|
|
251
|
+
return;
|
|
252
|
+
if (I(o), w(o), y(["READ_ACCOUNT_GROUP"])) {
|
|
253
|
+
const m = [
|
|
254
|
+
...new Set(N.flatten(o.map(({ accountGroupsWithAccess: f }) => f)))
|
|
255
|
+
].filter(P), p = await Promise.all(m.map((f) => O(f)));
|
|
256
|
+
u(p);
|
|
257
|
+
}
|
|
258
|
+
} catch (o) {
|
|
259
|
+
console.error("error occured while trying to fetch templates: ", o), S(
|
|
260
|
+
/* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplate.list.fetchTemplates.error", children: "An error occured while trying to fetch templates" })
|
|
261
|
+
);
|
|
262
|
+
} finally {
|
|
263
|
+
n(!1);
|
|
264
|
+
}
|
|
265
|
+
})(), () => {
|
|
266
|
+
a = !0, l();
|
|
267
|
+
};
|
|
268
|
+
}, []), /* @__PURE__ */ e.jsxs("div", { className: "template-list", children: [
|
|
269
|
+
/* @__PURE__ */ e.jsx(
|
|
270
|
+
le,
|
|
271
|
+
{
|
|
272
|
+
title: {
|
|
273
|
+
id: "route.label.templates.name",
|
|
274
|
+
defaultValue: "Notification Templates"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
/* @__PURE__ */ e.jsx(
|
|
279
|
+
W,
|
|
280
|
+
{
|
|
281
|
+
tooltip: M,
|
|
282
|
+
authorities: "WRITE_NOTIFICATION_TEMPLATE",
|
|
283
|
+
path: "/portaladmin/templates/create",
|
|
284
|
+
dataTestId: "create-template-button"
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ e.jsx(
|
|
288
|
+
$,
|
|
289
|
+
{
|
|
290
|
+
columnDefs: ce(
|
|
291
|
+
U,
|
|
292
|
+
b,
|
|
293
|
+
v,
|
|
294
|
+
K,
|
|
295
|
+
h
|
|
296
|
+
),
|
|
297
|
+
uniqueItemKey: (a) => `${a.id}`,
|
|
298
|
+
paginationSettings: de,
|
|
299
|
+
items: A,
|
|
300
|
+
isLoading: t,
|
|
301
|
+
"data-testid": "notification-templates-table"
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
g && j && /* @__PURE__ */ e.jsx(
|
|
305
|
+
re,
|
|
306
|
+
{
|
|
307
|
+
onCancel: () => i(!1),
|
|
308
|
+
onSave: b,
|
|
309
|
+
loading: t,
|
|
310
|
+
template: j
|
|
311
|
+
}
|
|
312
|
+
),
|
|
313
|
+
d && j && /* @__PURE__ */ e.jsx(
|
|
314
|
+
ue,
|
|
315
|
+
{
|
|
316
|
+
onCancel: () => x(!1),
|
|
317
|
+
onSave: b,
|
|
318
|
+
template: j
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
] });
|
|
322
|
+
}
|
|
323
|
+
const Ce = ne(fe);
|
|
324
|
+
export {
|
|
325
|
+
Ce as default
|
|
326
|
+
};
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { at as e, d9 as S, aN as E, bc as _, ah as N, aq as R, ag as o, bi as j, b4 as y, da as M } from "./ContextBarContext-f745a63a.js";
|
|
2
|
+
import { useState as A, useEffect as C } from "react";
|
|
3
|
+
import { ReactableWithClientSidePagination as U, messageBoxError as T, ContentHeader as w } from "@deviceinsight/ng-ui-components";
|
|
4
|
+
import { Button as x, Icon as b, Modal as K, useConfirm as V, SpinnerContainer as L } from "@deviceinsight/ng-ui-basic-components";
|
|
5
|
+
import { getInitialAccountGroupAssignmentRules as v, createInitialAccountGroupAssignmentRule as k, updateInitialAccountGroupAssignmentRule as q, deleteInitialAccountGroupAssignmentRule as H } from "@deviceinsight/ng-ui-api-client";
|
|
6
|
+
import "react-router-dom";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
function D() {
|
|
9
|
+
const [n, a] = A([]), [s, i] = A(!1), [f, m] = A(null);
|
|
10
|
+
C(() => {
|
|
11
|
+
i(!0);
|
|
12
|
+
let r = !1;
|
|
13
|
+
return v().then((l) => {
|
|
14
|
+
r || (a(l), i(!1));
|
|
15
|
+
}).catch((l) => {
|
|
16
|
+
r || (m(l), i(!1));
|
|
17
|
+
}), () => {
|
|
18
|
+
r = !0;
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
async function g(r) {
|
|
22
|
+
try {
|
|
23
|
+
i(!0);
|
|
24
|
+
const l = await k(r);
|
|
25
|
+
a([...n, l]);
|
|
26
|
+
} finally {
|
|
27
|
+
i(!1);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function c(r, l) {
|
|
31
|
+
try {
|
|
32
|
+
i(!0);
|
|
33
|
+
const u = await q(r, l);
|
|
34
|
+
a(n.map((t) => t.name === r ? u : t));
|
|
35
|
+
} finally {
|
|
36
|
+
i(!1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function d(r) {
|
|
40
|
+
try {
|
|
41
|
+
i(!0), await H(r), a(n.filter((l) => l.name !== r));
|
|
42
|
+
} finally {
|
|
43
|
+
i(!1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { rules: n, isLoading: s, error: f, createRule: g, editRule: c, deleteRule: d };
|
|
47
|
+
}
|
|
48
|
+
const O = {
|
|
49
|
+
page: 0,
|
|
50
|
+
size: 10,
|
|
51
|
+
sort: { direction: "ASC", property: "name" }
|
|
52
|
+
}, F = (n, a) => [
|
|
53
|
+
{
|
|
54
|
+
name: "name",
|
|
55
|
+
sortable: !0,
|
|
56
|
+
label: { id: "userGroupAssignments.col.name", defaultValue: "Name" },
|
|
57
|
+
render: ({ name: s }) => s
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "displayName",
|
|
61
|
+
sortable: !0,
|
|
62
|
+
label: { id: "userGroupAssignments.col.displayName", defaultValue: "Display Name" },
|
|
63
|
+
render: ({ displayName: s }) => s
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "acceptedEmailHostname",
|
|
67
|
+
sortable: !0,
|
|
68
|
+
label: { id: "userGroupAssignments.col.acceptedEmailHostname", defaultValue: "Accepted Email Hostname" },
|
|
69
|
+
render: ({ acceptedEmailHostname: s }) => s
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "accountGroup",
|
|
73
|
+
sortable: !1,
|
|
74
|
+
label: { id: "userGroupAssignments.col.accountGroup", defaultValue: "Account Group" },
|
|
75
|
+
render: ({ accountGroupId: s }) => /* @__PURE__ */ e.jsx(S, { id: s })
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "actions",
|
|
79
|
+
sortable: !0,
|
|
80
|
+
label: "",
|
|
81
|
+
width: "1%",
|
|
82
|
+
render: (s) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
83
|
+
/* @__PURE__ */ e.jsx(E, { authorities: ["WRITE_INITIAL_ACCOUNT_GROUP_ASSIGNMENT_RULE"], children: /* @__PURE__ */ e.jsx(x, { naked: !0, onClick: () => n(s), "data-testid": "edit-rule-button", children: /* @__PURE__ */ e.jsx(b, { edit: !0 }) }) }),
|
|
84
|
+
/* @__PURE__ */ e.jsx(E, { authorities: ["DELETE_INITIAL_ACCOUNT_GROUP_ASSIGNMENT_RULE"], children: /* @__PURE__ */ e.jsx(x, { naked: !0, onClick: () => a(s.name), "data-testid": "delete-rule-button", children: /* @__PURE__ */ e.jsx(b, { del: !0 }) }) })
|
|
85
|
+
] })
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
function P({ onEditRuleClick: n, onDeleteRuleClick: a, rules: s }) {
|
|
89
|
+
return /* @__PURE__ */ e.jsx(
|
|
90
|
+
U,
|
|
91
|
+
{
|
|
92
|
+
columnDefs: F(n, a),
|
|
93
|
+
uniqueItemKey: (i) => i.name,
|
|
94
|
+
paginationSettings: O,
|
|
95
|
+
items: s,
|
|
96
|
+
isLoading: !1,
|
|
97
|
+
"data-testid": "user-group-assignments-table"
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function W(n) {
|
|
102
|
+
var a;
|
|
103
|
+
if (R.isAxiosError(n) && ((a = n.response) != null && a.data)) {
|
|
104
|
+
const { fieldErrors: s } = n.response.data;
|
|
105
|
+
if (s)
|
|
106
|
+
return s.map(({ field: i }) => i);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function I({ onSubmit: n, onClose: a, value: s }) {
|
|
110
|
+
const {
|
|
111
|
+
handleSubmit: i,
|
|
112
|
+
formState: { isSubmitting: f },
|
|
113
|
+
control: m,
|
|
114
|
+
setError: g
|
|
115
|
+
} = _({
|
|
116
|
+
defaultValues: s ?? { name: "", displayName: "", acceptedEmailHostname: "" }
|
|
117
|
+
}), { t: c } = N(), d = {
|
|
118
|
+
required: c("userGroupAssignments.ruleModal.validation.required", {
|
|
119
|
+
defaultValue: "Required field"
|
|
120
|
+
})
|
|
121
|
+
}, r = i(async (l) => {
|
|
122
|
+
var u, t;
|
|
123
|
+
try {
|
|
124
|
+
await n(l);
|
|
125
|
+
} catch (h) {
|
|
126
|
+
const G = W(h);
|
|
127
|
+
if (G)
|
|
128
|
+
for (const p of G)
|
|
129
|
+
g(p, {
|
|
130
|
+
message: c("userGroupAssignments.ruleModal.validation.invalid", { defaultValue: "Invalid value" })
|
|
131
|
+
});
|
|
132
|
+
else
|
|
133
|
+
R.isAxiosError(h) && T(
|
|
134
|
+
((t = (u = h.response) == null ? void 0 : u.data) == null ? void 0 : t.message) ?? c("userGroupAssignments.ruleModal.validation.unknownError", { defaultValue: "An error occurred" })
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return /* @__PURE__ */ e.jsx(
|
|
139
|
+
K,
|
|
140
|
+
{
|
|
141
|
+
width: 500,
|
|
142
|
+
header: s ? /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.editTitle", children: "Edit Rule" }) : /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.createTitle", children: "Create Rule" }),
|
|
143
|
+
content: /* @__PURE__ */ e.jsxs("div", { className: "rule-modal", children: [
|
|
144
|
+
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(o, { i18nKey: "userGroupAssignments.ruleModal.info", children: [
|
|
145
|
+
"Rules regulate from which e-mail addresses (hostnames) logins will be accepted. Users",
|
|
146
|
+
"'",
|
|
147
|
+
" Rights will finally depend on the User Group they are assigned to."
|
|
148
|
+
] }) }),
|
|
149
|
+
/* @__PURE__ */ e.jsx(
|
|
150
|
+
j,
|
|
151
|
+
{
|
|
152
|
+
control: m,
|
|
153
|
+
name: "name",
|
|
154
|
+
rules: d,
|
|
155
|
+
render: ({ field: { ref: l, ...u }, fieldState: { error: t } }) => /* @__PURE__ */ e.jsx(
|
|
156
|
+
y,
|
|
157
|
+
{
|
|
158
|
+
label: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.name", children: "Name" }),
|
|
159
|
+
"data-testid": "nameField",
|
|
160
|
+
...u,
|
|
161
|
+
error: t == null ? void 0 : t.message,
|
|
162
|
+
required: !0
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ e.jsx(
|
|
168
|
+
j,
|
|
169
|
+
{
|
|
170
|
+
control: m,
|
|
171
|
+
name: "displayName",
|
|
172
|
+
rules: d,
|
|
173
|
+
render: ({ field: { ref: l, ...u }, fieldState: { error: t } }) => /* @__PURE__ */ e.jsx(
|
|
174
|
+
y,
|
|
175
|
+
{
|
|
176
|
+
label: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.displayName", children: "Display Name" }),
|
|
177
|
+
...u,
|
|
178
|
+
error: t == null ? void 0 : t.message,
|
|
179
|
+
"data-testid": "displayNameField",
|
|
180
|
+
required: !0
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
/* @__PURE__ */ e.jsx(
|
|
186
|
+
j,
|
|
187
|
+
{
|
|
188
|
+
control: m,
|
|
189
|
+
name: "acceptedEmailHostname",
|
|
190
|
+
rules: d,
|
|
191
|
+
render: ({ field: { ref: l, ...u }, fieldState: { error: t } }) => /* @__PURE__ */ e.jsx(
|
|
192
|
+
y,
|
|
193
|
+
{
|
|
194
|
+
label: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.acceptedEmailHostname", children: "E-Mail Hostname" }),
|
|
195
|
+
...u,
|
|
196
|
+
"data-testid": "acceptedEmailHostnameField",
|
|
197
|
+
error: t == null ? void 0 : t.message,
|
|
198
|
+
required: !0
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ e.jsx("hr", {}),
|
|
204
|
+
/* @__PURE__ */ e.jsx(
|
|
205
|
+
j,
|
|
206
|
+
{
|
|
207
|
+
control: m,
|
|
208
|
+
name: "accountGroupId",
|
|
209
|
+
rules: d,
|
|
210
|
+
render: ({ field: { ref: l, ...u }, fieldState: { error: t } }) => /* @__PURE__ */ e.jsx(
|
|
211
|
+
M,
|
|
212
|
+
{
|
|
213
|
+
...u,
|
|
214
|
+
label: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.accountGroupId", children: "in Target User Group" }),
|
|
215
|
+
"data-testid": "accountGroupIdField",
|
|
216
|
+
error: t == null ? void 0 : t.message,
|
|
217
|
+
required: !0
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
] }),
|
|
223
|
+
footer: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
224
|
+
/* @__PURE__ */ e.jsx(x, { primary: !0, onClick: r, disabled: f, children: /* @__PURE__ */ e.jsx(o, { i18nKey: "general.actions.apply", children: "Apply" }) }),
|
|
225
|
+
/* @__PURE__ */ e.jsx(x, { onClick: a, disabled: f, children: /* @__PURE__ */ e.jsx(o, { i18nKey: "general.actions.cancel", children: "Cancel" }) })
|
|
226
|
+
] })
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
function Z() {
|
|
231
|
+
const { isLoading: n, rules: a, error: s, createRule: i, editRule: f, deleteRule: m } = D(), [g, c] = A(!1), [d, r] = A(null), l = V(), { t: u } = N();
|
|
232
|
+
C(() => {
|
|
233
|
+
s && R.isAxiosError(s) && (T(
|
|
234
|
+
/* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.fetchError", children: "An error occurred while loading the initial user group assignment rules" })
|
|
235
|
+
), console.error("Error loading initial user group assignment rules", s));
|
|
236
|
+
}, [s]);
|
|
237
|
+
async function t(p) {
|
|
238
|
+
await i(p), c(!1);
|
|
239
|
+
}
|
|
240
|
+
async function h(p) {
|
|
241
|
+
d && (await f(d.name, p), r(null));
|
|
242
|
+
}
|
|
243
|
+
async function G(p) {
|
|
244
|
+
await l({
|
|
245
|
+
title: u("userGroupAssignments.deleteConfirmTitle", { defaultValue: "Delete Rule" }),
|
|
246
|
+
message: u("userGroupAssignments.deleteConfirm", {
|
|
247
|
+
defaultValue: "Do you really want to delete the rule?"
|
|
248
|
+
})
|
|
249
|
+
}) && await m(p);
|
|
250
|
+
}
|
|
251
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "di user-group-assignments", children: [
|
|
252
|
+
/* @__PURE__ */ e.jsxs(L, { show: n, "data-testid": "spinner-container", children: [
|
|
253
|
+
/* @__PURE__ */ e.jsx(
|
|
254
|
+
w,
|
|
255
|
+
{
|
|
256
|
+
title: {
|
|
257
|
+
id: "route.label.userGroupAssignments.name",
|
|
258
|
+
defaultValue: "User Group Assignments"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
!n && !!s && /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.fetchError", children: "An error occurred while loading the initial user group assignment rules" }),
|
|
263
|
+
!n && !s && a.length === 0 && /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.emptyList", children: "No initial user group assignment rules available yet." }),
|
|
264
|
+
a.length > 0 && /* @__PURE__ */ e.jsx(
|
|
265
|
+
P,
|
|
266
|
+
{
|
|
267
|
+
rules: a,
|
|
268
|
+
onEditRuleClick: r,
|
|
269
|
+
onDeleteRuleClick: G
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
/* @__PURE__ */ e.jsx(E, { authorities: ["WRITE_INITIAL_ACCOUNT_GROUP_ASSIGNMENT_RULE"], children: /* @__PURE__ */ e.jsx("div", { className: "footer", children: /* @__PURE__ */ e.jsx(x, { "data-testid": "create-rule-button", onClick: () => c(!0), children: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.createRule", children: "Create Rule" }) }) }) })
|
|
273
|
+
] }),
|
|
274
|
+
g && /* @__PURE__ */ e.jsx(
|
|
275
|
+
I,
|
|
276
|
+
{
|
|
277
|
+
onClose: () => c(!1),
|
|
278
|
+
onSubmit: t
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
d && /* @__PURE__ */ e.jsx(
|
|
282
|
+
I,
|
|
283
|
+
{
|
|
284
|
+
onClose: () => r(null),
|
|
285
|
+
onSubmit: h,
|
|
286
|
+
value: d
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
] });
|
|
290
|
+
}
|
|
291
|
+
export {
|
|
292
|
+
Z as default
|
|
293
|
+
};
|