@nice2dev/ui-iot 1.1.9 → 1.2.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/dist/index.cjs +2 -2
- package/dist/index.mjs +321 -293
- package/dist/ui-iot.css +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
2
|
-
import { useContext as B, createContext as
|
|
3
|
-
const de = (a, i) => i, se =
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as B, createContext as M, memo as oe, useState as u, useEffect as te, useCallback as C } from "react";
|
|
3
|
+
const de = (a, i) => i, se = M(de), le = M("en");
|
|
4
4
|
function R() {
|
|
5
5
|
const a = B(se), i = B(le);
|
|
6
6
|
return { t: a, lang: i };
|
|
7
7
|
}
|
|
8
|
-
b({
|
|
9
|
-
dir: "ltr",
|
|
10
|
-
isRTL: !1,
|
|
11
|
-
flip: (a) => a,
|
|
12
|
-
value: (a) => a.ltr
|
|
13
|
-
});
|
|
14
|
-
b(null);
|
|
15
|
-
b(null);
|
|
16
8
|
const fe = {
|
|
17
9
|
radius: "md",
|
|
18
10
|
shadow: "md",
|
|
@@ -30,7 +22,7 @@ const fe = {
|
|
|
30
22
|
animation: "normal",
|
|
31
23
|
density: "normal"
|
|
32
24
|
};
|
|
33
|
-
|
|
25
|
+
M({
|
|
34
26
|
displayStyle: "default",
|
|
35
27
|
variantConfig: fe,
|
|
36
28
|
setDisplayStyle: () => {
|
|
@@ -239,14 +231,14 @@ const me = {
|
|
|
239
231
|
md: 20,
|
|
240
232
|
lg: 24,
|
|
241
233
|
xl: 32
|
|
242
|
-
}, pe =
|
|
234
|
+
}, pe = M({});
|
|
243
235
|
function ye({
|
|
244
236
|
path: a,
|
|
245
237
|
size: i,
|
|
246
238
|
className: c,
|
|
247
239
|
style: n,
|
|
248
|
-
color:
|
|
249
|
-
title:
|
|
240
|
+
color: t,
|
|
241
|
+
title: o,
|
|
250
242
|
onClick: d
|
|
251
243
|
}) {
|
|
252
244
|
return /* @__PURE__ */ r(
|
|
@@ -257,35 +249,35 @@ function ye({
|
|
|
257
249
|
height: i,
|
|
258
250
|
viewBox: "0 0 24 24",
|
|
259
251
|
fill: "none",
|
|
260
|
-
stroke:
|
|
252
|
+
stroke: t || "currentColor",
|
|
261
253
|
strokeWidth: 2,
|
|
262
254
|
strokeLinecap: "round",
|
|
263
255
|
strokeLinejoin: "round",
|
|
264
256
|
className: `nice-icon ${c || ""}`,
|
|
265
257
|
style: n,
|
|
266
|
-
role:
|
|
267
|
-
"aria-label":
|
|
268
|
-
"aria-hidden": !
|
|
258
|
+
role: o ? "img" : "presentation",
|
|
259
|
+
"aria-label": o,
|
|
260
|
+
"aria-hidden": !o,
|
|
269
261
|
onClick: d,
|
|
270
262
|
children: [
|
|
271
|
-
|
|
263
|
+
o && /* @__PURE__ */ e("title", { children: o }),
|
|
272
264
|
/* @__PURE__ */ e("path", { d: a })
|
|
273
265
|
]
|
|
274
266
|
}
|
|
275
267
|
);
|
|
276
268
|
}
|
|
277
|
-
const
|
|
269
|
+
const p = ({
|
|
278
270
|
name: a,
|
|
279
271
|
size: i = "md",
|
|
280
272
|
className: c,
|
|
281
273
|
style: n,
|
|
282
|
-
color:
|
|
283
|
-
title:
|
|
274
|
+
color: t,
|
|
275
|
+
title: o,
|
|
284
276
|
onClick: d
|
|
285
277
|
}) => {
|
|
286
|
-
const { resolver: l } = B(pe),
|
|
278
|
+
const { resolver: l } = B(pe), b = typeof i == "number" ? i : he[i];
|
|
287
279
|
if (l) {
|
|
288
|
-
const _ = l(a,
|
|
280
|
+
const _ = l(a, b);
|
|
289
281
|
if (_)
|
|
290
282
|
return /* @__PURE__ */ e("span", { className: `nice-icon-wrap ${c || ""}`, style: n, onClick: d, children: _ });
|
|
291
283
|
}
|
|
@@ -294,27 +286,41 @@ const u = ({
|
|
|
294
286
|
ye,
|
|
295
287
|
{
|
|
296
288
|
path: m,
|
|
297
|
-
size:
|
|
289
|
+
size: b,
|
|
298
290
|
className: c,
|
|
299
291
|
style: n,
|
|
300
|
-
color:
|
|
301
|
-
title:
|
|
292
|
+
color: t,
|
|
293
|
+
title: o,
|
|
302
294
|
onClick: d
|
|
303
295
|
}
|
|
304
296
|
) : null;
|
|
305
297
|
};
|
|
306
|
-
|
|
298
|
+
M({
|
|
307
299
|
direction: "ltr",
|
|
308
300
|
isRTL: !1,
|
|
309
301
|
flip: (a) => a,
|
|
310
302
|
flipStyle: (a, i) => ({ [a]: i })
|
|
311
303
|
});
|
|
312
|
-
|
|
304
|
+
M({
|
|
313
305
|
permissions: {},
|
|
314
306
|
getAccessMode: () => "full"
|
|
315
307
|
});
|
|
316
|
-
|
|
317
|
-
|
|
308
|
+
M(null);
|
|
309
|
+
function ue() {
|
|
310
|
+
const a = globalThis.crypto;
|
|
311
|
+
if (typeof (a == null ? void 0 : a.randomUUID) == "function")
|
|
312
|
+
return a.randomUUID();
|
|
313
|
+
const i = new Uint8Array(16);
|
|
314
|
+
if (typeof (a == null ? void 0 : a.getRandomValues) == "function")
|
|
315
|
+
a.getRandomValues(i);
|
|
316
|
+
else
|
|
317
|
+
for (let n = 0; n < i.length; n++)
|
|
318
|
+
i[n] = Math.floor(Math.random() * 256);
|
|
319
|
+
i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128;
|
|
320
|
+
const c = Array.from(i, (n) => n.toString(16).padStart(2, "0")).join("");
|
|
321
|
+
return `${c.slice(0, 8)}-${c.slice(8, 12)}-${c.slice(12, 16)}-${c.slice(16, 20)}-${c.slice(20)}`;
|
|
322
|
+
}
|
|
323
|
+
M(null);
|
|
318
324
|
const Y = {
|
|
319
325
|
space1: "4px",
|
|
320
326
|
space2: "8px",
|
|
@@ -342,18 +348,18 @@ const Y = {
|
|
|
342
348
|
radiusLg: "8px",
|
|
343
349
|
radiusXl: "12px",
|
|
344
350
|
radiusFull: "9999px"
|
|
345
|
-
}),
|
|
351
|
+
}), ve = {
|
|
346
352
|
sm: "0 1px 2px rgba(0,0,0,0.05)",
|
|
347
353
|
md: "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",
|
|
348
354
|
lg: "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",
|
|
349
355
|
xl: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
|
|
350
|
-
},
|
|
356
|
+
}, be = {
|
|
351
357
|
sm: "0 1px 2px rgba(0,0,0,0.3)",
|
|
352
358
|
md: "0 4px 6px -1px rgba(0,0,0,0.4)",
|
|
353
359
|
lg: "0 10px 15px -3px rgba(0,0,0,0.4)",
|
|
354
360
|
xl: "0 20px 25px -5px rgba(0,0,0,0.4)"
|
|
355
361
|
};
|
|
356
|
-
function s(a, i, c, n,
|
|
362
|
+
function s(a, i, c, n, t) {
|
|
357
363
|
return {
|
|
358
364
|
name: a,
|
|
359
365
|
darkMode: "light",
|
|
@@ -369,14 +375,14 @@ function s(a, i, c, n, o) {
|
|
|
369
375
|
canvas: c.canvas ?? c.primary
|
|
370
376
|
},
|
|
371
377
|
text: { ...n, inverse: n.inverse ?? "#ffffff" },
|
|
372
|
-
borders: ae(
|
|
373
|
-
shadows:
|
|
378
|
+
borders: ae(t),
|
|
379
|
+
shadows: ve,
|
|
374
380
|
spacing: Y,
|
|
375
381
|
typography: Z,
|
|
376
382
|
transitions: ee
|
|
377
383
|
};
|
|
378
384
|
}
|
|
379
|
-
function h(a, i, c, n,
|
|
385
|
+
function h(a, i, c, n, t) {
|
|
380
386
|
return {
|
|
381
387
|
name: a,
|
|
382
388
|
darkMode: "dark",
|
|
@@ -392,8 +398,8 @@ function h(a, i, c, n, o) {
|
|
|
392
398
|
canvas: c.canvas ?? c.primary
|
|
393
399
|
},
|
|
394
400
|
text: { ...n, inverse: n.inverse ?? "#0f172a" },
|
|
395
|
-
borders: ae(
|
|
396
|
-
shadows:
|
|
401
|
+
borders: ae(t),
|
|
402
|
+
shadows: be,
|
|
397
403
|
spacing: Y,
|
|
398
404
|
typography: Z,
|
|
399
405
|
transitions: ee
|
|
@@ -788,7 +794,8 @@ h(
|
|
|
788
794
|
info: "#22d3ee"
|
|
789
795
|
},
|
|
790
796
|
{ primary: "#030712", secondary: "#111827", tertiary: "#1f2937", hover: "#1f2937" },
|
|
791
|
-
|
|
797
|
+
// indigo-500 is a dark fill: white on it reads better than the dark default of dark themes
|
|
798
|
+
{ primary: "#e5e7eb", secondary: "#9ca3af", muted: "#4b5563", onPrimary: "#ffffff" },
|
|
792
799
|
"#374151"
|
|
793
800
|
);
|
|
794
801
|
h(
|
|
@@ -1264,7 +1271,8 @@ h(
|
|
|
1264
1271
|
info: "#2aa198"
|
|
1265
1272
|
},
|
|
1266
1273
|
{ primary: "#002b36", secondary: "#073642", tertiary: "#0a4858", hover: "#073642" },
|
|
1267
|
-
|
|
1274
|
+
// Solarized red is a dark fill: white on it is 4.63 : 1, the dark default 3.86
|
|
1275
|
+
{ primary: "#eee8d5", secondary: "#93a1a1", muted: "#586e75", onError: "#ffffff" },
|
|
1268
1276
|
"#073642"
|
|
1269
1277
|
);
|
|
1270
1278
|
h(
|
|
@@ -1376,7 +1384,8 @@ h(
|
|
|
1376
1384
|
info: "#bf00ff"
|
|
1377
1385
|
},
|
|
1378
1386
|
{ primary: "#0a0e17", secondary: "#131824", tertiary: "#1c2333", hover: "#1c2333" },
|
|
1379
|
-
|
|
1387
|
+
// the purple info fill is dark: white on it is 4.51 : 1, the dark default 3.96
|
|
1388
|
+
{ primary: "#e0fbfc", secondary: "#80d4dd", muted: "#3a6b72", onInfo: "#ffffff" },
|
|
1380
1389
|
"#1c3a44"
|
|
1381
1390
|
);
|
|
1382
1391
|
h(
|
|
@@ -1432,7 +1441,8 @@ h(
|
|
|
1432
1441
|
info: "#9333ea"
|
|
1433
1442
|
},
|
|
1434
1443
|
{ primary: "#1a0a00", secondary: "#2d1500", tertiary: "#402000", hover: "#402000" },
|
|
1435
|
-
|
|
1444
|
+
// purple-600 info is a dark fill: white on it is 5.38 : 1, the dark default 3.32
|
|
1445
|
+
{ primary: "#ffedd5", secondary: "#fdba74", muted: "#9a5c28", onInfo: "#ffffff" },
|
|
1436
1446
|
"#5c3400"
|
|
1437
1447
|
);
|
|
1438
1448
|
s(
|
|
@@ -1743,28 +1753,28 @@ s(
|
|
|
1743
1753
|
{ primary: "#3b0a0a", secondary: "#7f1d1d", muted: "#dc6868" },
|
|
1744
1754
|
"#e8a0a0"
|
|
1745
1755
|
);
|
|
1746
|
-
const
|
|
1756
|
+
const ge = process.env.NODE_ENV === "development";
|
|
1747
1757
|
let re = {
|
|
1748
|
-
enabled:
|
|
1758
|
+
enabled: ge,
|
|
1749
1759
|
slowRenderThreshold: 16
|
|
1750
1760
|
};
|
|
1751
1761
|
const ie = [], O = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map();
|
|
1752
|
-
function
|
|
1762
|
+
function Me() {
|
|
1753
1763
|
ie.length = 0, O.clear(), ce.clear();
|
|
1754
1764
|
}
|
|
1755
|
-
function
|
|
1765
|
+
function _e(a) {
|
|
1756
1766
|
const i = re.slowRenderThreshold;
|
|
1757
1767
|
return ie.filter((c) => c.actualDuration > i);
|
|
1758
1768
|
}
|
|
1759
1769
|
function V(a) {
|
|
1760
1770
|
return a < 1 ? `${(a * 1e3).toFixed(0)}μs` : a < 1e3 ? `${a.toFixed(2)}ms` : `${(a / 1e3).toFixed(2)}s`;
|
|
1761
1771
|
}
|
|
1762
|
-
function _e() {
|
|
1763
|
-
const a = Array.from(O.values()), i = Me(), c = a.reduce((t, d) => t + d.renderCount, 0), n = a.length > 0 ? a.reduce((t, d) => t + d.avgRenderTime, 0) / a.length : 0, o = Array.from(ce.values());
|
|
1764
|
-
return { stats: a, slowRenders: i, totalRenders: c, avgRenderTime: n, marks: o };
|
|
1765
|
-
}
|
|
1766
1772
|
function Ne() {
|
|
1767
|
-
const a = _e();
|
|
1773
|
+
const a = Array.from(O.values()), i = _e(), c = a.reduce((o, d) => o + d.renderCount, 0), n = a.length > 0 ? a.reduce((o, d) => o + d.avgRenderTime, 0) / a.length : 0, t = Array.from(ce.values());
|
|
1774
|
+
return { stats: a, slowRenders: i, totalRenders: c, avgRenderTime: n, marks: t };
|
|
1775
|
+
}
|
|
1776
|
+
function we() {
|
|
1777
|
+
const a = Ne();
|
|
1768
1778
|
console.group(
|
|
1769
1779
|
"%c[Nice2Dev Performance Report]",
|
|
1770
1780
|
"color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"
|
|
@@ -1791,17 +1801,17 @@ function Ne() {
|
|
|
1791
1801
|
}))
|
|
1792
1802
|
), console.groupEnd()), console.groupEnd();
|
|
1793
1803
|
}
|
|
1794
|
-
const
|
|
1804
|
+
const Ce = oe(
|
|
1795
1805
|
({ position: a = "bottom-right", defaultCollapsed: i = !0 }) => {
|
|
1796
|
-
const [c, n] =
|
|
1806
|
+
const [c, n] = u(i), [t, o] = u([]), [d, l] = u({ used: 0, total: 0 });
|
|
1797
1807
|
if (te(() => {
|
|
1798
1808
|
const m = () => {
|
|
1799
1809
|
const w = Array.from(O.values());
|
|
1800
|
-
|
|
1801
|
-
const
|
|
1802
|
-
|
|
1803
|
-
used:
|
|
1804
|
-
total:
|
|
1810
|
+
o(w.sort((v, N) => N.totalRenderTime - v.totalRenderTime).slice(0, 10));
|
|
1811
|
+
const g = window.performance;
|
|
1812
|
+
g.memory && l({
|
|
1813
|
+
used: g.memory.usedJSHeapSize / 1024 / 1024,
|
|
1814
|
+
total: g.memory.totalJSHeapSize / 1024 / 1024
|
|
1805
1815
|
});
|
|
1806
1816
|
};
|
|
1807
1817
|
m();
|
|
@@ -1809,7 +1819,7 @@ const we = oe(
|
|
|
1809
1819
|
return () => clearInterval(_);
|
|
1810
1820
|
}, []), !re.enabled)
|
|
1811
1821
|
return null;
|
|
1812
|
-
const
|
|
1822
|
+
const b = {
|
|
1813
1823
|
position: "fixed",
|
|
1814
1824
|
zIndex: 99999,
|
|
1815
1825
|
...a.includes("top") ? { top: 8 } : { bottom: 8 },
|
|
@@ -1819,9 +1829,9 @@ const we = oe(
|
|
|
1819
1829
|
"div",
|
|
1820
1830
|
{
|
|
1821
1831
|
style: {
|
|
1822
|
-
...
|
|
1832
|
+
...b,
|
|
1823
1833
|
background: "var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",
|
|
1824
|
-
color: "var(--nice-
|
|
1834
|
+
color: "var(--nice-color-white, #fff)",
|
|
1825
1835
|
borderRadius: 8,
|
|
1826
1836
|
fontSize: 11,
|
|
1827
1837
|
fontFamily: "Monaco, Consolas, monospace",
|
|
@@ -1862,7 +1872,7 @@ const we = oe(
|
|
|
1862
1872
|
]
|
|
1863
1873
|
}
|
|
1864
1874
|
),
|
|
1865
|
-
/* @__PURE__ */ e("span", { style: { marginLeft: "auto", opacity: 0.5, display: "inline-flex" }, children: /* @__PURE__ */ e(
|
|
1875
|
+
/* @__PURE__ */ e("span", { style: { marginLeft: "auto", opacity: 0.5, display: "inline-flex" }, children: /* @__PURE__ */ e(p, { name: c ? "chevron-down" : "chevron-up", size: 12 }) })
|
|
1866
1876
|
]
|
|
1867
1877
|
}
|
|
1868
1878
|
),
|
|
@@ -1878,7 +1888,7 @@ const we = oe(
|
|
|
1878
1888
|
children: /* @__PURE__ */ e("strong", { children: "Top Components" })
|
|
1879
1889
|
}
|
|
1880
1890
|
),
|
|
1881
|
-
|
|
1891
|
+
t.map((m) => /* @__PURE__ */ r("div", { style: { marginBottom: 4, display: "flex", gap: 8 }, children: [
|
|
1882
1892
|
/* @__PURE__ */ e("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: m.componentName }),
|
|
1883
1893
|
/* @__PURE__ */ e(
|
|
1884
1894
|
"span",
|
|
@@ -1908,7 +1918,7 @@ const we = oe(
|
|
|
1908
1918
|
/* @__PURE__ */ e(
|
|
1909
1919
|
"button",
|
|
1910
1920
|
{
|
|
1911
|
-
onClick:
|
|
1921
|
+
onClick: we,
|
|
1912
1922
|
style: {
|
|
1913
1923
|
flex: 1,
|
|
1914
1924
|
padding: "4px 8px",
|
|
@@ -1925,7 +1935,7 @@ const we = oe(
|
|
|
1925
1935
|
/* @__PURE__ */ e(
|
|
1926
1936
|
"button",
|
|
1927
1937
|
{
|
|
1928
|
-
onClick:
|
|
1938
|
+
onClick: Me,
|
|
1929
1939
|
style: {
|
|
1930
1940
|
flex: 1,
|
|
1931
1941
|
padding: "4px 8px",
|
|
@@ -1946,10 +1956,10 @@ const we = oe(
|
|
|
1946
1956
|
);
|
|
1947
1957
|
}
|
|
1948
1958
|
);
|
|
1949
|
-
|
|
1959
|
+
Ce.displayName = "ProfilerOverlay";
|
|
1950
1960
|
process.env.NODE_ENV;
|
|
1951
|
-
|
|
1952
|
-
|
|
1961
|
+
M(null);
|
|
1962
|
+
M({
|
|
1953
1963
|
enabled: !0,
|
|
1954
1964
|
active: !1,
|
|
1955
1965
|
run: () => {
|
|
@@ -1986,10 +1996,10 @@ if (typeof document < "u" && !document.getElementById(W)) {
|
|
|
1986
1996
|
.nice-tutorial-button--md { width: 20px; height: 20px; font-size: 12px; }
|
|
1987
1997
|
`, document.head.appendChild(a);
|
|
1988
1998
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1999
|
+
M(null);
|
|
2000
|
+
M(null);
|
|
2001
|
+
M(null);
|
|
2002
|
+
M(null);
|
|
1993
2003
|
const G = {
|
|
1994
2004
|
display: "inline-block",
|
|
1995
2005
|
width: 10,
|
|
@@ -2008,59 +2018,59 @@ const G = {
|
|
|
2008
2018
|
{ type: "kpi", label: "KPI Card", icon: "target" },
|
|
2009
2019
|
{ type: "camera-feed", label: "Camera Feed", icon: "video" }
|
|
2010
2020
|
];
|
|
2011
|
-
function
|
|
2021
|
+
function Fe({
|
|
2012
2022
|
devices: a = [],
|
|
2013
2023
|
widgets: i = [],
|
|
2014
2024
|
alarms: c = [],
|
|
2015
2025
|
onDeviceSelect: n,
|
|
2016
|
-
onWidgetChange:
|
|
2017
|
-
onCommand:
|
|
2026
|
+
onWidgetChange: t,
|
|
2027
|
+
onCommand: o,
|
|
2018
2028
|
onAlarmAcknowledge: d,
|
|
2019
2029
|
fetchTelemetry: l,
|
|
2020
|
-
className:
|
|
2030
|
+
className: b = ""
|
|
2021
2031
|
}) {
|
|
2022
|
-
const [m, _] =
|
|
2032
|
+
const [m, _] = u(i), [w, g] = u(null), [v, N] = u("dashboard"), [H, L] = u(!1), [z, A] = u(""), y = C(
|
|
2023
2033
|
(f) => {
|
|
2024
2034
|
_((x) => {
|
|
2025
2035
|
const S = f(x);
|
|
2026
|
-
return
|
|
2036
|
+
return t == null || t(S), S;
|
|
2027
2037
|
});
|
|
2028
2038
|
},
|
|
2029
|
-
[
|
|
2039
|
+
[t]
|
|
2030
2040
|
), k = C(
|
|
2031
2041
|
(f) => {
|
|
2032
2042
|
var S;
|
|
2033
2043
|
const x = {
|
|
2034
|
-
id:
|
|
2044
|
+
id: ue(),
|
|
2035
2045
|
type: f,
|
|
2036
2046
|
title: ((S = F.find(($) => $.type === f)) == null ? void 0 : S.label) || f,
|
|
2037
|
-
position: { x: 0, y:
|
|
2047
|
+
position: { x: 0, y: He(m), width: 4, height: 3 },
|
|
2038
2048
|
config: {}
|
|
2039
2049
|
};
|
|
2040
|
-
|
|
2050
|
+
y(($) => [...$, x]);
|
|
2041
2051
|
},
|
|
2042
|
-
[m,
|
|
2043
|
-
),
|
|
2052
|
+
[m, y]
|
|
2053
|
+
), U = C(
|
|
2044
2054
|
(f) => {
|
|
2045
|
-
|
|
2055
|
+
g(f), n == null || n(f);
|
|
2046
2056
|
},
|
|
2047
2057
|
[n]
|
|
2048
|
-
),
|
|
2058
|
+
), E = C(
|
|
2049
2059
|
(f) => {
|
|
2050
2060
|
d == null || d(f);
|
|
2051
2061
|
},
|
|
2052
2062
|
[d]
|
|
2053
2063
|
), T = a.filter(
|
|
2054
2064
|
(f) => !z || f.name.toLowerCase().includes(z.toLowerCase()) || f.type.toLowerCase().includes(z.toLowerCase())
|
|
2055
|
-
),
|
|
2065
|
+
), D = c.filter((f) => !f.cleared), q = D.filter(
|
|
2056
2066
|
(f) => f.severity === "critical" || f.severity === "high"
|
|
2057
2067
|
);
|
|
2058
|
-
return /* @__PURE__ */ r("div", { className: `nice-iot-dashboard ${
|
|
2068
|
+
return /* @__PURE__ */ r("div", { className: `nice-iot-dashboard ${b}`, children: [
|
|
2059
2069
|
/* @__PURE__ */ r("header", { className: "nice-iot-dashboard__header", children: [
|
|
2060
2070
|
/* @__PURE__ */ e("h1", { children: "IoT Dashboard" }),
|
|
2061
2071
|
/* @__PURE__ */ r("div", { className: "nice-iot-dashboard__stats", children: [
|
|
2062
2072
|
/* @__PURE__ */ r("span", { className: "nice-iot-dashboard__stat", children: [
|
|
2063
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__stat-icon", children: /* @__PURE__ */ e(
|
|
2073
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__stat-icon", children: /* @__PURE__ */ e(p, { name: "wifi", size: 14 }) }),
|
|
2064
2074
|
a.length,
|
|
2065
2075
|
" Devices"
|
|
2066
2076
|
] }),
|
|
@@ -2075,7 +2085,7 @@ function Be({
|
|
|
2075
2085
|
" Offline"
|
|
2076
2086
|
] }),
|
|
2077
2087
|
q.length > 0 && /* @__PURE__ */ r("span", { className: "nice-iot-dashboard__stat nice-iot-dashboard__stat--alarms", children: [
|
|
2078
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__stat-icon", children: /* @__PURE__ */ e(
|
|
2088
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__stat-icon", children: /* @__PURE__ */ e(p, { name: "bell", size: 14 }) }),
|
|
2079
2089
|
q.length,
|
|
2080
2090
|
" Alarms"
|
|
2081
2091
|
] })
|
|
@@ -2092,11 +2102,11 @@ function Be({
|
|
|
2092
2102
|
/* @__PURE__ */ e("button", { className: v === "devices" ? "active" : "", onClick: () => N("devices"), children: "Devices" }),
|
|
2093
2103
|
/* @__PURE__ */ r("button", { className: v === "alarms" ? "active" : "", onClick: () => N("alarms"), children: [
|
|
2094
2104
|
"Alarms ",
|
|
2095
|
-
|
|
2105
|
+
D.length > 0 && `(${D.length})`
|
|
2096
2106
|
] })
|
|
2097
2107
|
] }),
|
|
2098
2108
|
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__actions", children: v === "dashboard" && /* @__PURE__ */ r("button", { onClick: () => L(!H), children: [
|
|
2099
|
-
/* @__PURE__ */ e(
|
|
2109
|
+
/* @__PURE__ */ e(p, { name: H ? "check" : "edit", size: 14 }),
|
|
2100
2110
|
" ",
|
|
2101
2111
|
H ? "Done" : "Edit"
|
|
2102
2112
|
] }) })
|
|
@@ -2110,7 +2120,7 @@ function Be({
|
|
|
2110
2120
|
className: "nice-iot-dashboard__palette-item",
|
|
2111
2121
|
onClick: () => k(f.type),
|
|
2112
2122
|
children: [
|
|
2113
|
-
/* @__PURE__ */ e(
|
|
2123
|
+
/* @__PURE__ */ e(p, { name: f.icon, size: 16 }),
|
|
2114
2124
|
/* @__PURE__ */ e("span", { children: f.label })
|
|
2115
2125
|
]
|
|
2116
2126
|
},
|
|
@@ -2119,14 +2129,14 @@ function Be({
|
|
|
2119
2129
|
] }),
|
|
2120
2130
|
/* @__PURE__ */ r("div", { className: "nice-iot-dashboard__grid", children: [
|
|
2121
2131
|
m.map((f) => /* @__PURE__ */ e(
|
|
2122
|
-
|
|
2132
|
+
ze,
|
|
2123
2133
|
{
|
|
2124
2134
|
widget: f,
|
|
2125
2135
|
devices: a,
|
|
2126
2136
|
alarms: c,
|
|
2127
2137
|
isEditing: H,
|
|
2128
|
-
onCommand:
|
|
2129
|
-
onDelete: () =>
|
|
2138
|
+
onCommand: o,
|
|
2139
|
+
onDelete: () => y((x) => x.filter((S) => S.id !== f.id))
|
|
2130
2140
|
},
|
|
2131
2141
|
f.id
|
|
2132
2142
|
)),
|
|
@@ -2144,20 +2154,20 @@ function Be({
|
|
|
2144
2154
|
}
|
|
2145
2155
|
) }),
|
|
2146
2156
|
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__device-grid", children: T.map((f) => /* @__PURE__ */ e(
|
|
2147
|
-
|
|
2157
|
+
xe,
|
|
2148
2158
|
{
|
|
2149
2159
|
device: f,
|
|
2150
2160
|
isSelected: (w == null ? void 0 : w.id) === f.id,
|
|
2151
|
-
onSelect: () =>
|
|
2161
|
+
onSelect: () => U(f)
|
|
2152
2162
|
},
|
|
2153
2163
|
f.id
|
|
2154
2164
|
)) }),
|
|
2155
2165
|
w && /* @__PURE__ */ e(
|
|
2156
|
-
|
|
2166
|
+
Se,
|
|
2157
2167
|
{
|
|
2158
2168
|
device: w,
|
|
2159
|
-
onCommand:
|
|
2160
|
-
onClose: () =>
|
|
2169
|
+
onCommand: o,
|
|
2170
|
+
onClose: () => g(null)
|
|
2161
2171
|
}
|
|
2162
2172
|
)
|
|
2163
2173
|
] }),
|
|
@@ -2170,7 +2180,7 @@ function Be({
|
|
|
2170
2180
|
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
2171
2181
|
/* @__PURE__ */ e("th", { children: "Actions" })
|
|
2172
2182
|
] }) }),
|
|
2173
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
2183
|
+
/* @__PURE__ */ e("tbody", { children: D.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 6, className: "nice-iot-dashboard__no-alarms", children: "No active alarms" }) }) : D.map((f) => {
|
|
2174
2184
|
const x = a.find((S) => S.id === f.deviceId);
|
|
2175
2185
|
return /* @__PURE__ */ r(
|
|
2176
2186
|
"tr",
|
|
@@ -2188,7 +2198,7 @@ function Be({
|
|
|
2188
2198
|
/* @__PURE__ */ e("td", { children: f.message }),
|
|
2189
2199
|
/* @__PURE__ */ e("td", { children: f.timestamp.toLocaleString() }),
|
|
2190
2200
|
/* @__PURE__ */ e("td", { children: f.acknowledged ? "Acknowledged" : "Active" }),
|
|
2191
|
-
/* @__PURE__ */ e("td", { children: !f.acknowledged && /* @__PURE__ */ e("button", { onClick: () =>
|
|
2201
|
+
/* @__PURE__ */ e("td", { children: !f.acknowledged && /* @__PURE__ */ e("button", { onClick: () => E(f.id), children: "Acknowledge" }) })
|
|
2192
2202
|
]
|
|
2193
2203
|
},
|
|
2194
2204
|
f.id
|
|
@@ -2197,7 +2207,7 @@ function Be({
|
|
|
2197
2207
|
] }) })
|
|
2198
2208
|
] });
|
|
2199
2209
|
}
|
|
2200
|
-
function
|
|
2210
|
+
function He(a) {
|
|
2201
2211
|
return a.length === 0 ? 0 : Math.max(...a.map((i) => i.position.y + i.position.height));
|
|
2202
2212
|
}
|
|
2203
2213
|
function I(a) {
|
|
@@ -2216,13 +2226,13 @@ function I(a) {
|
|
|
2216
2226
|
return "var(--nice-text-secondary, #6c757d)";
|
|
2217
2227
|
}
|
|
2218
2228
|
}
|
|
2219
|
-
function
|
|
2229
|
+
function ze({
|
|
2220
2230
|
widget: a,
|
|
2221
2231
|
devices: i,
|
|
2222
2232
|
alarms: c,
|
|
2223
2233
|
isEditing: n,
|
|
2224
|
-
onCommand:
|
|
2225
|
-
onDelete:
|
|
2234
|
+
onCommand: t,
|
|
2235
|
+
onDelete: o
|
|
2226
2236
|
}) {
|
|
2227
2237
|
const d = F.find((l) => l.type === a.type);
|
|
2228
2238
|
return /* @__PURE__ */ r(
|
|
@@ -2235,16 +2245,16 @@ function He({
|
|
|
2235
2245
|
},
|
|
2236
2246
|
children: [
|
|
2237
2247
|
/* @__PURE__ */ r("div", { className: "nice-iot-dashboard__widget-header", children: [
|
|
2238
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__widget-icon", children: /* @__PURE__ */ e(
|
|
2248
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__widget-icon", children: /* @__PURE__ */ e(p, { name: (d == null ? void 0 : d.icon) ?? "box", size: 14 }) }),
|
|
2239
2249
|
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__widget-title", children: a.title }),
|
|
2240
|
-
n && /* @__PURE__ */ e("button", { className: "nice-iot-dashboard__widget-delete", onClick:
|
|
2250
|
+
n && /* @__PURE__ */ e("button", { className: "nice-iot-dashboard__widget-delete", onClick: o, children: "×" })
|
|
2241
2251
|
] }),
|
|
2242
|
-
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__widget-content", children: /* @__PURE__ */ e(
|
|
2252
|
+
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__widget-content", children: /* @__PURE__ */ e(ke, { widget: a, devices: i, alarms: c, onCommand: t }) })
|
|
2243
2253
|
]
|
|
2244
2254
|
}
|
|
2245
2255
|
);
|
|
2246
2256
|
}
|
|
2247
|
-
function
|
|
2257
|
+
function ke({
|
|
2248
2258
|
widget: a,
|
|
2249
2259
|
devices: i,
|
|
2250
2260
|
alarms: c,
|
|
@@ -2252,35 +2262,35 @@ function ze({
|
|
|
2252
2262
|
}) {
|
|
2253
2263
|
switch (a.type) {
|
|
2254
2264
|
case "device-list":
|
|
2255
|
-
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__device-list", children: i.slice(0, 10).map((
|
|
2265
|
+
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__device-list", children: i.slice(0, 10).map((t) => /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__device-list-item", children: [
|
|
2256
2266
|
/* @__PURE__ */ e(
|
|
2257
2267
|
"span",
|
|
2258
2268
|
{
|
|
2259
2269
|
className: "nice-iot-dashboard__device-status",
|
|
2260
|
-
style: { background: I(
|
|
2270
|
+
style: { background: I(t.status) }
|
|
2261
2271
|
}
|
|
2262
2272
|
),
|
|
2263
|
-
/* @__PURE__ */ e("span", { children:
|
|
2264
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__device-type", children:
|
|
2265
|
-
] },
|
|
2273
|
+
/* @__PURE__ */ e("span", { children: t.name }),
|
|
2274
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__device-type", children: t.type })
|
|
2275
|
+
] }, t.id)) });
|
|
2266
2276
|
case "device-status":
|
|
2267
|
-
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__status-grid", children: ["online", "offline", "warning", "error"].map((
|
|
2268
|
-
const
|
|
2277
|
+
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__status-grid", children: ["online", "offline", "warning", "error"].map((t) => {
|
|
2278
|
+
const o = i.filter((d) => d.status === t).length;
|
|
2269
2279
|
return /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__status-card", children: [
|
|
2270
2280
|
/* @__PURE__ */ e(
|
|
2271
2281
|
"span",
|
|
2272
2282
|
{
|
|
2273
2283
|
className: "nice-iot-dashboard__status-indicator",
|
|
2274
|
-
style: { background: I(
|
|
2284
|
+
style: { background: I(t) }
|
|
2275
2285
|
}
|
|
2276
2286
|
),
|
|
2277
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-count", children:
|
|
2278
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-label", children:
|
|
2279
|
-
] },
|
|
2287
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-count", children: o }),
|
|
2288
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-label", children: t })
|
|
2289
|
+
] }, t);
|
|
2280
2290
|
}) });
|
|
2281
2291
|
case "telemetry-chart":
|
|
2282
2292
|
return /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__chart-placeholder", children: [
|
|
2283
|
-
/* @__PURE__ */ e(
|
|
2293
|
+
/* @__PURE__ */ e(p, { name: "bar-chart", size: 32 }),
|
|
2284
2294
|
/* @__PURE__ */ e("span", { children: "Telemetry Chart" }),
|
|
2285
2295
|
/* @__PURE__ */ e("small", { children: "Configure device and capability" })
|
|
2286
2296
|
] });
|
|
@@ -2309,30 +2319,30 @@ function ze({
|
|
|
2309
2319
|
] }) });
|
|
2310
2320
|
case "map":
|
|
2311
2321
|
return /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__map-placeholder", children: [
|
|
2312
|
-
/* @__PURE__ */ e(
|
|
2322
|
+
/* @__PURE__ */ e(p, { name: "map-pin", size: 32 }),
|
|
2313
2323
|
/* @__PURE__ */ e("span", { children: "Device Map" }),
|
|
2314
2324
|
/* @__PURE__ */ r("small", { children: [
|
|
2315
|
-
i.filter((
|
|
2325
|
+
i.filter((t) => t.location).length,
|
|
2316
2326
|
" devices with location"
|
|
2317
2327
|
] })
|
|
2318
2328
|
] });
|
|
2319
2329
|
case "alarms": {
|
|
2320
|
-
const
|
|
2321
|
-
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__alarm-list", children:
|
|
2330
|
+
const t = c.filter((o) => !o.cleared).slice(0, 5);
|
|
2331
|
+
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__alarm-list", children: t.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__alarm-empty", children: "No active alarms" }) : t.map((o) => /* @__PURE__ */ r(
|
|
2322
2332
|
"div",
|
|
2323
2333
|
{
|
|
2324
|
-
className: `nice-iot-dashboard__alarm-item nice-iot-dashboard__alarm-item--${
|
|
2334
|
+
className: `nice-iot-dashboard__alarm-item nice-iot-dashboard__alarm-item--${o.severity}`,
|
|
2325
2335
|
children: [
|
|
2326
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-severity", children:
|
|
2327
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-message", children:
|
|
2336
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-severity", children: o.severity }),
|
|
2337
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-message", children: o.message })
|
|
2328
2338
|
]
|
|
2329
2339
|
},
|
|
2330
|
-
|
|
2340
|
+
o.id
|
|
2331
2341
|
)) });
|
|
2332
2342
|
}
|
|
2333
2343
|
case "control-panel":
|
|
2334
2344
|
return /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__control-placeholder", children: [
|
|
2335
|
-
/* @__PURE__ */ e(
|
|
2345
|
+
/* @__PURE__ */ e(p, { name: "settings", size: 32 }),
|
|
2336
2346
|
/* @__PURE__ */ e("span", { children: "Control Panel" }),
|
|
2337
2347
|
/* @__PURE__ */ e("small", { children: "Configure device controls" })
|
|
2338
2348
|
] });
|
|
@@ -2345,7 +2355,7 @@ function ze({
|
|
|
2345
2355
|
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__widget-placeholder", children: a.type });
|
|
2346
2356
|
}
|
|
2347
2357
|
}
|
|
2348
|
-
function
|
|
2358
|
+
function xe({ device: a, isSelected: i, onSelect: c }) {
|
|
2349
2359
|
return /* @__PURE__ */ r(
|
|
2350
2360
|
"div",
|
|
2351
2361
|
{
|
|
@@ -2389,7 +2399,7 @@ function ke({ device: a, isSelected: i, onSelect: c }) {
|
|
|
2389
2399
|
}
|
|
2390
2400
|
);
|
|
2391
2401
|
}
|
|
2392
|
-
function
|
|
2402
|
+
function Se({
|
|
2393
2403
|
device: a,
|
|
2394
2404
|
onCommand: i,
|
|
2395
2405
|
onClose: c
|
|
@@ -2462,7 +2472,7 @@ function xe({
|
|
|
2462
2472
|
] })
|
|
2463
2473
|
] });
|
|
2464
2474
|
}
|
|
2465
|
-
const
|
|
2475
|
+
const Le = [
|
|
2466
2476
|
{ name: "MQTT Broker", image: "eclipse-mosquitto:latest" },
|
|
2467
2477
|
{ name: "Node-RED", image: "nodered/node-red:latest" },
|
|
2468
2478
|
{ name: "InfluxDB", image: "influxdb:latest" },
|
|
@@ -2470,34 +2480,34 @@ const Se = [
|
|
|
2470
2480
|
{ name: "Telegraf", image: "telegraf:latest" },
|
|
2471
2481
|
{ name: "Protocol Adapter", image: "nice2dev/protocol-adapter:latest" }
|
|
2472
2482
|
];
|
|
2473
|
-
function
|
|
2483
|
+
function Oe({
|
|
2474
2484
|
nodes: a = [],
|
|
2475
2485
|
modules: i = [],
|
|
2476
2486
|
onNodeSelect: c,
|
|
2477
2487
|
onModuleDeploy: n,
|
|
2478
|
-
onModuleAction:
|
|
2479
|
-
onNodeSync:
|
|
2488
|
+
onModuleAction: t,
|
|
2489
|
+
onNodeSync: o,
|
|
2480
2490
|
className: d = ""
|
|
2481
2491
|
}) {
|
|
2482
|
-
const [l,
|
|
2492
|
+
const [l, b] = u(null), [m, _] = u("nodes"), [w, g] = u(!1), [v, N] = u({
|
|
2483
2493
|
name: "",
|
|
2484
2494
|
image: "",
|
|
2485
2495
|
status: "pending"
|
|
2486
2496
|
}), H = C(
|
|
2487
|
-
(
|
|
2488
|
-
|
|
2497
|
+
(y) => {
|
|
2498
|
+
b(y), c == null || c(y);
|
|
2489
2499
|
},
|
|
2490
2500
|
[c]
|
|
2491
2501
|
), L = C(async () => {
|
|
2492
|
-
!l || !v.name || !v.image || (await (n == null ? void 0 : n(l.id, v)),
|
|
2502
|
+
!l || !v.name || !v.image || (await (n == null ? void 0 : n(l.id, v)), g(!1), N({ name: "", image: "", status: "pending" }));
|
|
2493
2503
|
}, [l, v, n]), z = C(
|
|
2494
|
-
async (
|
|
2495
|
-
l && await (
|
|
2504
|
+
async (y, k) => {
|
|
2505
|
+
l && await (t == null ? void 0 : t(l.id, y, k));
|
|
2496
2506
|
},
|
|
2497
|
-
[l,
|
|
2507
|
+
[l, t]
|
|
2498
2508
|
), A = C(async () => {
|
|
2499
|
-
l && await (
|
|
2500
|
-
}, [l,
|
|
2509
|
+
l && await (o == null ? void 0 : o(l.id));
|
|
2510
|
+
}, [l, o]);
|
|
2501
2511
|
return /* @__PURE__ */ r("div", { className: `nice-edge-manager ${d}`, children: [
|
|
2502
2512
|
/* @__PURE__ */ r("header", { className: "nice-edge-manager__header", children: [
|
|
2503
2513
|
/* @__PURE__ */ e("h1", { children: "Edge Manager" }),
|
|
@@ -2512,14 +2522,14 @@ function Fe({
|
|
|
2512
2522
|
] }),
|
|
2513
2523
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__main", children: [
|
|
2514
2524
|
m === "nodes" && /* @__PURE__ */ e("div", { className: "nice-edge-manager__nodes", children: /* @__PURE__ */ r("div", { className: "nice-edge-manager__node-grid", children: [
|
|
2515
|
-
a.map((
|
|
2516
|
-
|
|
2525
|
+
a.map((y) => /* @__PURE__ */ e(
|
|
2526
|
+
Ve,
|
|
2517
2527
|
{
|
|
2518
|
-
node:
|
|
2519
|
-
isSelected: (l == null ? void 0 : l.id) ===
|
|
2520
|
-
onSelect: () => H(
|
|
2528
|
+
node: y,
|
|
2529
|
+
isSelected: (l == null ? void 0 : l.id) === y.id,
|
|
2530
|
+
onSelect: () => H(y)
|
|
2521
2531
|
},
|
|
2522
|
-
|
|
2532
|
+
y.id
|
|
2523
2533
|
)),
|
|
2524
2534
|
a.length === 0 && /* @__PURE__ */ e("div", { className: "nice-edge-manager__empty", children: "No edge nodes configured" })
|
|
2525
2535
|
] }) }),
|
|
@@ -2533,30 +2543,30 @@ function Fe({
|
|
|
2533
2543
|
"button",
|
|
2534
2544
|
{
|
|
2535
2545
|
className: "nice-edge-manager__deploy-btn",
|
|
2536
|
-
onClick: () =>
|
|
2546
|
+
onClick: () => g(!0),
|
|
2537
2547
|
children: "+ Deploy Module"
|
|
2538
2548
|
}
|
|
2539
2549
|
)
|
|
2540
2550
|
] }),
|
|
2541
2551
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__module-grid", children: [
|
|
2542
|
-
l.deployedModules.map((
|
|
2543
|
-
|
|
2552
|
+
l.deployedModules.map((y) => /* @__PURE__ */ e(
|
|
2553
|
+
Ae,
|
|
2544
2554
|
{
|
|
2545
|
-
module:
|
|
2546
|
-
onAction: (k) => z(
|
|
2555
|
+
module: y,
|
|
2556
|
+
onAction: (k) => z(y.id, k)
|
|
2547
2557
|
},
|
|
2548
|
-
|
|
2558
|
+
y.id
|
|
2549
2559
|
)),
|
|
2550
2560
|
l.deployedModules.length === 0 && /* @__PURE__ */ e("div", { className: "nice-edge-manager__empty", children: "No modules deployed on this node" })
|
|
2551
2561
|
] })
|
|
2552
2562
|
] }),
|
|
2553
2563
|
m === "modules" && !l && /* @__PURE__ */ e("div", { className: "nice-edge-manager__no-selection", children: "Select a node from the Nodes tab to manage modules" }),
|
|
2554
2564
|
l && /* @__PURE__ */ e(
|
|
2555
|
-
|
|
2565
|
+
Pe,
|
|
2556
2566
|
{
|
|
2557
2567
|
node: l,
|
|
2558
2568
|
onSync: A,
|
|
2559
|
-
onClose: () =>
|
|
2569
|
+
onClose: () => b(null)
|
|
2560
2570
|
}
|
|
2561
2571
|
)
|
|
2562
2572
|
] }),
|
|
@@ -2564,10 +2574,10 @@ function Fe({
|
|
|
2564
2574
|
De,
|
|
2565
2575
|
{
|
|
2566
2576
|
config: v,
|
|
2567
|
-
templates:
|
|
2577
|
+
templates: Le,
|
|
2568
2578
|
onChange: N,
|
|
2569
2579
|
onDeploy: L,
|
|
2570
|
-
onClose: () =>
|
|
2580
|
+
onClose: () => g(!1)
|
|
2571
2581
|
}
|
|
2572
2582
|
)
|
|
2573
2583
|
] });
|
|
@@ -2591,11 +2601,11 @@ function ne(a) {
|
|
|
2591
2601
|
function j(a) {
|
|
2592
2602
|
return a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : a < 1024 * 1024 * 1024 ? `${(a / 1024 / 1024).toFixed(1)} MB` : `${(a / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
2593
2603
|
}
|
|
2594
|
-
function
|
|
2604
|
+
function Te(a) {
|
|
2595
2605
|
const i = Math.floor(a / 86400), c = Math.floor(a % 86400 / 3600), n = Math.floor(a % 3600 / 60);
|
|
2596
2606
|
return i > 0 ? `${i}d ${c}h` : c > 0 ? `${c}h ${n}m` : `${n}m`;
|
|
2597
2607
|
}
|
|
2598
|
-
function
|
|
2608
|
+
function Ve({ node: a, isSelected: i, onSelect: c }) {
|
|
2599
2609
|
return /* @__PURE__ */ r(
|
|
2600
2610
|
"div",
|
|
2601
2611
|
{
|
|
@@ -2616,18 +2626,18 @@ function Te({ node: a, isSelected: i, onSelect: c }) {
|
|
|
2616
2626
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__node-body", children: [
|
|
2617
2627
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__node-info", children: [
|
|
2618
2628
|
/* @__PURE__ */ r("span", { children: [
|
|
2619
|
-
/* @__PURE__ */ e(
|
|
2629
|
+
/* @__PURE__ */ e(p, { name: "server", size: 12 }),
|
|
2620
2630
|
" ",
|
|
2621
2631
|
a.hardware.cpu
|
|
2622
2632
|
] }),
|
|
2623
2633
|
/* @__PURE__ */ r("span", { children: [
|
|
2624
|
-
/* @__PURE__ */ e(
|
|
2634
|
+
/* @__PURE__ */ e(p, { name: "database", size: 12 }),
|
|
2625
2635
|
" ",
|
|
2626
2636
|
(a.hardware.memoryMB / 1024).toFixed(1),
|
|
2627
2637
|
" GB"
|
|
2628
2638
|
] })
|
|
2629
2639
|
] }),
|
|
2630
|
-
/* @__PURE__ */ e("div", { className: "nice-edge-manager__node-metrics", children: a.metrics && /* @__PURE__ */ r(
|
|
2640
|
+
/* @__PURE__ */ e("div", { className: "nice-edge-manager__node-metrics", children: a.metrics && /* @__PURE__ */ r(P, { children: [
|
|
2631
2641
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__metric", children: [
|
|
2632
2642
|
/* @__PURE__ */ e("span", { className: "nice-edge-manager__metric-label", children: "CPU" }),
|
|
2633
2643
|
/* @__PURE__ */ e("div", { className: "nice-edge-manager__metric-bar", children: /* @__PURE__ */ e(
|
|
@@ -2666,7 +2676,7 @@ function Te({ node: a, isSelected: i, onSelect: c }) {
|
|
|
2666
2676
|
}
|
|
2667
2677
|
);
|
|
2668
2678
|
}
|
|
2669
|
-
function
|
|
2679
|
+
function Ae({ module: a, onAction: i }) {
|
|
2670
2680
|
return /* @__PURE__ */ r("div", { className: "nice-edge-manager__module-card", children: [
|
|
2671
2681
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__module-header", children: [
|
|
2672
2682
|
/* @__PURE__ */ e(
|
|
@@ -2708,7 +2718,7 @@ function Ve({ module: a, onAction: i }) {
|
|
|
2708
2718
|
] })
|
|
2709
2719
|
] }),
|
|
2710
2720
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__module-actions", children: [
|
|
2711
|
-
a.status === "running" && /* @__PURE__ */ r(
|
|
2721
|
+
a.status === "running" && /* @__PURE__ */ r(P, { children: [
|
|
2712
2722
|
/* @__PURE__ */ e("button", { onClick: () => i("stop"), children: "Stop" }),
|
|
2713
2723
|
/* @__PURE__ */ e("button", { onClick: () => i("restart"), children: "Restart" })
|
|
2714
2724
|
] }),
|
|
@@ -2717,16 +2727,16 @@ function Ve({ module: a, onAction: i }) {
|
|
|
2717
2727
|
] })
|
|
2718
2728
|
] });
|
|
2719
2729
|
}
|
|
2720
|
-
function
|
|
2730
|
+
function Pe({ node: a, onSync: i, onClose: c }) {
|
|
2721
2731
|
return /* @__PURE__ */ r("aside", { className: "nice-edge-manager__detail", children: [
|
|
2722
2732
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-header", children: [
|
|
2723
2733
|
/* @__PURE__ */ e("h3", { children: a.name }),
|
|
2724
2734
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-actions", children: [
|
|
2725
2735
|
/* @__PURE__ */ r("button", { onClick: i, children: [
|
|
2726
|
-
/* @__PURE__ */ e(
|
|
2736
|
+
/* @__PURE__ */ e(p, { name: "refresh", size: 14 }),
|
|
2727
2737
|
" Sync"
|
|
2728
2738
|
] }),
|
|
2729
|
-
/* @__PURE__ */ e("button", { onClick: c, "aria-label": "Close", children: /* @__PURE__ */ e(
|
|
2739
|
+
/* @__PURE__ */ e("button", { onClick: c, "aria-label": "Close", children: /* @__PURE__ */ e(p, { name: "close", size: 14 }) })
|
|
2730
2740
|
] })
|
|
2731
2741
|
] }),
|
|
2732
2742
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-content", children: [
|
|
@@ -2745,7 +2755,7 @@ function Ae({ node: a, onSync: i, onClose: c }) {
|
|
|
2745
2755
|
] }),
|
|
2746
2756
|
a.metrics && /* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-row", children: [
|
|
2747
2757
|
/* @__PURE__ */ e("span", { children: "Uptime:" }),
|
|
2748
|
-
/* @__PURE__ */ e("span", { children:
|
|
2758
|
+
/* @__PURE__ */ e("span", { children: Te(a.metrics.uptime) })
|
|
2749
2759
|
] })
|
|
2750
2760
|
] }),
|
|
2751
2761
|
/* @__PURE__ */ r("section", { children: [
|
|
@@ -2810,7 +2820,7 @@ function Ae({ node: a, onSync: i, onClose: c }) {
|
|
|
2810
2820
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-row", children: [
|
|
2811
2821
|
/* @__PURE__ */ e("span", { children: "Cloud:" }),
|
|
2812
2822
|
/* @__PURE__ */ r("span", { children: [
|
|
2813
|
-
/* @__PURE__ */ e(
|
|
2823
|
+
/* @__PURE__ */ e(p, { name: a.connectivity.cloudConnected ? "check" : "close", size: 12 }),
|
|
2814
2824
|
" ",
|
|
2815
2825
|
a.connectivity.cloudConnected ? "Connected" : "Disconnected"
|
|
2816
2826
|
] })
|
|
@@ -2893,12 +2903,12 @@ function De({
|
|
|
2893
2903
|
templates: i,
|
|
2894
2904
|
onChange: c,
|
|
2895
2905
|
onDeploy: n,
|
|
2896
|
-
onClose:
|
|
2906
|
+
onClose: t
|
|
2897
2907
|
}) {
|
|
2898
2908
|
return /* @__PURE__ */ e("div", { className: "nice-edge-manager__dialog-overlay", children: /* @__PURE__ */ r("div", { className: "nice-edge-manager__dialog", children: [
|
|
2899
2909
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__dialog-header", children: [
|
|
2900
2910
|
/* @__PURE__ */ e("h3", { children: "Deploy Module" }),
|
|
2901
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
2911
|
+
/* @__PURE__ */ e("button", { onClick: t, "aria-label": "Close", children: /* @__PURE__ */ e(p, { name: "close", size: 14 }) })
|
|
2902
2912
|
] }),
|
|
2903
2913
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__dialog-content", children: [
|
|
2904
2914
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__field", children: [
|
|
@@ -2907,8 +2917,8 @@ function De({
|
|
|
2907
2917
|
"select",
|
|
2908
2918
|
{
|
|
2909
2919
|
value: "",
|
|
2910
|
-
onChange: (
|
|
2911
|
-
const d = i.find((l) => l.image ===
|
|
2920
|
+
onChange: (o) => {
|
|
2921
|
+
const d = i.find((l) => l.image === o.target.value);
|
|
2912
2922
|
d && c({
|
|
2913
2923
|
...a,
|
|
2914
2924
|
name: d.name,
|
|
@@ -2917,7 +2927,7 @@ function De({
|
|
|
2917
2927
|
},
|
|
2918
2928
|
children: [
|
|
2919
2929
|
/* @__PURE__ */ e("option", { value: "", children: "Select a template..." }),
|
|
2920
|
-
i.map((
|
|
2930
|
+
i.map((o) => /* @__PURE__ */ e("option", { value: o.image, children: o.name }, o.image))
|
|
2921
2931
|
]
|
|
2922
2932
|
}
|
|
2923
2933
|
)
|
|
@@ -2929,7 +2939,7 @@ function De({
|
|
|
2929
2939
|
{
|
|
2930
2940
|
type: "text",
|
|
2931
2941
|
value: a.name || "",
|
|
2932
|
-
onChange: (
|
|
2942
|
+
onChange: (o) => c({ ...a, name: o.target.value }),
|
|
2933
2943
|
placeholder: "e.g., my-module"
|
|
2934
2944
|
}
|
|
2935
2945
|
)
|
|
@@ -2941,7 +2951,7 @@ function De({
|
|
|
2941
2951
|
{
|
|
2942
2952
|
type: "text",
|
|
2943
2953
|
value: a.image || "",
|
|
2944
|
-
onChange: (
|
|
2954
|
+
onChange: (o) => c({ ...a, image: o.target.value }),
|
|
2945
2955
|
placeholder: "e.g., nginx:latest"
|
|
2946
2956
|
}
|
|
2947
2957
|
)
|
|
@@ -2953,13 +2963,13 @@ function De({
|
|
|
2953
2963
|
{
|
|
2954
2964
|
type: "text",
|
|
2955
2965
|
value: a.version || "1.0.0",
|
|
2956
|
-
onChange: (
|
|
2966
|
+
onChange: (o) => c({ ...a, version: o.target.value })
|
|
2957
2967
|
}
|
|
2958
2968
|
)
|
|
2959
2969
|
] })
|
|
2960
2970
|
] }),
|
|
2961
2971
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__dialog-footer", children: [
|
|
2962
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
2972
|
+
/* @__PURE__ */ e("button", { onClick: t, children: "Cancel" }),
|
|
2963
2973
|
/* @__PURE__ */ e("button", { className: "nice-edge-manager__deploy-confirm", onClick: n, children: "Deploy" })
|
|
2964
2974
|
] })
|
|
2965
2975
|
] }) });
|
|
@@ -2991,71 +3001,71 @@ const Q = {
|
|
|
2991
3001
|
applicationName: "Nice2Dev IoT Client",
|
|
2992
3002
|
nodes: []
|
|
2993
3003
|
};
|
|
2994
|
-
function
|
|
3004
|
+
function qe({
|
|
2995
3005
|
protocol: a = "mqtt",
|
|
2996
3006
|
config: i,
|
|
2997
3007
|
onSave: c,
|
|
2998
3008
|
onTest: n,
|
|
2999
|
-
className:
|
|
3009
|
+
className: t = ""
|
|
3000
3010
|
}) {
|
|
3001
|
-
const { t } = R(), [d, l] =
|
|
3011
|
+
const { t: o } = R(), [d, l] = u(a), [b, m] = u(
|
|
3002
3012
|
(i == null ? void 0 : i.type) === "mqtt" ? { ...Q, ...i.config } : Q
|
|
3003
|
-
), [_, w] =
|
|
3013
|
+
), [_, w] = u(
|
|
3004
3014
|
(i == null ? void 0 : i.type) === "coap" ? { ...J, ...i.config } : J
|
|
3005
|
-
), [
|
|
3015
|
+
), [g, v] = u(
|
|
3006
3016
|
(i == null ? void 0 : i.type) === "modbus" ? { ...K, ...i.config } : K
|
|
3007
|
-
), [N, H] =
|
|
3017
|
+
), [N, H] = u(
|
|
3008
3018
|
(i == null ? void 0 : i.type) === "opcua" ? { ...X, ...i.config } : X
|
|
3009
|
-
), [L, z] =
|
|
3019
|
+
), [L, z] = u(null), [A, y] = u(!1), k = C(() => {
|
|
3010
3020
|
switch (d) {
|
|
3011
3021
|
case "mqtt":
|
|
3012
|
-
return
|
|
3022
|
+
return b;
|
|
3013
3023
|
case "coap":
|
|
3014
3024
|
return _;
|
|
3015
3025
|
case "modbus-tcp":
|
|
3016
3026
|
case "modbus-rtu":
|
|
3017
|
-
return
|
|
3027
|
+
return g;
|
|
3018
3028
|
case "opcua":
|
|
3019
3029
|
return N;
|
|
3020
3030
|
default:
|
|
3021
|
-
return
|
|
3031
|
+
return b;
|
|
3022
3032
|
}
|
|
3023
|
-
}, [d,
|
|
3033
|
+
}, [d, b, _, g, N]), U = C(() => {
|
|
3024
3034
|
c == null || c(k());
|
|
3025
|
-
}, [k, c]),
|
|
3035
|
+
}, [k, c]), E = C(async () => {
|
|
3026
3036
|
if (n) {
|
|
3027
|
-
|
|
3037
|
+
y(!0), z(null);
|
|
3028
3038
|
try {
|
|
3029
3039
|
const T = await n(k());
|
|
3030
3040
|
z(T);
|
|
3031
3041
|
} catch (T) {
|
|
3032
3042
|
z({ success: !1, message: String(T) });
|
|
3033
3043
|
} finally {
|
|
3034
|
-
|
|
3044
|
+
y(!1);
|
|
3035
3045
|
}
|
|
3036
3046
|
}
|
|
3037
3047
|
}, [k, n]);
|
|
3038
|
-
return /* @__PURE__ */ r("div", { className: `nice-protocol-config ${
|
|
3048
|
+
return /* @__PURE__ */ r("div", { className: `nice-protocol-config ${t}`, children: [
|
|
3039
3049
|
/* @__PURE__ */ r("header", { className: "nice-protocol-config__header", children: [
|
|
3040
|
-
/* @__PURE__ */ e("h2", { children:
|
|
3050
|
+
/* @__PURE__ */ e("h2", { children: o("protocolConfig.title", "Protocol Configuration") }),
|
|
3041
3051
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__protocol-selector", children: [
|
|
3042
|
-
/* @__PURE__ */ e("label", { children: "Protocol:" }),
|
|
3052
|
+
/* @__PURE__ */ e("label", { children: o("protocolConfig.protocol", "Protocol:") }),
|
|
3043
3053
|
/* @__PURE__ */ r("select", { value: d, onChange: (T) => l(T.target.value), children: [
|
|
3044
|
-
/* @__PURE__ */ e("option", { value: "mqtt", children:
|
|
3045
|
-
/* @__PURE__ */ e("option", { value: "coap", children:
|
|
3046
|
-
/* @__PURE__ */ e("option", { value: "modbus-tcp", children:
|
|
3047
|
-
/* @__PURE__ */ e("option", { value: "modbus-rtu", children:
|
|
3048
|
-
/* @__PURE__ */ e("option", { value: "opcua", children:
|
|
3054
|
+
/* @__PURE__ */ e("option", { value: "mqtt", children: o("protocolConfig.mqtt", "MQTT") }),
|
|
3055
|
+
/* @__PURE__ */ e("option", { value: "coap", children: o("protocolConfig.coap", "CoAP") }),
|
|
3056
|
+
/* @__PURE__ */ e("option", { value: "modbus-tcp", children: o("protocolConfig.modbusTcp", "Modbus TCP") }),
|
|
3057
|
+
/* @__PURE__ */ e("option", { value: "modbus-rtu", children: o("protocolConfig.modbusRtu", "Modbus RTU") }),
|
|
3058
|
+
/* @__PURE__ */ e("option", { value: "opcua", children: o("protocolConfig.opcUa", "OPC-UA") })
|
|
3049
3059
|
] })
|
|
3050
3060
|
] })
|
|
3051
3061
|
] }),
|
|
3052
3062
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__content", children: [
|
|
3053
|
-
d === "mqtt" && /* @__PURE__ */ e(
|
|
3054
|
-
d === "coap" && /* @__PURE__ */ e(
|
|
3063
|
+
d === "mqtt" && /* @__PURE__ */ e(Re, { config: b, onChange: m }),
|
|
3064
|
+
d === "coap" && /* @__PURE__ */ e(Ie, { config: _, onChange: w }),
|
|
3055
3065
|
(d === "modbus-tcp" || d === "modbus-rtu") && /* @__PURE__ */ e(
|
|
3056
|
-
|
|
3066
|
+
Ue,
|
|
3057
3067
|
{
|
|
3058
|
-
config:
|
|
3068
|
+
config: g,
|
|
3059
3069
|
type: d === "modbus-rtu" ? "rtu" : "tcp",
|
|
3060
3070
|
onChange: v
|
|
3061
3071
|
}
|
|
@@ -3067,7 +3077,7 @@ function Oe({
|
|
|
3067
3077
|
{
|
|
3068
3078
|
className: `nice-protocol-config__test-result nice-protocol-config__test-result--${L.success ? "success" : "error"}`,
|
|
3069
3079
|
children: [
|
|
3070
|
-
/* @__PURE__ */ e(
|
|
3080
|
+
/* @__PURE__ */ e(p, { name: L.success ? "check" : "close", size: 14 }),
|
|
3071
3081
|
" ",
|
|
3072
3082
|
L.message
|
|
3073
3083
|
]
|
|
@@ -3078,22 +3088,24 @@ function Oe({
|
|
|
3078
3088
|
"button",
|
|
3079
3089
|
{
|
|
3080
3090
|
className: "nice-protocol-config__test-btn",
|
|
3081
|
-
onClick:
|
|
3091
|
+
onClick: E,
|
|
3082
3092
|
disabled: A || !n,
|
|
3083
|
-
children: A ? "Testing..." : /* @__PURE__ */ r(
|
|
3084
|
-
/* @__PURE__ */ e(
|
|
3085
|
-
"
|
|
3093
|
+
children: A ? o("protocolConfig.testing", "Testing...") : /* @__PURE__ */ r(P, { children: [
|
|
3094
|
+
/* @__PURE__ */ e(p, { name: "plug", size: 14 }),
|
|
3095
|
+
" ",
|
|
3096
|
+
o("protocolConfig.testConnection", "Test Connection")
|
|
3086
3097
|
] })
|
|
3087
3098
|
}
|
|
3088
3099
|
),
|
|
3089
|
-
/* @__PURE__ */ r("button", { className: "nice-protocol-config__save-btn", onClick:
|
|
3090
|
-
/* @__PURE__ */ e(
|
|
3091
|
-
"
|
|
3100
|
+
/* @__PURE__ */ r("button", { className: "nice-protocol-config__save-btn", onClick: U, children: [
|
|
3101
|
+
/* @__PURE__ */ e(p, { name: "save", size: 14 }),
|
|
3102
|
+
" ",
|
|
3103
|
+
o("save", "Save")
|
|
3092
3104
|
] })
|
|
3093
3105
|
] })
|
|
3094
3106
|
] });
|
|
3095
3107
|
}
|
|
3096
|
-
function
|
|
3108
|
+
function Re({ config: a, onChange: i }) {
|
|
3097
3109
|
const { t: c } = R();
|
|
3098
3110
|
return /* @__PURE__ */ r("div", { className: "nice-protocol-config__section", children: [
|
|
3099
3111
|
/* @__PURE__ */ e("h3", { children: c("protocolConfig.mqttConfiguration", "MQTT Configuration") }),
|
|
@@ -3166,7 +3178,7 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3166
3178
|
)
|
|
3167
3179
|
] }),
|
|
3168
3180
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3169
|
-
/* @__PURE__ */ e("label", { children: "Keep Alive (seconds)" }),
|
|
3181
|
+
/* @__PURE__ */ e("label", { children: c("protocolConfig.keepAlive", "Keep Alive (seconds)") }),
|
|
3170
3182
|
/* @__PURE__ */ e(
|
|
3171
3183
|
"input",
|
|
3172
3184
|
{
|
|
@@ -3190,15 +3202,15 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3190
3202
|
] }),
|
|
3191
3203
|
/* @__PURE__ */ e("h4", { children: c("protocolConfig.topics", "Topics") }),
|
|
3192
3204
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__topics", children: [
|
|
3193
|
-
a.topics.map((n,
|
|
3205
|
+
a.topics.map((n, t) => /* @__PURE__ */ r("div", { className: "nice-protocol-config__topic-row", children: [
|
|
3194
3206
|
/* @__PURE__ */ e(
|
|
3195
3207
|
"input",
|
|
3196
3208
|
{
|
|
3197
3209
|
type: "text",
|
|
3198
3210
|
value: n.pattern,
|
|
3199
|
-
onChange: (
|
|
3211
|
+
onChange: (o) => {
|
|
3200
3212
|
const d = [...a.topics];
|
|
3201
|
-
d[
|
|
3213
|
+
d[t] = { ...d[t], pattern: o.target.value }, i({ ...a, topics: d });
|
|
3202
3214
|
},
|
|
3203
3215
|
placeholder: c("protocolConfig.topicPatternPlaceholder", "e.g., sensors/+/data")
|
|
3204
3216
|
}
|
|
@@ -3207,9 +3219,9 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3207
3219
|
"select",
|
|
3208
3220
|
{
|
|
3209
3221
|
value: n.qos,
|
|
3210
|
-
onChange: (
|
|
3222
|
+
onChange: (o) => {
|
|
3211
3223
|
const d = [...a.topics];
|
|
3212
|
-
d[
|
|
3224
|
+
d[t] = { ...d[t], qos: parseInt(o.target.value, 10) }, i({ ...a, topics: d });
|
|
3213
3225
|
},
|
|
3214
3226
|
children: [
|
|
3215
3227
|
/* @__PURE__ */ e("option", { value: 0, children: c("protocolConfig.qos0", "QoS 0") }),
|
|
@@ -3222,11 +3234,11 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3222
3234
|
"select",
|
|
3223
3235
|
{
|
|
3224
3236
|
value: n.direction,
|
|
3225
|
-
onChange: (
|
|
3237
|
+
onChange: (o) => {
|
|
3226
3238
|
const d = [...a.topics];
|
|
3227
|
-
d[
|
|
3228
|
-
...d[
|
|
3229
|
-
direction:
|
|
3239
|
+
d[t] = {
|
|
3240
|
+
...d[t],
|
|
3241
|
+
direction: o.target.value
|
|
3230
3242
|
}, i({ ...a, topics: d });
|
|
3231
3243
|
},
|
|
3232
3244
|
children: [
|
|
@@ -3240,14 +3252,14 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3240
3252
|
"button",
|
|
3241
3253
|
{
|
|
3242
3254
|
onClick: () => {
|
|
3243
|
-
const
|
|
3244
|
-
i({ ...a, topics:
|
|
3255
|
+
const o = a.topics.filter((d, l) => l !== t);
|
|
3256
|
+
i({ ...a, topics: o });
|
|
3245
3257
|
},
|
|
3246
3258
|
children: "×"
|
|
3247
3259
|
}
|
|
3248
3260
|
)
|
|
3249
|
-
] },
|
|
3250
|
-
/* @__PURE__ */
|
|
3261
|
+
] }, t)),
|
|
3262
|
+
/* @__PURE__ */ r(
|
|
3251
3263
|
"button",
|
|
3252
3264
|
{
|
|
3253
3265
|
onClick: () => {
|
|
@@ -3259,13 +3271,17 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3259
3271
|
]
|
|
3260
3272
|
});
|
|
3261
3273
|
},
|
|
3262
|
-
children:
|
|
3274
|
+
children: [
|
|
3275
|
+
/* @__PURE__ */ e(p, { name: "plus", size: 14 }),
|
|
3276
|
+
" ",
|
|
3277
|
+
c("protocolConfig.addTopic", "Add Topic")
|
|
3278
|
+
]
|
|
3263
3279
|
}
|
|
3264
3280
|
)
|
|
3265
3281
|
] })
|
|
3266
3282
|
] });
|
|
3267
3283
|
}
|
|
3268
|
-
function
|
|
3284
|
+
function Ie({ config: a, onChange: i }) {
|
|
3269
3285
|
const { t: c } = R();
|
|
3270
3286
|
return /* @__PURE__ */ r("div", { className: "nice-protocol-config__section", children: [
|
|
3271
3287
|
/* @__PURE__ */ e("h3", { children: c("protocolConfig.coapConfiguration", "CoAP Configuration") }),
|
|
@@ -3317,15 +3333,15 @@ function Re({ config: a, onChange: i }) {
|
|
|
3317
3333
|
] }),
|
|
3318
3334
|
/* @__PURE__ */ e("h4", { children: c("protocolConfig.resources", "Resources") }),
|
|
3319
3335
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__resources", children: [
|
|
3320
|
-
a.resources.map((n,
|
|
3336
|
+
a.resources.map((n, t) => /* @__PURE__ */ r("div", { className: "nice-protocol-config__resource-row", children: [
|
|
3321
3337
|
/* @__PURE__ */ e(
|
|
3322
3338
|
"input",
|
|
3323
3339
|
{
|
|
3324
3340
|
type: "text",
|
|
3325
3341
|
value: n.path,
|
|
3326
|
-
onChange: (
|
|
3342
|
+
onChange: (o) => {
|
|
3327
3343
|
const d = [...a.resources];
|
|
3328
|
-
d[
|
|
3344
|
+
d[t] = { ...d[t], path: o.target.value }, i({ ...a, resources: d });
|
|
3329
3345
|
},
|
|
3330
3346
|
placeholder: "/sensors/temperature"
|
|
3331
3347
|
}
|
|
@@ -3334,14 +3350,14 @@ function Re({ config: a, onChange: i }) {
|
|
|
3334
3350
|
"button",
|
|
3335
3351
|
{
|
|
3336
3352
|
onClick: () => {
|
|
3337
|
-
const
|
|
3338
|
-
i({ ...a, resources:
|
|
3353
|
+
const o = a.resources.filter((d, l) => l !== t);
|
|
3354
|
+
i({ ...a, resources: o });
|
|
3339
3355
|
},
|
|
3340
3356
|
children: "×"
|
|
3341
3357
|
}
|
|
3342
3358
|
)
|
|
3343
|
-
] },
|
|
3344
|
-
/* @__PURE__ */
|
|
3359
|
+
] }, t)),
|
|
3360
|
+
/* @__PURE__ */ r(
|
|
3345
3361
|
"button",
|
|
3346
3362
|
{
|
|
3347
3363
|
onClick: () => {
|
|
@@ -3353,13 +3369,17 @@ function Re({ config: a, onChange: i }) {
|
|
|
3353
3369
|
]
|
|
3354
3370
|
});
|
|
3355
3371
|
},
|
|
3356
|
-
children:
|
|
3372
|
+
children: [
|
|
3373
|
+
/* @__PURE__ */ e(p, { name: "plus", size: 14 }),
|
|
3374
|
+
" ",
|
|
3375
|
+
c("protocolConfig.addResource", "Add Resource")
|
|
3376
|
+
]
|
|
3357
3377
|
}
|
|
3358
3378
|
)
|
|
3359
3379
|
] })
|
|
3360
3380
|
] });
|
|
3361
3381
|
}
|
|
3362
|
-
function
|
|
3382
|
+
function Ue({
|
|
3363
3383
|
config: a,
|
|
3364
3384
|
type: i,
|
|
3365
3385
|
onChange: c
|
|
@@ -3372,7 +3392,7 @@ function Ie({
|
|
|
3372
3392
|
" Configuration"
|
|
3373
3393
|
] }),
|
|
3374
3394
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__grid", children: [
|
|
3375
|
-
i === "tcp" && /* @__PURE__ */ r(
|
|
3395
|
+
i === "tcp" && /* @__PURE__ */ r(P, { children: [
|
|
3376
3396
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3377
3397
|
/* @__PURE__ */ e("label", { children: n("protocolConfig.host", "Host") }),
|
|
3378
3398
|
/* @__PURE__ */ e(
|
|
@@ -3380,7 +3400,7 @@ function Ie({
|
|
|
3380
3400
|
{
|
|
3381
3401
|
type: "text",
|
|
3382
3402
|
value: a.host || "",
|
|
3383
|
-
onChange: (
|
|
3403
|
+
onChange: (t) => c({ ...a, host: t.target.value })
|
|
3384
3404
|
}
|
|
3385
3405
|
)
|
|
3386
3406
|
] }),
|
|
@@ -3391,12 +3411,12 @@ function Ie({
|
|
|
3391
3411
|
{
|
|
3392
3412
|
type: "number",
|
|
3393
3413
|
value: a.port || 502,
|
|
3394
|
-
onChange: (
|
|
3414
|
+
onChange: (t) => c({ ...a, port: parseInt(t.target.value, 10) || 502 })
|
|
3395
3415
|
}
|
|
3396
3416
|
)
|
|
3397
3417
|
] })
|
|
3398
3418
|
] }),
|
|
3399
|
-
i === "rtu" && /* @__PURE__ */ r(
|
|
3419
|
+
i === "rtu" && /* @__PURE__ */ r(P, { children: [
|
|
3400
3420
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3401
3421
|
/* @__PURE__ */ e("label", { children: n("protocolConfig.serialPort", "Serial Port") }),
|
|
3402
3422
|
/* @__PURE__ */ e(
|
|
@@ -3404,7 +3424,7 @@ function Ie({
|
|
|
3404
3424
|
{
|
|
3405
3425
|
type: "text",
|
|
3406
3426
|
value: a.serialPort || "",
|
|
3407
|
-
onChange: (
|
|
3427
|
+
onChange: (t) => c({ ...a, serialPort: t.target.value }),
|
|
3408
3428
|
placeholder: n("protocolConfig.serialPortPlaceholder", "COM1 or /dev/ttyUSB0")
|
|
3409
3429
|
}
|
|
3410
3430
|
)
|
|
@@ -3415,7 +3435,7 @@ function Ie({
|
|
|
3415
3435
|
"select",
|
|
3416
3436
|
{
|
|
3417
3437
|
value: a.baudRate || 9600,
|
|
3418
|
-
onChange: (
|
|
3438
|
+
onChange: (t) => c({ ...a, baudRate: parseInt(t.target.value, 10) }),
|
|
3419
3439
|
children: [
|
|
3420
3440
|
/* @__PURE__ */ e("option", { value: 9600, children: "9600" }),
|
|
3421
3441
|
/* @__PURE__ */ e("option", { value: 19200, children: "19200" }),
|
|
@@ -3432,11 +3452,11 @@ function Ie({
|
|
|
3432
3452
|
"select",
|
|
3433
3453
|
{
|
|
3434
3454
|
value: a.parity || "none",
|
|
3435
|
-
onChange: (
|
|
3455
|
+
onChange: (t) => c({ ...a, parity: t.target.value }),
|
|
3436
3456
|
children: [
|
|
3437
3457
|
/* @__PURE__ */ e("option", { value: "none", children: n("protocolConfig.none", "None") }),
|
|
3438
3458
|
/* @__PURE__ */ e("option", { value: "even", children: n("protocolConfig.even", "Even") }),
|
|
3439
|
-
/* @__PURE__ */ e("option", { value: "odd", children: "Odd" })
|
|
3459
|
+
/* @__PURE__ */ e("option", { value: "odd", children: n("protocolConfig.odd", "Odd") })
|
|
3440
3460
|
]
|
|
3441
3461
|
}
|
|
3442
3462
|
)
|
|
@@ -3449,20 +3469,20 @@ function Ie({
|
|
|
3449
3469
|
{
|
|
3450
3470
|
type: "number",
|
|
3451
3471
|
value: a.slaveId,
|
|
3452
|
-
onChange: (
|
|
3472
|
+
onChange: (t) => c({ ...a, slaveId: parseInt(t.target.value, 10) || 1 }),
|
|
3453
3473
|
min: 1,
|
|
3454
3474
|
max: 247
|
|
3455
3475
|
}
|
|
3456
3476
|
)
|
|
3457
3477
|
] }),
|
|
3458
3478
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3459
|
-
/* @__PURE__ */ e("label", { children: "Timeout (ms)" }),
|
|
3479
|
+
/* @__PURE__ */ e("label", { children: n("protocolConfig.timeoutMs", "Timeout (ms)") }),
|
|
3460
3480
|
/* @__PURE__ */ e(
|
|
3461
3481
|
"input",
|
|
3462
3482
|
{
|
|
3463
3483
|
type: "number",
|
|
3464
3484
|
value: a.timeout,
|
|
3465
|
-
onChange: (
|
|
3485
|
+
onChange: (t) => c({ ...a, timeout: parseInt(t.target.value, 10) || 1e3 })
|
|
3466
3486
|
}
|
|
3467
3487
|
)
|
|
3468
3488
|
] })
|
|
@@ -3474,18 +3494,18 @@ function Ie({
|
|
|
3474
3494
|
/* @__PURE__ */ e("th", { children: n("protocolConfig.address", "Address") }),
|
|
3475
3495
|
/* @__PURE__ */ e("th", { children: n("protocolConfig.type", "Type") }),
|
|
3476
3496
|
/* @__PURE__ */ e("th", { children: n("protocolConfig.dataType", "Data Type") }),
|
|
3477
|
-
/* @__PURE__ */ e("th", { children: "R/W" }),
|
|
3497
|
+
/* @__PURE__ */ e("th", { children: n("protocolConfig.readWrite", "R/W") }),
|
|
3478
3498
|
/* @__PURE__ */ e("th", {})
|
|
3479
3499
|
] }) }),
|
|
3480
|
-
/* @__PURE__ */ e("tbody", { children: a.registers.map((
|
|
3500
|
+
/* @__PURE__ */ e("tbody", { children: a.registers.map((t, o) => /* @__PURE__ */ r("tr", { children: [
|
|
3481
3501
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
3482
3502
|
"input",
|
|
3483
3503
|
{
|
|
3484
3504
|
type: "text",
|
|
3485
|
-
value:
|
|
3505
|
+
value: t.name,
|
|
3486
3506
|
onChange: (d) => {
|
|
3487
3507
|
const l = [...a.registers];
|
|
3488
|
-
l[
|
|
3508
|
+
l[o] = { ...l[o], name: d.target.value }, c({ ...a, registers: l });
|
|
3489
3509
|
}
|
|
3490
3510
|
}
|
|
3491
3511
|
) }),
|
|
@@ -3493,11 +3513,11 @@ function Ie({
|
|
|
3493
3513
|
"input",
|
|
3494
3514
|
{
|
|
3495
3515
|
type: "number",
|
|
3496
|
-
value:
|
|
3516
|
+
value: t.address,
|
|
3497
3517
|
onChange: (d) => {
|
|
3498
3518
|
const l = [...a.registers];
|
|
3499
|
-
l[
|
|
3500
|
-
...l[
|
|
3519
|
+
l[o] = {
|
|
3520
|
+
...l[o],
|
|
3501
3521
|
address: parseInt(d.target.value, 10) || 0
|
|
3502
3522
|
}, c({ ...a, registers: l });
|
|
3503
3523
|
}
|
|
@@ -3506,11 +3526,11 @@ function Ie({
|
|
|
3506
3526
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ r(
|
|
3507
3527
|
"select",
|
|
3508
3528
|
{
|
|
3509
|
-
value:
|
|
3529
|
+
value: t.type,
|
|
3510
3530
|
onChange: (d) => {
|
|
3511
3531
|
const l = [...a.registers];
|
|
3512
|
-
l[
|
|
3513
|
-
...l[
|
|
3532
|
+
l[o] = {
|
|
3533
|
+
...l[o],
|
|
3514
3534
|
type: d.target.value
|
|
3515
3535
|
}, c({ ...a, registers: l });
|
|
3516
3536
|
},
|
|
@@ -3525,11 +3545,11 @@ function Ie({
|
|
|
3525
3545
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ r(
|
|
3526
3546
|
"select",
|
|
3527
3547
|
{
|
|
3528
|
-
value:
|
|
3548
|
+
value: t.dataType,
|
|
3529
3549
|
onChange: (d) => {
|
|
3530
3550
|
const l = [...a.registers];
|
|
3531
|
-
l[
|
|
3532
|
-
...l[
|
|
3551
|
+
l[o] = {
|
|
3552
|
+
...l[o],
|
|
3533
3553
|
dataType: d.target.value
|
|
3534
3554
|
}, c({ ...a, registers: l });
|
|
3535
3555
|
},
|
|
@@ -3548,10 +3568,10 @@ function Ie({
|
|
|
3548
3568
|
"input",
|
|
3549
3569
|
{
|
|
3550
3570
|
type: "checkbox",
|
|
3551
|
-
checked:
|
|
3571
|
+
checked: t.readable,
|
|
3552
3572
|
onChange: (d) => {
|
|
3553
3573
|
const l = [...a.registers];
|
|
3554
|
-
l[
|
|
3574
|
+
l[o] = { ...l[o], readable: d.target.checked }, c({ ...a, registers: l });
|
|
3555
3575
|
},
|
|
3556
3576
|
title: n("protocolConfig.readable", "Readable")
|
|
3557
3577
|
}
|
|
@@ -3560,10 +3580,10 @@ function Ie({
|
|
|
3560
3580
|
"input",
|
|
3561
3581
|
{
|
|
3562
3582
|
type: "checkbox",
|
|
3563
|
-
checked:
|
|
3583
|
+
checked: t.writable,
|
|
3564
3584
|
onChange: (d) => {
|
|
3565
3585
|
const l = [...a.registers];
|
|
3566
|
-
l[
|
|
3586
|
+
l[o] = { ...l[o], writable: d.target.checked }, c({ ...a, registers: l });
|
|
3567
3587
|
},
|
|
3568
3588
|
title: n("protocolConfig.writable", "Writable")
|
|
3569
3589
|
}
|
|
@@ -3573,15 +3593,15 @@ function Ie({
|
|
|
3573
3593
|
"button",
|
|
3574
3594
|
{
|
|
3575
3595
|
onClick: () => {
|
|
3576
|
-
const d = a.registers.filter((l,
|
|
3596
|
+
const d = a.registers.filter((l, b) => b !== o);
|
|
3577
3597
|
c({ ...a, registers: d });
|
|
3578
3598
|
},
|
|
3579
3599
|
children: "×"
|
|
3580
3600
|
}
|
|
3581
3601
|
) })
|
|
3582
|
-
] },
|
|
3602
|
+
] }, o)) })
|
|
3583
3603
|
] }),
|
|
3584
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ r(
|
|
3585
3605
|
"button",
|
|
3586
3606
|
{
|
|
3587
3607
|
onClick: () => {
|
|
@@ -3600,7 +3620,11 @@ function Ie({
|
|
|
3600
3620
|
]
|
|
3601
3621
|
});
|
|
3602
3622
|
},
|
|
3603
|
-
children:
|
|
3623
|
+
children: [
|
|
3624
|
+
/* @__PURE__ */ e(p, { name: "plus", size: 14 }),
|
|
3625
|
+
" ",
|
|
3626
|
+
n("protocolConfig.addRegister", "Add Register")
|
|
3627
|
+
]
|
|
3604
3628
|
}
|
|
3605
3629
|
)
|
|
3606
3630
|
] });
|
|
@@ -3652,13 +3676,13 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3652
3676
|
}),
|
|
3653
3677
|
children: [
|
|
3654
3678
|
/* @__PURE__ */ e("option", { value: "anonymous", children: c("protocolConfig.anonymous", "Anonymous") }),
|
|
3655
|
-
/* @__PURE__ */ e("option", { value: "username", children: "Username/Password" }),
|
|
3679
|
+
/* @__PURE__ */ e("option", { value: "username", children: c("protocolConfig.usernamePassword", "Username/Password") }),
|
|
3656
3680
|
/* @__PURE__ */ e("option", { value: "certificate", children: c("protocolConfig.certificate", "Certificate") })
|
|
3657
3681
|
]
|
|
3658
3682
|
}
|
|
3659
3683
|
)
|
|
3660
3684
|
] }),
|
|
3661
|
-
a.authentication === "username" && /* @__PURE__ */ r(
|
|
3685
|
+
a.authentication === "username" && /* @__PURE__ */ r(P, { children: [
|
|
3662
3686
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3663
3687
|
/* @__PURE__ */ e("label", { children: c("protocolConfig.username", "Username") }),
|
|
3664
3688
|
/* @__PURE__ */ e(
|
|
@@ -3696,15 +3720,15 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3696
3720
|
] }),
|
|
3697
3721
|
/* @__PURE__ */ e("h4", { children: c("protocolConfig.nodes", "Nodes") }),
|
|
3698
3722
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__nodes", children: [
|
|
3699
|
-
a.nodes.map((n,
|
|
3723
|
+
a.nodes.map((n, t) => /* @__PURE__ */ r("div", { className: "nice-protocol-config__node-row", children: [
|
|
3700
3724
|
/* @__PURE__ */ e(
|
|
3701
3725
|
"input",
|
|
3702
3726
|
{
|
|
3703
3727
|
type: "text",
|
|
3704
3728
|
value: n.nodeId,
|
|
3705
|
-
onChange: (
|
|
3729
|
+
onChange: (o) => {
|
|
3706
3730
|
const d = [...a.nodes];
|
|
3707
|
-
d[
|
|
3731
|
+
d[t] = { ...d[t], nodeId: o.target.value }, i({ ...a, nodes: d });
|
|
3708
3732
|
},
|
|
3709
3733
|
placeholder: c("protocolConfig.nodeIdPlaceholder", "ns=2;s=Temperature")
|
|
3710
3734
|
}
|
|
@@ -3714,9 +3738,9 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3714
3738
|
{
|
|
3715
3739
|
type: "text",
|
|
3716
3740
|
value: n.displayName,
|
|
3717
|
-
onChange: (
|
|
3741
|
+
onChange: (o) => {
|
|
3718
3742
|
const d = [...a.nodes];
|
|
3719
|
-
d[
|
|
3743
|
+
d[t] = { ...d[t], displayName: o.target.value }, i({ ...a, nodes: d });
|
|
3720
3744
|
},
|
|
3721
3745
|
placeholder: c("protocolConfig.displayNamePlaceholder", "Display Name")
|
|
3722
3746
|
}
|
|
@@ -3725,14 +3749,14 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3725
3749
|
"button",
|
|
3726
3750
|
{
|
|
3727
3751
|
onClick: () => {
|
|
3728
|
-
const
|
|
3729
|
-
i({ ...a, nodes:
|
|
3752
|
+
const o = a.nodes.filter((d, l) => l !== t);
|
|
3753
|
+
i({ ...a, nodes: o });
|
|
3730
3754
|
},
|
|
3731
3755
|
children: "×"
|
|
3732
3756
|
}
|
|
3733
3757
|
)
|
|
3734
|
-
] },
|
|
3735
|
-
/* @__PURE__ */
|
|
3758
|
+
] }, t)),
|
|
3759
|
+
/* @__PURE__ */ r(
|
|
3736
3760
|
"button",
|
|
3737
3761
|
{
|
|
3738
3762
|
onClick: () => {
|
|
@@ -3744,14 +3768,18 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3744
3768
|
]
|
|
3745
3769
|
});
|
|
3746
3770
|
},
|
|
3747
|
-
children:
|
|
3771
|
+
children: [
|
|
3772
|
+
/* @__PURE__ */ e(p, { name: "plus", size: 14 }),
|
|
3773
|
+
" ",
|
|
3774
|
+
c("protocolConfig.addNode", "Add Node")
|
|
3775
|
+
]
|
|
3748
3776
|
}
|
|
3749
3777
|
)
|
|
3750
3778
|
] })
|
|
3751
3779
|
] });
|
|
3752
3780
|
}
|
|
3753
3781
|
export {
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3782
|
+
Oe as NiceEdgeManager,
|
|
3783
|
+
Fe as NiceIoTDashboard,
|
|
3784
|
+
qe as NiceProtocolConfig
|
|
3757
3785
|
};
|