@deviceinsight/ng-ui-scale-lib 9.26.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-59c05fe4.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-6768666a.js → UserGroupTheme-BLBu4kUe.js} +51 -53
- package/dist/UserGroupTheme-BLBu4kUe.js.map +1 -0
- package/dist/api.d.ts +805 -802
- package/dist/api.js +73 -77
- 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 +4729 -17113
- 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 +85 -108
- package/dist/AccessEditModal-c2178ad5.js +0 -92
- package/dist/BundleManagementContainer-60c28e65.js +0 -20
- package/dist/BundlesContainer-b3ee1991.js +0 -912
- package/dist/ContextBarContext-a6c59c97.js +0 -88776
- package/dist/DatapointImport-f6bdbdbc.js +0 -864
- package/dist/FileUploadInput-81bb787f.js +0 -44
- package/dist/Files-dc240d97.js +0 -364
- package/dist/GlobalPowerBiReports-3b7feef9.js +0 -11081
- package/dist/Graph-f5463f47.js +0 -25012
- package/dist/JsonSettingWidget-307658b8.js +0 -56
- package/dist/LicensesEditPage-f62cca26.js +0 -146
- package/dist/LicensesList-85279448.js +0 -150
- package/dist/PropertiesEditPage-4edb93b7.js +0 -371
- package/dist/TemplateEditPage-fe1b5f44.js +0 -508
- package/dist/TemplateTextInput-34e4356f.js +0 -49
- package/dist/TemplatesListPage-cd3194a7.js +0 -330
- package/dist/UserGroupAssignments-291f29f0.js +0 -297
- package/dist/index-738ab9ab.js +0 -18679
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { jsx as e, jsxs as h, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E, useCallback as B, useEffect as G } from "react";
|
|
3
|
+
import { Prompt as U, useLocation as D, useHistory as M, useParams as R } from "react-router-dom";
|
|
4
|
+
import { getPropertyById as X, updateProperty as H, createProperty as _ } from "@deviceinsight/ng-ui-api-client";
|
|
5
|
+
import { Button as w, Checkbox as A, Icon as O, ButtonRow as j, Spinner as Y } from "@deviceinsight/ng-ui-basic-components";
|
|
6
|
+
import { messageBoxError as K, ContentHeader as W } from "@deviceinsight/ng-ui-components";
|
|
7
|
+
import "react-i18next";
|
|
8
|
+
import { X as N, bS as $, a as d, u as z, P as I, bT as J, bU as C, bV as q, bW as Q, bX as Z, b8 as ee, r as re, bY as le } from "./setTitle-Ck-71vC0.js";
|
|
9
|
+
import te from "axios";
|
|
10
|
+
import { useFormContext as ae, useController as ne, useForm as ie, FormProvider as se, Controller as f } from "react-hook-form";
|
|
11
|
+
import oe from "classnames";
|
|
12
|
+
function de(r) {
|
|
13
|
+
const { options: a, onChange: u, values: i, ...s } = r;
|
|
14
|
+
function c(l) {
|
|
15
|
+
i.includes(l.value) ? u(i.filter((y) => y !== l.value)) : u([...i, l.value]);
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ e(N, { ...s, children: /* @__PURE__ */ e("div", { className: "buttonpicker", children: a.map((l) => /* @__PURE__ */ e(
|
|
18
|
+
w,
|
|
19
|
+
{
|
|
20
|
+
onClick: () => c(l),
|
|
21
|
+
className: oe({
|
|
22
|
+
active: i.includes(l.value)
|
|
23
|
+
}),
|
|
24
|
+
disabled: r.disabled,
|
|
25
|
+
children: /* @__PURE__ */ e($, { translationDescriptor: l.label })
|
|
26
|
+
},
|
|
27
|
+
String(l.value)
|
|
28
|
+
)) }) });
|
|
29
|
+
}
|
|
30
|
+
function ue() {
|
|
31
|
+
const {
|
|
32
|
+
getValues: r,
|
|
33
|
+
formState: { errors: a },
|
|
34
|
+
trigger: u
|
|
35
|
+
} = ae(), [i, s] = E(!!r("allowedValues")), {
|
|
36
|
+
field: { value: c, onChange: l },
|
|
37
|
+
fieldState: { invalid: y }
|
|
38
|
+
} = ne({
|
|
39
|
+
name: "allowedValues",
|
|
40
|
+
rules: {
|
|
41
|
+
validate: (n) => n == null || n?.some((p) => p !== "") ? void 0 : "Required"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
function v(n) {
|
|
45
|
+
l(c?.filter((p, m) => m !== n));
|
|
46
|
+
}
|
|
47
|
+
function S(n) {
|
|
48
|
+
l(c ? [...c, n] : [n]);
|
|
49
|
+
}
|
|
50
|
+
function g(n, p) {
|
|
51
|
+
l(c?.map((m, b) => p === b ? n : m));
|
|
52
|
+
}
|
|
53
|
+
async function T(n) {
|
|
54
|
+
l(n ? [] : null), s(n), !n && y && await u();
|
|
55
|
+
}
|
|
56
|
+
return /* @__PURE__ */ h(V, { children: [
|
|
57
|
+
/* @__PURE__ */ h(
|
|
58
|
+
N,
|
|
59
|
+
{
|
|
60
|
+
label: /* @__PURE__ */ h("div", { className: "di allowed-values-header", children: [
|
|
61
|
+
/* @__PURE__ */ e(A, { type: "toggle", value: i, toggleSmall: !0, onChange: T }),
|
|
62
|
+
" ",
|
|
63
|
+
/* @__PURE__ */ e(d, { i18nKey: "properties.labels.allowedValues", children: "Allowed Values" })
|
|
64
|
+
] }),
|
|
65
|
+
error: a.allowedValues ? "Required" : void 0,
|
|
66
|
+
className: "di allowed-values-container",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ e(A, { value: i, onChange: T }),
|
|
69
|
+
c?.length === 0 ? /* @__PURE__ */ e("div", { className: "empty-placeholder", children: /* @__PURE__ */ e(d, { i18nKey: "properties.labels.allowedValuesEmptyPlaceholder", children: "No values" }) }) : /* @__PURE__ */ e("ul", { children: c?.map((n, p) => /* @__PURE__ */ h("li", { className: "item", children: [
|
|
70
|
+
/* @__PURE__ */ e(N, { className: "value-container", children: /* @__PURE__ */ e(
|
|
71
|
+
"input",
|
|
72
|
+
{
|
|
73
|
+
type: "text",
|
|
74
|
+
value: n,
|
|
75
|
+
onChange: (m) => g(m.target.value, p)
|
|
76
|
+
}
|
|
77
|
+
) }),
|
|
78
|
+
/* @__PURE__ */ e(w, { onClick: () => v(p), children: /* @__PURE__ */ e(O, { del: !0 }) })
|
|
79
|
+
] }, p)) })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
i && /* @__PURE__ */ h(w, { onClick: () => S(""), children: [
|
|
84
|
+
/* @__PURE__ */ e(O, { add: !0 }),
|
|
85
|
+
/* @__PURE__ */ e(d, { i18nKey: "properties.labels.allowedValuesAdd", children: "Add" })
|
|
86
|
+
] })
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
const ce = ["STRING", "TEXT", "DATE", "LONG", "DOUBLE", "BOOLEAN", "IP", "GEO"].map((r) => ({
|
|
90
|
+
value: r,
|
|
91
|
+
name: r
|
|
92
|
+
})), pe = ["ASSET", "ASSET_GROUP", "ACCOUNT", "ACCOUNT_GROUP", "DATAPOINT"].map(
|
|
93
|
+
(r) => ({
|
|
94
|
+
value: r,
|
|
95
|
+
label: r
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
function me() {
|
|
99
|
+
return {
|
|
100
|
+
key: "",
|
|
101
|
+
type: "STRING",
|
|
102
|
+
entityTargets: [],
|
|
103
|
+
addToAll: !1,
|
|
104
|
+
deletable: !0
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function he({ editedProperty: r, isReadonly: a, onSubmit: u, onCancel: i }) {
|
|
108
|
+
const { t: s } = z(), c = ie({
|
|
109
|
+
defaultValues: r || me()
|
|
110
|
+
}), {
|
|
111
|
+
control: l,
|
|
112
|
+
handleSubmit: y,
|
|
113
|
+
watch: v,
|
|
114
|
+
setError: S,
|
|
115
|
+
formState: { isSubmitting: g, isDirty: T }
|
|
116
|
+
} = c;
|
|
117
|
+
function n() {
|
|
118
|
+
async function t(o) {
|
|
119
|
+
try {
|
|
120
|
+
await u(o);
|
|
121
|
+
} catch (P) {
|
|
122
|
+
if (te.isAxiosError(P)) {
|
|
123
|
+
const { fieldName: x, message: k } = Q(P, s);
|
|
124
|
+
x ? S(x, { message: k }) : K(k);
|
|
125
|
+
} else
|
|
126
|
+
K(Z(s));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return y(t, (o) => {
|
|
130
|
+
console.warn("Validation error", o);
|
|
131
|
+
})();
|
|
132
|
+
}
|
|
133
|
+
const p = v("type"), m = !!r, b = p === "STRING" || p === "TEXT", F = !!v("allowedValues");
|
|
134
|
+
return /* @__PURE__ */ e(se, { ...c, children: /* @__PURE__ */ h("div", { className: "property-form", children: [
|
|
135
|
+
/* @__PURE__ */ e(
|
|
136
|
+
f,
|
|
137
|
+
{
|
|
138
|
+
name: "key",
|
|
139
|
+
control: l,
|
|
140
|
+
rules: {
|
|
141
|
+
required: s("properties.form.validation.key.required", {
|
|
142
|
+
defaultValue: "Please enter a property key"
|
|
143
|
+
})
|
|
144
|
+
},
|
|
145
|
+
render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ e(
|
|
146
|
+
I,
|
|
147
|
+
{
|
|
148
|
+
...t,
|
|
149
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.labels.key", children: "Key" }),
|
|
150
|
+
error: o?.message,
|
|
151
|
+
required: !0,
|
|
152
|
+
disabled: a || m
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
/* @__PURE__ */ e(
|
|
158
|
+
f,
|
|
159
|
+
{
|
|
160
|
+
name: "type",
|
|
161
|
+
control: l,
|
|
162
|
+
render: ({ field: t }) => /* @__PURE__ */ e(
|
|
163
|
+
J,
|
|
164
|
+
{
|
|
165
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.labels.type", children: "Type" }),
|
|
166
|
+
options: ce,
|
|
167
|
+
required: !0,
|
|
168
|
+
disabled: a || m,
|
|
169
|
+
value: t.value,
|
|
170
|
+
onChange: t.onChange
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ e(
|
|
176
|
+
f,
|
|
177
|
+
{
|
|
178
|
+
name: "entityTargets",
|
|
179
|
+
control: l,
|
|
180
|
+
rules: { validate: (t) => t.length === 0 ? "Required" : void 0 },
|
|
181
|
+
render: ({ field: { value: t, onChange: o }, fieldState: { error: P } }) => /* @__PURE__ */ e(
|
|
182
|
+
de,
|
|
183
|
+
{
|
|
184
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.labels.entityTargets", children: "Entity targets" }),
|
|
185
|
+
values: t,
|
|
186
|
+
onChange: o,
|
|
187
|
+
options: pe,
|
|
188
|
+
error: P ? s("properties.form.validation.entityTargets.required", {
|
|
189
|
+
defaultValue: "Please select a at least one entity target"
|
|
190
|
+
}) : void 0,
|
|
191
|
+
required: !0,
|
|
192
|
+
disabled: a
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ e(
|
|
198
|
+
f,
|
|
199
|
+
{
|
|
200
|
+
name: "addToAll",
|
|
201
|
+
control: l,
|
|
202
|
+
render: ({ field: t }) => /* @__PURE__ */ e(
|
|
203
|
+
C,
|
|
204
|
+
{
|
|
205
|
+
...t,
|
|
206
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.labels.addToSearch", children: "Add to Search" }),
|
|
207
|
+
disabled: a || m
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ e(
|
|
213
|
+
f,
|
|
214
|
+
{
|
|
215
|
+
name: "unique",
|
|
216
|
+
control: l,
|
|
217
|
+
render: ({ field: { value: t, onChange: o } }) => /* @__PURE__ */ e(
|
|
218
|
+
C,
|
|
219
|
+
{
|
|
220
|
+
value: !!t,
|
|
221
|
+
onChange: o,
|
|
222
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.labels.unique", children: "Unique" }),
|
|
223
|
+
disabled: a
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
/* @__PURE__ */ e(
|
|
229
|
+
f,
|
|
230
|
+
{
|
|
231
|
+
name: "final",
|
|
232
|
+
control: l,
|
|
233
|
+
render: ({ field: { value: t, onChange: o } }) => /* @__PURE__ */ e(
|
|
234
|
+
C,
|
|
235
|
+
{
|
|
236
|
+
value: !!t,
|
|
237
|
+
onChange: o,
|
|
238
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.labels.final", children: "Final" }),
|
|
239
|
+
disabled: a
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
b && !F && /* @__PURE__ */ h(V, { children: [
|
|
245
|
+
/* @__PURE__ */ e(
|
|
246
|
+
f,
|
|
247
|
+
{
|
|
248
|
+
name: "minLength",
|
|
249
|
+
control: l,
|
|
250
|
+
render: ({ field: { value: t, ...o } }) => /* @__PURE__ */ e(
|
|
251
|
+
q,
|
|
252
|
+
{
|
|
253
|
+
...o,
|
|
254
|
+
value: t ?? void 0,
|
|
255
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.label.minLength", children: "Minimum length" }),
|
|
256
|
+
placeholder: a ? s("properties.placeholder.notSet", { defaultValue: "Not set" }) : "0",
|
|
257
|
+
readOnly: a
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ e(
|
|
263
|
+
f,
|
|
264
|
+
{
|
|
265
|
+
name: "maxLength",
|
|
266
|
+
control: l,
|
|
267
|
+
render: ({ field: { value: t, ...o } }) => /* @__PURE__ */ e(
|
|
268
|
+
q,
|
|
269
|
+
{
|
|
270
|
+
...o,
|
|
271
|
+
value: t ?? void 0,
|
|
272
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.label.maxLength", children: "Maximum length" }),
|
|
273
|
+
placeholder: a ? s("properties.placeholder.notSet", { defaultValue: "Not set" }) : "0",
|
|
274
|
+
readOnly: a
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ e(
|
|
280
|
+
f,
|
|
281
|
+
{
|
|
282
|
+
name: "regularExpression",
|
|
283
|
+
control: l,
|
|
284
|
+
render: ({ field: { value: t, ...o } }) => /* @__PURE__ */ e(
|
|
285
|
+
I,
|
|
286
|
+
{
|
|
287
|
+
...o,
|
|
288
|
+
value: t ?? void 0,
|
|
289
|
+
label: /* @__PURE__ */ e(d, { i18nKey: "properties.labels.regularExpression", children: "Regular expression" }),
|
|
290
|
+
readOnly: a,
|
|
291
|
+
placeholder: a ? s("properties.placeholder.notSet", { defaultValue: "Not set" }) : ""
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] }),
|
|
297
|
+
p === "STRING" && /* @__PURE__ */ e(ue, {}),
|
|
298
|
+
/* @__PURE__ */ h("div", { className: "formRequired", children: [
|
|
299
|
+
"* ",
|
|
300
|
+
/* @__PURE__ */ e(d, { i18nKey: "form.field.required", children: "required" })
|
|
301
|
+
] }),
|
|
302
|
+
/* @__PURE__ */ h(j, { dividing: !0, children: [
|
|
303
|
+
/* @__PURE__ */ e(w, { className: "with-spinner", primary: !0, onClick: n, disabled: g, children: /* @__PURE__ */ e(d, { i18nKey: "general.actions.save", children: "Save" }) }),
|
|
304
|
+
/* @__PURE__ */ e(w, { disabled: g, onClick: i, children: /* @__PURE__ */ e(d, { i18nKey: "general.actions.cancel", children: "Cancel" }) })
|
|
305
|
+
] }),
|
|
306
|
+
/* @__PURE__ */ e(U, { message: "", when: T && !g })
|
|
307
|
+
] }) });
|
|
308
|
+
}
|
|
309
|
+
const fe = (r) => r ? {
|
|
310
|
+
id: "properties.create.title",
|
|
311
|
+
defaultValue: "Create Property"
|
|
312
|
+
} : {
|
|
313
|
+
id: "properties.edit.title",
|
|
314
|
+
defaultValue: "Edit Property"
|
|
315
|
+
}, ge = /* @__PURE__ */ e(d, { i18nKey: "properties.saveSuccessMessage", children: "Property has been saved successfully." });
|
|
316
|
+
function L(r) {
|
|
317
|
+
if (r.type === "STRING" && r.allowedValues && r.allowedValues.length > 0) {
|
|
318
|
+
const { regularExpression: a, maxLength: u, minLength: i, allowedValues: s, ...c } = r;
|
|
319
|
+
return { ...c, allowedValues: [...new Set(s.filter((l) => l !== ""))] };
|
|
320
|
+
}
|
|
321
|
+
if (r.allowedValues && r.allowedValues.length === 0) {
|
|
322
|
+
const { allowedValues: a, ...u } = r;
|
|
323
|
+
return u;
|
|
324
|
+
}
|
|
325
|
+
if (r.type !== "STRING" && r.type !== "TEXT") {
|
|
326
|
+
const { regularExpression: a, maxLength: u, minLength: i, ...s } = r;
|
|
327
|
+
return s;
|
|
328
|
+
}
|
|
329
|
+
return r;
|
|
330
|
+
}
|
|
331
|
+
function xe() {
|
|
332
|
+
const { pathname: r } = D(), a = M(), { propertyKey: u } = R(), [i, s] = E(void 0), [c, l] = E(!0), [y, v] = E(!1), S = B(async (m) => {
|
|
333
|
+
try {
|
|
334
|
+
const b = await X(m);
|
|
335
|
+
s(b);
|
|
336
|
+
} catch (b) {
|
|
337
|
+
console.error(b), v(!0);
|
|
338
|
+
} finally {
|
|
339
|
+
l(!1);
|
|
340
|
+
}
|
|
341
|
+
}, []);
|
|
342
|
+
G(() => {
|
|
343
|
+
u && u !== "create" ? S(u) : l(!1);
|
|
344
|
+
}, [u, S]);
|
|
345
|
+
function g() {
|
|
346
|
+
a.push(r.substring(0, r.lastIndexOf("/")));
|
|
347
|
+
}
|
|
348
|
+
async function T(m) {
|
|
349
|
+
i ? await H(L(m)) : await _(L(m)), le(ge), g();
|
|
350
|
+
}
|
|
351
|
+
function n() {
|
|
352
|
+
g();
|
|
353
|
+
}
|
|
354
|
+
if (y)
|
|
355
|
+
return /* @__PURE__ */ e(ee, {});
|
|
356
|
+
const p = fe(!i);
|
|
357
|
+
return c ? /* @__PURE__ */ e(Y, { center: !0 }) : /* @__PURE__ */ h(V, { children: [
|
|
358
|
+
/* @__PURE__ */ e(W, { title: p, parentPageLink: !0 }),
|
|
359
|
+
/* @__PURE__ */ e(
|
|
360
|
+
he,
|
|
361
|
+
{
|
|
362
|
+
editedProperty: i,
|
|
363
|
+
isReadonly: !!i && !re(["UPDATE_PROPERTY"]),
|
|
364
|
+
onSubmit: T,
|
|
365
|
+
onCancel: n
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] });
|
|
369
|
+
}
|
|
370
|
+
export {
|
|
371
|
+
xe as default
|
|
372
|
+
};
|
|
373
|
+
//# sourceMappingURL=PropertiesEditPage-OrwneFF4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertiesEditPage-OrwneFF4.js","sources":["../ng-ui-scale/src/components/inputs/buttonPicker/ButtonPicker.tsx","../ng-ui-scale/src/modules/properties/AllowedValues.tsx","../ng-ui-scale/src/modules/properties/PropertyForm.tsx","../ng-ui-scale/src/modules/properties/PropertiesEditPage.tsx"],"sourcesContent":["import cx from 'classnames';\n\nimport {Button} from '@deviceinsight/ng-ui-basic-components';\n\nimport type {TranslationDescriptor} from 'i18n';\nimport TransByDescriptor from 'i18n/TransByDescriptor';\nimport FieldDecorator, {type FieldDecoratorProps} from '../FieldDecorator';\n\nimport '../input.scss';\n\nexport type ButtonPickerOption<T> = {\n\tvalue: T;\n\tlabel: string | TranslationDescriptor;\n};\n\ntype OwnProps<T> = {\n\tonChange: (values: T[]) => void;\n\toptions: ButtonPickerOption<T>[];\n\tvalues: T[];\n\tdisabled?: boolean;\n};\n\ntype Props<T> = FieldDecoratorProps & OwnProps<T>;\n\nexport default function ButtonPicker<T>(props: Props<T>) {\n\tconst {options, onChange, values, ...rest} = props;\n\n\tfunction toggleOption(option: ButtonPickerOption<T>) {\n\t\tif (values.includes(option.value)) {\n\t\t\tonChange(values.filter(v => v !== option.value));\n\t\t} else {\n\t\t\tonChange([...values, option.value]);\n\t\t}\n\t}\n\n\treturn (\n\t\t<FieldDecorator {...rest}>\n\t\t\t<div className=\"buttonpicker\">\n\t\t\t\t{options.map(option => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={String(option.value)}\n\t\t\t\t\t\tonClick={() => toggleOption(option)}\n\t\t\t\t\t\tclassName={cx({\n\t\t\t\t\t\t\tactive: values.includes(option.value),\n\t\t\t\t\t\t})}\n\t\t\t\t\t\tdisabled={props.disabled}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TransByDescriptor translationDescriptor={option.label} />\n\t\t\t\t\t</Button>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</FieldDecorator>\n\t);\n}\n","import {useState} from 'react';\nimport {useController, useFormContext} from 'react-hook-form';\n\nimport type {Property} from '@deviceinsight/ng-ui-api-client';\nimport {Button, Checkbox, Icon} from '@deviceinsight/ng-ui-basic-components';\n\nimport FieldDecorator from 'components/inputs/FieldDecorator';\nimport {Trans} from 'i18n';\n\nexport default function AllowedValues() {\n\tconst {\n\t\tgetValues,\n\t\tformState: {errors},\n\t\ttrigger,\n\t} = useFormContext<Property>();\n\tconst [enabled, setEnabled] = useState<boolean>(!!getValues('allowedValues'));\n\tconst {\n\t\tfield: {value: allowedValues, onChange},\n\t\tfieldState: {invalid: allowedValuesInvalid},\n\t} = useController<Property, 'allowedValues'>({\n\t\tname: 'allowedValues',\n\t\trules: {\n\t\t\tvalidate: allowedValues =>\n\t\t\t\tallowedValues == null || allowedValues?.some(v => v !== '') ? undefined : 'Required',\n\t\t},\n\t});\n\n\tfunction remove(index: number) {\n\t\tonChange(allowedValues?.filter((v, i) => i !== index));\n\t}\n\n\tfunction append(value: string) {\n\t\tonChange(allowedValues ? [...allowedValues, value] : [value]);\n\t}\n\n\tfunction change(value: string, index: number) {\n\t\tonChange(allowedValues?.map((allowedValue, i) => (index === i ? value : allowedValue)));\n\t}\n\n\tasync function handleEnabledChange(enabled: boolean) {\n\t\tonChange(enabled ? [] : null);\n\t\tsetEnabled(enabled);\n\n\t\tif (!enabled && allowedValuesInvalid) {\n\t\t\tawait trigger();\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FieldDecorator\n\t\t\t\tlabel={\n\t\t\t\t\t<div className=\"di allowed-values-header\">\n\t\t\t\t\t\t<Checkbox type=\"toggle\" value={enabled} toggleSmall onChange={handleEnabledChange} />{' '}\n\t\t\t\t\t\t<Trans i18nKey=\"properties.labels.allowedValues\">Allowed Values</Trans>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\terror={errors.allowedValues ? 'Required' : undefined}\n\t\t\t\tclassName=\"di allowed-values-container\"\n\t\t\t>\n\t\t\t\t<Checkbox value={enabled} onChange={handleEnabledChange} />\n\t\t\t\t{allowedValues?.length === 0 ? (\n\t\t\t\t\t<div className=\"empty-placeholder\">\n\t\t\t\t\t\t<Trans i18nKey=\"properties.labels.allowedValuesEmptyPlaceholder\">No values</Trans>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t{allowedValues?.map((allowedValue, index) => (\n\t\t\t\t\t\t\t<li key={index} className=\"item\">\n\t\t\t\t\t\t\t\t<FieldDecorator className=\"value-container\">\n\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\tvalue={allowedValue}\n\t\t\t\t\t\t\t\t\t\tonChange={e => change(e.target.value, index)}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</FieldDecorator>\n\t\t\t\t\t\t\t\t<Button onClick={() => remove(index)}>\n\t\t\t\t\t\t\t\t\t<Icon del />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t)}\n\t\t\t</FieldDecorator>\n\t\t\t{enabled && (\n\t\t\t\t<Button onClick={() => append('')}>\n\t\t\t\t\t<Icon add />\n\t\t\t\t\t<Trans i18nKey=\"properties.labels.allowedValuesAdd\">Add</Trans>\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t</>\n\t);\n}\n","import axios from 'axios';\nimport {Controller, FormProvider, useForm} from 'react-hook-form';\nimport {Prompt} from 'react-router-dom';\n\nimport type {EntityTarget, Property} from '@deviceinsight/ng-ui-api-client';\nimport {Button, ButtonRow} from '@deviceinsight/ng-ui-basic-components';\nimport {messageBoxError} from '@deviceinsight/ng-ui-components';\n\nimport ButtonPicker from 'components/inputs/buttonPicker/ButtonPicker';\nimport Checkbox from 'components/inputs/checkbox/Checkbox';\nimport NumberInput from 'components/inputs/numberInput/NumberInput';\nimport SelectInput from 'components/inputs/selectInput/SelectInput';\nimport TextInput from 'components/inputs/textInput/TextInput';\nimport {Trans, useTranslation} from 'i18n';\nimport AllowedValues from './AllowedValues';\nimport {getUnknownBackendErrorMessage, parseBackendError} from './utils';\n\nimport './propertiesEditPage.scss';\n\nconst typeOptions = ['STRING', 'TEXT', 'DATE', 'LONG', 'DOUBLE', 'BOOLEAN', 'IP', 'GEO'].map(pType => {\n\treturn {\n\t\tvalue: pType,\n\t\tname: pType,\n\t};\n});\n\nconst entityTargetOptions = (['ASSET', 'ASSET_GROUP', 'ACCOUNT', 'ACCOUNT_GROUP', 'DATAPOINT'] as EntityTarget[]).map(\n\tpType => ({\n\t\tvalue: pType,\n\t\tlabel: pType,\n\t}),\n);\n\ntype Props = {\n\teditedProperty: Property | undefined;\n\tisReadonly: boolean;\n\tonSubmit: (property: Property) => Promise<void>;\n\tonCancel: () => void;\n};\n\nfunction createEmptyFormData(): Property {\n\treturn {\n\t\tkey: '',\n\t\ttype: 'STRING',\n\t\tentityTargets: [],\n\t\taddToAll: false,\n\t\tdeletable: true,\n\t};\n}\n\nfunction PropertyForm({editedProperty, isReadonly, onSubmit, onCancel}: Props) {\n\tconst {t} = useTranslation();\n\tconst formContext = useForm<Property>({\n\t\tdefaultValues: editedProperty ? editedProperty : createEmptyFormData(),\n\t});\n\tconst {\n\t\tcontrol,\n\t\thandleSubmit,\n\t\twatch,\n\t\tsetError,\n\t\tformState: {isSubmitting, isDirty},\n\t} = formContext;\n\n\tfunction submit(): Promise<void> {\n\t\tasync function submitFunction(property: Property) {\n\t\t\ttry {\n\t\t\t\tawait onSubmit(property);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tif (axios.isAxiosError(error)) {\n\t\t\t\t\tconst {fieldName, message} = parseBackendError(error, t);\n\t\t\t\t\tif (fieldName) {\n\t\t\t\t\t\tsetError(fieldName as any, {message});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmessageBoxError(message);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmessageBoxError(getUnknownBackendErrorMessage(t));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn handleSubmit(submitFunction, errors => {\n\t\t\tconsole.warn('Validation error', errors);\n\t\t})();\n\t}\n\n\tconst type = watch('type');\n\n\tconst isEditMode = !!editedProperty;\n\tconst isStringOrText = type === 'STRING' || type === 'TEXT';\n\tconst areAllowedValuesEnabled = !!watch('allowedValues');\n\n\treturn (\n\t\t<FormProvider {...formContext}>\n\t\t\t<div className=\"property-form\">\n\t\t\t\t<Controller\n\t\t\t\t\tname=\"key\"\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\trules={{\n\t\t\t\t\t\trequired: t('properties.form.validation.key.required', {\n\t\t\t\t\t\t\tdefaultValue: 'Please enter a property key',\n\t\t\t\t\t\t}),\n\t\t\t\t\t}}\n\t\t\t\t\trender={({field, fieldState: {error}}) => (\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t{...field}\n\t\t\t\t\t\t\tlabel={<Trans i18nKey=\"properties.labels.key\">Key</Trans>}\n\t\t\t\t\t\t\terror={error?.message}\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\tdisabled={isReadonly || isEditMode}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<Controller\n\t\t\t\t\tname=\"type\"\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\trender={({field}) => (\n\t\t\t\t\t\t<SelectInput\n\t\t\t\t\t\t\tlabel={<Trans i18nKey=\"properties.labels.type\">Type</Trans>}\n\t\t\t\t\t\t\toptions={typeOptions}\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\tdisabled={isReadonly || isEditMode}\n\t\t\t\t\t\t\tvalue={field.value}\n\t\t\t\t\t\t\tonChange={field.onChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<Controller\n\t\t\t\t\tname=\"entityTargets\"\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\trules={{validate: entityTargets => (entityTargets.length === 0 ? 'Required' : undefined)}}\n\t\t\t\t\trender={({field: {value, onChange}, fieldState: {error}}) => (\n\t\t\t\t\t\t<ButtonPicker\n\t\t\t\t\t\t\tlabel={<Trans i18nKey=\"properties.labels.entityTargets\">Entity targets</Trans>}\n\t\t\t\t\t\t\tvalues={value}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\toptions={entityTargetOptions}\n\t\t\t\t\t\t\terror={\n\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t\t? t('properties.form.validation.entityTargets.required', {\n\t\t\t\t\t\t\t\t\t\t\tdefaultValue: 'Please select a at least one entity target',\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\tdisabled={isReadonly}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<Controller\n\t\t\t\t\tname=\"addToAll\"\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\trender={({field}) => (\n\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\t{...field}\n\t\t\t\t\t\t\tlabel={<Trans i18nKey=\"properties.labels.addToSearch\">Add to Search</Trans>}\n\t\t\t\t\t\t\tdisabled={isReadonly || isEditMode}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<Controller\n\t\t\t\t\tname=\"unique\"\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\trender={({field: {value, onChange}}) => (\n\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\tvalue={!!value}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tlabel={<Trans i18nKey=\"properties.labels.unique\">Unique</Trans>}\n\t\t\t\t\t\t\tdisabled={isReadonly}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<Controller\n\t\t\t\t\tname=\"final\"\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\trender={({field: {value, onChange}}) => (\n\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\tvalue={!!value}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tlabel={<Trans i18nKey=\"properties.labels.final\">Final</Trans>}\n\t\t\t\t\t\t\tdisabled={isReadonly}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t{isStringOrText && !areAllowedValuesEnabled && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Controller\n\t\t\t\t\t\t\tname=\"minLength\"\n\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\trender={({field: {value, ...rest}}) => (\n\t\t\t\t\t\t\t\t<NumberInput\n\t\t\t\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t\t\t\tvalue={value ?? undefined}\n\t\t\t\t\t\t\t\t\tlabel={<Trans i18nKey=\"properties.label.minLength\">Minimum length</Trans>}\n\t\t\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t\t\tisReadonly ? t('properties.placeholder.notSet', {defaultValue: 'Not set'}) : '0'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treadOnly={isReadonly}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Controller\n\t\t\t\t\t\t\tname=\"maxLength\"\n\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\trender={({field: {value, ...rest}}) => (\n\t\t\t\t\t\t\t\t<NumberInput\n\t\t\t\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t\t\t\tvalue={value ?? undefined}\n\t\t\t\t\t\t\t\t\tlabel={<Trans i18nKey=\"properties.label.maxLength\">Maximum length</Trans>}\n\t\t\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t\t\tisReadonly ? t('properties.placeholder.notSet', {defaultValue: 'Not set'}) : '0'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treadOnly={isReadonly}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Controller\n\t\t\t\t\t\t\tname=\"regularExpression\"\n\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\trender={({field: {value, ...rest}}) => (\n\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\t\t\t\tvalue={value ?? undefined}\n\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t<Trans i18nKey=\"properties.labels.regularExpression\">Regular expression</Trans>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treadOnly={isReadonly}\n\t\t\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t\t\tisReadonly ? t('properties.placeholder.notSet', {defaultValue: 'Not set'}) : ''\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{type === 'STRING' && <AllowedValues />}\n\n\t\t\t\t<div className=\"formRequired\">\n\t\t\t\t\t* <Trans i18nKey=\"form.field.required\">required</Trans>\n\t\t\t\t</div>\n\t\t\t\t<ButtonRow dividing>\n\t\t\t\t\t<Button className=\"with-spinner\" primary onClick={submit} disabled={isSubmitting}>\n\t\t\t\t\t\t{<Trans i18nKey=\"general.actions.save\">Save</Trans>}\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button disabled={isSubmitting} onClick={onCancel}>\n\t\t\t\t\t\t<Trans i18nKey=\"general.actions.cancel\">Cancel</Trans>\n\t\t\t\t\t</Button>\n\t\t\t\t</ButtonRow>\n\t\t\t\t<Prompt message=\"\" when={isDirty && !isSubmitting} />\n\t\t\t</div>\n\t\t</FormProvider>\n\t);\n}\n\nexport default PropertyForm;\n","import {useCallback, useEffect, useState} from 'react';\nimport {useHistory, useLocation, useParams} from 'react-router-dom';\n\nimport {\n\tcreateProperty as createPropertyApi,\n\tgetPropertyById,\n\ttype Property,\n\tupdateProperty as updatePropertyApi,\n} from '@deviceinsight/ng-ui-api-client';\nimport {Spinner} from '@deviceinsight/ng-ui-basic-components';\nimport {ContentHeader} from '@deviceinsight/ng-ui-components';\n\nimport {Trans} from 'i18n';\nimport PageNotFound from '../../components/page/misc/PageNotFound';\nimport {hasAuthorities} from '../../utils/hasAuthorities';\nimport PropertyForm from './PropertyForm';\nimport {displaySuccessMessage} from './utils';\n\nconst getContentHeaderTitle = (createMode: boolean) => {\n\treturn createMode\n\t\t? {\n\t\t\t\tid: 'properties.create.title',\n\t\t\t\tdefaultValue: 'Create Property',\n\t\t\t}\n\t\t: {\n\t\t\t\tid: 'properties.edit.title',\n\t\t\t\tdefaultValue: 'Edit Property',\n\t\t\t};\n};\n\nconst messageSuccessSaveProperty = (\n\t<Trans i18nKey=\"properties.saveSuccessMessage\">Property has been saved successfully.</Trans>\n);\n\nfunction clearPropertyFields(property: Property): Property {\n\tif (property.type === 'STRING' && property.allowedValues && property.allowedValues.length > 0) {\n\t\t// biome-ignore lint/correctness/noUnusedVariables: It's ok\n\t\tconst {regularExpression, maxLength, minLength, allowedValues, ...newProperty} = property;\n\t\treturn {...newProperty, allowedValues: [...new Set(allowedValues.filter(value => value !== ''))]};\n\t}\n\n\t// The backend does not accept an empty array for allowedValues\n\tif (property.allowedValues && property.allowedValues.length === 0) {\n\t\t// biome-ignore lint/correctness/noUnusedVariables: It's ok\n\t\tconst {allowedValues, ...newProperty} = property;\n\t\treturn newProperty;\n\t}\n\tif (property.type !== 'STRING' && property.type !== 'TEXT') {\n\t\t// biome-ignore lint/correctness/noUnusedVariables: It's ok\n\t\tconst {regularExpression, maxLength, minLength, ...newProperty} = property;\n\t\treturn newProperty;\n\t}\n\n\treturn property;\n}\n\nexport default function PropertiesEditPage() {\n\tconst {pathname} = useLocation();\n\tconst history = useHistory();\n\tconst {propertyKey} = useParams<{propertyKey: string}>();\n\tconst [property, setProperty] = useState<Property | undefined>(undefined);\n\tconst [isLoading, setIsLoading] = useState<boolean>(true);\n\tconst [notFound, setNotFound] = useState<boolean>(false);\n\n\tconst loadProperty = useCallback(async (propertyKey: string) => {\n\t\ttry {\n\t\t\tconst property = await getPropertyById(propertyKey);\n\t\t\tsetProperty(property);\n\t\t} catch (e) {\n\t\t\tconsole.error(e);\n\t\t\tsetNotFound(true);\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (propertyKey && propertyKey !== 'create') {\n\t\t\tloadProperty(propertyKey);\n\t\t} else {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [propertyKey, loadProperty]);\n\n\tfunction goToParentPage() {\n\t\thistory.push(pathname.substring(0, pathname.lastIndexOf('/')));\n\t}\n\n\tasync function handleSubmit(formData: Property) {\n\t\tif (property) {\n\t\t\tawait updatePropertyApi(clearPropertyFields(formData));\n\t\t} else {\n\t\t\tawait createPropertyApi(clearPropertyFields(formData));\n\t\t}\n\t\tdisplaySuccessMessage(messageSuccessSaveProperty);\n\t\tgoToParentPage();\n\t}\n\n\tfunction cancel() {\n\t\tgoToParentPage();\n\t}\n\n\tif (notFound) {\n\t\treturn <PageNotFound />;\n\t}\n\tconst contentHeaderTitle = getContentHeaderTitle(!property);\n\treturn !isLoading ? (\n\t\t<>\n\t\t\t<ContentHeader title={contentHeaderTitle} parentPageLink />\n\t\t\t<PropertyForm\n\t\t\t\teditedProperty={property}\n\t\t\t\tisReadonly={!!property && !hasAuthorities(['UPDATE_PROPERTY'] as string[])}\n\t\t\t\tonSubmit={handleSubmit}\n\t\t\t\tonCancel={cancel}\n\t\t\t/>\n\t\t</>\n\t) : (\n\t\t<Spinner center />\n\t);\n}\n"],"names":["ButtonPicker","props","options","onChange","values","rest","toggleOption","option","v","jsx","FieldDecorator","Button","cx","TransByDescriptor","AllowedValues","getValues","errors","trigger","useFormContext","enabled","setEnabled","useState","allowedValues","allowedValuesInvalid","useController","remove","index","i","append","value","change","allowedValue","handleEnabledChange","jsxs","Fragment","Checkbox","Trans","e","Icon","typeOptions","pType","entityTargetOptions","createEmptyFormData","PropertyForm","editedProperty","isReadonly","onSubmit","onCancel","t","useTranslation","formContext","useForm","control","handleSubmit","watch","setError","isSubmitting","isDirty","submit","submitFunction","property","error","axios","fieldName","message","parseBackendError","messageBoxError","getUnknownBackendErrorMessage","type","isEditMode","isStringOrText","areAllowedValuesEnabled","FormProvider","Controller","field","TextInput","SelectInput","entityTargets","NumberInput","ButtonRow","Prompt","getContentHeaderTitle","createMode","messageSuccessSaveProperty","clearPropertyFields","regularExpression","maxLength","minLength","newProperty","PropertiesEditPage","pathname","useLocation","history","useHistory","propertyKey","useParams","setProperty","isLoading","setIsLoading","notFound","setNotFound","loadProperty","useCallback","getPropertyById","useEffect","goToParentPage","formData","updatePropertyApi","createPropertyApi","displaySuccessMessage","cancel","PageNotFound","contentHeaderTitle","Spinner","ContentHeader","hasAuthorities"],"mappings":";;;;;;;;;;;AAwBA,SAAwBA,GAAgBC,GAAiB;AACxD,QAAM,EAAC,SAAAC,GAAS,UAAAC,GAAU,QAAAC,GAAQ,GAAGC,MAAQJ;AAE7C,WAASK,EAAaC,GAA+B;AACpD,IAAIH,EAAO,SAASG,EAAO,KAAK,IAC/BJ,EAASC,EAAO,OAAO,CAAAI,MAAKA,MAAMD,EAAO,KAAK,CAAC,IAE/CJ,EAAS,CAAC,GAAGC,GAAQG,EAAO,KAAK,CAAC;AAAA,EAEpC;AAEA,SACC,gBAAAE,EAACC,GAAA,EAAgB,GAAGL,GACnB,UAAA,gBAAAI,EAAC,SAAI,WAAU,gBACb,UAAAP,EAAQ,IAAI,CAAAK,MACZ,gBAAAE;AAAA,IAACE;AAAA,IAAA;AAAA,MAEA,SAAS,MAAML,EAAaC,CAAM;AAAA,MAClC,WAAWK,GAAG;AAAA,QACb,QAAQR,EAAO,SAASG,EAAO,KAAK;AAAA,MAAA,CACpC;AAAA,MACD,UAAUN,EAAM;AAAA,MAEhB,UAAA,gBAAAQ,EAACI,GAAA,EAAkB,uBAAuBN,EAAO,MAAA,CAAO;AAAA,IAAA;AAAA,IAPnD,OAAOA,EAAO,KAAK;AAAA,EAAA,CASzB,GACF,EAAA,CACD;AAEF;AC5CA,SAAwBO,KAAgB;AACvC,QAAM;AAAA,IACL,WAAAC;AAAA,IACA,WAAW,EAAC,QAAAC,EAAA;AAAA,IACZ,SAAAC;AAAA,EAAA,IACGC,GAAA,GACE,CAACC,GAASC,CAAU,IAAIC,EAAkB,CAAC,CAACN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ContentHeader as
|
|
6
|
-
import {
|
|
1
|
+
import { jsx as r, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as c, useState as y, useCallback as b, useEffect as m } from "react";
|
|
3
|
+
import { deleteProperty as T } from "@deviceinsight/ng-ui-api-client";
|
|
4
|
+
import { Bubble as P, Button as h, Icon as A, withConfirm as I } from "@deviceinsight/ng-ui-basic-components";
|
|
5
|
+
import { ContentHeader as g } from "@deviceinsight/ng-ui-components";
|
|
6
|
+
import { r as O, a, G, u as v, bM as D, bN as E } from "./setTitle-Ck-71vC0.js";
|
|
7
|
+
import { Link as C } from "react-router-dom";
|
|
7
8
|
import "react-i18next";
|
|
8
|
-
|
|
9
|
-
import "i18next";
|
|
10
|
-
import "ux4iot-react";
|
|
11
|
-
const D = [
|
|
9
|
+
const V = [
|
|
12
10
|
"name",
|
|
13
11
|
"urn",
|
|
14
12
|
"parentId",
|
|
@@ -31,19 +29,19 @@ const D = [
|
|
|
31
29
|
"displayName",
|
|
32
30
|
"definitionId"
|
|
33
31
|
];
|
|
34
|
-
function
|
|
35
|
-
const
|
|
32
|
+
function S(p, o) {
|
|
33
|
+
const i = O(["DELETE_PROPERTY"]);
|
|
36
34
|
return [
|
|
37
35
|
{
|
|
38
36
|
name: "propertyKey",
|
|
39
|
-
label: /* @__PURE__ */
|
|
37
|
+
label: /* @__PURE__ */ r(a, { i18nKey: "properties.tableHeaders.key", children: "Property" }),
|
|
40
38
|
sortable: !0,
|
|
41
39
|
filterable: {
|
|
42
40
|
filterType: "text",
|
|
43
|
-
filterFn: (e,
|
|
41
|
+
filterFn: (e, t) => e.key.toLowerCase().indexOf(t.toLowerCase()) >= 0
|
|
44
42
|
},
|
|
45
|
-
render: (e) => /* @__PURE__ */
|
|
46
|
-
|
|
43
|
+
render: (e) => /* @__PURE__ */ r(
|
|
44
|
+
C,
|
|
47
45
|
{
|
|
48
46
|
to: `properties/${e.key}`,
|
|
49
47
|
state: e,
|
|
@@ -53,7 +51,7 @@ function G(n, l) {
|
|
|
53
51
|
},
|
|
54
52
|
{
|
|
55
53
|
name: "propertyType",
|
|
56
|
-
label: /* @__PURE__ */
|
|
54
|
+
label: /* @__PURE__ */ r(a, { i18nKey: "properties.tableHeaders.type", children: "Type" }),
|
|
57
55
|
width: "10%",
|
|
58
56
|
filterable: {
|
|
59
57
|
filterType: "options",
|
|
@@ -115,13 +113,13 @@ function G(n, l) {
|
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
],
|
|
118
|
-
filterFn: (e,
|
|
116
|
+
filterFn: (e, t) => e.type === t
|
|
119
117
|
},
|
|
120
118
|
render: (e) => e.type
|
|
121
119
|
},
|
|
122
120
|
{
|
|
123
121
|
name: "propertyEntityTargets",
|
|
124
|
-
label: /* @__PURE__ */
|
|
122
|
+
label: /* @__PURE__ */ r(a, { i18nKey: "properties.tableHeaders.entityTargets", children: "Scope" }),
|
|
125
123
|
width: "30%",
|
|
126
124
|
filterable: {
|
|
127
125
|
filterType: "options",
|
|
@@ -162,7 +160,7 @@ function G(n, l) {
|
|
|
162
160
|
}
|
|
163
161
|
}
|
|
164
162
|
],
|
|
165
|
-
filterFn: (e,
|
|
163
|
+
filterFn: (e, t) => e.entityTargets.includes(t)
|
|
166
164
|
},
|
|
167
165
|
render: (e) => [...e.entityTargets].sort().join(", ")
|
|
168
166
|
},
|
|
@@ -172,55 +170,54 @@ function G(n, l) {
|
|
|
172
170
|
width: "10%",
|
|
173
171
|
align: "right",
|
|
174
172
|
render: (e) => {
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
const
|
|
178
|
-
|
|
173
|
+
const t = V.includes(e.key);
|
|
174
|
+
if (i) {
|
|
175
|
+
const l = /* @__PURE__ */ r(
|
|
176
|
+
h,
|
|
179
177
|
{
|
|
180
178
|
naked: !0,
|
|
181
179
|
title: {
|
|
182
180
|
id: "properties.tableHeaders.deleteProperty",
|
|
183
181
|
defaultValue: "Delete this Property"
|
|
184
182
|
},
|
|
185
|
-
onClick: () =>
|
|
186
|
-
disabled:
|
|
187
|
-
children: /* @__PURE__ */
|
|
183
|
+
onClick: () => o(e),
|
|
184
|
+
disabled: t,
|
|
185
|
+
children: /* @__PURE__ */ r(A, { del: !0 })
|
|
188
186
|
}
|
|
189
187
|
);
|
|
190
|
-
return
|
|
191
|
-
|
|
188
|
+
return t ? /* @__PURE__ */ r(
|
|
189
|
+
P,
|
|
192
190
|
{
|
|
193
|
-
content: /* @__PURE__ */
|
|
194
|
-
children:
|
|
191
|
+
content: /* @__PURE__ */ r(a, { i18nKey: "properties.tableHeaders.reserved", children: "This property is reserved and can't be deleted" }),
|
|
192
|
+
children: l
|
|
195
193
|
}
|
|
196
|
-
) :
|
|
194
|
+
) : l;
|
|
197
195
|
} else
|
|
198
196
|
return null;
|
|
199
197
|
}
|
|
200
198
|
}
|
|
201
199
|
];
|
|
202
200
|
}
|
|
203
|
-
const
|
|
201
|
+
const w = {
|
|
204
202
|
page: 0,
|
|
205
203
|
size: 15,
|
|
206
204
|
sort: {
|
|
207
205
|
property: "key",
|
|
208
206
|
direction: "ASC"
|
|
209
207
|
}
|
|
210
|
-
},
|
|
211
|
-
const { properties:
|
|
212
|
-
async function p() {
|
|
208
|
+
}, N = ({ confirm: p }) => {
|
|
209
|
+
const { properties: o, reloadProperties: i } = c(G), [e, t] = y(!1), { t: l } = v(), d = /* @__PURE__ */ r(a, { i18nKey: "portalAdmin.sidebarElements.properties.create", children: "Create new property" }), s = b(async () => {
|
|
213
210
|
try {
|
|
214
|
-
|
|
211
|
+
t(!0), await i();
|
|
215
212
|
} finally {
|
|
216
|
-
|
|
213
|
+
t(!1);
|
|
217
214
|
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}, []);
|
|
222
|
-
async function u(
|
|
223
|
-
await
|
|
215
|
+
}, [i]);
|
|
216
|
+
m(() => {
|
|
217
|
+
s();
|
|
218
|
+
}, [s]);
|
|
219
|
+
async function u(n) {
|
|
220
|
+
await p(
|
|
224
221
|
{
|
|
225
222
|
id: "properties.confirmDeletePropertyTitle",
|
|
226
223
|
defaultValue: "Delete Property"
|
|
@@ -229,11 +226,11 @@ const C = {
|
|
|
229
226
|
id: "properties.confirmDeletePropertyMessage",
|
|
230
227
|
defaultValue: "Do you really want to delete this Property?"
|
|
231
228
|
}
|
|
232
|
-
),
|
|
229
|
+
), t(!0), await T(n), await s();
|
|
233
230
|
}
|
|
234
|
-
return /* @__PURE__ */
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
|
|
231
|
+
return /* @__PURE__ */ f("div", { "data-testid": "properties-list", children: [
|
|
232
|
+
/* @__PURE__ */ r(
|
|
233
|
+
g,
|
|
237
234
|
{
|
|
238
235
|
title: {
|
|
239
236
|
id: "route.label.properties.name",
|
|
@@ -241,8 +238,8 @@ const C = {
|
|
|
241
238
|
}
|
|
242
239
|
}
|
|
243
240
|
),
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
|
|
241
|
+
/* @__PURE__ */ r(
|
|
242
|
+
D,
|
|
246
243
|
{
|
|
247
244
|
tooltip: d,
|
|
248
245
|
authorities: "CREATE_PROPERTY",
|
|
@@ -250,20 +247,21 @@ const C = {
|
|
|
250
247
|
dataTestId: "create-property-button"
|
|
251
248
|
}
|
|
252
249
|
),
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
|
|
250
|
+
/* @__PURE__ */ r(
|
|
251
|
+
E,
|
|
255
252
|
{
|
|
256
|
-
columnDefs:
|
|
257
|
-
items:
|
|
253
|
+
columnDefs: S(l, u),
|
|
254
|
+
items: o,
|
|
258
255
|
isLoading: e,
|
|
259
|
-
uniqueItemKey: (
|
|
260
|
-
paginationSettings:
|
|
256
|
+
uniqueItemKey: (n) => n.key,
|
|
257
|
+
paginationSettings: w,
|
|
261
258
|
"data-testid": "properties-table",
|
|
262
259
|
tableName: "properties"
|
|
263
260
|
}
|
|
264
261
|
)
|
|
265
262
|
] });
|
|
266
|
-
},
|
|
263
|
+
}, U = I(N);
|
|
267
264
|
export {
|
|
268
|
-
|
|
265
|
+
U as default
|
|
269
266
|
};
|
|
267
|
+
//# sourceMappingURL=PropertiesList-DRYRjsEu.js.map
|