@deviceinsight/ng-ui-scale-lib 9.25.0 → 10.0.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 +1 -1
- package/dist/AccessEditModal-x6TMxYkb.js +90 -0
- package/dist/AccessEditModal-x6TMxYkb.js.map +1 -0
- package/dist/BundleManagementContainer-B49bT5K-.js +16 -0
- package/dist/BundleManagementContainer-B49bT5K-.js.map +1 -0
- package/dist/BundlesContainer-BHzbWPe9.js +914 -0
- package/dist/BundlesContainer-BHzbWPe9.js.map +1 -0
- package/dist/DatapointImport-BSFXGuOh.js +293 -0
- package/dist/DatapointImport-BSFXGuOh.js.map +1 -0
- package/dist/FileUploadInput-Ccq_3cug.js +45 -0
- package/dist/FileUploadInput-Ccq_3cug.js.map +1 -0
- package/dist/Files-BniY5cJF.js +347 -0
- package/dist/Files-BniY5cJF.js.map +1 -0
- package/dist/GlobalPowerBiReports-CayA5Bqf.js +103 -0
- package/dist/GlobalPowerBiReports-CayA5Bqf.js.map +1 -0
- package/dist/Graph-BqYDNKEo.js +53 -0
- package/dist/Graph-BqYDNKEo.js.map +1 -0
- package/dist/JsonSettingWidget-pI5gCFnm.js +53 -0
- package/dist/JsonSettingWidget-pI5gCFnm.js.map +1 -0
- package/dist/LicensesEditPage-Bef9P-VO.js +145 -0
- package/dist/LicensesEditPage-Bef9P-VO.js.map +1 -0
- package/dist/LicensesList-Bwb2a9OS.js +149 -0
- package/dist/LicensesList-Bwb2a9OS.js.map +1 -0
- package/dist/PropertiesEditPage-OrwneFF4.js +373 -0
- package/dist/PropertiesEditPage-OrwneFF4.js.map +1 -0
- package/dist/{PropertiesList-0aa186df.js → PropertiesList-DRYRjsEu.js} +56 -58
- package/dist/PropertiesList-DRYRjsEu.js.map +1 -0
- package/dist/TemplateEditPage-B9v3VwGH.js +508 -0
- package/dist/TemplateEditPage-B9v3VwGH.js.map +1 -0
- package/dist/TemplateTextInput-CZFJ0oAT.js +45 -0
- package/dist/TemplateTextInput-CZFJ0oAT.js.map +1 -0
- package/dist/TemplatesListPage-BIZ0egkq.js +330 -0
- package/dist/TemplatesListPage-BIZ0egkq.js.map +1 -0
- package/dist/UserGroupAssignments-Wk1S9obw.js +297 -0
- package/dist/UserGroupAssignments-Wk1S9obw.js.map +1 -0
- package/dist/{UserGroupTheme-0f17124b.js → UserGroupTheme-BLBu4kUe.js} +51 -53
- package/dist/UserGroupTheme-BLBu4kUe.js.map +1 -0
- package/dist/api.d.ts +790 -786
- package/dist/api.js +72 -76
- package/dist/api.js.map +1 -0
- package/dist/{consts-012135e5.js → consts-CZ_QkIyI.js} +1 -2
- package/dist/consts-CZ_QkIyI.js.map +1 -0
- package/dist/{customFileCategories-1b64ed45.js → customFileCategories-bG5S9qSy.js} +1 -0
- package/dist/customFileCategories-bG5S9qSy.js.map +1 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.js +4744 -17135
- package/dist/index.js.map +1 -0
- package/dist/setTitle-Ck-71vC0.js +39377 -0
- package/dist/setTitle-Ck-71vC0.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/{useCanDeleteBundleVersion-64f35949.js → useCanDeleteBundleVersion-CUD1pDJ0.js} +1 -0
- package/dist/useCanDeleteBundleVersion-CUD1pDJ0.js.map +1 -0
- package/package.json +86 -107
- package/dist/AccessEditModal-cedd4fb0.js +0 -92
- package/dist/BundleManagementContainer-08557220.js +0 -20
- package/dist/BundlesContainer-bff2a150.js +0 -912
- package/dist/ContextBarContext-7e6ed0f4.js +0 -88545
- package/dist/DatapointImport-ec7416a8.js +0 -864
- package/dist/FileUploadInput-b89d7c2f.js +0 -44
- package/dist/Files-5e4b71b0.js +0 -364
- package/dist/GlobalPowerBiReports-ad9449e0.js +0 -11081
- package/dist/Graph-865da2fa.js +0 -25012
- package/dist/JsonSettingWidget-24f37cfc.js +0 -56
- package/dist/LicensesEditPage-a0445b99.js +0 -146
- package/dist/LicensesList-9706b88d.js +0 -150
- package/dist/PropertiesEditPage-56eebca4.js +0 -371
- package/dist/TemplateEditPage-e281b762.js +0 -508
- package/dist/TemplateTextInput-63d68053.js +0 -49
- package/dist/TemplatesListPage-f2d7bd81.js +0 -330
- package/dist/UserGroupAssignments-b30d1774.js +0 -297
- package/dist/index-69036fda.js +0 -18679
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import { aw as e, ag as s, aX as y, dd as B, b1 as O, ah as F, bP as V, bw as z, aj as N, da as W, de as $ } from "./ContextBarContext-7e6ed0f4.js";
|
|
2
|
-
import { useContext as H, useState as T, useCallback as q, useEffect as Y } from "react";
|
|
3
|
-
import { Link as X, useLocation as J } from "react-router-dom";
|
|
4
|
-
import { fetchUserGroupById as P, fetchEmailTemplates as _, fetchEmailTemplateAccessById as Q, 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 "react-i18next";
|
|
8
|
-
import { A as re } from "./AccessEditModal-cedd4fb0.js";
|
|
9
|
-
import "react-dom";
|
|
10
|
-
import "i18next";
|
|
11
|
-
import "ux4iot-react";
|
|
12
|
-
function ce(r, l, c, h, m) {
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
name: "displayName",
|
|
16
|
-
label: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.columns.name", children: "Name" }),
|
|
17
|
-
width: "10%",
|
|
18
|
-
sortable: !0,
|
|
19
|
-
filterable: {
|
|
20
|
-
filterType: "text",
|
|
21
|
-
filterFn: (t, n) => (t.displayName || t.name).toLowerCase().indexOf(n.toLowerCase()) >= 0
|
|
22
|
-
},
|
|
23
|
-
render: (t) => t.id ? /* @__PURE__ */ e.jsx(X, { to: `./${t.id}`, children: t.displayName || t.name }) : "-"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "message",
|
|
27
|
-
label: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.columns.message", children: "Message" }),
|
|
28
|
-
width: "40%",
|
|
29
|
-
sortable: !0,
|
|
30
|
-
whiteSpace: "normal",
|
|
31
|
-
render: ({ text: t }) => t
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "subject",
|
|
35
|
-
label: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.columns.subject", children: "Subject" }),
|
|
36
|
-
width: "20%",
|
|
37
|
-
sortable: !0,
|
|
38
|
-
whiteSpace: "normal",
|
|
39
|
-
render: ({ subject: t }) => /* @__PURE__ */ e.jsx("span", { children: t }) || /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.noSubject", children: "None" })
|
|
40
|
-
},
|
|
41
|
-
y(["READ_ACCOUNT_GROUP"]) ? {
|
|
42
|
-
name: "userGroups",
|
|
43
|
-
label: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplates.columns.userGroups", children: "Authorised User Groups" }),
|
|
44
|
-
width: "10%",
|
|
45
|
-
whiteSpace: "normal",
|
|
46
|
-
filterable: {
|
|
47
|
-
filterType: "text",
|
|
48
|
-
filterFn: (t, n) => t.name.toLowerCase().includes(n.toLowerCase())
|
|
49
|
-
},
|
|
50
|
-
render: (t) => {
|
|
51
|
-
const { accountGroupsWithAccess: n } = t;
|
|
52
|
-
if (!n || !n.length)
|
|
53
|
-
return null;
|
|
54
|
-
function g(i) {
|
|
55
|
-
return m.find((u) => u.id === i) || {
|
|
56
|
-
displayName: "-",
|
|
57
|
-
id: i
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
if (n.length > 1)
|
|
61
|
-
return /* @__PURE__ */ e.jsx(
|
|
62
|
-
oe,
|
|
63
|
-
{
|
|
64
|
-
menuButton: /* @__PURE__ */ e.jsx(G, { text: `${n.length} User Groups` }),
|
|
65
|
-
children: n.map((i) => {
|
|
66
|
-
const u = g(i), x = n.filter(
|
|
67
|
-
(A) => A !== u.id
|
|
68
|
-
);
|
|
69
|
-
return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx(
|
|
70
|
-
G,
|
|
71
|
-
{
|
|
72
|
-
text: u.displayName || u.name,
|
|
73
|
-
onDelete: () => l(x, t)
|
|
74
|
-
}
|
|
75
|
-
) }, u.id);
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
{
|
|
80
|
-
const i = g(n[0]);
|
|
81
|
-
return /* @__PURE__ */ e.jsx(
|
|
82
|
-
G,
|
|
83
|
-
{
|
|
84
|
-
text: i.displayName || i.name,
|
|
85
|
-
onDelete: () => h(t)
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
} : null,
|
|
91
|
-
y([["DELETE_NOTIFICATION_TEMPLATE"], ["READ_ACCOUNT_GROUP"]]) ? {
|
|
92
|
-
name: "actions",
|
|
93
|
-
label: "",
|
|
94
|
-
width: "10%",
|
|
95
|
-
align: "right",
|
|
96
|
-
render: (t) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
97
|
-
y([["READ_ACCOUNT_GROUP"]]) && /* @__PURE__ */ e.jsx(
|
|
98
|
-
C,
|
|
99
|
-
{
|
|
100
|
-
naked: !0,
|
|
101
|
-
onClick: () => c(t),
|
|
102
|
-
"data-testid": "edit-notification-template-access-button",
|
|
103
|
-
children: /* @__PURE__ */ e.jsx("img", { className: "di icon", src: B, alt: "key" })
|
|
104
|
-
}
|
|
105
|
-
),
|
|
106
|
-
y(["DELETE_NOTIFICATION_TEMPLATE"]) && /* @__PURE__ */ e.jsx(
|
|
107
|
-
C,
|
|
108
|
-
{
|
|
109
|
-
naked: !0,
|
|
110
|
-
onClick: () => r(t),
|
|
111
|
-
"data-testid": "delete-notification-template-button",
|
|
112
|
-
children: /* @__PURE__ */ e.jsx(te, { del: !0 })
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
] })
|
|
116
|
-
} : null
|
|
117
|
-
].filter(O);
|
|
118
|
-
}
|
|
119
|
-
function me({ onCancel: r, onSave: l, template: c }) {
|
|
120
|
-
const { t: h } = F(), m = y(["ACCESS_TO_ALL_NOTIFICATION_TEMPLATES"]), t = m ? h("notificationTemplate.access.delete.authorized", {
|
|
121
|
-
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!"
|
|
122
|
-
}) : h("notificationTemplate.access.delete.unauthorized", {
|
|
123
|
-
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."
|
|
124
|
-
});
|
|
125
|
-
return /* @__PURE__ */ e.jsx(
|
|
126
|
-
ae,
|
|
127
|
-
{
|
|
128
|
-
onOutsideClick: r,
|
|
129
|
-
header: /* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplate.access.delete.modal.title", children: "Remove all authorised User Groups from this Template" }),
|
|
130
|
-
content: /* @__PURE__ */ e.jsx(ie, { type: m ? "warning" : "error", icon: V, message: t }),
|
|
131
|
-
footer: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
132
|
-
m && /* @__PURE__ */ e.jsx(C, { onClick: () => l([], c), children: /* @__PURE__ */ e.jsx(s, { i18nKey: "general.actions.save", children: "Save" }) }),
|
|
133
|
-
/* @__PURE__ */ e.jsx(C, { onClick: () => r(), children: /* @__PURE__ */ e.jsx(s, { i18nKey: "general.actions.cancel", children: "Cancel" }) })
|
|
134
|
-
] })
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
const ue = {
|
|
139
|
-
page: 0,
|
|
140
|
-
size: 10,
|
|
141
|
-
sort: {
|
|
142
|
-
property: "name",
|
|
143
|
-
direction: "ASC"
|
|
144
|
-
}
|
|
145
|
-
}, de = {
|
|
146
|
-
locale: "null",
|
|
147
|
-
page: 0,
|
|
148
|
-
size: 2e3
|
|
149
|
-
};
|
|
150
|
-
async function pe() {
|
|
151
|
-
const r = await _(de);
|
|
152
|
-
return await Promise.all(
|
|
153
|
-
r.map(async (l) => {
|
|
154
|
-
const { accountGroupIds: c } = await Q(l.id);
|
|
155
|
-
return Promise.resolve({
|
|
156
|
-
...l,
|
|
157
|
-
accountGroupsWithAccess: c,
|
|
158
|
-
type: "email"
|
|
159
|
-
});
|
|
160
|
-
})
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
function fe({ confirm: r }) {
|
|
164
|
-
const { setContextInfo: l } = H(z), { pathname: c } = J(), [h, m] = T([]), [t, n] = T(!0), [g, i] = T(!1), [u, x] = T(!1), [A, w] = T([]), [j, L] = T(), M = /* @__PURE__ */ e.jsx(s, { i18nKey: "portalAdmin.sidebarElements.templates.create", children: "Create new notification template" }), I = q(
|
|
165
|
-
(a) => {
|
|
166
|
-
l({
|
|
167
|
-
type: "search",
|
|
168
|
-
elements: a.length,
|
|
169
|
-
totalElements: a.length,
|
|
170
|
-
totalElementsAccurate: void 0,
|
|
171
|
-
context: "notificationtemplates",
|
|
172
|
-
pathname: c
|
|
173
|
-
});
|
|
174
|
-
},
|
|
175
|
-
[c, l]
|
|
176
|
-
);
|
|
177
|
-
async function D(a) {
|
|
178
|
-
n(!0);
|
|
179
|
-
try {
|
|
180
|
-
const o = await _({
|
|
181
|
-
name: a.name,
|
|
182
|
-
page: 0,
|
|
183
|
-
size: 2e3
|
|
184
|
-
});
|
|
185
|
-
await Promise.all(o.map((p) => ee(p.id)));
|
|
186
|
-
const d = A.filter((p) => p.name !== a.name);
|
|
187
|
-
w(d), I(d);
|
|
188
|
-
} catch (o) {
|
|
189
|
-
console.error("error occured while trying to delete the template", o), S(
|
|
190
|
-
/* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplate.list.deleteTemplate.error", children: "An error occurred while trying to delete the template" })
|
|
191
|
-
);
|
|
192
|
-
} finally {
|
|
193
|
-
n(!1);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
function v(a) {
|
|
197
|
-
r(
|
|
198
|
-
{
|
|
199
|
-
id: "notificationTemplate.list.confirmDeleteTitle",
|
|
200
|
-
defaultValue: "Delete template"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
id: "notificationTemplate.list.confirmDeleteMessage",
|
|
204
|
-
defaultValue: "Do you really want to delete this template?"
|
|
205
|
-
}
|
|
206
|
-
).then(() => D(a));
|
|
207
|
-
}
|
|
208
|
-
async function b(a, o) {
|
|
209
|
-
if (o) {
|
|
210
|
-
n(!0);
|
|
211
|
-
try {
|
|
212
|
-
const d = await _({
|
|
213
|
-
name: o.name,
|
|
214
|
-
page: 0,
|
|
215
|
-
size: 2e3
|
|
216
|
-
}), p = { ...o, accountGroupsWithAccess: a }, f = N.unionBy([p], A, "id");
|
|
217
|
-
await Promise.all(
|
|
218
|
-
d.map(
|
|
219
|
-
(E) => Z({
|
|
220
|
-
...E,
|
|
221
|
-
accountGroupsWithAccess: a
|
|
222
|
-
})
|
|
223
|
-
)
|
|
224
|
-
);
|
|
225
|
-
const R = [
|
|
226
|
-
...new Set(
|
|
227
|
-
N.flatten(
|
|
228
|
-
f.map(({ accountGroupsWithAccess: E }) => E).filter(Boolean)
|
|
229
|
-
)
|
|
230
|
-
)
|
|
231
|
-
], k = await Promise.all(R.map((E) => P(E)));
|
|
232
|
-
w(f), m(k), I(f);
|
|
233
|
-
} catch (d) {
|
|
234
|
-
console.error("error occured while trying to save access on template: ", d), S(
|
|
235
|
-
/* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplate.list.updateTemplate.error", children: "An error occured while trying to save access" })
|
|
236
|
-
);
|
|
237
|
-
} finally {
|
|
238
|
-
n(!1), x(!1), i(!1);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
function U(a) {
|
|
243
|
-
L(a), i(!0);
|
|
244
|
-
}
|
|
245
|
-
function K(a) {
|
|
246
|
-
L(a), x(!0);
|
|
247
|
-
}
|
|
248
|
-
return Y(() => {
|
|
249
|
-
let a = !1;
|
|
250
|
-
return (async () => {
|
|
251
|
-
try {
|
|
252
|
-
const o = await pe();
|
|
253
|
-
if (a)
|
|
254
|
-
return;
|
|
255
|
-
if (w(o), I(o), y(["READ_ACCOUNT_GROUP"])) {
|
|
256
|
-
const d = [
|
|
257
|
-
...new Set(N.flatten(o.map(({ accountGroupsWithAccess: f }) => f)))
|
|
258
|
-
].filter(O), p = await Promise.all(d.map((f) => P(f)));
|
|
259
|
-
m(p);
|
|
260
|
-
}
|
|
261
|
-
} catch (o) {
|
|
262
|
-
console.error("error occured while trying to fetch templates: ", o), S(
|
|
263
|
-
/* @__PURE__ */ e.jsx(s, { i18nKey: "notificationTemplate.list.fetchTemplates.error", children: "An error occured while trying to fetch templates" })
|
|
264
|
-
);
|
|
265
|
-
} finally {
|
|
266
|
-
n(!1);
|
|
267
|
-
}
|
|
268
|
-
})(), () => {
|
|
269
|
-
a = !0, l();
|
|
270
|
-
};
|
|
271
|
-
}, []), /* @__PURE__ */ e.jsxs("div", { className: "template-list", children: [
|
|
272
|
-
/* @__PURE__ */ e.jsx(
|
|
273
|
-
le,
|
|
274
|
-
{
|
|
275
|
-
title: {
|
|
276
|
-
id: "route.label.templates.name",
|
|
277
|
-
defaultValue: "Notification Templates"
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
),
|
|
281
|
-
/* @__PURE__ */ e.jsx(
|
|
282
|
-
W,
|
|
283
|
-
{
|
|
284
|
-
tooltip: M,
|
|
285
|
-
authorities: "WRITE_NOTIFICATION_TEMPLATE",
|
|
286
|
-
path: "/portaladmin/templates/create",
|
|
287
|
-
dataTestId: "create-template-button"
|
|
288
|
-
}
|
|
289
|
-
),
|
|
290
|
-
/* @__PURE__ */ e.jsx(
|
|
291
|
-
$,
|
|
292
|
-
{
|
|
293
|
-
columnDefs: ce(
|
|
294
|
-
v,
|
|
295
|
-
b,
|
|
296
|
-
U,
|
|
297
|
-
K,
|
|
298
|
-
h
|
|
299
|
-
),
|
|
300
|
-
uniqueItemKey: (a) => `${a.id}`,
|
|
301
|
-
paginationSettings: ue,
|
|
302
|
-
items: A,
|
|
303
|
-
isLoading: t,
|
|
304
|
-
"data-testid": "notification-templates-table",
|
|
305
|
-
tableName: "notificationTemplates"
|
|
306
|
-
}
|
|
307
|
-
),
|
|
308
|
-
g && j && /* @__PURE__ */ e.jsx(
|
|
309
|
-
re,
|
|
310
|
-
{
|
|
311
|
-
onCancel: () => i(!1),
|
|
312
|
-
onSave: b,
|
|
313
|
-
loading: t,
|
|
314
|
-
template: j
|
|
315
|
-
}
|
|
316
|
-
),
|
|
317
|
-
u && j && /* @__PURE__ */ e.jsx(
|
|
318
|
-
me,
|
|
319
|
-
{
|
|
320
|
-
onCancel: () => x(!1),
|
|
321
|
-
onSave: b,
|
|
322
|
-
template: j
|
|
323
|
-
}
|
|
324
|
-
)
|
|
325
|
-
] });
|
|
326
|
-
}
|
|
327
|
-
const be = ne(fe);
|
|
328
|
-
export {
|
|
329
|
-
be as default
|
|
330
|
-
};
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import { aw as e, db as S, aQ as E, bf as _, ah as N, al as R, ag as o, bl as j, b7 as y, dc as M } from "./ContextBarContext-7e6ed0f4.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 H, deleteInitialAccountGroupAssignmentRule as q } from "@deviceinsight/ng-ui-api-client";
|
|
6
|
-
import "react-router-dom";
|
|
7
|
-
import "react-dom";
|
|
8
|
-
import "react-i18next";
|
|
9
|
-
import "i18next";
|
|
10
|
-
import "ux4iot-react";
|
|
11
|
-
function D() {
|
|
12
|
-
const [n, a] = A([]), [s, r] = A(!1), [f, m] = A(null);
|
|
13
|
-
C(() => {
|
|
14
|
-
r(!0);
|
|
15
|
-
let i = !1;
|
|
16
|
-
return v().then((l) => {
|
|
17
|
-
i || (a(l), r(!1));
|
|
18
|
-
}).catch((l) => {
|
|
19
|
-
i || (m(l), r(!1));
|
|
20
|
-
}), () => {
|
|
21
|
-
i = !0;
|
|
22
|
-
};
|
|
23
|
-
}, []);
|
|
24
|
-
async function g(i) {
|
|
25
|
-
try {
|
|
26
|
-
r(!0);
|
|
27
|
-
const l = await k(i);
|
|
28
|
-
a([...n, l]);
|
|
29
|
-
} finally {
|
|
30
|
-
r(!1);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function c(i, l) {
|
|
34
|
-
try {
|
|
35
|
-
r(!0);
|
|
36
|
-
const u = await H(i, l);
|
|
37
|
-
a(n.map((t) => t.name === i ? u : t));
|
|
38
|
-
} finally {
|
|
39
|
-
r(!1);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async function d(i) {
|
|
43
|
-
try {
|
|
44
|
-
r(!0), await q(i), a(n.filter((l) => l.name !== i));
|
|
45
|
-
} finally {
|
|
46
|
-
r(!1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return { rules: n, isLoading: s, error: f, createRule: g, editRule: c, deleteRule: d };
|
|
50
|
-
}
|
|
51
|
-
const O = {
|
|
52
|
-
page: 0,
|
|
53
|
-
size: 10,
|
|
54
|
-
sort: { direction: "ASC", property: "name" }
|
|
55
|
-
}, F = (n, a) => [
|
|
56
|
-
{
|
|
57
|
-
name: "name",
|
|
58
|
-
sortable: !0,
|
|
59
|
-
label: { id: "userGroupAssignments.col.name", defaultValue: "Name" },
|
|
60
|
-
render: ({ name: s }) => s
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "displayName",
|
|
64
|
-
sortable: !0,
|
|
65
|
-
label: { id: "userGroupAssignments.col.displayName", defaultValue: "Display Name" },
|
|
66
|
-
render: ({ displayName: s }) => s
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "acceptedEmailHostname",
|
|
70
|
-
sortable: !0,
|
|
71
|
-
label: { id: "userGroupAssignments.col.acceptedEmailHostname", defaultValue: "Accepted Email Hostname" },
|
|
72
|
-
render: ({ acceptedEmailHostname: s }) => s
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "accountGroup",
|
|
76
|
-
sortable: !1,
|
|
77
|
-
label: { id: "userGroupAssignments.col.accountGroup", defaultValue: "Account Group" },
|
|
78
|
-
render: ({ accountGroupId: s }) => /* @__PURE__ */ e.jsx(S, { id: s })
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: "actions",
|
|
82
|
-
sortable: !0,
|
|
83
|
-
label: "",
|
|
84
|
-
width: "1%",
|
|
85
|
-
render: (s) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
86
|
-
/* @__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 }) }) }),
|
|
87
|
-
/* @__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 }) }) })
|
|
88
|
-
] })
|
|
89
|
-
}
|
|
90
|
-
];
|
|
91
|
-
function P({ onEditRuleClick: n, onDeleteRuleClick: a, rules: s }) {
|
|
92
|
-
return /* @__PURE__ */ e.jsx(
|
|
93
|
-
U,
|
|
94
|
-
{
|
|
95
|
-
columnDefs: F(n, a),
|
|
96
|
-
uniqueItemKey: (r) => r.name,
|
|
97
|
-
paginationSettings: O,
|
|
98
|
-
items: s,
|
|
99
|
-
isLoading: !1,
|
|
100
|
-
"data-testid": "user-group-assignments-table",
|
|
101
|
-
tableName: "userGroupAssignments"
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
function W(n) {
|
|
106
|
-
var a;
|
|
107
|
-
if (R.isAxiosError(n) && ((a = n.response) != null && a.data)) {
|
|
108
|
-
const { fieldErrors: s } = n.response.data;
|
|
109
|
-
if (s)
|
|
110
|
-
return s.map(({ field: r }) => r);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function I({ onSubmit: n, onClose: a, value: s }) {
|
|
114
|
-
const {
|
|
115
|
-
handleSubmit: r,
|
|
116
|
-
formState: { isSubmitting: f },
|
|
117
|
-
control: m,
|
|
118
|
-
setError: g
|
|
119
|
-
} = _({
|
|
120
|
-
defaultValues: s ?? { name: "", displayName: "", acceptedEmailHostname: "" }
|
|
121
|
-
}), { t: c } = N(), d = {
|
|
122
|
-
required: c("userGroupAssignments.ruleModal.validation.required", {
|
|
123
|
-
defaultValue: "Required field"
|
|
124
|
-
})
|
|
125
|
-
}, i = r(async (l) => {
|
|
126
|
-
var u, t;
|
|
127
|
-
try {
|
|
128
|
-
await n(l);
|
|
129
|
-
} catch (h) {
|
|
130
|
-
const G = W(h);
|
|
131
|
-
if (G)
|
|
132
|
-
for (const p of G)
|
|
133
|
-
g(p, {
|
|
134
|
-
message: c("userGroupAssignments.ruleModal.validation.invalid", { defaultValue: "Invalid value" })
|
|
135
|
-
});
|
|
136
|
-
else
|
|
137
|
-
R.isAxiosError(h) && T(
|
|
138
|
-
((t = (u = h.response) == null ? void 0 : u.data) == null ? void 0 : t.message) ?? c("userGroupAssignments.ruleModal.validation.unknownError", { defaultValue: "An error occurred" })
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
return /* @__PURE__ */ e.jsx(
|
|
143
|
-
K,
|
|
144
|
-
{
|
|
145
|
-
width: 500,
|
|
146
|
-
header: s ? /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.editTitle", children: "Edit Rule" }) : /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.createTitle", children: "Create Rule" }),
|
|
147
|
-
content: /* @__PURE__ */ e.jsxs("div", { className: "rule-modal", children: [
|
|
148
|
-
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(o, { i18nKey: "userGroupAssignments.ruleModal.info", children: [
|
|
149
|
-
"Rules regulate from which e-mail addresses (hostnames) logins will be accepted. Users",
|
|
150
|
-
"'",
|
|
151
|
-
" Rights will finally depend on the User Group they are assigned to."
|
|
152
|
-
] }) }),
|
|
153
|
-
/* @__PURE__ */ e.jsx(
|
|
154
|
-
j,
|
|
155
|
-
{
|
|
156
|
-
control: m,
|
|
157
|
-
name: "name",
|
|
158
|
-
rules: d,
|
|
159
|
-
render: ({ field: { ref: l, ...u }, fieldState: { error: t } }) => /* @__PURE__ */ e.jsx(
|
|
160
|
-
y,
|
|
161
|
-
{
|
|
162
|
-
label: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.name", children: "Name" }),
|
|
163
|
-
"data-testid": "nameField",
|
|
164
|
-
...u,
|
|
165
|
-
error: t == null ? void 0 : t.message,
|
|
166
|
-
required: !0
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
),
|
|
171
|
-
/* @__PURE__ */ e.jsx(
|
|
172
|
-
j,
|
|
173
|
-
{
|
|
174
|
-
control: m,
|
|
175
|
-
name: "displayName",
|
|
176
|
-
rules: d,
|
|
177
|
-
render: ({ field: { ref: l, ...u }, fieldState: { error: t } }) => /* @__PURE__ */ e.jsx(
|
|
178
|
-
y,
|
|
179
|
-
{
|
|
180
|
-
label: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.displayName", children: "Display Name" }),
|
|
181
|
-
...u,
|
|
182
|
-
error: t == null ? void 0 : t.message,
|
|
183
|
-
"data-testid": "displayNameField",
|
|
184
|
-
required: !0
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
}
|
|
188
|
-
),
|
|
189
|
-
/* @__PURE__ */ e.jsx(
|
|
190
|
-
j,
|
|
191
|
-
{
|
|
192
|
-
control: m,
|
|
193
|
-
name: "acceptedEmailHostname",
|
|
194
|
-
rules: d,
|
|
195
|
-
render: ({ field: { ref: l, ...u }, fieldState: { error: t } }) => /* @__PURE__ */ e.jsx(
|
|
196
|
-
y,
|
|
197
|
-
{
|
|
198
|
-
label: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.acceptedEmailHostname", children: "E-Mail Hostname" }),
|
|
199
|
-
...u,
|
|
200
|
-
"data-testid": "acceptedEmailHostnameField",
|
|
201
|
-
error: t == null ? void 0 : t.message,
|
|
202
|
-
required: !0
|
|
203
|
-
}
|
|
204
|
-
)
|
|
205
|
-
}
|
|
206
|
-
),
|
|
207
|
-
/* @__PURE__ */ e.jsx("hr", {}),
|
|
208
|
-
/* @__PURE__ */ e.jsx(
|
|
209
|
-
j,
|
|
210
|
-
{
|
|
211
|
-
control: m,
|
|
212
|
-
name: "accountGroupId",
|
|
213
|
-
rules: d,
|
|
214
|
-
render: ({ field: { ref: l, ...u }, fieldState: { error: t } }) => /* @__PURE__ */ e.jsx(
|
|
215
|
-
M,
|
|
216
|
-
{
|
|
217
|
-
...u,
|
|
218
|
-
label: /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.ruleModal.accountGroupId", children: "in Target User Group" }),
|
|
219
|
-
"data-testid": "accountGroupIdField",
|
|
220
|
-
error: t == null ? void 0 : t.message,
|
|
221
|
-
required: !0
|
|
222
|
-
}
|
|
223
|
-
)
|
|
224
|
-
}
|
|
225
|
-
)
|
|
226
|
-
] }),
|
|
227
|
-
footer: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
228
|
-
/* @__PURE__ */ e.jsx(x, { primary: !0, onClick: i, disabled: f, children: /* @__PURE__ */ e.jsx(o, { i18nKey: "general.actions.apply", children: "Apply" }) }),
|
|
229
|
-
/* @__PURE__ */ e.jsx(x, { onClick: a, disabled: f, children: /* @__PURE__ */ e.jsx(o, { i18nKey: "general.actions.cancel", children: "Cancel" }) })
|
|
230
|
-
] })
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
function te() {
|
|
235
|
-
const { isLoading: n, rules: a, error: s, createRule: r, editRule: f, deleteRule: m } = D(), [g, c] = A(!1), [d, i] = A(null), l = V(), { t: u } = N();
|
|
236
|
-
C(() => {
|
|
237
|
-
s && R.isAxiosError(s) && (T(
|
|
238
|
-
/* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.fetchError", children: "An error occurred while loading the initial user group assignment rules" })
|
|
239
|
-
), console.error("Error loading initial user group assignment rules", s));
|
|
240
|
-
}, [s]);
|
|
241
|
-
async function t(p) {
|
|
242
|
-
await r(p), c(!1);
|
|
243
|
-
}
|
|
244
|
-
async function h(p) {
|
|
245
|
-
d && (await f(d.name, p), i(null));
|
|
246
|
-
}
|
|
247
|
-
async function G(p) {
|
|
248
|
-
await l({
|
|
249
|
-
title: u("userGroupAssignments.deleteConfirmTitle", { defaultValue: "Delete Rule" }),
|
|
250
|
-
message: u("userGroupAssignments.deleteConfirm", {
|
|
251
|
-
defaultValue: "Do you really want to delete the rule?"
|
|
252
|
-
})
|
|
253
|
-
}) && await m(p);
|
|
254
|
-
}
|
|
255
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "di user-group-assignments", children: [
|
|
256
|
-
/* @__PURE__ */ e.jsxs(L, { show: n, "data-testid": "spinner-container", children: [
|
|
257
|
-
/* @__PURE__ */ e.jsx(
|
|
258
|
-
w,
|
|
259
|
-
{
|
|
260
|
-
title: {
|
|
261
|
-
id: "route.label.userGroupAssignments.name",
|
|
262
|
-
defaultValue: "User Group Assignments"
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
),
|
|
266
|
-
!n && !!s && /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.fetchError", children: "An error occurred while loading the initial user group assignment rules" }),
|
|
267
|
-
!n && !s && a.length === 0 && /* @__PURE__ */ e.jsx(o, { i18nKey: "userGroupAssignments.emptyList", children: "No initial user group assignment rules available yet." }),
|
|
268
|
-
a.length > 0 && /* @__PURE__ */ e.jsx(
|
|
269
|
-
P,
|
|
270
|
-
{
|
|
271
|
-
rules: a,
|
|
272
|
-
onEditRuleClick: i,
|
|
273
|
-
onDeleteRuleClick: G
|
|
274
|
-
}
|
|
275
|
-
),
|
|
276
|
-
/* @__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" }) }) }) })
|
|
277
|
-
] }),
|
|
278
|
-
g && /* @__PURE__ */ e.jsx(
|
|
279
|
-
I,
|
|
280
|
-
{
|
|
281
|
-
onClose: () => c(!1),
|
|
282
|
-
onSubmit: t
|
|
283
|
-
}
|
|
284
|
-
),
|
|
285
|
-
d && /* @__PURE__ */ e.jsx(
|
|
286
|
-
I,
|
|
287
|
-
{
|
|
288
|
-
onClose: () => i(null),
|
|
289
|
-
onSubmit: h,
|
|
290
|
-
value: d
|
|
291
|
-
}
|
|
292
|
-
)
|
|
293
|
-
] });
|
|
294
|
-
}
|
|
295
|
-
export {
|
|
296
|
-
te as default
|
|
297
|
-
};
|