@deviceinsight/ng-ui-scale-lib 9.26.0 → 10.0.1

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