@davra/ui-core 1.0.0-AEP-6394.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.
- package/README.md +30 -0
- package/dist/style.css +1 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/components/labels/LabelInput.vue.d.ts +46 -0
- package/dist/types/components/labels/LabelsSelector.vue.d.ts +24 -0
- package/dist/types/components/labels/index.d.ts +3 -0
- package/dist/types/components/labels/labelInput.test.d.ts +1 -0
- package/dist/types/components/labels/labelsSelector.test.d.ts +1 -0
- package/dist/types/components/modals/ConfirmModal.vue.d.ts +21 -0
- package/dist/types/components/modals/DeleteModal.vue.d.ts +34 -0
- package/dist/types/components/modals/Modal.vue.d.ts +26 -0
- package/dist/types/components/modals/ViewObjectModal.vue.d.ts +44 -0
- package/dist/types/components/modals/index.d.ts +5 -0
- package/dist/types/components/utils/ScrollText.vue.d.ts +9 -0
- package/dist/types/components/utils/Snackbar.vue.d.ts +2 -0
- package/dist/types/components/utils/index.d.ts +3 -0
- package/dist/types/components/utils/snackbar.test.d.ts +1 -0
- package/dist/types/constants/MyConstants.d.ts +1 -0
- package/dist/types/constants/index.d.ts +2 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/services/davraApi.d.ts +3 -0
- package/dist/types/services/devicesCountersService.d.ts +10 -0
- package/dist/types/services/devicesCountersService.test.d.ts +1 -0
- package/dist/types/services/devicesService.d.ts +18 -0
- package/dist/types/services/devicesService.test.d.ts +1 -0
- package/dist/types/services/index.d.ts +11 -0
- package/dist/types/services/labelsService.d.ts +8 -0
- package/dist/types/services/labelsService.test.d.ts +1 -0
- package/dist/types/services/metricsCountersService.d.ts +5 -0
- package/dist/types/services/metricsCountersService.test.d.ts +1 -0
- package/dist/types/services/metricsService.d.ts +6 -0
- package/dist/types/services/metricsService.test.d.ts +1 -0
- package/dist/types/services/timeseriesService.d.ts +5 -0
- package/dist/types/services/timeseriesService.test.d.ts +1 -0
- package/dist/types/services/twinTypesService.d.ts +5 -0
- package/dist/types/services/twinTypesService.test.d.ts +1 -0
- package/dist/types/services/twinsCountersService.d.ts +6 -0
- package/dist/types/services/twinsCountersService.test.d.ts +1 -0
- package/dist/types/services/twinsService.d.ts +22 -0
- package/dist/types/services/twinsService.test.d.ts +1 -0
- package/dist/types/services/userSessionService.d.ts +12 -0
- package/dist/types/services/userSessionService.test.d.ts +1 -0
- package/dist/types/stores/alertMessages.d.ts +19 -0
- package/dist/types/stores/alertMessages.test.d.ts +1 -0
- package/dist/types/stores/devices.d.ts +42 -0
- package/dist/types/stores/devices.test.d.ts +1 -0
- package/dist/types/stores/index.d.ts +7 -0
- package/dist/types/stores/labels.d.ts +20 -0
- package/dist/types/stores/labels.test.d.ts +1 -0
- package/dist/types/stores/metrics.d.ts +39 -0
- package/dist/types/stores/metrics.test.d.ts +1 -0
- package/dist/types/stores/twinTypes.d.ts +27 -0
- package/dist/types/stores/twinTypes.test.d.ts +1 -0
- package/dist/types/stores/twins.d.ts +42 -0
- package/dist/types/stores/twins.test.d.ts +1 -0
- package/dist/types/stores/userSession.d.ts +24 -0
- package/dist/types/stores/userSession.test.d.ts +1 -0
- package/dist/types/types.d.ts +175 -0
- package/dist/types/utils/MyUtil.d.ts +5 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/ui-core.es.js +1586 -0
- package/package.json +54 -0
@@ -0,0 +1,1586 @@
|
|
1
|
+
import { getCurrentInstance as be, ref as b, watch as J, computed as S, defineComponent as L, onMounted as ue, resolveComponent as p, openBlock as A, createBlock as C, withCtx as i, createVNode as d, unref as u, isRef as R, readonly as q, createTextVNode as E, toDisplayString as B, createCommentVNode as P, mergeProps as F, withDirectives as he, vShow as ge, createElementVNode as de, createElementBlock as pe, Fragment as Ae, renderList as Ee, renderSlot as z, inject as Ce, normalizeProps as Ie, guardReactiveProps as Se, useCssVars as Te, normalizeClass as Ue } from "vue";
|
2
|
+
import De from "axios";
|
3
|
+
import { defineStore as N, storeToRefs as K } from "pinia";
|
4
|
+
const ee = {
|
5
|
+
baseURL: ""
|
6
|
+
}, f = (e = "") => De.create({
|
7
|
+
...ee,
|
8
|
+
baseURL: e || ee.baseURL
|
9
|
+
}), ke = async () => {
|
10
|
+
try {
|
11
|
+
const { data: e } = await f().get(
|
12
|
+
"/api/v1/tags/keys",
|
13
|
+
{
|
14
|
+
headers: {
|
15
|
+
Accept: "application/json"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
);
|
19
|
+
return e || [];
|
20
|
+
} catch {
|
21
|
+
return [];
|
22
|
+
}
|
23
|
+
}, Ve = async (e) => {
|
24
|
+
try {
|
25
|
+
const { data: t } = await f().get(
|
26
|
+
`/api/v1/tags/values/${e}`,
|
27
|
+
{
|
28
|
+
headers: {
|
29
|
+
Accept: "application/json"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
);
|
33
|
+
return t || [];
|
34
|
+
} catch {
|
35
|
+
return [];
|
36
|
+
}
|
37
|
+
}, $e = async (e, t) => {
|
38
|
+
const o = { ...e };
|
39
|
+
Object.entries(o).forEach(([l, n]) => {
|
40
|
+
t && t.includes(l) && delete o[l], (!n || /[^a-zA-Z_0-9\-+]/g.test(n)) && delete o[l];
|
41
|
+
});
|
42
|
+
try {
|
43
|
+
return await f().post(
|
44
|
+
"/api/v1/tags",
|
45
|
+
o,
|
46
|
+
{
|
47
|
+
headers: {
|
48
|
+
Accept: "application/json"
|
49
|
+
}
|
50
|
+
}
|
51
|
+
), !0;
|
52
|
+
} catch {
|
53
|
+
return !1;
|
54
|
+
}
|
55
|
+
}, Z = {
|
56
|
+
getLabels: ke,
|
57
|
+
createLabel: $e,
|
58
|
+
getValuesByKey: Ve
|
59
|
+
}, Re = async (e = 0, t = 1e3, o, l) => {
|
60
|
+
const n = [];
|
61
|
+
n.push(`start=${e || 0}`), t && n.push(`limit=${t}`), o && n.push(`sort=${o}`), l && n.push(l);
|
62
|
+
try {
|
63
|
+
const { data: r, headers: s } = await f().get(
|
64
|
+
`/api/v1/twins?${n.join("&")}`,
|
65
|
+
{
|
66
|
+
headers: {
|
67
|
+
Accept: "application/json"
|
68
|
+
}
|
69
|
+
}
|
70
|
+
);
|
71
|
+
return { totalRecords: parseInt(s["com-davra-total-results"]), records: r };
|
72
|
+
} catch {
|
73
|
+
throw new Error("Twins API Error");
|
74
|
+
}
|
75
|
+
}, je = async (e) => {
|
76
|
+
try {
|
77
|
+
const { data: t, headers: o } = await f().post(
|
78
|
+
"/api/v1/twins/query",
|
79
|
+
e,
|
80
|
+
{
|
81
|
+
headers: {
|
82
|
+
Accept: "application/json"
|
83
|
+
}
|
84
|
+
}
|
85
|
+
);
|
86
|
+
return { totalRecords: parseInt(o["com-davra-total-results"]), records: t };
|
87
|
+
} catch {
|
88
|
+
throw new Error("Twins API Error");
|
89
|
+
}
|
90
|
+
}, Oe = async (e) => {
|
91
|
+
try {
|
92
|
+
const { data: t, headers: o } = await f().get(
|
93
|
+
`/api/v1/twins?arrayUUIDs=${e.join(",")}`,
|
94
|
+
{
|
95
|
+
headers: {
|
96
|
+
Accept: "application/json"
|
97
|
+
}
|
98
|
+
}
|
99
|
+
);
|
100
|
+
return { totalRecords: parseInt(o["com-davra-total-results"]), records: t };
|
101
|
+
} catch {
|
102
|
+
throw new Error("Twins API Error");
|
103
|
+
}
|
104
|
+
}, Me = async (e, t = 0, o = 1e3, l, n) => {
|
105
|
+
const r = [`digitalTwinTypeName=${e}`, `limit=${o}`, `start=${t}`];
|
106
|
+
l && r.push(`sort=${l}`), n && r.push(`name=~${n}`);
|
107
|
+
try {
|
108
|
+
const { data: s, headers: a } = await f().get(
|
109
|
+
`/api/v1/twins/?${r.join("&")}`,
|
110
|
+
{
|
111
|
+
headers: {
|
112
|
+
Accept: "application/json"
|
113
|
+
}
|
114
|
+
}
|
115
|
+
);
|
116
|
+
return { totalRecords: parseInt(a["com-davra-total-results"]), records: s };
|
117
|
+
} catch {
|
118
|
+
throw new Error("Twins API Error");
|
119
|
+
}
|
120
|
+
}, Pe = async (e) => {
|
121
|
+
try {
|
122
|
+
const { data: t } = await f().get(
|
123
|
+
`/api/v1/twins/${e}`,
|
124
|
+
{
|
125
|
+
headers: {
|
126
|
+
Accept: "application/json"
|
127
|
+
}
|
128
|
+
}
|
129
|
+
);
|
130
|
+
return t;
|
131
|
+
} catch {
|
132
|
+
throw new Error("Twins API Error");
|
133
|
+
}
|
134
|
+
}, Be = async (e) => {
|
135
|
+
try {
|
136
|
+
const { data: t } = await f().get(
|
137
|
+
`/api/v1/twins/${e}/attachments`,
|
138
|
+
{
|
139
|
+
headers: {
|
140
|
+
Accept: "application/json"
|
141
|
+
}
|
142
|
+
}
|
143
|
+
);
|
144
|
+
return t;
|
145
|
+
} catch {
|
146
|
+
throw new Error("Twins API Error");
|
147
|
+
}
|
148
|
+
}, W = {
|
149
|
+
getTwins: Re,
|
150
|
+
getTwinsByTypeName: Me,
|
151
|
+
getTwinByUUID: Pe,
|
152
|
+
getTwinByUUIDs: Oe,
|
153
|
+
getTwinAttachements: Be,
|
154
|
+
queryTwins: je
|
155
|
+
};
|
156
|
+
var te;
|
157
|
+
const xe = typeof window < "u", Le = (e) => typeof e < "u", Ne = (e) => typeof e == "function";
|
158
|
+
xe && ((te = window == null ? void 0 : window.navigator) != null && te.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
159
|
+
function qe(e) {
|
160
|
+
return e;
|
161
|
+
}
|
162
|
+
function ze(e) {
|
163
|
+
return JSON.parse(JSON.stringify(e));
|
164
|
+
}
|
165
|
+
const ae = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ne = "__vueuse_ssr_handlers__";
|
166
|
+
ae[ne] = ae[ne] || {};
|
167
|
+
var se;
|
168
|
+
(function(e) {
|
169
|
+
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
170
|
+
})(se || (se = {}));
|
171
|
+
var Fe = Object.defineProperty, oe = Object.getOwnPropertySymbols, Qe = Object.prototype.hasOwnProperty, We = Object.prototype.propertyIsEnumerable, re = (e, t, o) => t in e ? Fe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, Je = (e, t) => {
|
172
|
+
for (var o in t || (t = {}))
|
173
|
+
Qe.call(t, o) && re(e, o, t[o]);
|
174
|
+
if (oe)
|
175
|
+
for (var o of oe(t))
|
176
|
+
We.call(t, o) && re(e, o, t[o]);
|
177
|
+
return e;
|
178
|
+
};
|
179
|
+
const Ke = {
|
180
|
+
easeInSine: [0.12, 0, 0.39, 0],
|
181
|
+
easeOutSine: [0.61, 1, 0.88, 1],
|
182
|
+
easeInOutSine: [0.37, 0, 0.63, 1],
|
183
|
+
easeInQuad: [0.11, 0, 0.5, 0],
|
184
|
+
easeOutQuad: [0.5, 1, 0.89, 1],
|
185
|
+
easeInOutQuad: [0.45, 0, 0.55, 1],
|
186
|
+
easeInCubic: [0.32, 0, 0.67, 0],
|
187
|
+
easeOutCubic: [0.33, 1, 0.68, 1],
|
188
|
+
easeInOutCubic: [0.65, 0, 0.35, 1],
|
189
|
+
easeInQuart: [0.5, 0, 0.75, 0],
|
190
|
+
easeOutQuart: [0.25, 1, 0.5, 1],
|
191
|
+
easeInOutQuart: [0.76, 0, 0.24, 1],
|
192
|
+
easeInQuint: [0.64, 0, 0.78, 0],
|
193
|
+
easeOutQuint: [0.22, 1, 0.36, 1],
|
194
|
+
easeInOutQuint: [0.83, 0, 0.17, 1],
|
195
|
+
easeInExpo: [0.7, 0, 0.84, 0],
|
196
|
+
easeOutExpo: [0.16, 1, 0.3, 1],
|
197
|
+
easeInOutExpo: [0.87, 0, 0.13, 1],
|
198
|
+
easeInCirc: [0.55, 0, 1, 0.45],
|
199
|
+
easeOutCirc: [0, 0.55, 0.45, 1],
|
200
|
+
easeInOutCirc: [0.85, 0, 0.15, 1],
|
201
|
+
easeInBack: [0.36, 0, 0.66, -0.56],
|
202
|
+
easeOutBack: [0.34, 1.56, 0.64, 1],
|
203
|
+
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
204
|
+
};
|
205
|
+
Je({
|
206
|
+
linear: qe
|
207
|
+
}, Ke);
|
208
|
+
function G(e, t, o, l = {}) {
|
209
|
+
var n, r, s;
|
210
|
+
const {
|
211
|
+
clone: a = !1,
|
212
|
+
passive: c = !1,
|
213
|
+
eventName: v,
|
214
|
+
deep: _ = !1,
|
215
|
+
defaultValue: h
|
216
|
+
} = l, w = be(), I = o || (w == null ? void 0 : w.emit) || ((n = w == null ? void 0 : w.$emit) == null ? void 0 : n.bind(w)) || ((s = (r = w == null ? void 0 : w.proxy) == null ? void 0 : r.$emit) == null ? void 0 : s.bind(w == null ? void 0 : w.proxy));
|
217
|
+
let T = v;
|
218
|
+
t || (t = "modelValue"), T = v || T || `update:${t.toString()}`;
|
219
|
+
const j = (D) => a ? Ne(a) ? a(D) : ze(D) : D, U = () => Le(e[t]) ? j(e[t]) : h;
|
220
|
+
if (c) {
|
221
|
+
const D = U(), O = b(D);
|
222
|
+
return J(() => e[t], (m) => O.value = j(m)), J(O, (m) => {
|
223
|
+
(m !== e[t] || _) && I(T, m);
|
224
|
+
}, { deep: _ }), O;
|
225
|
+
} else
|
226
|
+
return S({
|
227
|
+
get() {
|
228
|
+
return U();
|
229
|
+
},
|
230
|
+
set(D) {
|
231
|
+
I(T, D);
|
232
|
+
}
|
233
|
+
});
|
234
|
+
}
|
235
|
+
function Ge(e, t, o = {}) {
|
236
|
+
const l = {};
|
237
|
+
for (const n in e)
|
238
|
+
l[n] = G(e, n, t, o);
|
239
|
+
return l;
|
240
|
+
}
|
241
|
+
const He = /* @__PURE__ */ de("span", null, null, -1), Ye = /* @__PURE__ */ de("span", null, null, -1), ve = /* @__PURE__ */ L({
|
242
|
+
__name: "LabelInput",
|
243
|
+
props: {
|
244
|
+
labels: {},
|
245
|
+
twintypes: {},
|
246
|
+
labelkey: {},
|
247
|
+
labelvalue: {},
|
248
|
+
readonly: { type: Boolean }
|
249
|
+
},
|
250
|
+
emits: ["update:labelkey", "update:labelvalue", "removelabel"],
|
251
|
+
setup(e, { emit: t }) {
|
252
|
+
const o = e, l = S(() => [
|
253
|
+
{ header: "Keys", color: "blue", icon: "mdi-label" },
|
254
|
+
...o.labels,
|
255
|
+
{ header: "Digital Twin Types", color: "purple", icon: "mdi-content-duplicate" },
|
256
|
+
...o.twintypes
|
257
|
+
]), { labelkey: n, labelvalue: r } = Ge(o, t), s = b(""), a = b(""), c = b([]), v = b([]), _ = b(!1), h = (m) => o.twintypes.find((g) => g === m) ? "twintypes" : "labels", w = S(() => h(n.value)), I = () => {
|
258
|
+
document.activeElement.blur();
|
259
|
+
}, T = (m) => {
|
260
|
+
m.key === "Enter" && I();
|
261
|
+
}, j = async (m) => {
|
262
|
+
const g = h(m);
|
263
|
+
if (_.value = !0, g === "twintypes")
|
264
|
+
try {
|
265
|
+
const k = await W.getTwinsByTypeName(m);
|
266
|
+
v.value = k.records.map(($) => ({ value: $.UUID, label: $.name }));
|
267
|
+
} catch {
|
268
|
+
}
|
269
|
+
else if (g === "labels")
|
270
|
+
try {
|
271
|
+
const k = await Z.getValuesByKey(m);
|
272
|
+
c.value = k;
|
273
|
+
} catch {
|
274
|
+
}
|
275
|
+
else
|
276
|
+
v.value = [], c.value = [];
|
277
|
+
_.value = !1;
|
278
|
+
};
|
279
|
+
J(n, async (m, g) => {
|
280
|
+
m !== g && (j(m), g !== "" && (r.value = ""));
|
281
|
+
});
|
282
|
+
const U = b(), D = S(() => {
|
283
|
+
var m;
|
284
|
+
return (m = U.value) == null ? void 0 : m.isFocused;
|
285
|
+
}), O = {
|
286
|
+
specialNames: (m) => ![
|
287
|
+
"deviceid",
|
288
|
+
"uuid",
|
289
|
+
"tags",
|
290
|
+
"serialnumber",
|
291
|
+
"tenantid",
|
292
|
+
"userid"
|
293
|
+
].includes(m.toLowerCase().trim()) || "cannot use this name",
|
294
|
+
alphanumericAndDash: (m) => !/[^a-zA-Z_0-9\-+]/g.test(m) || "No spaces and Only alphanumeric and dash or underscore",
|
295
|
+
notEmpty: (m) => !!m.trim() || "Required"
|
296
|
+
};
|
297
|
+
return ue(() => {
|
298
|
+
n.value && j(n.value);
|
299
|
+
}), (m, g) => {
|
300
|
+
const k = p("v-icon"), $ = p("v-chip"), V = p("v-list-item-title"), M = p("v-list-item"), X = p("v-combobox"), H = p("v-col"), _e = p("v-autocomplete"), fe = p("v-btn"), we = p("v-row");
|
301
|
+
return A(), C(we, { class: "py-2" }, {
|
302
|
+
default: i(() => [
|
303
|
+
d(H, { class: "py-0 flex-grow-1 flex-shrink-0" }, {
|
304
|
+
default: i(() => [
|
305
|
+
d(X, {
|
306
|
+
modelValue: u(n),
|
307
|
+
"onUpdate:modelValue": g[0] || (g[0] = (y) => R(n) ? n.value = y : null),
|
308
|
+
search: u(s),
|
309
|
+
"onUpdate:search": g[1] || (g[1] = (y) => R(s) ? s.value = y : null),
|
310
|
+
"item-value": "value",
|
311
|
+
"data-testid": "label-key-selector",
|
312
|
+
readonly: "readonly" in m ? m.readonly : u(q),
|
313
|
+
class: "label-combo-key",
|
314
|
+
variant: "outlined",
|
315
|
+
label: "Key",
|
316
|
+
items: u(l),
|
317
|
+
"hide-no-data": !1,
|
318
|
+
"no-data-text": "",
|
319
|
+
"hide-details": "auto",
|
320
|
+
density: "compact",
|
321
|
+
rules: [O.alphanumericAndDash, O.specialNames],
|
322
|
+
"menu-props": { maxHeight: "400px", zIndex: 9999999 },
|
323
|
+
onKeydown: T
|
324
|
+
}, {
|
325
|
+
"no-data": i(() => [
|
326
|
+
He
|
327
|
+
]),
|
328
|
+
"prepend-item": i(() => [
|
329
|
+
u(s) && !u(l).includes(u(s)) ? (A(), C(M, {
|
330
|
+
key: 0,
|
331
|
+
class: "bg-blue-lighten-5",
|
332
|
+
onClick: I
|
333
|
+
}, {
|
334
|
+
default: i(() => [
|
335
|
+
d(V, null, {
|
336
|
+
default: i(() => [
|
337
|
+
E(" Create new key "),
|
338
|
+
d($, {
|
339
|
+
class: "ma-2",
|
340
|
+
color: "blue",
|
341
|
+
label: ""
|
342
|
+
}, {
|
343
|
+
default: i(() => [
|
344
|
+
d(k, {
|
345
|
+
start: "",
|
346
|
+
icon: "mdi-label"
|
347
|
+
}),
|
348
|
+
E(" " + B(u(s)), 1)
|
349
|
+
]),
|
350
|
+
_: 1
|
351
|
+
})
|
352
|
+
]),
|
353
|
+
_: 1
|
354
|
+
})
|
355
|
+
]),
|
356
|
+
_: 1
|
357
|
+
})) : P("", !0)
|
358
|
+
]),
|
359
|
+
item: i(({ item: y, props: x }) => [
|
360
|
+
y.raw.header ? (A(), C(M, F({ key: 0 }, x, {
|
361
|
+
disabled: "",
|
362
|
+
class: ["opacityMax", `bg-${y.raw.color}-lighten-5`],
|
363
|
+
style: {},
|
364
|
+
title: !1,
|
365
|
+
subtitle: y.raw.header
|
366
|
+
}), {
|
367
|
+
prepend: i(() => [
|
368
|
+
he(d(k, {
|
369
|
+
icon: y.raw.icon,
|
370
|
+
color: y.raw.color,
|
371
|
+
size: "small"
|
372
|
+
}, null, 8, ["icon", "color"]), [
|
373
|
+
[ge, y.raw.icon]
|
374
|
+
])
|
375
|
+
]),
|
376
|
+
_: 2
|
377
|
+
}, 1040, ["class", "subtitle"])) : (A(), C(M, F({ key: 1 }, x, {
|
378
|
+
title: y.value
|
379
|
+
}), null, 16, ["title"]))
|
380
|
+
]),
|
381
|
+
chip: i(({ item: y, props: x }) => [
|
382
|
+
y.value ? (A(), C($, F({
|
383
|
+
key: 0,
|
384
|
+
color: h(y.value) === "twintypes" ? "purple" : "blue",
|
385
|
+
label: ""
|
386
|
+
}, x), {
|
387
|
+
default: i(() => [
|
388
|
+
d(k, {
|
389
|
+
start: "",
|
390
|
+
icon: h(y.value) === "twintypes" ? "mdi-content-duplicate" : "mdi-label"
|
391
|
+
}, null, 8, ["icon"]),
|
392
|
+
E(" " + B(y.value), 1)
|
393
|
+
]),
|
394
|
+
_: 2
|
395
|
+
}, 1040, ["color"])) : P("", !0)
|
396
|
+
]),
|
397
|
+
_: 1
|
398
|
+
}, 8, ["modelValue", "search", "readonly", "items", "rules"])
|
399
|
+
]),
|
400
|
+
_: 1
|
401
|
+
}),
|
402
|
+
d(H, { class: "py-0 flex-grow-1 flex-shrink-0" }, {
|
403
|
+
default: i(() => [
|
404
|
+
u(w) === "twintypes" ? (A(), C(_e, {
|
405
|
+
key: 0,
|
406
|
+
ref_key: "autocomplete",
|
407
|
+
ref: U,
|
408
|
+
modelValue: u(r),
|
409
|
+
"onUpdate:modelValue": g[2] || (g[2] = (y) => R(r) ? r.value = y : null),
|
410
|
+
"data-testid": "label-twin-selector",
|
411
|
+
readonly: "readonly" in m ? m.readonly : u(q),
|
412
|
+
class: "label-auto-value",
|
413
|
+
variant: "outlined",
|
414
|
+
"hide-details": "auto",
|
415
|
+
label: "Twin",
|
416
|
+
loading: u(_),
|
417
|
+
density: "compact",
|
418
|
+
"item-title": "label",
|
419
|
+
"item-value": "value",
|
420
|
+
items: u(v),
|
421
|
+
disabled: u(n) === "",
|
422
|
+
"menu-props": { maxHeight: "400px" },
|
423
|
+
"hide-no-data": !1,
|
424
|
+
"no-data-text": "",
|
425
|
+
clearable: ""
|
426
|
+
}, {
|
427
|
+
chip: i(({ item: y, props: x }) => [
|
428
|
+
y.value && !u(D) ? (A(), C($, F({
|
429
|
+
key: 0,
|
430
|
+
color: "purple",
|
431
|
+
label: ""
|
432
|
+
}, x), {
|
433
|
+
default: i(() => [
|
434
|
+
d(k, {
|
435
|
+
start: "",
|
436
|
+
icon: "mdi-shape"
|
437
|
+
}),
|
438
|
+
E(" " + B(y.title), 1)
|
439
|
+
]),
|
440
|
+
_: 2
|
441
|
+
}, 1040)) : P("", !0)
|
442
|
+
]),
|
443
|
+
_: 1
|
444
|
+
}, 8, ["modelValue", "readonly", "loading", "items", "disabled"])) : (A(), C(X, {
|
445
|
+
key: 1,
|
446
|
+
search: u(a),
|
447
|
+
"onUpdate:search": g[3] || (g[3] = (y) => R(a) ? a.value = y : null),
|
448
|
+
modelValue: u(r),
|
449
|
+
"onUpdate:modelValue": g[4] || (g[4] = (y) => R(r) ? r.value = y : null),
|
450
|
+
disabled: !u(n) || u(n) === "",
|
451
|
+
"data-testid": "label-value-selector",
|
452
|
+
class: "label-combo-value",
|
453
|
+
"menu-props": { maxHeight: "400px" },
|
454
|
+
loading: u(_),
|
455
|
+
"hide-details": "auto",
|
456
|
+
variant: "outlined",
|
457
|
+
label: "Value",
|
458
|
+
items: u(c),
|
459
|
+
density: "compact",
|
460
|
+
"item-title": "label",
|
461
|
+
"item-value": "value",
|
462
|
+
"hide-no-data": !1,
|
463
|
+
"no-data-text": "",
|
464
|
+
rules: [O.alphanumericAndDash],
|
465
|
+
readonly: "readonly" in m ? m.readonly : u(q)
|
466
|
+
}, {
|
467
|
+
"no-data": i(() => [
|
468
|
+
Ye
|
469
|
+
]),
|
470
|
+
"prepend-item": i(() => [
|
471
|
+
u(a) && !u(c).find((y) => y === u(a)) ? (A(), C(M, {
|
472
|
+
key: 0,
|
473
|
+
class: "bg-blue-lighten-5",
|
474
|
+
onClick: I
|
475
|
+
}, {
|
476
|
+
default: i(() => [
|
477
|
+
d(V, null, {
|
478
|
+
default: i(() => [
|
479
|
+
E(" Create new value "),
|
480
|
+
d($, {
|
481
|
+
class: "ma-2",
|
482
|
+
color: "blue",
|
483
|
+
label: ""
|
484
|
+
}, {
|
485
|
+
default: i(() => [
|
486
|
+
d(k, {
|
487
|
+
start: "",
|
488
|
+
icon: "mdi-label"
|
489
|
+
}),
|
490
|
+
E(" " + B(u(a)), 1)
|
491
|
+
]),
|
492
|
+
_: 1
|
493
|
+
})
|
494
|
+
]),
|
495
|
+
_: 1
|
496
|
+
})
|
497
|
+
]),
|
498
|
+
_: 1
|
499
|
+
})) : P("", !0)
|
500
|
+
]),
|
501
|
+
chip: i(({ item: y, props: x }) => [
|
502
|
+
y.value ? (A(), C($, F({
|
503
|
+
key: 0,
|
504
|
+
color: "blue",
|
505
|
+
label: ""
|
506
|
+
}, x), {
|
507
|
+
default: i(() => [
|
508
|
+
d(k, {
|
509
|
+
start: "",
|
510
|
+
icon: "mdi-shape"
|
511
|
+
}),
|
512
|
+
E(" " + B(y.title), 1)
|
513
|
+
]),
|
514
|
+
_: 2
|
515
|
+
}, 1040)) : P("", !0)
|
516
|
+
]),
|
517
|
+
_: 1
|
518
|
+
}, 8, ["search", "modelValue", "disabled", "loading", "items", "rules", "readonly"]))
|
519
|
+
]),
|
520
|
+
_: 1
|
521
|
+
}),
|
522
|
+
d(H, {
|
523
|
+
cols: "1",
|
524
|
+
style: { "min-width": "40px" },
|
525
|
+
class: "pa-0 flex-grow-0 flex-shrink-1"
|
526
|
+
}, {
|
527
|
+
default: i(() => [
|
528
|
+
("readonly" in m ? m.readonly : u(q)) ? P("", !0) : (A(), C(fe, {
|
529
|
+
key: 0,
|
530
|
+
class: "label-delete-btn",
|
531
|
+
variant: "text",
|
532
|
+
icon: "mdi-delete",
|
533
|
+
color: "grey-darken-1",
|
534
|
+
flat: "",
|
535
|
+
size: "small",
|
536
|
+
onClick: g[5] || (g[5] = (y) => m.$emit("removelabel"))
|
537
|
+
}))
|
538
|
+
]),
|
539
|
+
_: 1
|
540
|
+
})
|
541
|
+
]),
|
542
|
+
_: 1
|
543
|
+
});
|
544
|
+
};
|
545
|
+
}
|
546
|
+
}), Ze = async () => {
|
547
|
+
try {
|
548
|
+
const { data: e } = await f().get(
|
549
|
+
"/api/v1/twintypes",
|
550
|
+
{
|
551
|
+
headers: {
|
552
|
+
Accept: "application/json"
|
553
|
+
}
|
554
|
+
}
|
555
|
+
);
|
556
|
+
return Object.values(e) || [];
|
557
|
+
} catch {
|
558
|
+
return [];
|
559
|
+
}
|
560
|
+
}, Xe = {
|
561
|
+
getTwinTypes: Ze
|
562
|
+
}, me = N("twinTypes", () => {
|
563
|
+
const e = b([]), t = S(() => e.value.map((n) => n.name)), o = S(() => e.value.map((n) => ({ value: n.UUID, label: n.name }))), l = async () => {
|
564
|
+
try {
|
565
|
+
const n = await Xe.getTwinTypes();
|
566
|
+
e.value = n;
|
567
|
+
} catch {
|
568
|
+
}
|
569
|
+
};
|
570
|
+
return l(), {
|
571
|
+
twinTypes: e,
|
572
|
+
pullTwinTypes: l,
|
573
|
+
twinTypeNames: t,
|
574
|
+
twinTypeSelectArray: o
|
575
|
+
};
|
576
|
+
}), et = N("labels", () => {
|
577
|
+
const e = b([]), t = async () => {
|
578
|
+
try {
|
579
|
+
const l = await Z.getLabels();
|
580
|
+
e.value = l;
|
581
|
+
} catch {
|
582
|
+
}
|
583
|
+
}, o = async (l) => {
|
584
|
+
const { twinTypeNames: n } = K(me());
|
585
|
+
try {
|
586
|
+
await Z.createLabel(l, n.value), await t();
|
587
|
+
} catch {
|
588
|
+
}
|
589
|
+
};
|
590
|
+
return t(), {
|
591
|
+
labels: e,
|
592
|
+
pullLabels: t,
|
593
|
+
updateLabels: o
|
594
|
+
};
|
595
|
+
}), tt = /* @__PURE__ */ L({
|
596
|
+
__name: "LabelsSelector",
|
597
|
+
props: {
|
598
|
+
modelValue: {},
|
599
|
+
readonly: { type: Boolean }
|
600
|
+
},
|
601
|
+
emits: ["update:modelValue"],
|
602
|
+
setup(e, { emit: t }) {
|
603
|
+
const o = e, { labels: l } = K(et()), { twinTypeNames: n } = K(me()), r = b([]), s = S(() => (_) => l.value.filter((h) => !n.value.includes(h) && (_.key === h || !r.value.find(({ key: w }) => w === h)))), a = S(() => (_) => n.value.filter((h) => _.key === h || !r.value.find(({ key: w }) => w === h))), c = () => {
|
604
|
+
r.value.push({ key: "", value: "" });
|
605
|
+
}, v = (_) => {
|
606
|
+
r.value.splice(_, 1);
|
607
|
+
};
|
608
|
+
return J(r, (_) => {
|
609
|
+
const h = _.reduce((w, I) => (I.key && I.value && (w[I.key] = I.value), w), {});
|
610
|
+
t("update:modelValue", h);
|
611
|
+
}, { deep: !0 }), ue(() => {
|
612
|
+
o.modelValue && (r.value = Object.entries(o.modelValue).map(([_, h]) => ({ key: _, value: h })));
|
613
|
+
}), (_, h) => {
|
614
|
+
const w = p("v-spacer"), I = p("v-btn"), T = p("v-row"), j = p("v-card-title"), U = p("v-list-subheader"), D = p("v-col"), O = p("v-divider"), m = ve, g = p("v-card-text"), k = p("v-sheet");
|
615
|
+
return A(), C(k, {
|
616
|
+
class: "pa-3",
|
617
|
+
variant: "tonal",
|
618
|
+
border: "",
|
619
|
+
rounded: "",
|
620
|
+
color: "grey-lighten-4"
|
621
|
+
}, {
|
622
|
+
default: i(() => [
|
623
|
+
d(j, { class: "text-primary" }, {
|
624
|
+
default: i(() => [
|
625
|
+
d(T, { "no-gutters": "" }, {
|
626
|
+
default: i(() => [
|
627
|
+
E(" Labels "),
|
628
|
+
d(w),
|
629
|
+
("readonly" in _ ? _.readonly : u(q)) ? P("", !0) : (A(), C(I, {
|
630
|
+
key: 0,
|
631
|
+
class: "label-add-btn",
|
632
|
+
size: "small",
|
633
|
+
"prepend-icon": "mdi-plus",
|
634
|
+
variant: "tonal",
|
635
|
+
color: "primary",
|
636
|
+
onClick: c
|
637
|
+
}, {
|
638
|
+
default: i(() => [
|
639
|
+
E(" add a label ")
|
640
|
+
]),
|
641
|
+
_: 1
|
642
|
+
}))
|
643
|
+
]),
|
644
|
+
_: 1
|
645
|
+
})
|
646
|
+
]),
|
647
|
+
_: 1
|
648
|
+
}),
|
649
|
+
u(r).length ? (A(), C(g, { key: 0 }, {
|
650
|
+
default: i(() => [
|
651
|
+
d(T, { "no-gutters": "" }, {
|
652
|
+
default: i(() => [
|
653
|
+
d(D, null, {
|
654
|
+
default: i(() => [
|
655
|
+
d(U, null, {
|
656
|
+
default: i(() => [
|
657
|
+
E("Key")
|
658
|
+
]),
|
659
|
+
_: 1
|
660
|
+
})
|
661
|
+
]),
|
662
|
+
_: 1
|
663
|
+
}),
|
664
|
+
d(D, null, {
|
665
|
+
default: i(() => [
|
666
|
+
d(U, null, {
|
667
|
+
default: i(() => [
|
668
|
+
E("Value")
|
669
|
+
]),
|
670
|
+
_: 1
|
671
|
+
})
|
672
|
+
]),
|
673
|
+
_: 1
|
674
|
+
})
|
675
|
+
]),
|
676
|
+
_: 1
|
677
|
+
}),
|
678
|
+
d(O, { class: "mb-3" }),
|
679
|
+
(A(!0), pe(Ae, null, Ee(u(r), ($, V) => (A(), C(m, {
|
680
|
+
key: V,
|
681
|
+
labelkey: u(r)[V].key,
|
682
|
+
"onUpdate:labelkey": (M) => u(r)[V].key = M,
|
683
|
+
labelvalue: u(r)[V].value,
|
684
|
+
"onUpdate:labelvalue": (M) => u(r)[V].value = M,
|
685
|
+
readonly: "readonly" in _ ? _.readonly : u(q),
|
686
|
+
labels: u(s)(u(r)[V]),
|
687
|
+
twintypes: u(a)(u(r)[V]),
|
688
|
+
"data-lab-key": $.key,
|
689
|
+
onRemovelabel: (M) => v(V)
|
690
|
+
}, null, 8, ["labelkey", "onUpdate:labelkey", "labelvalue", "onUpdate:labelvalue", "readonly", "labels", "twintypes", "data-lab-key", "onRemovelabel"]))), 128))
|
691
|
+
]),
|
692
|
+
_: 1
|
693
|
+
})) : P("", !0)
|
694
|
+
]),
|
695
|
+
_: 1
|
696
|
+
});
|
697
|
+
};
|
698
|
+
}
|
699
|
+
}), at = /* @__PURE__ */ L({
|
700
|
+
__name: "Modal",
|
701
|
+
props: {
|
702
|
+
modelValue: { type: Boolean },
|
703
|
+
parentActivator: { type: Boolean }
|
704
|
+
},
|
705
|
+
emits: ["confirm", "update:modelValue"],
|
706
|
+
setup(e, { emit: t }) {
|
707
|
+
const o = e, l = o.parentActivator ? b(!1) : G(o, "modelValue", t);
|
708
|
+
return (n, r) => {
|
709
|
+
const s = p("v-dialog");
|
710
|
+
return A(), C(s, {
|
711
|
+
modelValue: u(l),
|
712
|
+
"onUpdate:modelValue": r[0] || (r[0] = (a) => R(l) ? l.value = a : null),
|
713
|
+
activator: n.parentActivator ? "parent" : void 0
|
714
|
+
}, {
|
715
|
+
default: i(() => [
|
716
|
+
z(n.$slots, "default")
|
717
|
+
]),
|
718
|
+
_: 3
|
719
|
+
}, 8, ["modelValue", "activator"]);
|
720
|
+
};
|
721
|
+
}
|
722
|
+
}), nt = Symbol.for("vuetify:display");
|
723
|
+
function st() {
|
724
|
+
const e = Ce(nt);
|
725
|
+
if (!e)
|
726
|
+
throw new Error("Could not find Vuetify display injection");
|
727
|
+
return e;
|
728
|
+
}
|
729
|
+
const ot = /* @__PURE__ */ L({
|
730
|
+
__name: "ViewObjectModal",
|
731
|
+
props: {
|
732
|
+
title: {},
|
733
|
+
modelValue: { type: Boolean },
|
734
|
+
parentActivator: { type: Boolean },
|
735
|
+
hideActions: { type: Boolean }
|
736
|
+
},
|
737
|
+
emits: ["confirm", "update:modelValue"],
|
738
|
+
setup(e, { emit: t }) {
|
739
|
+
const o = e, l = o.parentActivator ? b(!1) : G(o, "modelValue", t), n = () => {
|
740
|
+
t("confirm"), l.value = !1;
|
741
|
+
}, { mobile: r } = st();
|
742
|
+
return (s, a) => {
|
743
|
+
const c = p("v-toolbar-title"), v = p("v-btn"), _ = p("v-toolbar"), h = p("v-card-text"), w = p("v-spacer"), I = p("v-card-actions"), T = p("v-card"), j = p("v-dialog");
|
744
|
+
return A(), C(j, {
|
745
|
+
modelValue: u(l),
|
746
|
+
"onUpdate:modelValue": a[2] || (a[2] = (U) => R(l) ? l.value = U : null),
|
747
|
+
activator: s.parentActivator ? "parent" : void 0,
|
748
|
+
"max-width": "800px",
|
749
|
+
fullscreen: u(r)
|
750
|
+
}, {
|
751
|
+
default: i(() => [
|
752
|
+
d(T, null, {
|
753
|
+
default: i(() => [
|
754
|
+
d(_, { color: "white" }, {
|
755
|
+
append: i(() => [
|
756
|
+
d(v, {
|
757
|
+
"data-testid": "close-kpi-modal",
|
758
|
+
size: "small",
|
759
|
+
icon: "mdi-close",
|
760
|
+
onClick: a[0] || (a[0] = (U) => l.value = !1)
|
761
|
+
})
|
762
|
+
]),
|
763
|
+
default: i(() => [
|
764
|
+
d(c, null, {
|
765
|
+
default: i(() => [
|
766
|
+
E(B(s.title), 1)
|
767
|
+
]),
|
768
|
+
_: 1
|
769
|
+
})
|
770
|
+
]),
|
771
|
+
_: 1
|
772
|
+
}),
|
773
|
+
d(h, null, {
|
774
|
+
default: i(() => [
|
775
|
+
z(s.$slots, "default")
|
776
|
+
]),
|
777
|
+
_: 3
|
778
|
+
}),
|
779
|
+
s.hideActions ? P("", !0) : (A(), C(I, { key: 0 }, {
|
780
|
+
default: i(() => [
|
781
|
+
z(s.$slots, "actions", Ie(Se({ confirm: n, dialog: u(l) })), () => [
|
782
|
+
d(w),
|
783
|
+
d(v, {
|
784
|
+
class: "delete-modal-dismiss",
|
785
|
+
color: "grey",
|
786
|
+
onClick: a[1] || (a[1] = (U) => l.value = !1)
|
787
|
+
}, {
|
788
|
+
default: i(() => [
|
789
|
+
E(" Dismiss ")
|
790
|
+
]),
|
791
|
+
_: 1
|
792
|
+
}),
|
793
|
+
d(v, {
|
794
|
+
class: "delete-modal-confirm",
|
795
|
+
color: "red",
|
796
|
+
variant: "elevated",
|
797
|
+
onClick: n
|
798
|
+
}, {
|
799
|
+
default: i(() => [
|
800
|
+
E(" Yes, I'm sure ")
|
801
|
+
]),
|
802
|
+
_: 1
|
803
|
+
})
|
804
|
+
])
|
805
|
+
]),
|
806
|
+
_: 3
|
807
|
+
}))
|
808
|
+
]),
|
809
|
+
_: 3
|
810
|
+
})
|
811
|
+
]),
|
812
|
+
_: 3
|
813
|
+
}, 8, ["modelValue", "activator", "fullscreen"]);
|
814
|
+
};
|
815
|
+
}
|
816
|
+
}), rt = /* @__PURE__ */ L({
|
817
|
+
__name: "DeleteModal",
|
818
|
+
props: {
|
819
|
+
title: {},
|
820
|
+
modelValue: { type: Boolean },
|
821
|
+
parentActivator: { type: Boolean }
|
822
|
+
},
|
823
|
+
emits: ["confirm", "update:modelValue"],
|
824
|
+
setup(e, { emit: t }) {
|
825
|
+
const o = e, l = o.parentActivator ? b(!1) : G(o, "modelValue", t), n = () => {
|
826
|
+
t("confirm"), l.value = !1;
|
827
|
+
};
|
828
|
+
return (r, s) => {
|
829
|
+
const a = p("v-card-title"), c = p("v-card-text"), v = p("v-spacer"), _ = p("v-btn"), h = p("v-card-actions"), w = p("v-card"), I = p("v-dialog");
|
830
|
+
return A(), C(I, {
|
831
|
+
modelValue: u(l),
|
832
|
+
"onUpdate:modelValue": s[1] || (s[1] = (T) => R(l) ? l.value = T : null),
|
833
|
+
activator: r.parentActivator ? "parent" : void 0,
|
834
|
+
"max-width": "400px"
|
835
|
+
}, {
|
836
|
+
default: i(() => [
|
837
|
+
d(w, null, {
|
838
|
+
default: i(() => [
|
839
|
+
d(a, null, {
|
840
|
+
default: i(() => [
|
841
|
+
E(B(r.title), 1)
|
842
|
+
]),
|
843
|
+
_: 1
|
844
|
+
}),
|
845
|
+
d(c, null, {
|
846
|
+
default: i(() => [
|
847
|
+
z(r.$slots, "default")
|
848
|
+
]),
|
849
|
+
_: 3
|
850
|
+
}),
|
851
|
+
d(h, null, {
|
852
|
+
default: i(() => [
|
853
|
+
d(v),
|
854
|
+
d(_, {
|
855
|
+
class: "delete-modal-dismiss",
|
856
|
+
color: "grey",
|
857
|
+
onClick: s[0] || (s[0] = (T) => l.value = !1)
|
858
|
+
}, {
|
859
|
+
default: i(() => [
|
860
|
+
E(" Dismiss ")
|
861
|
+
]),
|
862
|
+
_: 1
|
863
|
+
}),
|
864
|
+
d(_, {
|
865
|
+
class: "delete-modal-confirm",
|
866
|
+
color: "red",
|
867
|
+
variant: "elevated",
|
868
|
+
onClick: n
|
869
|
+
}, {
|
870
|
+
default: i(() => [
|
871
|
+
E(" Yes, I'm sure ")
|
872
|
+
]),
|
873
|
+
_: 1
|
874
|
+
})
|
875
|
+
]),
|
876
|
+
_: 1
|
877
|
+
})
|
878
|
+
]),
|
879
|
+
_: 3
|
880
|
+
})
|
881
|
+
]),
|
882
|
+
_: 3
|
883
|
+
}, 8, ["modelValue", "activator"]);
|
884
|
+
};
|
885
|
+
}
|
886
|
+
}), lt = /* @__PURE__ */ L({
|
887
|
+
__name: "ConfirmModal",
|
888
|
+
props: {
|
889
|
+
title: {}
|
890
|
+
},
|
891
|
+
emits: ["confirm"],
|
892
|
+
setup(e, { emit: t }) {
|
893
|
+
const o = b(!1), l = () => {
|
894
|
+
o.value = !1, t("confirm");
|
895
|
+
};
|
896
|
+
return (n, r) => {
|
897
|
+
const s = p("v-card-title"), a = p("v-card-text"), c = p("v-spacer"), v = p("v-btn"), _ = p("v-card-actions"), h = p("v-card"), w = p("v-dialog");
|
898
|
+
return A(), C(w, {
|
899
|
+
modelValue: u(o),
|
900
|
+
"onUpdate:modelValue": r[1] || (r[1] = (I) => R(o) ? o.value = I : null),
|
901
|
+
activator: "parent",
|
902
|
+
"max-width": "400px"
|
903
|
+
}, {
|
904
|
+
default: i(() => [
|
905
|
+
d(h, null, {
|
906
|
+
default: i(() => [
|
907
|
+
d(s, null, {
|
908
|
+
default: i(() => [
|
909
|
+
E(B(n.title), 1)
|
910
|
+
]),
|
911
|
+
_: 1
|
912
|
+
}),
|
913
|
+
d(a, null, {
|
914
|
+
default: i(() => [
|
915
|
+
z(n.$slots, "default")
|
916
|
+
]),
|
917
|
+
_: 3
|
918
|
+
}),
|
919
|
+
d(_, null, {
|
920
|
+
default: i(() => [
|
921
|
+
d(c),
|
922
|
+
d(v, {
|
923
|
+
class: "confirm-modal-dismiss",
|
924
|
+
color: "grey",
|
925
|
+
onClick: r[0] || (r[0] = (I) => o.value = !1)
|
926
|
+
}, {
|
927
|
+
default: i(() => [
|
928
|
+
E(" Cancel ")
|
929
|
+
]),
|
930
|
+
_: 1
|
931
|
+
}),
|
932
|
+
d(v, {
|
933
|
+
class: "confirm-modal-confirm",
|
934
|
+
color: "primary",
|
935
|
+
variant: "elevated",
|
936
|
+
onClick: l
|
937
|
+
}, {
|
938
|
+
default: i(() => [
|
939
|
+
E(" Yes, I'm sure ")
|
940
|
+
]),
|
941
|
+
_: 1
|
942
|
+
})
|
943
|
+
]),
|
944
|
+
_: 1
|
945
|
+
})
|
946
|
+
]),
|
947
|
+
_: 3
|
948
|
+
})
|
949
|
+
]),
|
950
|
+
_: 3
|
951
|
+
}, 8, ["modelValue"]);
|
952
|
+
};
|
953
|
+
}
|
954
|
+
}), ct = /* @__PURE__ */ L({
|
955
|
+
__name: "ScrollText",
|
956
|
+
setup(e) {
|
957
|
+
Te((s) => ({
|
958
|
+
"2e2ac96b": u(n),
|
959
|
+
e0628022: u(l)
|
960
|
+
}));
|
961
|
+
const t = b(null), o = S(() => {
|
962
|
+
var s, a;
|
963
|
+
return t.value ? ((s = t.value) == null ? void 0 : s.scrollWidth) - ((a = t.value) == null ? void 0 : a.offsetWidth) : 0;
|
964
|
+
}), l = S(() => `${-o.value - 10}px`), n = S(() => `${o.value / 30}s`), r = S(() => {
|
965
|
+
var s, a;
|
966
|
+
return ((s = t.value) == null ? void 0 : s.scrollWidth) !== ((a = t.value) == null ? void 0 : a.offsetWidth);
|
967
|
+
});
|
968
|
+
return (s, a) => (A(), pe("div", {
|
969
|
+
ref_key: "text",
|
970
|
+
ref: t,
|
971
|
+
class: Ue({ "scroll-text": u(r) })
|
972
|
+
}, [
|
973
|
+
z(s.$slots, "default", {}, void 0, !0)
|
974
|
+
], 2));
|
975
|
+
}
|
976
|
+
});
|
977
|
+
const it = (e, t) => {
|
978
|
+
const o = e.__vccOpts || e;
|
979
|
+
for (const [l, n] of t)
|
980
|
+
o[l] = n;
|
981
|
+
return o;
|
982
|
+
}, ut = /* @__PURE__ */ it(ct, [["__scopeId", "data-v-4d66a865"]]), Q = N("alertMessages", () => {
|
983
|
+
const e = b(!1), t = b(""), o = b(""), l = b(5e3);
|
984
|
+
return {
|
985
|
+
snackbar: e,
|
986
|
+
snackbarText: t,
|
987
|
+
snackbarSeverity: o,
|
988
|
+
snackbarTimeout: l,
|
989
|
+
setSnackbarMessage: (r = "", s = "", a = 5e3) => {
|
990
|
+
t.value = r, o.value = s, l.value = a, e.value = !0;
|
991
|
+
}
|
992
|
+
};
|
993
|
+
}), dt = /* @__PURE__ */ L({
|
994
|
+
__name: "Snackbar",
|
995
|
+
setup(e) {
|
996
|
+
const { snackbar: t, snackbarText: o, snackbarTimeout: l, snackbarSeverity: n } = K(Q());
|
997
|
+
return (r, s) => {
|
998
|
+
const a = p("v-btn"), c = p("v-snackbar");
|
999
|
+
return A(), C(c, {
|
1000
|
+
modelValue: u(t),
|
1001
|
+
"onUpdate:modelValue": s[1] || (s[1] = (v) => R(t) ? t.value = v : null),
|
1002
|
+
style: { "margin-bottom": "50px" },
|
1003
|
+
"data-testid": "snackbar",
|
1004
|
+
timeout: u(l),
|
1005
|
+
variant: "tonal",
|
1006
|
+
color: u(n)
|
1007
|
+
}, {
|
1008
|
+
actions: i(() => [
|
1009
|
+
d(a, {
|
1010
|
+
color: "snackbarSeverity",
|
1011
|
+
variant: "text",
|
1012
|
+
onClick: s[0] || (s[0] = (v) => t.value = !1)
|
1013
|
+
}, {
|
1014
|
+
default: i(() => [
|
1015
|
+
E(" Close ")
|
1016
|
+
]),
|
1017
|
+
_: 1
|
1018
|
+
})
|
1019
|
+
]),
|
1020
|
+
default: i(() => [
|
1021
|
+
E(B(u(o)) + " ", 1)
|
1022
|
+
]),
|
1023
|
+
_: 1
|
1024
|
+
}, 8, ["modelValue", "timeout", "color"]);
|
1025
|
+
};
|
1026
|
+
}
|
1027
|
+
}), le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
1028
|
+
__proto__: null,
|
1029
|
+
ConfirmModal: lt,
|
1030
|
+
DeleteModal: rt,
|
1031
|
+
LabelInput: ve,
|
1032
|
+
LabelsSelector: tt,
|
1033
|
+
Modal: at,
|
1034
|
+
ScrollText: ut,
|
1035
|
+
Snackbar: dt,
|
1036
|
+
ViewObjectModal: ot
|
1037
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
1038
|
+
const pt = 100, Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
1039
|
+
__proto__: null,
|
1040
|
+
MAGIC_NUM: pt
|
1041
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
1042
|
+
function vt(e, t) {
|
1043
|
+
return e + t;
|
1044
|
+
}
|
1045
|
+
const Bt = {
|
1046
|
+
add: vt
|
1047
|
+
}, mt = async () => {
|
1048
|
+
try {
|
1049
|
+
const { data: e } = await f().get(
|
1050
|
+
"/user",
|
1051
|
+
{
|
1052
|
+
headers: {
|
1053
|
+
Accept: "application/json"
|
1054
|
+
}
|
1055
|
+
}
|
1056
|
+
);
|
1057
|
+
return e;
|
1058
|
+
} catch (e) {
|
1059
|
+
throw e;
|
1060
|
+
}
|
1061
|
+
}, ye = [
|
1062
|
+
{ Action: "devices.ACCESS" },
|
1063
|
+
{ Action: "devices.CREATE_DEVICE" },
|
1064
|
+
{ Action: "devicetypes.CREATE_DEVICE_TYPE" },
|
1065
|
+
{ Action: "devices.DELETE" },
|
1066
|
+
{ Action: "metrics.ACCESS" },
|
1067
|
+
{ Action: "metrics.CREATE_METRIC" },
|
1068
|
+
{ Action: "users.ACCESS" },
|
1069
|
+
{ Action: "users.CREATE_USER" },
|
1070
|
+
{ Action: "applications.ACCESS" },
|
1071
|
+
{ Action: "applications.CREATE_APPLICATION" },
|
1072
|
+
{ Action: "rulesengine.ACCESS" },
|
1073
|
+
{ Action: "rulesengine.CREATE_RULE" },
|
1074
|
+
{ Action: "microservices.ACCESS" },
|
1075
|
+
{ Action: "microservices.CREATE_MICROSERVICE" },
|
1076
|
+
{ Action: "componenttoolkit.ACCESS" },
|
1077
|
+
{ Action: "componenttoolkit.CREATE_WIDGET" },
|
1078
|
+
{ Action: "authorization.roles.ACCESS" },
|
1079
|
+
{ Action: "authorization.roles.CREATE_ROLE" },
|
1080
|
+
{ Action: "jobs.ACCESS" },
|
1081
|
+
{ Action: "jobs.CREATE_JOB" },
|
1082
|
+
{ Action: "files.ACCESS" },
|
1083
|
+
{ Action: "files.CREATE_FILE" },
|
1084
|
+
{ Action: "auditlogs.ACCESS" },
|
1085
|
+
{ Action: "twintypes.ACCESS" },
|
1086
|
+
{ Action: "twintypes.CREATE_TWINTYPE" },
|
1087
|
+
{ Action: "twins.ACCESS" },
|
1088
|
+
{ Action: "twins.CREATE_TWIN" },
|
1089
|
+
{ Action: "features.ACCESS" },
|
1090
|
+
{ Action: "features.CREATE_FEATURE" },
|
1091
|
+
{ Action: "oauthclients.ACCESS" },
|
1092
|
+
{ Action: "oauthclients.CREATE" },
|
1093
|
+
{ Action: "digitalSignatures.ACCESS" },
|
1094
|
+
{ Action: "digitalSignatures.CREATE_DIGITAL_SIGNATURE" },
|
1095
|
+
{ Action: "dashboards.ACCESS" },
|
1096
|
+
{ Action: "dashboards.CREATE_DASHBOARD" },
|
1097
|
+
{ Action: "integrations.ACCESS" }
|
1098
|
+
], yt = async (e = []) => {
|
1099
|
+
try {
|
1100
|
+
const { data: t } = await f().post(
|
1101
|
+
"/api/v1/authorization/policy/check",
|
1102
|
+
e.length ? e : ye,
|
1103
|
+
{
|
1104
|
+
headers: {
|
1105
|
+
Accept: "application/json"
|
1106
|
+
}
|
1107
|
+
}
|
1108
|
+
);
|
1109
|
+
return t;
|
1110
|
+
} catch {
|
1111
|
+
return [];
|
1112
|
+
}
|
1113
|
+
}, ce = {
|
1114
|
+
getUser: mt,
|
1115
|
+
getUserPermissions: yt,
|
1116
|
+
permissionList: ye
|
1117
|
+
}, _t = async (e) => {
|
1118
|
+
const t = [];
|
1119
|
+
e && t.push(e);
|
1120
|
+
try {
|
1121
|
+
const { data: o } = await f().get(
|
1122
|
+
`/api/v1/iotdata/devices/counters/metrics?${t.join("&")}`,
|
1123
|
+
{
|
1124
|
+
headers: {
|
1125
|
+
Accept: "application/json"
|
1126
|
+
}
|
1127
|
+
}
|
1128
|
+
);
|
1129
|
+
return o;
|
1130
|
+
} catch {
|
1131
|
+
throw new Error("Devices Counters API Error");
|
1132
|
+
}
|
1133
|
+
}, ft = async (e) => {
|
1134
|
+
try {
|
1135
|
+
const { data: t } = await f().get(
|
1136
|
+
`/api/v1/iotdata/devices/counters/metrics?arrayUUIDs=${e.join(",")}`,
|
1137
|
+
{
|
1138
|
+
headers: {
|
1139
|
+
Accept: "application/json"
|
1140
|
+
}
|
1141
|
+
}
|
1142
|
+
);
|
1143
|
+
return t;
|
1144
|
+
} catch {
|
1145
|
+
throw new Error("Devices Counters API Error");
|
1146
|
+
}
|
1147
|
+
}, wt = async (e) => {
|
1148
|
+
try {
|
1149
|
+
const { data: t } = await f().get(
|
1150
|
+
`/api/v1/iotdata/devices/counters/metrics/${e}`,
|
1151
|
+
{
|
1152
|
+
headers: {
|
1153
|
+
Accept: "application/json"
|
1154
|
+
}
|
1155
|
+
}
|
1156
|
+
);
|
1157
|
+
return t;
|
1158
|
+
} catch {
|
1159
|
+
throw new Error("Devices Counters API Error");
|
1160
|
+
}
|
1161
|
+
}, bt = async (e) => {
|
1162
|
+
try {
|
1163
|
+
const { data: t } = await f().get(
|
1164
|
+
`/api/v1/iotdata/devices/counters/${e}`,
|
1165
|
+
{
|
1166
|
+
headers: {
|
1167
|
+
Accept: "application/json"
|
1168
|
+
}
|
1169
|
+
}
|
1170
|
+
);
|
1171
|
+
return t;
|
1172
|
+
} catch {
|
1173
|
+
throw new Error("Devices Counters API Error");
|
1174
|
+
}
|
1175
|
+
}, ht = async (e) => {
|
1176
|
+
try {
|
1177
|
+
const { data: t } = await f().get(
|
1178
|
+
`/api/v1/iotdata/devices/counters/latest/${e}`,
|
1179
|
+
{
|
1180
|
+
headers: {
|
1181
|
+
Accept: "application/json"
|
1182
|
+
}
|
1183
|
+
}
|
1184
|
+
);
|
1185
|
+
return t[0];
|
1186
|
+
} catch {
|
1187
|
+
throw new Error("Devices Counters API Error");
|
1188
|
+
}
|
1189
|
+
}, gt = async (e) => {
|
1190
|
+
try {
|
1191
|
+
const { data: t } = await f().get(
|
1192
|
+
`/api/v1/iotdata/devices/counters/latest?arrayUUIDs=${e.join(",")}`,
|
1193
|
+
{
|
1194
|
+
headers: {
|
1195
|
+
Accept: "application/json"
|
1196
|
+
}
|
1197
|
+
}
|
1198
|
+
);
|
1199
|
+
return t;
|
1200
|
+
} catch {
|
1201
|
+
throw new Error("Devices Counters API Error");
|
1202
|
+
}
|
1203
|
+
}, xt = {
|
1204
|
+
getDevicesCountersMetric: _t,
|
1205
|
+
getDevicesCountersMetricByUUID: wt,
|
1206
|
+
getDevicesCountersMetricByUUIDs: ft,
|
1207
|
+
getDevicesCountersByUUID: bt,
|
1208
|
+
getDevicesCountersLatestByUUID: ht,
|
1209
|
+
getDevicesCountersLatestByUUIDs: gt
|
1210
|
+
}, At = async (e) => {
|
1211
|
+
try {
|
1212
|
+
const { data: t } = await f().get(
|
1213
|
+
`/api/v1/iotdata/twins/counters/${e}`,
|
1214
|
+
{
|
1215
|
+
headers: {
|
1216
|
+
Accept: "application/json"
|
1217
|
+
}
|
1218
|
+
}
|
1219
|
+
);
|
1220
|
+
return t;
|
1221
|
+
} catch {
|
1222
|
+
throw new Error("Twins Counters API Error");
|
1223
|
+
}
|
1224
|
+
}, Et = async (e) => {
|
1225
|
+
try {
|
1226
|
+
const { data: t } = await f().get(
|
1227
|
+
`/api/v1/iotdata/twins/counters/latest/${e}`,
|
1228
|
+
{
|
1229
|
+
headers: {
|
1230
|
+
Accept: "application/json"
|
1231
|
+
}
|
1232
|
+
}
|
1233
|
+
);
|
1234
|
+
return t;
|
1235
|
+
} catch {
|
1236
|
+
throw new Error("Twins Counters API Error");
|
1237
|
+
}
|
1238
|
+
}, Lt = {
|
1239
|
+
getTwinsCountersLatestByUUID: Et,
|
1240
|
+
getTwinsCountersByUUID: At
|
1241
|
+
}, Ct = async (e, t, o, l) => {
|
1242
|
+
const n = [];
|
1243
|
+
n.push(`start=${e || 0}`), t && n.push(`limit=${t}`), o && n.push(`sort=${o}`), l && n.push(l);
|
1244
|
+
try {
|
1245
|
+
const { data: r } = await f().get(
|
1246
|
+
`/api/v1/devices?${n.join("&")}`,
|
1247
|
+
{
|
1248
|
+
headers: {
|
1249
|
+
Accept: "application/json"
|
1250
|
+
}
|
1251
|
+
}
|
1252
|
+
);
|
1253
|
+
return r;
|
1254
|
+
} catch {
|
1255
|
+
throw new Error("Devices API Error");
|
1256
|
+
}
|
1257
|
+
}, It = async (e) => {
|
1258
|
+
try {
|
1259
|
+
const { data: t } = await f().post(
|
1260
|
+
"/api/v1/devices/query",
|
1261
|
+
e,
|
1262
|
+
{
|
1263
|
+
headers: {
|
1264
|
+
Accept: "application/json"
|
1265
|
+
}
|
1266
|
+
}
|
1267
|
+
);
|
1268
|
+
return t;
|
1269
|
+
} catch {
|
1270
|
+
throw new Error("Devices API Error");
|
1271
|
+
}
|
1272
|
+
}, St = async (e) => {
|
1273
|
+
try {
|
1274
|
+
const { data: t } = await f().get(
|
1275
|
+
`/api/v1/devices/${e}`,
|
1276
|
+
{
|
1277
|
+
headers: {
|
1278
|
+
Accept: "application/json"
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
);
|
1282
|
+
return t.records[0];
|
1283
|
+
} catch {
|
1284
|
+
throw new Error("Devices API Error");
|
1285
|
+
}
|
1286
|
+
}, Tt = async (e) => {
|
1287
|
+
try {
|
1288
|
+
const { data: t } = await f().get(
|
1289
|
+
`/api/v1/devices?arrayUUIDs=${e.join(",")}`,
|
1290
|
+
{
|
1291
|
+
headers: {
|
1292
|
+
Accept: "application/json"
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
);
|
1296
|
+
return t;
|
1297
|
+
} catch {
|
1298
|
+
throw new Error("Devices API Error");
|
1299
|
+
}
|
1300
|
+
}, Ut = async (e) => {
|
1301
|
+
try {
|
1302
|
+
const { data: t } = await f().get(
|
1303
|
+
`/api/v1/devices/attachments/${e}`,
|
1304
|
+
{
|
1305
|
+
headers: {
|
1306
|
+
Accept: "application/json"
|
1307
|
+
}
|
1308
|
+
}
|
1309
|
+
);
|
1310
|
+
return t;
|
1311
|
+
} catch {
|
1312
|
+
throw new Error("Devices API Error");
|
1313
|
+
}
|
1314
|
+
}, Y = {
|
1315
|
+
getDevices: Ct,
|
1316
|
+
queryDevices: It,
|
1317
|
+
getDeviceByUUID: St,
|
1318
|
+
getDeviceByUUIDs: Tt,
|
1319
|
+
getDeviceAttachements: Ut
|
1320
|
+
}, Dt = async (e) => {
|
1321
|
+
try {
|
1322
|
+
const { data: t } = await f().post(
|
1323
|
+
"/api/v2/timeseriesdata",
|
1324
|
+
e,
|
1325
|
+
{
|
1326
|
+
headers: {
|
1327
|
+
Accept: "application/json"
|
1328
|
+
}
|
1329
|
+
}
|
1330
|
+
);
|
1331
|
+
return t;
|
1332
|
+
} catch {
|
1333
|
+
throw new Error("Timeseries Error");
|
1334
|
+
}
|
1335
|
+
}, Nt = {
|
1336
|
+
queryTimeseries: Dt
|
1337
|
+
}, kt = async () => {
|
1338
|
+
var e, t, o, l, n, r, s;
|
1339
|
+
try {
|
1340
|
+
const { data: a } = await f().get(
|
1341
|
+
"/api/v1/iotdata/meta-data/metrics",
|
1342
|
+
{
|
1343
|
+
headers: {
|
1344
|
+
Accept: "application/json"
|
1345
|
+
}
|
1346
|
+
}
|
1347
|
+
);
|
1348
|
+
return a.fields;
|
1349
|
+
} catch (a) {
|
1350
|
+
const c = typeof ((t = (e = a == null ? void 0 : a.response) == null ? void 0 : e.data) == null ? void 0 : t.message) == "string" ? (l = (o = a == null ? void 0 : a.response) == null ? void 0 : o.data) == null ? void 0 : l.message : typeof ((n = a == null ? void 0 : a.response) == null ? void 0 : n.data) == "string" ? (r = a == null ? void 0 : a.response) == null ? void 0 : r.data : "";
|
1351
|
+
throw new Error(`API Error ${(s = a == null ? void 0 : a.response) == null ? void 0 : s.status} ${c}`);
|
1352
|
+
}
|
1353
|
+
}, Vt = async (e) => {
|
1354
|
+
var t, o, l, n, r, s, a;
|
1355
|
+
try {
|
1356
|
+
const { data: c } = await f().post(
|
1357
|
+
"/api/v1/iotdata/meta-data",
|
1358
|
+
{
|
1359
|
+
name: e.name,
|
1360
|
+
label: e.label,
|
1361
|
+
units: e.units,
|
1362
|
+
description: e.description,
|
1363
|
+
semantics: e.semantics || "metric",
|
1364
|
+
labels: e.labels
|
1365
|
+
},
|
1366
|
+
{
|
1367
|
+
headers: {
|
1368
|
+
Accept: "application/json"
|
1369
|
+
}
|
1370
|
+
}
|
1371
|
+
);
|
1372
|
+
return c;
|
1373
|
+
} catch (c) {
|
1374
|
+
const v = typeof ((o = (t = c == null ? void 0 : c.response) == null ? void 0 : t.data) == null ? void 0 : o.message) == "string" ? (n = (l = c == null ? void 0 : c.response) == null ? void 0 : l.data) == null ? void 0 : n.message : typeof ((r = c == null ? void 0 : c.response) == null ? void 0 : r.data) == "string" ? (s = c == null ? void 0 : c.response) == null ? void 0 : s.data : "";
|
1375
|
+
throw new Error(`API Error ${(a = c == null ? void 0 : c.response) == null ? void 0 : a.status} ${v}`);
|
1376
|
+
}
|
1377
|
+
}, ie = {
|
1378
|
+
getMetrics: kt,
|
1379
|
+
postMetric: Vt
|
1380
|
+
}, qt = N("userSession", () => {
|
1381
|
+
const e = b(JSON.parse(localStorage.getItem("user") || "null")), t = b(JSON.parse(localStorage.getItem("user-permissions") || "[]")), o = S(() => {
|
1382
|
+
var s;
|
1383
|
+
return ((s = e.value) == null ? void 0 : s.name) || "no user";
|
1384
|
+
}), l = S(() => (s) => {
|
1385
|
+
var a, c;
|
1386
|
+
return s ? ((c = (a = t.value) == null ? void 0 : a.find((v) => v.Action === s)) == null ? void 0 : c.Allowed) || !1 : !0;
|
1387
|
+
}), n = async () => {
|
1388
|
+
var s, a;
|
1389
|
+
try {
|
1390
|
+
const c = await ce.getUser();
|
1391
|
+
if (e.value = c, (s = e.value) != null && s.UUID) {
|
1392
|
+
const v = await ce.getUserPermissions();
|
1393
|
+
t.value = v, localStorage.setItem("user", JSON.stringify(e.value)), localStorage.setItem("user-permissions", JSON.stringify(t.value));
|
1394
|
+
}
|
1395
|
+
} catch (c) {
|
1396
|
+
((a = c.response) == null ? void 0 : a.status) === 401 && (window.location.href = "/ui/login.html");
|
1397
|
+
}
|
1398
|
+
}, r = () => {
|
1399
|
+
e.value = null, t.value = [], localStorage.removeItem("user"), localStorage.removeItem("user-permission"), window.location.href = "/ui/logout";
|
1400
|
+
};
|
1401
|
+
return n(), { user: e, pullUser: n, userName: o, userPermissions: t, getPermission: l, logout: r };
|
1402
|
+
}), zt = N("devices", () => {
|
1403
|
+
const e = b({});
|
1404
|
+
return {
|
1405
|
+
pullDevicesByUUIDs: async (n, r = !1) => {
|
1406
|
+
r && n.forEach((s) => {
|
1407
|
+
delete e.value[s];
|
1408
|
+
});
|
1409
|
+
try {
|
1410
|
+
const s = await Y.getDeviceByUUIDs(n);
|
1411
|
+
return s.records.forEach((a) => {
|
1412
|
+
e.value[a.UUID] = a;
|
1413
|
+
}), s;
|
1414
|
+
} catch {
|
1415
|
+
return {
|
1416
|
+
totalRecords: 0,
|
1417
|
+
records: []
|
1418
|
+
};
|
1419
|
+
}
|
1420
|
+
},
|
1421
|
+
pullDevices: async (n, r, s, a) => {
|
1422
|
+
try {
|
1423
|
+
const c = await Y.getDevices(n, r, s, a);
|
1424
|
+
return c.records.forEach((v) => {
|
1425
|
+
e.value[v.UUID] = v;
|
1426
|
+
}), c;
|
1427
|
+
} catch {
|
1428
|
+
return {
|
1429
|
+
totalRecords: 0,
|
1430
|
+
records: []
|
1431
|
+
};
|
1432
|
+
}
|
1433
|
+
},
|
1434
|
+
devicesCollection: e,
|
1435
|
+
getDeviceFromUUID: async (n, r) => {
|
1436
|
+
const s = e.value[n];
|
1437
|
+
if (s)
|
1438
|
+
return s;
|
1439
|
+
if (r)
|
1440
|
+
return null;
|
1441
|
+
try {
|
1442
|
+
const a = await Y.getDeviceByUUID(n);
|
1443
|
+
if (a)
|
1444
|
+
return e.value[a.UUID] = a, a;
|
1445
|
+
} catch {
|
1446
|
+
return null;
|
1447
|
+
}
|
1448
|
+
}
|
1449
|
+
};
|
1450
|
+
}), Ft = N("twins", () => {
|
1451
|
+
const e = b({});
|
1452
|
+
return {
|
1453
|
+
pullTwinsByUUIDs: async (n, r = !1) => {
|
1454
|
+
r && n.forEach((s) => {
|
1455
|
+
delete e.value[s];
|
1456
|
+
});
|
1457
|
+
try {
|
1458
|
+
const s = await W.getTwinByUUIDs(n);
|
1459
|
+
return s.records.forEach((a) => {
|
1460
|
+
e.value[a.UUID] = a;
|
1461
|
+
}), s;
|
1462
|
+
} catch {
|
1463
|
+
return {
|
1464
|
+
totalRecords: 0,
|
1465
|
+
records: []
|
1466
|
+
};
|
1467
|
+
}
|
1468
|
+
},
|
1469
|
+
pullTwins: async (n, r, s, a) => {
|
1470
|
+
try {
|
1471
|
+
const c = await W.getTwins(n, r, s, a);
|
1472
|
+
return c.records.forEach((v) => {
|
1473
|
+
e.value[v.UUID] = v;
|
1474
|
+
}), c;
|
1475
|
+
} catch {
|
1476
|
+
return {
|
1477
|
+
totalRecords: 0,
|
1478
|
+
records: []
|
1479
|
+
};
|
1480
|
+
}
|
1481
|
+
},
|
1482
|
+
twinsCollection: e,
|
1483
|
+
getTwinFromUUID: async (n, r) => {
|
1484
|
+
const s = e.value[n];
|
1485
|
+
if (s)
|
1486
|
+
return s;
|
1487
|
+
if (r)
|
1488
|
+
return null;
|
1489
|
+
try {
|
1490
|
+
const a = await W.getTwinByUUID(n);
|
1491
|
+
if (a)
|
1492
|
+
return e.value[a.UUID] = a, a;
|
1493
|
+
} catch {
|
1494
|
+
return null;
|
1495
|
+
}
|
1496
|
+
}
|
1497
|
+
};
|
1498
|
+
}), $t = async () => {
|
1499
|
+
try {
|
1500
|
+
const { data: e } = await f().get(
|
1501
|
+
"/api/v1/iotdata/metrics/counters",
|
1502
|
+
{
|
1503
|
+
headers: {
|
1504
|
+
Accept: "application/json"
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
);
|
1508
|
+
return e;
|
1509
|
+
} catch {
|
1510
|
+
throw new Error("Metric Counter API Error");
|
1511
|
+
}
|
1512
|
+
}, Rt = {
|
1513
|
+
getMetricsCounters: $t
|
1514
|
+
}, Qt = N("metrics", () => {
|
1515
|
+
const e = b([]), t = b([]), o = S(() => (a) => {
|
1516
|
+
var c;
|
1517
|
+
return (c = t.value) == null ? void 0 : c.find((v) => v.name === a);
|
1518
|
+
}), l = S(() => e.value.map((a) => ({ title: `${a.label} ${a.name}`, label: a.label, value: a.name }))), n = async (a) => {
|
1519
|
+
if (!(a && e.value.length))
|
1520
|
+
try {
|
1521
|
+
const c = await ie.getMetrics();
|
1522
|
+
e.value = c;
|
1523
|
+
} catch (c) {
|
1524
|
+
Q().setSnackbarMessage(c, "error");
|
1525
|
+
}
|
1526
|
+
}, r = async () => {
|
1527
|
+
try {
|
1528
|
+
const a = await Rt.getMetricsCounters();
|
1529
|
+
t.value = a;
|
1530
|
+
} catch (a) {
|
1531
|
+
Q().setSnackbarMessage(a, "error");
|
1532
|
+
}
|
1533
|
+
}, s = async (a) => {
|
1534
|
+
let c = !1;
|
1535
|
+
try {
|
1536
|
+
await ie.postMetric(a), c = !0, Q().setSnackbarMessage(`Metric ${a.name} successfully saved`, "success");
|
1537
|
+
} catch (v) {
|
1538
|
+
Q().setSnackbarMessage(v, "error");
|
1539
|
+
}
|
1540
|
+
return await n(), await r(), c;
|
1541
|
+
};
|
1542
|
+
return n(), {
|
1543
|
+
metrics: e,
|
1544
|
+
metricsCounters: t,
|
1545
|
+
pullMetrics: n,
|
1546
|
+
pullMetricsCounters: r,
|
1547
|
+
getMetricCounter: o,
|
1548
|
+
saveMetric: s,
|
1549
|
+
metricsArr: l
|
1550
|
+
};
|
1551
|
+
});
|
1552
|
+
function Wt(e) {
|
1553
|
+
for (const t in le)
|
1554
|
+
e.component(t, le[t]);
|
1555
|
+
}
|
1556
|
+
export {
|
1557
|
+
lt as ConfirmModal,
|
1558
|
+
f as DavraApiClient,
|
1559
|
+
ee as DavraApiConfig,
|
1560
|
+
rt as DeleteModal,
|
1561
|
+
xt as DevicesCountersService,
|
1562
|
+
Y as DevicesService,
|
1563
|
+
ve as LabelInput,
|
1564
|
+
tt as LabelsSelector,
|
1565
|
+
Z as LabelsService,
|
1566
|
+
ie as MetricsService,
|
1567
|
+
at as Modal,
|
1568
|
+
Pt as MyConstants,
|
1569
|
+
Bt as MyUtil,
|
1570
|
+
ut as ScrollText,
|
1571
|
+
dt as Snackbar,
|
1572
|
+
Nt as TimeseriesService,
|
1573
|
+
Xe as TwinTypesService,
|
1574
|
+
Lt as TwinsCountersService,
|
1575
|
+
W as TwinsService,
|
1576
|
+
ce as UserSessionService,
|
1577
|
+
ot as ViewObjectModal,
|
1578
|
+
Wt as installCoreComponents,
|
1579
|
+
Q as useAlertMessagesStore,
|
1580
|
+
zt as useDevicesStore,
|
1581
|
+
et as useLabelsStore,
|
1582
|
+
Qt as useMetricsStore,
|
1583
|
+
me as useTwinTypesStore,
|
1584
|
+
Ft as useTwinsStore,
|
1585
|
+
qt as useUserSessionStore
|
1586
|
+
};
|