@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,908 @@
|
|
|
1
|
+
import { ah as S, bc as P, at as e, ag as r, bi as A, b4 as I, d6 as T, aN as F, b1 as re, aj as ae, d7 as ie, cn as q, d8 as oe } from "./ContextBarContext-f745a63a.js";
|
|
2
|
+
import { useEffect as D, useState as V, useRef as ce, useCallback as ue, createElement as he } from "react";
|
|
3
|
+
import { useLocation as me } from "react-router-dom";
|
|
4
|
+
import { createBundle as xe, deleteBundleFile as je, createBundleFile as fe, releaseBundleVersion as Ee, fetchBundleVersion as G, fetchBundleFiles as z, createBundleVersion as ge, deleteBundleVersion as Be, downloadBundleFile as be, fetchBundleVersions as W, deleteBundle as Ve, fetchAllBundles as De } from "@deviceinsight/ng-ui-api-client";
|
|
5
|
+
import { messageBoxSuccess as $, messageBoxError as H, ReactableWithClientSidePagination as Ne, Reactable as Te, ContentHeader as ve } from "@deviceinsight/ng-ui-components";
|
|
6
|
+
import { Modal as _, SpinnerContainer as N, Button as j, Icon as v, Label as _e, AccordionItem as ye, Accordion as pe } from "@deviceinsight/ng-ui-basic-components";
|
|
7
|
+
import { B as c, Q, a as Ce } from "./consts-012135e5.js";
|
|
8
|
+
import { F as Le } from "./FileUploadInput-6dc037cb.js";
|
|
9
|
+
import { u as Se, b as Ae } from "./useCanDeleteBundleVersion-64f35949.js";
|
|
10
|
+
import "react-dom";
|
|
11
|
+
const Y = (n) => {
|
|
12
|
+
n && setTimeout(() => n.focus(), 0);
|
|
13
|
+
}, Z = (n, t) => {
|
|
14
|
+
D(() => {
|
|
15
|
+
const s = (l) => {
|
|
16
|
+
t || (l.code === "Enter" || l.code === "NumpadEnter") && n();
|
|
17
|
+
};
|
|
18
|
+
return document.addEventListener("keydown", s), () => {
|
|
19
|
+
document.removeEventListener("keydown", s);
|
|
20
|
+
};
|
|
21
|
+
}, [n, t]);
|
|
22
|
+
}, Ie = ({ setOpen: n, loadBundles: t }) => {
|
|
23
|
+
const { t: s } = S(), {
|
|
24
|
+
handleSubmit: l,
|
|
25
|
+
control: d,
|
|
26
|
+
formState: { isSubmitting: a }
|
|
27
|
+
} = P({ defaultValues: { name: "" } }), i = (o) => xe(o).then(() => {
|
|
28
|
+
t(), n(!1), $(
|
|
29
|
+
/* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.createBundleSuccess", children: "The bundle was created." })
|
|
30
|
+
);
|
|
31
|
+
}).catch((h) => {
|
|
32
|
+
console.error("bundle creation error", h), H(/* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.createBundleError", children: "Could not save bundle" }));
|
|
33
|
+
}), u = () => l(i, (o) => {
|
|
34
|
+
console.warn("Validation error", o);
|
|
35
|
+
})();
|
|
36
|
+
return Z(u, !1), /* @__PURE__ */ e.jsx(
|
|
37
|
+
_,
|
|
38
|
+
{
|
|
39
|
+
width: 400,
|
|
40
|
+
header: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundle.create.title", children: "Create new Bundle" }),
|
|
41
|
+
content: /* @__PURE__ */ e.jsx(N, { show: a, "data-testid": c.CREATE_BUNDLE_DIALOG, children: /* @__PURE__ */ e.jsx("div", { className: "di form", children: /* @__PURE__ */ e.jsx(
|
|
42
|
+
A,
|
|
43
|
+
{
|
|
44
|
+
name: "name",
|
|
45
|
+
control: d,
|
|
46
|
+
rules: {
|
|
47
|
+
required: s("bundleManagement.bundles.name.required", {
|
|
48
|
+
defaultValue: "Name is required"
|
|
49
|
+
}),
|
|
50
|
+
maxLength: {
|
|
51
|
+
value: 32,
|
|
52
|
+
message: s("bundleManagement.bundles.name.maxLength", {
|
|
53
|
+
defaultValue: "Name cannot be longer than 32 characters"
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
render: ({ field: { value: o, onChange: h, onBlur: m }, fieldState: { error: x } }) => /* @__PURE__ */ e.jsx(
|
|
58
|
+
I,
|
|
59
|
+
{
|
|
60
|
+
value: o,
|
|
61
|
+
onChange: h,
|
|
62
|
+
onBlur: m,
|
|
63
|
+
error: x == null ? void 0 : x.message,
|
|
64
|
+
required: !0,
|
|
65
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundle.name", children: "Name" }),
|
|
66
|
+
"data-testid": c.BUNDLE_NAME_INPUT,
|
|
67
|
+
ref: Y
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
) }) }),
|
|
72
|
+
footer: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
73
|
+
/* @__PURE__ */ e.jsx(
|
|
74
|
+
j,
|
|
75
|
+
{
|
|
76
|
+
primary: !0,
|
|
77
|
+
"data-testid": c.SAVE_BUNDLE_BUTTON,
|
|
78
|
+
onClick: u,
|
|
79
|
+
disabled: a,
|
|
80
|
+
children: /* @__PURE__ */ e.jsx(r, { i18nKey: T.save.id, children: T.save.defaultValue })
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ e.jsx(
|
|
84
|
+
j,
|
|
85
|
+
{
|
|
86
|
+
onClick: () => n(!1),
|
|
87
|
+
"data-testid": c.CANCEL_SAVE_BUNDLE_BUTTON,
|
|
88
|
+
children: /* @__PURE__ */ e.jsx(r, { i18nKey: T.cancel.id, children: T.cancel.defaultValue })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] })
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}, O = (n, t, s) => {
|
|
95
|
+
n && n.some((l) => !l.condition || l.condition(s) ? (t(/* @__PURE__ */ e.jsx(r, { i18nKey: l.id, children: l.defaultValue })), !0) : !1);
|
|
96
|
+
};
|
|
97
|
+
function g({
|
|
98
|
+
requestFunction: n,
|
|
99
|
+
errorMessages: t,
|
|
100
|
+
successMessages: s,
|
|
101
|
+
initialData: l
|
|
102
|
+
}) {
|
|
103
|
+
const [d, a] = V(l), [i, u] = V(!1), [o, h] = V(void 0), m = ce(!0), b = ue(async (...B) => {
|
|
104
|
+
try {
|
|
105
|
+
h(void 0), u(!0);
|
|
106
|
+
const f = await n(...B);
|
|
107
|
+
m.current && f && a(f), O(s, $, f);
|
|
108
|
+
} catch (f) {
|
|
109
|
+
m.current && h(f), O(t, H, f);
|
|
110
|
+
} finally {
|
|
111
|
+
m.current && u(!1);
|
|
112
|
+
}
|
|
113
|
+
}, [n, t, s]);
|
|
114
|
+
return D(() => (m.current = !0, () => {
|
|
115
|
+
m.current = !1;
|
|
116
|
+
}), [n, t, s]), { run: b, data: d, loading: i, error: o };
|
|
117
|
+
}
|
|
118
|
+
const K = (n) => n ? /* @__PURE__ */ e.jsx("span", { children: re(n, { showTimezone: !1 }) }) : "-", Fe = ({
|
|
119
|
+
onViewDetails: n,
|
|
120
|
+
onDelete: t,
|
|
121
|
+
onEdit: s
|
|
122
|
+
}, l) => [
|
|
123
|
+
{
|
|
124
|
+
name: "name",
|
|
125
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.name", children: "Name" }),
|
|
126
|
+
sortable: !0,
|
|
127
|
+
render: (d) => /* @__PURE__ */ e.jsx(
|
|
128
|
+
"a",
|
|
129
|
+
{
|
|
130
|
+
href: "edit",
|
|
131
|
+
onClick: (a) => {
|
|
132
|
+
a.preventDefault(), n(d.id);
|
|
133
|
+
},
|
|
134
|
+
children: d.name
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
width: "15%"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "description",
|
|
141
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.description", children: "Description" }),
|
|
142
|
+
sortable: !0,
|
|
143
|
+
render: ({ description: d }) => /* @__PURE__ */ e.jsx("span", { children: d }),
|
|
144
|
+
width: "20%"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "fileCount",
|
|
148
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.files", children: "Files" }),
|
|
149
|
+
sortable: !0,
|
|
150
|
+
render: ({ fileCount: d }) => /* @__PURE__ */ e.jsx("span", { children: d || "-" }),
|
|
151
|
+
width: "10%"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "draft",
|
|
155
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.status", children: "Status" }),
|
|
156
|
+
sortable: !0,
|
|
157
|
+
render: ({ draft: d }) => /* @__PURE__ */ e.jsx("span", { children: d ? /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.draft", children: "Draft" }) : /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.published", children: "Published" }) }),
|
|
158
|
+
width: "10%"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "createdAt",
|
|
162
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.createdAt", children: "Created at" }),
|
|
163
|
+
sortable: !0,
|
|
164
|
+
render: ({ createdAt: d }) => /* @__PURE__ */ e.jsx("span", { children: K(d) })
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "releasedAt",
|
|
168
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.releasedAt", children: "Published at" }),
|
|
169
|
+
sortable: !0,
|
|
170
|
+
render: ({ releasedAt: d }) => /* @__PURE__ */ e.jsx("span", { children: d ? K(d) : "-" })
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "delete",
|
|
174
|
+
label: "",
|
|
175
|
+
width: "5%",
|
|
176
|
+
align: "right",
|
|
177
|
+
render: (d) => /* @__PURE__ */ e.jsx(F, { authorities: ["WRITE_BUNDLE"], children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
178
|
+
d.draft && /* @__PURE__ */ e.jsx(
|
|
179
|
+
j,
|
|
180
|
+
{
|
|
181
|
+
naked: !0,
|
|
182
|
+
small: !0,
|
|
183
|
+
onClick: () => s(d.id),
|
|
184
|
+
title: l("bundleversion.edit", {
|
|
185
|
+
defaultValue: "Edit Bundle Version"
|
|
186
|
+
}),
|
|
187
|
+
"data-testid": c.DELETE_VERSION_ICON,
|
|
188
|
+
children: /* @__PURE__ */ e.jsx(v, { edit: !0 })
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ e.jsx(
|
|
192
|
+
j,
|
|
193
|
+
{
|
|
194
|
+
naked: !0,
|
|
195
|
+
small: !0,
|
|
196
|
+
onClick: () => t(d),
|
|
197
|
+
title: l("bundleversion.delete", {
|
|
198
|
+
defaultValue: "Delete Bundle Version",
|
|
199
|
+
version: d.name
|
|
200
|
+
}),
|
|
201
|
+
"data-testid": c.DELETE_VERSION_ICON,
|
|
202
|
+
children: /* @__PURE__ */ e.jsx(v, { del: !0 })
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
] }) })
|
|
206
|
+
}
|
|
207
|
+
], Me = /^[a-zA-Z0-9_.-]*$/;
|
|
208
|
+
function we({ header: n, formContext: t, onSubmit: s }) {
|
|
209
|
+
const { t: l } = S(), { control: d } = t;
|
|
210
|
+
return Z(s, !1), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
211
|
+
/* @__PURE__ */ e.jsx(
|
|
212
|
+
"h3",
|
|
213
|
+
{
|
|
214
|
+
style: {
|
|
215
|
+
marginBottom: 20
|
|
216
|
+
},
|
|
217
|
+
children: n
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
/* @__PURE__ */ e.jsxs("form", { className: "di form", "data-testid": c.CREATE_VERSION_DIALOG, children: [
|
|
221
|
+
/* @__PURE__ */ e.jsx(
|
|
222
|
+
A,
|
|
223
|
+
{
|
|
224
|
+
name: "name",
|
|
225
|
+
control: d,
|
|
226
|
+
rules: {
|
|
227
|
+
required: l("version.name.required", {
|
|
228
|
+
defaultValue: "Name is required."
|
|
229
|
+
}),
|
|
230
|
+
pattern: {
|
|
231
|
+
value: Me,
|
|
232
|
+
message: l("version.name.pattern", {
|
|
233
|
+
defaultValue: "Name can only contain latin characters, number, dots and underscores."
|
|
234
|
+
})
|
|
235
|
+
},
|
|
236
|
+
maxLength: {
|
|
237
|
+
value: 50,
|
|
238
|
+
message: l("version.name.maxLength", {
|
|
239
|
+
defaultValue: "Name cannot be longer than 50 characters"
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
render: ({ field: { value: a, onChange: i, onBlur: u }, fieldState: { error: o } }) => /* @__PURE__ */ e.jsx(
|
|
244
|
+
I,
|
|
245
|
+
{
|
|
246
|
+
"data-testid": c.VERSION_NAME_INPUT,
|
|
247
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.name", children: "Name" }),
|
|
248
|
+
value: a,
|
|
249
|
+
onChange: i,
|
|
250
|
+
onBlur: u,
|
|
251
|
+
error: o == null ? void 0 : o.message,
|
|
252
|
+
required: !0,
|
|
253
|
+
ref: Y
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
/* @__PURE__ */ e.jsx(
|
|
259
|
+
A,
|
|
260
|
+
{
|
|
261
|
+
name: "description",
|
|
262
|
+
control: d,
|
|
263
|
+
rules: {
|
|
264
|
+
maxLength: {
|
|
265
|
+
value: 250,
|
|
266
|
+
message: l("version.description.maxLength", {
|
|
267
|
+
defaultValue: "Description cannot be longer than 250 characters"
|
|
268
|
+
})
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
render: ({ field: { value: a, onChange: i, onBlur: u }, fieldState: { error: o } }) => /* @__PURE__ */ e.jsx(
|
|
272
|
+
I,
|
|
273
|
+
{
|
|
274
|
+
"data-testid": c.VERSION_DESCRIPTION_INPUT,
|
|
275
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.description", children: "Description" }),
|
|
276
|
+
value: a,
|
|
277
|
+
onChange: i,
|
|
278
|
+
onBlur: u,
|
|
279
|
+
error: o == null ? void 0 : o.message
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
)
|
|
284
|
+
] })
|
|
285
|
+
] });
|
|
286
|
+
}
|
|
287
|
+
const J = [
|
|
288
|
+
{
|
|
289
|
+
name: "name",
|
|
290
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.file.name", children: "Name" }),
|
|
291
|
+
sortable: !0,
|
|
292
|
+
render: ({ name: n }) => n,
|
|
293
|
+
width: "60%"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: "size",
|
|
297
|
+
label: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.file.size", children: "Size" }),
|
|
298
|
+
sortable: !1,
|
|
299
|
+
render: ({ size: n }) => /* @__PURE__ */ e.jsxs("span", { children: [
|
|
300
|
+
Math.round(n / 10) / 100,
|
|
301
|
+
" kB"
|
|
302
|
+
] }),
|
|
303
|
+
width: "30%"
|
|
304
|
+
}
|
|
305
|
+
], Oe = (n, t) => [
|
|
306
|
+
...J,
|
|
307
|
+
{
|
|
308
|
+
name: "delete",
|
|
309
|
+
label: "",
|
|
310
|
+
align: "right",
|
|
311
|
+
render: (s) => /* @__PURE__ */ e.jsx(
|
|
312
|
+
j,
|
|
313
|
+
{
|
|
314
|
+
naked: !0,
|
|
315
|
+
small: !0,
|
|
316
|
+
onClick: () => n(s),
|
|
317
|
+
title: t("bundleversion.file.delete", {
|
|
318
|
+
defaultValue: "Delete File {{name: file.name}}",
|
|
319
|
+
name: s.name
|
|
320
|
+
}),
|
|
321
|
+
"data-testid": c.DELETE_FILE_ICON,
|
|
322
|
+
children: /* @__PURE__ */ e.jsx(v, { del: !0 })
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
}
|
|
326
|
+
], Ke = (n, t) => [
|
|
327
|
+
...J,
|
|
328
|
+
{
|
|
329
|
+
name: "delete",
|
|
330
|
+
label: "",
|
|
331
|
+
align: "right",
|
|
332
|
+
render: (s) => /* @__PURE__ */ e.jsx(
|
|
333
|
+
j,
|
|
334
|
+
{
|
|
335
|
+
naked: !0,
|
|
336
|
+
small: !0,
|
|
337
|
+
onClick: () => n(s),
|
|
338
|
+
title: t("bundleversion.file.download", {
|
|
339
|
+
defaultValue: "Download File {{name: file.name}}",
|
|
340
|
+
name: s.name
|
|
341
|
+
}),
|
|
342
|
+
"data-testid": c.DOWNLOAD_FILE_ICON,
|
|
343
|
+
children: /* @__PURE__ */ e.jsx(v, { download: !0 })
|
|
344
|
+
}
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
], X = ({ count: n }) => /* @__PURE__ */ e.jsx(
|
|
348
|
+
_e,
|
|
349
|
+
{
|
|
350
|
+
className: "neutral",
|
|
351
|
+
style: {
|
|
352
|
+
marginLeft: 10
|
|
353
|
+
},
|
|
354
|
+
text: n ? `${n}` : "0",
|
|
355
|
+
"data-testid": c.LABEL_VERSION_COUNT
|
|
356
|
+
}
|
|
357
|
+
), Re = {
|
|
358
|
+
page: 0,
|
|
359
|
+
size: 5,
|
|
360
|
+
sort: {
|
|
361
|
+
property: "name",
|
|
362
|
+
direction: "ASC"
|
|
363
|
+
}
|
|
364
|
+
}, ee = ({
|
|
365
|
+
files: n,
|
|
366
|
+
columnDefs: t,
|
|
367
|
+
isLoading: s
|
|
368
|
+
}) => /* @__PURE__ */ e.jsx("div", { className: "fields", "data-testid": c.VERSION_FILES_DIALOG, children: /* @__PURE__ */ e.jsxs("div", { className: "field", children: [
|
|
369
|
+
/* @__PURE__ */ e.jsxs("h2", { children: [
|
|
370
|
+
/* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.files", children: "Files" }),
|
|
371
|
+
/* @__PURE__ */ e.jsx(X, { count: n.length })
|
|
372
|
+
] }),
|
|
373
|
+
/* @__PURE__ */ e.jsx(
|
|
374
|
+
Ne,
|
|
375
|
+
{
|
|
376
|
+
columnDefs: t,
|
|
377
|
+
uniqueItemKey: (l) => `${l.name}_${l.size}`,
|
|
378
|
+
paginationSettings: Re,
|
|
379
|
+
items: n,
|
|
380
|
+
isLoading: s
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
] }) }), ne = ({ bundle: n, version: t }) => /* @__PURE__ */ e.jsxs("div", { className: "bundle-version-info", children: [
|
|
384
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
385
|
+
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx(r, { i18nKey: "version.files.bundleName", children: "Bundle Name" }) }),
|
|
386
|
+
/* @__PURE__ */ e.jsx("span", { children: n.name })
|
|
387
|
+
] }),
|
|
388
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
389
|
+
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx(r, { i18nKey: "version.files.versionName", children: "Version Name" }) }),
|
|
390
|
+
/* @__PURE__ */ e.jsx("span", { children: t ? t.name : "" })
|
|
391
|
+
] }),
|
|
392
|
+
t && t.description && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
393
|
+
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx(r, { i18nKey: "version.files.versionDescription", children: "Version Description" }) }),
|
|
394
|
+
/* @__PURE__ */ e.jsx("span", { children: t.description })
|
|
395
|
+
] })
|
|
396
|
+
] }), Ue = {
|
|
397
|
+
id: "bundlemanagement.fetchAllBundlesError",
|
|
398
|
+
defaultValue: "The bundles could not be loaded"
|
|
399
|
+
}, ke = {
|
|
400
|
+
id: "bundlemanagement.deleteBundleError",
|
|
401
|
+
defaultValue: "The bundle could not be deleted"
|
|
402
|
+
}, te = {
|
|
403
|
+
id: "bundlemanagement.fetchBundleVersionError",
|
|
404
|
+
defaultValue: "The version could not be loaded"
|
|
405
|
+
}, se = {
|
|
406
|
+
id: "bundlemanagement.fetchBundleFilesError",
|
|
407
|
+
defaultValue: "The files for this version could not be loaded"
|
|
408
|
+
}, Pe = {
|
|
409
|
+
id: "bundlemanagement.downloadBundleFileError",
|
|
410
|
+
defaultValue: "The file could not be downloaded"
|
|
411
|
+
}, qe = {
|
|
412
|
+
id: "bundlemanagement.deleteBundleVersionError",
|
|
413
|
+
defaultValue: "The version could not be deleted"
|
|
414
|
+
}, Ge = {
|
|
415
|
+
id: "bundlemanagement.releaseBundleVersionError",
|
|
416
|
+
defaultValue: "The version could not be published"
|
|
417
|
+
}, ze = {
|
|
418
|
+
id: "bundleversion.createBundleVersionError",
|
|
419
|
+
defaultValue: "The version could not be created"
|
|
420
|
+
}, We = {
|
|
421
|
+
id: "bundlemanagement.fetchBundleVersionsError",
|
|
422
|
+
defaultValue: "The versions for this bundle could not be loaded"
|
|
423
|
+
}, $e = {
|
|
424
|
+
id: "bundlemanagement.deleteBundleFileError",
|
|
425
|
+
defaultValue: "The file could not be deleted"
|
|
426
|
+
}, He = {
|
|
427
|
+
id: "bundlemanagement.saveBundleDuplicateFileError",
|
|
428
|
+
defaultValue: "A file with this name already exists"
|
|
429
|
+
}, Qe = {
|
|
430
|
+
id: "bundlemanagement.saveBundleFileError",
|
|
431
|
+
defaultValue: "The file could not be saved"
|
|
432
|
+
}, Ye = "DUPLICATE_FILE_NAME", Ze = ({
|
|
433
|
+
bundle: n,
|
|
434
|
+
version: t,
|
|
435
|
+
fileLoader: { run: s, data: l, loading: d }
|
|
436
|
+
}) => {
|
|
437
|
+
const { t: a } = S(), i = t ? t.id : "", { run: u, loading: o } = g({
|
|
438
|
+
requestFunction: je,
|
|
439
|
+
errorMessages: [$e]
|
|
440
|
+
}), { run: h, loading: m } = g({
|
|
441
|
+
requestFunction: fe,
|
|
442
|
+
errorMessages: [
|
|
443
|
+
{
|
|
444
|
+
...He,
|
|
445
|
+
condition: (E) => ae.get(E, "response.data.error") === Ye
|
|
446
|
+
},
|
|
447
|
+
Qe
|
|
448
|
+
]
|
|
449
|
+
}), x = () => s(n.id, i), b = (E) => u(n.id, i, E.id).then(x), B = (E) => h(n.id, i, E, ie()).then(x), f = Oe(b, a);
|
|
450
|
+
return D(() => {
|
|
451
|
+
i && s(n.id, i);
|
|
452
|
+
}, [s, i, n]), /* @__PURE__ */ e.jsxs("div", { className: "bundle-version", children: [
|
|
453
|
+
/* @__PURE__ */ e.jsx(ne, { bundle: n, version: t }),
|
|
454
|
+
/* @__PURE__ */ e.jsx(
|
|
455
|
+
ee,
|
|
456
|
+
{
|
|
457
|
+
isLoading: o || m || d,
|
|
458
|
+
files: l || [],
|
|
459
|
+
columnDefs: f
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
/* @__PURE__ */ e.jsx("div", { "data-testid": c.VERSION_FILE_UPLOAD_AREA, children: /* @__PURE__ */ e.jsx(
|
|
463
|
+
Le,
|
|
464
|
+
{
|
|
465
|
+
style: {
|
|
466
|
+
width: "100%"
|
|
467
|
+
},
|
|
468
|
+
onChange: (E) => {
|
|
469
|
+
if (E) {
|
|
470
|
+
const y = new FormData();
|
|
471
|
+
y.append("file", E), B(y);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
l ? l.length : 1
|
|
476
|
+
) })
|
|
477
|
+
] });
|
|
478
|
+
}, Je = {
|
|
479
|
+
id: "bundlemanagement.deleteBundleSuccess",
|
|
480
|
+
defaultValue: "The bundle was deleted"
|
|
481
|
+
}, Xe = {
|
|
482
|
+
id: "bundlemanagement.deleteBundleVersionSuccess",
|
|
483
|
+
defaultValue: "The version was deleted."
|
|
484
|
+
}, en = {
|
|
485
|
+
id: "bundlemanagement.releaseBundleVersionSuccess",
|
|
486
|
+
defaultValue: "The version was published"
|
|
487
|
+
}, p = {
|
|
488
|
+
id: "bundlemanagement.modalCloseButton",
|
|
489
|
+
defaultValue: "Close"
|
|
490
|
+
}, C = {
|
|
491
|
+
id: "bundlemanagement.modalDeleteButton",
|
|
492
|
+
defaultValue: "Delete"
|
|
493
|
+
}, L = {
|
|
494
|
+
id: "bundlemanagement.modalCancelButton",
|
|
495
|
+
defaultValue: "Cancel"
|
|
496
|
+
}, R = {
|
|
497
|
+
id: "bundlemanagement.modalSaveAndProceedButton",
|
|
498
|
+
defaultValue: "Save and Proceed"
|
|
499
|
+
}, nn = [te], tn = [se], sn = [ze], dn = [Ge], ln = [en], rn = ({ bundle: n, versionId: t, setVersionId: s, onClose: l }) => {
|
|
500
|
+
const d = P({
|
|
501
|
+
defaultValues: {
|
|
502
|
+
name: "",
|
|
503
|
+
description: ""
|
|
504
|
+
}
|
|
505
|
+
}), { handleSubmit: a } = d, i = (f) => ge(n.id, f).then((E) => s(E.id)), u = () => a(i, (f) => {
|
|
506
|
+
console.warn("Validation error", f);
|
|
507
|
+
})(), o = g({
|
|
508
|
+
requestFunction: u,
|
|
509
|
+
errorMessages: sn
|
|
510
|
+
}), h = g({
|
|
511
|
+
requestFunction: Ee,
|
|
512
|
+
errorMessages: dn,
|
|
513
|
+
successMessages: ln
|
|
514
|
+
}), m = g({
|
|
515
|
+
requestFunction: G,
|
|
516
|
+
errorMessages: nn
|
|
517
|
+
}), x = g({
|
|
518
|
+
requestFunction: z,
|
|
519
|
+
errorMessages: tn
|
|
520
|
+
}), { run: b } = m;
|
|
521
|
+
D(() => {
|
|
522
|
+
t && b(n.id, t);
|
|
523
|
+
}, [t, b, n]);
|
|
524
|
+
const B = !!(x.data && x.data.length);
|
|
525
|
+
return /* @__PURE__ */ e.jsx(
|
|
526
|
+
_,
|
|
527
|
+
{
|
|
528
|
+
width: 500,
|
|
529
|
+
header: t ? /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.editversion", children: "Add Files" }) : /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.addversion", children: "Create new Version" }),
|
|
530
|
+
content: /* @__PURE__ */ e.jsx(
|
|
531
|
+
N,
|
|
532
|
+
{
|
|
533
|
+
show: h.loading || m.loading && !m.data || o.loading,
|
|
534
|
+
children: t ? /* @__PURE__ */ e.jsx(Ze, { bundle: n, version: m.data, fileLoader: x }) : /* @__PURE__ */ e.jsx(we, { header: n.name, formContext: d, onSubmit: u })
|
|
535
|
+
}
|
|
536
|
+
),
|
|
537
|
+
footer: t ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
538
|
+
/* @__PURE__ */ e.jsx(
|
|
539
|
+
j,
|
|
540
|
+
{
|
|
541
|
+
primary: !0,
|
|
542
|
+
onClick: () => h.run(n.id, t || "").then(l),
|
|
543
|
+
disabled: !B || h.loading,
|
|
544
|
+
children: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.publish", children: "Publish" })
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
/* @__PURE__ */ e.jsx(j, { onClick: l, "data-testid": c.CANCEL_SAVE_VERSION_BUTTON, children: /* @__PURE__ */ e.jsx(r, { i18nKey: p.id, children: p.defaultValue }) })
|
|
548
|
+
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
549
|
+
/* @__PURE__ */ e.jsx(
|
|
550
|
+
j,
|
|
551
|
+
{
|
|
552
|
+
primary: !0,
|
|
553
|
+
onClick: o.run,
|
|
554
|
+
disabled: d.formState.isSubmitting || o.loading,
|
|
555
|
+
"data-testid": c.SAVE_VERSION_BUTTON,
|
|
556
|
+
children: /* @__PURE__ */ e.jsx(r, { i18nKey: R.id, children: R.defaultValue })
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
/* @__PURE__ */ e.jsx(j, { onClick: l, "data-testid": c.CANCEL_SAVE_VERSION_BUTTON, children: /* @__PURE__ */ e.jsx(r, { i18nKey: T.cancel.id, children: T.cancel.defaultValue }) })
|
|
560
|
+
] })
|
|
561
|
+
}
|
|
562
|
+
);
|
|
563
|
+
}, U = {
|
|
564
|
+
id: "bundlemanagement.deleteBundleVersionModalTitle",
|
|
565
|
+
defaultValue: "Delete Version"
|
|
566
|
+
}, k = {
|
|
567
|
+
id: "bundlemanagement.deleteBundleModalTitle",
|
|
568
|
+
defaultValue: "Delete Bundle"
|
|
569
|
+
}, an = (n, t) => /* @__PURE__ */ e.jsx("div", { "data-testid": c.DELETE_BUNDLE_DIALOG, children: t || /* @__PURE__ */ e.jsx("p", { children: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.deleteBundleModalBodyError", children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
570
|
+
"The version ",
|
|
571
|
+
/* @__PURE__ */ e.jsx("strong", { children: n }),
|
|
572
|
+
" cannot be deleted."
|
|
573
|
+
] }) }) }) }), on = (n) => /* @__PURE__ */ e.jsx("div", { "data-testid": c.DELETE_VERSION_DIALOG, children: /* @__PURE__ */ e.jsx("p", { children: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.deleteVersionModalBody", children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
574
|
+
"Do you really want to delete the version ",
|
|
575
|
+
/* @__PURE__ */ e.jsx("strong", { children: n }),
|
|
576
|
+
"?"
|
|
577
|
+
] }) }) }) }), cn = ({ version: n, canBeDeleted: t, error: s, processing: l }) => /* @__PURE__ */ e.jsx(N, { show: l, children: /* @__PURE__ */ e.jsx(
|
|
578
|
+
"div",
|
|
579
|
+
{
|
|
580
|
+
style: {
|
|
581
|
+
minHeight: 50
|
|
582
|
+
},
|
|
583
|
+
children: !l && (t ? on(n.name) : an(n.name, s))
|
|
584
|
+
}
|
|
585
|
+
) }), un = [qe], hn = [Xe], mn = ({ bundle: n, version: t, onCancel: s, loadVersions: l }) => {
|
|
586
|
+
const { run: d } = g({
|
|
587
|
+
requestFunction: Be,
|
|
588
|
+
errorMessages: un,
|
|
589
|
+
successMessages: hn
|
|
590
|
+
}), a = Se(n, t), i = () => d(n.id, t.id).then(l).then(s);
|
|
591
|
+
return /* @__PURE__ */ e.jsx(
|
|
592
|
+
_,
|
|
593
|
+
{
|
|
594
|
+
header: /* @__PURE__ */ e.jsx(r, { i18nKey: U.id, children: U.defaultValue }),
|
|
595
|
+
content: /* @__PURE__ */ e.jsx(cn, { version: t, ...a }),
|
|
596
|
+
footer: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
597
|
+
/* @__PURE__ */ e.jsx(j, { primary: !0, disabled: !a.canBeDeleted, onClick: i, children: /* @__PURE__ */ e.jsx(r, { i18nKey: C.id, children: C.defaultValue }) }),
|
|
598
|
+
/* @__PURE__ */ e.jsx(j, { onClick: s, children: /* @__PURE__ */ e.jsx(r, { i18nKey: L.id, children: L.defaultValue }) })
|
|
599
|
+
] }),
|
|
600
|
+
width: 500
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}, xn = [te], jn = [se], fn = ({ bundle: n, versionId: t, onClose: s, t: l }) => {
|
|
604
|
+
const {
|
|
605
|
+
run: d,
|
|
606
|
+
data: a,
|
|
607
|
+
loading: i
|
|
608
|
+
} = g({
|
|
609
|
+
requestFunction: G,
|
|
610
|
+
versionId: t,
|
|
611
|
+
errorMessages: xn
|
|
612
|
+
}), {
|
|
613
|
+
run: u,
|
|
614
|
+
data: o,
|
|
615
|
+
loading: h
|
|
616
|
+
} = g({
|
|
617
|
+
requestFunction: z,
|
|
618
|
+
errorMessages: jn
|
|
619
|
+
}), { run: m, loading: x } = g({
|
|
620
|
+
requestFunction: (B) => be(n.id, t, B.id).then((f) => {
|
|
621
|
+
window.location.replace(f.downloadLink);
|
|
622
|
+
}),
|
|
623
|
+
errorMessages: [Pe]
|
|
624
|
+
}), b = Ke(m, l);
|
|
625
|
+
return D(() => {
|
|
626
|
+
t && (d(n.id, t), u(n.id, t));
|
|
627
|
+
}, [u, d, t, n]), /* @__PURE__ */ e.jsx(
|
|
628
|
+
_,
|
|
629
|
+
{
|
|
630
|
+
width: 500,
|
|
631
|
+
header: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.viewVersion", children: "Version Details" }),
|
|
632
|
+
content: /* @__PURE__ */ e.jsx(N, { show: i, children: /* @__PURE__ */ e.jsxs("div", { className: "bundle-version", "data-testid": c.VERSION_DETAILS_DIALOG, children: [
|
|
633
|
+
/* @__PURE__ */ e.jsx(ne, { bundle: n, version: a }),
|
|
634
|
+
/* @__PURE__ */ e.jsx(
|
|
635
|
+
ee,
|
|
636
|
+
{
|
|
637
|
+
isLoading: x || h,
|
|
638
|
+
files: o || [],
|
|
639
|
+
columnDefs: b
|
|
640
|
+
}
|
|
641
|
+
)
|
|
642
|
+
] }) }),
|
|
643
|
+
footer: /* @__PURE__ */ e.jsx(j, { onClick: s, "data-testid": c.MODAL_CLOSE_BUTTON, children: /* @__PURE__ */ e.jsx(r, { i18nKey: p.id, children: p.defaultValue }) })
|
|
644
|
+
}
|
|
645
|
+
);
|
|
646
|
+
}, En = {
|
|
647
|
+
getRowClass: (n) => n.draft ? "draft" : "released"
|
|
648
|
+
}, gn = ({ columnDefs: n, paginationSettings: t, setPaginationSettings: s, versions: l, loading: d }) => /* @__PURE__ */ e.jsx(N, { show: d, children: /* @__PURE__ */ e.jsxs(
|
|
649
|
+
"div",
|
|
650
|
+
{
|
|
651
|
+
className: "bundle-version-table",
|
|
652
|
+
style: {
|
|
653
|
+
minHeight: 50
|
|
654
|
+
},
|
|
655
|
+
children: [
|
|
656
|
+
/* @__PURE__ */ e.jsxs("h2", { children: [
|
|
657
|
+
/* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.title", children: "Versions" }),
|
|
658
|
+
/* @__PURE__ */ e.jsx(X, { count: l && l.totalElements })
|
|
659
|
+
] }),
|
|
660
|
+
/* @__PURE__ */ e.jsx(
|
|
661
|
+
Te,
|
|
662
|
+
{
|
|
663
|
+
isLoading: !1,
|
|
664
|
+
uniqueItemKey: (a) => a.id,
|
|
665
|
+
columnDefs: n,
|
|
666
|
+
paginationSettings: t,
|
|
667
|
+
onChangePage: (a) => s({ ...t, page: a }),
|
|
668
|
+
onSort: (a, i) => s({
|
|
669
|
+
...t,
|
|
670
|
+
sort: {
|
|
671
|
+
property: a,
|
|
672
|
+
direction: i
|
|
673
|
+
}
|
|
674
|
+
}),
|
|
675
|
+
pageable: l,
|
|
676
|
+
rowDef: En,
|
|
677
|
+
"data-testid": "bundle-versions-table"
|
|
678
|
+
}
|
|
679
|
+
)
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
) }), Bn = {
|
|
683
|
+
page: 0,
|
|
684
|
+
size: 5,
|
|
685
|
+
sort: {
|
|
686
|
+
property: "createdAt",
|
|
687
|
+
direction: "DESC"
|
|
688
|
+
}
|
|
689
|
+
}, bn = [We], Vn = ({ bundle: n, isOpen: t }) => {
|
|
690
|
+
const { t: s } = S(), [l, d] = V(!1), [a, i] = V(void 0), [u, o] = V(void 0), [h, m] = V(void 0), x = q();
|
|
691
|
+
D(() => {
|
|
692
|
+
const le = x.get(Q), w = x.get(Ce);
|
|
693
|
+
w && le === n.id && i(w);
|
|
694
|
+
}, [x, n]);
|
|
695
|
+
const b = Fe(
|
|
696
|
+
{
|
|
697
|
+
onViewDetails: i,
|
|
698
|
+
onDelete: m,
|
|
699
|
+
onEdit: o
|
|
700
|
+
},
|
|
701
|
+
s
|
|
702
|
+
), [B, f] = V(Bn), {
|
|
703
|
+
run: E,
|
|
704
|
+
data: y,
|
|
705
|
+
loading: de
|
|
706
|
+
} = g({
|
|
707
|
+
requestFunction: W,
|
|
708
|
+
errorMessages: bn
|
|
709
|
+
}), M = () => E(n.id, B);
|
|
710
|
+
return D(() => {
|
|
711
|
+
t && E(n.id, B);
|
|
712
|
+
}, [t, B, E, n]), /* @__PURE__ */ e.jsxs("div", { "data-testid": c.BUNDLE_VERSION_VIEW, children: [
|
|
713
|
+
/* @__PURE__ */ e.jsx(
|
|
714
|
+
gn,
|
|
715
|
+
{
|
|
716
|
+
versions: y,
|
|
717
|
+
paginationSettings: B,
|
|
718
|
+
setPaginationSettings: f,
|
|
719
|
+
columnDefs: b,
|
|
720
|
+
loading: de
|
|
721
|
+
}
|
|
722
|
+
),
|
|
723
|
+
/* @__PURE__ */ e.jsx(F, { authorities: ["WRITE_BUNDLE"], children: /* @__PURE__ */ e.jsxs(
|
|
724
|
+
j,
|
|
725
|
+
{
|
|
726
|
+
onClick: () => d(!0),
|
|
727
|
+
"data-testid": c.CREATE_VERSION_BUTTON,
|
|
728
|
+
children: [
|
|
729
|
+
/* @__PURE__ */ e.jsx(v, { add: !0 }),
|
|
730
|
+
/* @__PURE__ */ e.jsx("span", { children: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleversion.addversion", children: "Create new version" }) })
|
|
731
|
+
]
|
|
732
|
+
}
|
|
733
|
+
) }),
|
|
734
|
+
h && /* @__PURE__ */ e.jsx(
|
|
735
|
+
mn,
|
|
736
|
+
{
|
|
737
|
+
bundle: n,
|
|
738
|
+
version: h,
|
|
739
|
+
onCancel: () => m(void 0),
|
|
740
|
+
loadVersions: M
|
|
741
|
+
}
|
|
742
|
+
),
|
|
743
|
+
(l || u) && /* @__PURE__ */ e.jsx(
|
|
744
|
+
rn,
|
|
745
|
+
{
|
|
746
|
+
bundle: n,
|
|
747
|
+
versionId: u,
|
|
748
|
+
setVersionId: o,
|
|
749
|
+
onClose: () => {
|
|
750
|
+
d(!1), o(void 0), M();
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
),
|
|
754
|
+
a && /* @__PURE__ */ e.jsx(
|
|
755
|
+
fn,
|
|
756
|
+
{
|
|
757
|
+
bundle: n,
|
|
758
|
+
versionId: a,
|
|
759
|
+
onClose: () => i(void 0),
|
|
760
|
+
t: s
|
|
761
|
+
}
|
|
762
|
+
)
|
|
763
|
+
] });
|
|
764
|
+
}, Dn = (n) => {
|
|
765
|
+
const { bundle: t, onDelete: s, isOpen: l } = n, { id: d, name: a } = t;
|
|
766
|
+
return /* @__PURE__ */ he(
|
|
767
|
+
ye,
|
|
768
|
+
{
|
|
769
|
+
...n,
|
|
770
|
+
"data-testid": c.ACCORDION_ITEM + d,
|
|
771
|
+
title: a,
|
|
772
|
+
key: d,
|
|
773
|
+
tools: [
|
|
774
|
+
/* @__PURE__ */ e.jsx(
|
|
775
|
+
F,
|
|
776
|
+
{
|
|
777
|
+
authorities: ["DELETE_BUNDLE"],
|
|
778
|
+
children: /* @__PURE__ */ e.jsx(
|
|
779
|
+
j,
|
|
780
|
+
{
|
|
781
|
+
naked: !0,
|
|
782
|
+
onClick: () => s(t),
|
|
783
|
+
title: {
|
|
784
|
+
id: "bundle.delete.title",
|
|
785
|
+
defaultValue: "Delete this Bundle"
|
|
786
|
+
},
|
|
787
|
+
"data-testid": c.DELETE_BUNDLE_BUTTON,
|
|
788
|
+
children: /* @__PURE__ */ e.jsx(v, { del: !0, large: !0 })
|
|
789
|
+
},
|
|
790
|
+
c.DELETE_BUNDLE_BUTTON
|
|
791
|
+
)
|
|
792
|
+
},
|
|
793
|
+
c.DELETE_BUNDLE_BUTTON
|
|
794
|
+
)
|
|
795
|
+
]
|
|
796
|
+
},
|
|
797
|
+
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(Vn, { bundle: t, isOpen: !!l }) })
|
|
798
|
+
);
|
|
799
|
+
}, Nn = (n, t) => {
|
|
800
|
+
const s = n.get(Q);
|
|
801
|
+
return !t || !t.length || !s ? 0 : t.reduce((l, d, a) => d.id === s ? a : l, 0);
|
|
802
|
+
}, Tn = ({ bundles: n, onDelete: t, isLoading: s }) => {
|
|
803
|
+
const l = q(), d = Nn(l, n);
|
|
804
|
+
return /* @__PURE__ */ e.jsxs(N, { show: s, children: [
|
|
805
|
+
/* @__PURE__ */ e.jsx(pe, { accordionClass: "bundles", defaultOpenPageIndex: d, children: (n || []).map((a) => /* @__PURE__ */ e.jsx(Dn, { bundle: a, onDelete: t }, a.name)) }, d),
|
|
806
|
+
!s && (!n || !n.length) && /* @__PURE__ */ e.jsx(r, { i18nKey: "bundleManagement.noBundles", children: "There are currently no bundles" })
|
|
807
|
+
] });
|
|
808
|
+
}, vn = (n, t) => /* @__PURE__ */ e.jsx("div", { "data-testid": c.DELETE_BUNDLE_DIALOG, children: t || /* @__PURE__ */ e.jsx("p", { children: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.deleteBundleModalBodyError", children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
809
|
+
"The bundle ",
|
|
810
|
+
/* @__PURE__ */ e.jsx("strong", { children: n }),
|
|
811
|
+
" cannot be deleted."
|
|
812
|
+
] }) }) }) }), _n = (n, t) => /* @__PURE__ */ e.jsxs("div", { "data-testid": c.DELETE_BUNDLE_DIALOG, children: [
|
|
813
|
+
/* @__PURE__ */ e.jsx("p", { "data-testid": "deleteBundleModalBody1", children: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.deleteBundleModalBody1", children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
814
|
+
"Do you really want to delete the bundle ",
|
|
815
|
+
/* @__PURE__ */ e.jsx("strong", { children: n }),
|
|
816
|
+
"?"
|
|
817
|
+
] }) }) }),
|
|
818
|
+
!!t && t !== "0" && /* @__PURE__ */ e.jsx("p", { "data-testid": "deleteBundleModalBody2", children: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.deleteBundleModalBody2", children: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
819
|
+
"Deleting this bundle will also delete ",
|
|
820
|
+
/* @__PURE__ */ e.jsx("strong", { children: t }),
|
|
821
|
+
" version(s) and the associated files."
|
|
822
|
+
] }) }) }),
|
|
823
|
+
/* @__PURE__ */ e.jsx("p", { "data-testid": "deleteBundleModalBody3", children: /* @__PURE__ */ e.jsx(r, { i18nKey: "bundlemanagement.deleteBundleModalBody3", children: "This action cannot be undone." }) })
|
|
824
|
+
] }), yn = ({ bundle: n, canBeDeleted: t, error: s, processing: l }) => {
|
|
825
|
+
const {
|
|
826
|
+
run: d,
|
|
827
|
+
data: a,
|
|
828
|
+
loading: i
|
|
829
|
+
} = g({
|
|
830
|
+
requestFunction: W
|
|
831
|
+
});
|
|
832
|
+
return D(() => {
|
|
833
|
+
t && d(n.id);
|
|
834
|
+
}, [d, n, t]), /* @__PURE__ */ e.jsx(N, { show: l || i, children: /* @__PURE__ */ e.jsx(
|
|
835
|
+
"div",
|
|
836
|
+
{
|
|
837
|
+
style: {
|
|
838
|
+
minHeight: 50
|
|
839
|
+
},
|
|
840
|
+
children: !l && !i && (t ? _n(n.name, a ? a.totalElements.toString() : void 0) : vn(n.name, s))
|
|
841
|
+
}
|
|
842
|
+
) });
|
|
843
|
+
}, pn = [ke], Cn = [Je], Ln = ({ bundle: n, onCancel: t, loadBundles: s }) => {
|
|
844
|
+
const { run: l } = g({
|
|
845
|
+
requestFunction: Ve,
|
|
846
|
+
errorMessages: pn,
|
|
847
|
+
successMessages: Cn
|
|
848
|
+
}), d = Ae(n), a = () => l(n.id).then(s).then(t);
|
|
849
|
+
return /* @__PURE__ */ e.jsx(
|
|
850
|
+
_,
|
|
851
|
+
{
|
|
852
|
+
header: /* @__PURE__ */ e.jsx(r, { i18nKey: k.id, children: k.defaultValue }),
|
|
853
|
+
content: /* @__PURE__ */ e.jsx(yn, { bundle: n, ...d }),
|
|
854
|
+
footer: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
855
|
+
/* @__PURE__ */ e.jsx(j, { primary: !0, disabled: !d.canBeDeleted, onClick: a, children: /* @__PURE__ */ e.jsx(r, { i18nKey: C.id, children: C.defaultValue }) }),
|
|
856
|
+
/* @__PURE__ */ e.jsx(j, { onClick: t, children: /* @__PURE__ */ e.jsx(r, { i18nKey: L.id, children: L.defaultValue }) })
|
|
857
|
+
] }),
|
|
858
|
+
width: 500
|
|
859
|
+
}
|
|
860
|
+
);
|
|
861
|
+
}, Sn = [Ue], Pn = () => {
|
|
862
|
+
const n = me(), [t, s] = V(!1), {
|
|
863
|
+
data: l,
|
|
864
|
+
loading: d,
|
|
865
|
+
run: a
|
|
866
|
+
} = g({
|
|
867
|
+
requestFunction: De,
|
|
868
|
+
errorMessages: Sn,
|
|
869
|
+
initialData: []
|
|
870
|
+
}), [i, u] = V(), o = /* @__PURE__ */ e.jsx(r, { i18nKey: "portalAdmin.sidebarElements.bundles.create", children: "Create new bundle" }), h = () => {
|
|
871
|
+
s(!0);
|
|
872
|
+
};
|
|
873
|
+
return D(() => {
|
|
874
|
+
s(!1), a();
|
|
875
|
+
}, [n, a]), /* @__PURE__ */ e.jsxs("div", { className: "bundles-container", children: [
|
|
876
|
+
/* @__PURE__ */ e.jsx(
|
|
877
|
+
ve,
|
|
878
|
+
{
|
|
879
|
+
title: {
|
|
880
|
+
id: "route.label.bundleManagement.name",
|
|
881
|
+
defaultValue: "Bundle Management"
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
),
|
|
885
|
+
/* @__PURE__ */ e.jsx(
|
|
886
|
+
oe,
|
|
887
|
+
{
|
|
888
|
+
tooltip: o,
|
|
889
|
+
authorities: "WRITE_BUNDLE",
|
|
890
|
+
dataTestId: "create-bundle-button",
|
|
891
|
+
onClick: h
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
/* @__PURE__ */ e.jsx(Tn, { bundles: l, onDelete: u, isLoading: d }),
|
|
895
|
+
i && /* @__PURE__ */ e.jsx(
|
|
896
|
+
Ln,
|
|
897
|
+
{
|
|
898
|
+
bundle: i,
|
|
899
|
+
onCancel: () => u(void 0),
|
|
900
|
+
loadBundles: a
|
|
901
|
+
}
|
|
902
|
+
),
|
|
903
|
+
t && /* @__PURE__ */ e.jsx(Ie, { loadBundles: a, setOpen: s })
|
|
904
|
+
] });
|
|
905
|
+
};
|
|
906
|
+
export {
|
|
907
|
+
Pn as default
|
|
908
|
+
};
|