@nice2dev/ui-iot 1.1.10 → 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 +287 -251
- package/dist/ui-iot.css +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
2
|
-
import { useContext as B, createContext as M, memo as oe, useState as
|
|
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
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);
|
|
@@ -237,8 +237,8 @@ function ye({
|
|
|
237
237
|
size: i,
|
|
238
238
|
className: c,
|
|
239
239
|
style: n,
|
|
240
|
-
color:
|
|
241
|
-
title:
|
|
240
|
+
color: t,
|
|
241
|
+
title: o,
|
|
242
242
|
onClick: d
|
|
243
243
|
}) {
|
|
244
244
|
return /* @__PURE__ */ r(
|
|
@@ -249,30 +249,30 @@ function ye({
|
|
|
249
249
|
height: i,
|
|
250
250
|
viewBox: "0 0 24 24",
|
|
251
251
|
fill: "none",
|
|
252
|
-
stroke:
|
|
252
|
+
stroke: t || "currentColor",
|
|
253
253
|
strokeWidth: 2,
|
|
254
254
|
strokeLinecap: "round",
|
|
255
255
|
strokeLinejoin: "round",
|
|
256
256
|
className: `nice-icon ${c || ""}`,
|
|
257
257
|
style: n,
|
|
258
|
-
role:
|
|
259
|
-
"aria-label":
|
|
260
|
-
"aria-hidden": !
|
|
258
|
+
role: o ? "img" : "presentation",
|
|
259
|
+
"aria-label": o,
|
|
260
|
+
"aria-hidden": !o,
|
|
261
261
|
onClick: d,
|
|
262
262
|
children: [
|
|
263
|
-
|
|
263
|
+
o && /* @__PURE__ */ e("title", { children: o }),
|
|
264
264
|
/* @__PURE__ */ e("path", { d: a })
|
|
265
265
|
]
|
|
266
266
|
}
|
|
267
267
|
);
|
|
268
268
|
}
|
|
269
|
-
const
|
|
269
|
+
const p = ({
|
|
270
270
|
name: a,
|
|
271
271
|
size: i = "md",
|
|
272
272
|
className: c,
|
|
273
273
|
style: n,
|
|
274
|
-
color:
|
|
275
|
-
title:
|
|
274
|
+
color: t,
|
|
275
|
+
title: o,
|
|
276
276
|
onClick: d
|
|
277
277
|
}) => {
|
|
278
278
|
const { resolver: l } = B(pe), b = typeof i == "number" ? i : he[i];
|
|
@@ -289,8 +289,8 @@ const u = ({
|
|
|
289
289
|
size: b,
|
|
290
290
|
className: c,
|
|
291
291
|
style: n,
|
|
292
|
-
color:
|
|
293
|
-
title:
|
|
292
|
+
color: t,
|
|
293
|
+
title: o,
|
|
294
294
|
onClick: d
|
|
295
295
|
}
|
|
296
296
|
) : null;
|
|
@@ -306,6 +306,20 @@ M({
|
|
|
306
306
|
getAccessMode: () => "full"
|
|
307
307
|
});
|
|
308
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
|
+
}
|
|
309
323
|
M(null);
|
|
310
324
|
const Y = {
|
|
311
325
|
space1: "4px",
|
|
@@ -334,18 +348,18 @@ const Y = {
|
|
|
334
348
|
radiusLg: "8px",
|
|
335
349
|
radiusXl: "12px",
|
|
336
350
|
radiusFull: "9999px"
|
|
337
|
-
}),
|
|
351
|
+
}), ve = {
|
|
338
352
|
sm: "0 1px 2px rgba(0,0,0,0.05)",
|
|
339
353
|
md: "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",
|
|
340
354
|
lg: "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",
|
|
341
355
|
xl: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
|
|
342
|
-
},
|
|
356
|
+
}, be = {
|
|
343
357
|
sm: "0 1px 2px rgba(0,0,0,0.3)",
|
|
344
358
|
md: "0 4px 6px -1px rgba(0,0,0,0.4)",
|
|
345
359
|
lg: "0 10px 15px -3px rgba(0,0,0,0.4)",
|
|
346
360
|
xl: "0 20px 25px -5px rgba(0,0,0,0.4)"
|
|
347
361
|
};
|
|
348
|
-
function s(a, i, c, n,
|
|
362
|
+
function s(a, i, c, n, t) {
|
|
349
363
|
return {
|
|
350
364
|
name: a,
|
|
351
365
|
darkMode: "light",
|
|
@@ -361,14 +375,14 @@ function s(a, i, c, n, o) {
|
|
|
361
375
|
canvas: c.canvas ?? c.primary
|
|
362
376
|
},
|
|
363
377
|
text: { ...n, inverse: n.inverse ?? "#ffffff" },
|
|
364
|
-
borders: ae(
|
|
365
|
-
shadows:
|
|
378
|
+
borders: ae(t),
|
|
379
|
+
shadows: ve,
|
|
366
380
|
spacing: Y,
|
|
367
381
|
typography: Z,
|
|
368
382
|
transitions: ee
|
|
369
383
|
};
|
|
370
384
|
}
|
|
371
|
-
function h(a, i, c, n,
|
|
385
|
+
function h(a, i, c, n, t) {
|
|
372
386
|
return {
|
|
373
387
|
name: a,
|
|
374
388
|
darkMode: "dark",
|
|
@@ -384,8 +398,8 @@ function h(a, i, c, n, o) {
|
|
|
384
398
|
canvas: c.canvas ?? c.primary
|
|
385
399
|
},
|
|
386
400
|
text: { ...n, inverse: n.inverse ?? "#0f172a" },
|
|
387
|
-
borders: ae(
|
|
388
|
-
shadows:
|
|
401
|
+
borders: ae(t),
|
|
402
|
+
shadows: be,
|
|
389
403
|
spacing: Y,
|
|
390
404
|
typography: Z,
|
|
391
405
|
transitions: ee
|
|
@@ -780,7 +794,8 @@ h(
|
|
|
780
794
|
info: "#22d3ee"
|
|
781
795
|
},
|
|
782
796
|
{ primary: "#030712", secondary: "#111827", tertiary: "#1f2937", hover: "#1f2937" },
|
|
783
|
-
|
|
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" },
|
|
784
799
|
"#374151"
|
|
785
800
|
);
|
|
786
801
|
h(
|
|
@@ -1256,7 +1271,8 @@ h(
|
|
|
1256
1271
|
info: "#2aa198"
|
|
1257
1272
|
},
|
|
1258
1273
|
{ primary: "#002b36", secondary: "#073642", tertiary: "#0a4858", hover: "#073642" },
|
|
1259
|
-
|
|
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" },
|
|
1260
1276
|
"#073642"
|
|
1261
1277
|
);
|
|
1262
1278
|
h(
|
|
@@ -1368,7 +1384,8 @@ h(
|
|
|
1368
1384
|
info: "#bf00ff"
|
|
1369
1385
|
},
|
|
1370
1386
|
{ primary: "#0a0e17", secondary: "#131824", tertiary: "#1c2333", hover: "#1c2333" },
|
|
1371
|
-
|
|
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" },
|
|
1372
1389
|
"#1c3a44"
|
|
1373
1390
|
);
|
|
1374
1391
|
h(
|
|
@@ -1424,7 +1441,8 @@ h(
|
|
|
1424
1441
|
info: "#9333ea"
|
|
1425
1442
|
},
|
|
1426
1443
|
{ primary: "#1a0a00", secondary: "#2d1500", tertiary: "#402000", hover: "#402000" },
|
|
1427
|
-
|
|
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" },
|
|
1428
1446
|
"#5c3400"
|
|
1429
1447
|
);
|
|
1430
1448
|
s(
|
|
@@ -1735,28 +1753,28 @@ s(
|
|
|
1735
1753
|
{ primary: "#3b0a0a", secondary: "#7f1d1d", muted: "#dc6868" },
|
|
1736
1754
|
"#e8a0a0"
|
|
1737
1755
|
);
|
|
1738
|
-
const
|
|
1756
|
+
const ge = process.env.NODE_ENV === "development";
|
|
1739
1757
|
let re = {
|
|
1740
|
-
enabled:
|
|
1758
|
+
enabled: ge,
|
|
1741
1759
|
slowRenderThreshold: 16
|
|
1742
1760
|
};
|
|
1743
1761
|
const ie = [], O = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map();
|
|
1744
|
-
function
|
|
1762
|
+
function Me() {
|
|
1745
1763
|
ie.length = 0, O.clear(), ce.clear();
|
|
1746
1764
|
}
|
|
1747
|
-
function
|
|
1765
|
+
function _e(a) {
|
|
1748
1766
|
const i = re.slowRenderThreshold;
|
|
1749
1767
|
return ie.filter((c) => c.actualDuration > i);
|
|
1750
1768
|
}
|
|
1751
1769
|
function V(a) {
|
|
1752
1770
|
return a < 1 ? `${(a * 1e3).toFixed(0)}μs` : a < 1e3 ? `${a.toFixed(2)}ms` : `${(a / 1e3).toFixed(2)}s`;
|
|
1753
1771
|
}
|
|
1754
|
-
function _e() {
|
|
1755
|
-
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());
|
|
1756
|
-
return { stats: a, slowRenders: i, totalRenders: c, avgRenderTime: n, marks: o };
|
|
1757
|
-
}
|
|
1758
1772
|
function Ne() {
|
|
1759
|
-
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();
|
|
1760
1778
|
console.group(
|
|
1761
1779
|
"%c[Nice2Dev Performance Report]",
|
|
1762
1780
|
"color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"
|
|
@@ -1783,13 +1801,13 @@ function Ne() {
|
|
|
1783
1801
|
}))
|
|
1784
1802
|
), console.groupEnd()), console.groupEnd();
|
|
1785
1803
|
}
|
|
1786
|
-
const
|
|
1804
|
+
const Ce = oe(
|
|
1787
1805
|
({ position: a = "bottom-right", defaultCollapsed: i = !0 }) => {
|
|
1788
|
-
const [c, n] =
|
|
1806
|
+
const [c, n] = u(i), [t, o] = u([]), [d, l] = u({ used: 0, total: 0 });
|
|
1789
1807
|
if (te(() => {
|
|
1790
1808
|
const m = () => {
|
|
1791
1809
|
const w = Array.from(O.values());
|
|
1792
|
-
|
|
1810
|
+
o(w.sort((v, N) => N.totalRenderTime - v.totalRenderTime).slice(0, 10));
|
|
1793
1811
|
const g = window.performance;
|
|
1794
1812
|
g.memory && l({
|
|
1795
1813
|
used: g.memory.usedJSHeapSize / 1024 / 1024,
|
|
@@ -1813,7 +1831,7 @@ const we = oe(
|
|
|
1813
1831
|
style: {
|
|
1814
1832
|
...b,
|
|
1815
1833
|
background: "var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",
|
|
1816
|
-
color: "var(--nice-
|
|
1834
|
+
color: "var(--nice-color-white, #fff)",
|
|
1817
1835
|
borderRadius: 8,
|
|
1818
1836
|
fontSize: 11,
|
|
1819
1837
|
fontFamily: "Monaco, Consolas, monospace",
|
|
@@ -1854,7 +1872,7 @@ const we = oe(
|
|
|
1854
1872
|
]
|
|
1855
1873
|
}
|
|
1856
1874
|
),
|
|
1857
|
-
/* @__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 }) })
|
|
1858
1876
|
]
|
|
1859
1877
|
}
|
|
1860
1878
|
),
|
|
@@ -1870,7 +1888,7 @@ const we = oe(
|
|
|
1870
1888
|
children: /* @__PURE__ */ e("strong", { children: "Top Components" })
|
|
1871
1889
|
}
|
|
1872
1890
|
),
|
|
1873
|
-
|
|
1891
|
+
t.map((m) => /* @__PURE__ */ r("div", { style: { marginBottom: 4, display: "flex", gap: 8 }, children: [
|
|
1874
1892
|
/* @__PURE__ */ e("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: m.componentName }),
|
|
1875
1893
|
/* @__PURE__ */ e(
|
|
1876
1894
|
"span",
|
|
@@ -1900,7 +1918,7 @@ const we = oe(
|
|
|
1900
1918
|
/* @__PURE__ */ e(
|
|
1901
1919
|
"button",
|
|
1902
1920
|
{
|
|
1903
|
-
onClick:
|
|
1921
|
+
onClick: we,
|
|
1904
1922
|
style: {
|
|
1905
1923
|
flex: 1,
|
|
1906
1924
|
padding: "4px 8px",
|
|
@@ -1917,7 +1935,7 @@ const we = oe(
|
|
|
1917
1935
|
/* @__PURE__ */ e(
|
|
1918
1936
|
"button",
|
|
1919
1937
|
{
|
|
1920
|
-
onClick:
|
|
1938
|
+
onClick: Me,
|
|
1921
1939
|
style: {
|
|
1922
1940
|
flex: 1,
|
|
1923
1941
|
padding: "4px 8px",
|
|
@@ -1938,7 +1956,7 @@ const we = oe(
|
|
|
1938
1956
|
);
|
|
1939
1957
|
}
|
|
1940
1958
|
);
|
|
1941
|
-
|
|
1959
|
+
Ce.displayName = "ProfilerOverlay";
|
|
1942
1960
|
process.env.NODE_ENV;
|
|
1943
1961
|
M(null);
|
|
1944
1962
|
M({
|
|
@@ -2000,51 +2018,51 @@ const G = {
|
|
|
2000
2018
|
{ type: "kpi", label: "KPI Card", icon: "target" },
|
|
2001
2019
|
{ type: "camera-feed", label: "Camera Feed", icon: "video" }
|
|
2002
2020
|
];
|
|
2003
|
-
function
|
|
2021
|
+
function Fe({
|
|
2004
2022
|
devices: a = [],
|
|
2005
2023
|
widgets: i = [],
|
|
2006
2024
|
alarms: c = [],
|
|
2007
2025
|
onDeviceSelect: n,
|
|
2008
|
-
onWidgetChange:
|
|
2009
|
-
onCommand:
|
|
2026
|
+
onWidgetChange: t,
|
|
2027
|
+
onCommand: o,
|
|
2010
2028
|
onAlarmAcknowledge: d,
|
|
2011
2029
|
fetchTelemetry: l,
|
|
2012
2030
|
className: b = ""
|
|
2013
2031
|
}) {
|
|
2014
|
-
const [m, _] =
|
|
2032
|
+
const [m, _] = u(i), [w, g] = u(null), [v, N] = u("dashboard"), [H, L] = u(!1), [z, A] = u(""), y = C(
|
|
2015
2033
|
(f) => {
|
|
2016
2034
|
_((x) => {
|
|
2017
2035
|
const S = f(x);
|
|
2018
|
-
return
|
|
2036
|
+
return t == null || t(S), S;
|
|
2019
2037
|
});
|
|
2020
2038
|
},
|
|
2021
|
-
[
|
|
2039
|
+
[t]
|
|
2022
2040
|
), k = C(
|
|
2023
2041
|
(f) => {
|
|
2024
2042
|
var S;
|
|
2025
2043
|
const x = {
|
|
2026
|
-
id:
|
|
2044
|
+
id: ue(),
|
|
2027
2045
|
type: f,
|
|
2028
2046
|
title: ((S = F.find(($) => $.type === f)) == null ? void 0 : S.label) || f,
|
|
2029
|
-
position: { x: 0, y:
|
|
2047
|
+
position: { x: 0, y: He(m), width: 4, height: 3 },
|
|
2030
2048
|
config: {}
|
|
2031
2049
|
};
|
|
2032
|
-
|
|
2050
|
+
y(($) => [...$, x]);
|
|
2033
2051
|
},
|
|
2034
|
-
[m,
|
|
2035
|
-
),
|
|
2052
|
+
[m, y]
|
|
2053
|
+
), U = C(
|
|
2036
2054
|
(f) => {
|
|
2037
2055
|
g(f), n == null || n(f);
|
|
2038
2056
|
},
|
|
2039
2057
|
[n]
|
|
2040
|
-
),
|
|
2058
|
+
), E = C(
|
|
2041
2059
|
(f) => {
|
|
2042
2060
|
d == null || d(f);
|
|
2043
2061
|
},
|
|
2044
2062
|
[d]
|
|
2045
2063
|
), T = a.filter(
|
|
2046
2064
|
(f) => !z || f.name.toLowerCase().includes(z.toLowerCase()) || f.type.toLowerCase().includes(z.toLowerCase())
|
|
2047
|
-
),
|
|
2065
|
+
), D = c.filter((f) => !f.cleared), q = D.filter(
|
|
2048
2066
|
(f) => f.severity === "critical" || f.severity === "high"
|
|
2049
2067
|
);
|
|
2050
2068
|
return /* @__PURE__ */ r("div", { className: `nice-iot-dashboard ${b}`, children: [
|
|
@@ -2052,7 +2070,7 @@ function Be({
|
|
|
2052
2070
|
/* @__PURE__ */ e("h1", { children: "IoT Dashboard" }),
|
|
2053
2071
|
/* @__PURE__ */ r("div", { className: "nice-iot-dashboard__stats", children: [
|
|
2054
2072
|
/* @__PURE__ */ r("span", { className: "nice-iot-dashboard__stat", children: [
|
|
2055
|
-
/* @__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 }) }),
|
|
2056
2074
|
a.length,
|
|
2057
2075
|
" Devices"
|
|
2058
2076
|
] }),
|
|
@@ -2067,7 +2085,7 @@ function Be({
|
|
|
2067
2085
|
" Offline"
|
|
2068
2086
|
] }),
|
|
2069
2087
|
q.length > 0 && /* @__PURE__ */ r("span", { className: "nice-iot-dashboard__stat nice-iot-dashboard__stat--alarms", children: [
|
|
2070
|
-
/* @__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 }) }),
|
|
2071
2089
|
q.length,
|
|
2072
2090
|
" Alarms"
|
|
2073
2091
|
] })
|
|
@@ -2084,11 +2102,11 @@ function Be({
|
|
|
2084
2102
|
/* @__PURE__ */ e("button", { className: v === "devices" ? "active" : "", onClick: () => N("devices"), children: "Devices" }),
|
|
2085
2103
|
/* @__PURE__ */ r("button", { className: v === "alarms" ? "active" : "", onClick: () => N("alarms"), children: [
|
|
2086
2104
|
"Alarms ",
|
|
2087
|
-
|
|
2105
|
+
D.length > 0 && `(${D.length})`
|
|
2088
2106
|
] })
|
|
2089
2107
|
] }),
|
|
2090
2108
|
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__actions", children: v === "dashboard" && /* @__PURE__ */ r("button", { onClick: () => L(!H), children: [
|
|
2091
|
-
/* @__PURE__ */ e(
|
|
2109
|
+
/* @__PURE__ */ e(p, { name: H ? "check" : "edit", size: 14 }),
|
|
2092
2110
|
" ",
|
|
2093
2111
|
H ? "Done" : "Edit"
|
|
2094
2112
|
] }) })
|
|
@@ -2102,7 +2120,7 @@ function Be({
|
|
|
2102
2120
|
className: "nice-iot-dashboard__palette-item",
|
|
2103
2121
|
onClick: () => k(f.type),
|
|
2104
2122
|
children: [
|
|
2105
|
-
/* @__PURE__ */ e(
|
|
2123
|
+
/* @__PURE__ */ e(p, { name: f.icon, size: 16 }),
|
|
2106
2124
|
/* @__PURE__ */ e("span", { children: f.label })
|
|
2107
2125
|
]
|
|
2108
2126
|
},
|
|
@@ -2111,14 +2129,14 @@ function Be({
|
|
|
2111
2129
|
] }),
|
|
2112
2130
|
/* @__PURE__ */ r("div", { className: "nice-iot-dashboard__grid", children: [
|
|
2113
2131
|
m.map((f) => /* @__PURE__ */ e(
|
|
2114
|
-
|
|
2132
|
+
ze,
|
|
2115
2133
|
{
|
|
2116
2134
|
widget: f,
|
|
2117
2135
|
devices: a,
|
|
2118
2136
|
alarms: c,
|
|
2119
2137
|
isEditing: H,
|
|
2120
|
-
onCommand:
|
|
2121
|
-
onDelete: () =>
|
|
2138
|
+
onCommand: o,
|
|
2139
|
+
onDelete: () => y((x) => x.filter((S) => S.id !== f.id))
|
|
2122
2140
|
},
|
|
2123
2141
|
f.id
|
|
2124
2142
|
)),
|
|
@@ -2136,19 +2154,19 @@ function Be({
|
|
|
2136
2154
|
}
|
|
2137
2155
|
) }),
|
|
2138
2156
|
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__device-grid", children: T.map((f) => /* @__PURE__ */ e(
|
|
2139
|
-
|
|
2157
|
+
xe,
|
|
2140
2158
|
{
|
|
2141
2159
|
device: f,
|
|
2142
2160
|
isSelected: (w == null ? void 0 : w.id) === f.id,
|
|
2143
|
-
onSelect: () =>
|
|
2161
|
+
onSelect: () => U(f)
|
|
2144
2162
|
},
|
|
2145
2163
|
f.id
|
|
2146
2164
|
)) }),
|
|
2147
2165
|
w && /* @__PURE__ */ e(
|
|
2148
|
-
|
|
2166
|
+
Se,
|
|
2149
2167
|
{
|
|
2150
2168
|
device: w,
|
|
2151
|
-
onCommand:
|
|
2169
|
+
onCommand: o,
|
|
2152
2170
|
onClose: () => g(null)
|
|
2153
2171
|
}
|
|
2154
2172
|
)
|
|
@@ -2162,7 +2180,7 @@ function Be({
|
|
|
2162
2180
|
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
2163
2181
|
/* @__PURE__ */ e("th", { children: "Actions" })
|
|
2164
2182
|
] }) }),
|
|
2165
|
-
/* @__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) => {
|
|
2166
2184
|
const x = a.find((S) => S.id === f.deviceId);
|
|
2167
2185
|
return /* @__PURE__ */ r(
|
|
2168
2186
|
"tr",
|
|
@@ -2180,7 +2198,7 @@ function Be({
|
|
|
2180
2198
|
/* @__PURE__ */ e("td", { children: f.message }),
|
|
2181
2199
|
/* @__PURE__ */ e("td", { children: f.timestamp.toLocaleString() }),
|
|
2182
2200
|
/* @__PURE__ */ e("td", { children: f.acknowledged ? "Acknowledged" : "Active" }),
|
|
2183
|
-
/* @__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" }) })
|
|
2184
2202
|
]
|
|
2185
2203
|
},
|
|
2186
2204
|
f.id
|
|
@@ -2189,7 +2207,7 @@ function Be({
|
|
|
2189
2207
|
] }) })
|
|
2190
2208
|
] });
|
|
2191
2209
|
}
|
|
2192
|
-
function
|
|
2210
|
+
function He(a) {
|
|
2193
2211
|
return a.length === 0 ? 0 : Math.max(...a.map((i) => i.position.y + i.position.height));
|
|
2194
2212
|
}
|
|
2195
2213
|
function I(a) {
|
|
@@ -2208,13 +2226,13 @@ function I(a) {
|
|
|
2208
2226
|
return "var(--nice-text-secondary, #6c757d)";
|
|
2209
2227
|
}
|
|
2210
2228
|
}
|
|
2211
|
-
function
|
|
2229
|
+
function ze({
|
|
2212
2230
|
widget: a,
|
|
2213
2231
|
devices: i,
|
|
2214
2232
|
alarms: c,
|
|
2215
2233
|
isEditing: n,
|
|
2216
|
-
onCommand:
|
|
2217
|
-
onDelete:
|
|
2234
|
+
onCommand: t,
|
|
2235
|
+
onDelete: o
|
|
2218
2236
|
}) {
|
|
2219
2237
|
const d = F.find((l) => l.type === a.type);
|
|
2220
2238
|
return /* @__PURE__ */ r(
|
|
@@ -2227,16 +2245,16 @@ function He({
|
|
|
2227
2245
|
},
|
|
2228
2246
|
children: [
|
|
2229
2247
|
/* @__PURE__ */ r("div", { className: "nice-iot-dashboard__widget-header", children: [
|
|
2230
|
-
/* @__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 }) }),
|
|
2231
2249
|
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__widget-title", children: a.title }),
|
|
2232
|
-
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: "×" })
|
|
2233
2251
|
] }),
|
|
2234
|
-
/* @__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 }) })
|
|
2235
2253
|
]
|
|
2236
2254
|
}
|
|
2237
2255
|
);
|
|
2238
2256
|
}
|
|
2239
|
-
function
|
|
2257
|
+
function ke({
|
|
2240
2258
|
widget: a,
|
|
2241
2259
|
devices: i,
|
|
2242
2260
|
alarms: c,
|
|
@@ -2244,35 +2262,35 @@ function ze({
|
|
|
2244
2262
|
}) {
|
|
2245
2263
|
switch (a.type) {
|
|
2246
2264
|
case "device-list":
|
|
2247
|
-
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: [
|
|
2248
2266
|
/* @__PURE__ */ e(
|
|
2249
2267
|
"span",
|
|
2250
2268
|
{
|
|
2251
2269
|
className: "nice-iot-dashboard__device-status",
|
|
2252
|
-
style: { background: I(
|
|
2270
|
+
style: { background: I(t.status) }
|
|
2253
2271
|
}
|
|
2254
2272
|
),
|
|
2255
|
-
/* @__PURE__ */ e("span", { children:
|
|
2256
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__device-type", children:
|
|
2257
|
-
] },
|
|
2273
|
+
/* @__PURE__ */ e("span", { children: t.name }),
|
|
2274
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__device-type", children: t.type })
|
|
2275
|
+
] }, t.id)) });
|
|
2258
2276
|
case "device-status":
|
|
2259
|
-
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__status-grid", children: ["online", "offline", "warning", "error"].map((
|
|
2260
|
-
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;
|
|
2261
2279
|
return /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__status-card", children: [
|
|
2262
2280
|
/* @__PURE__ */ e(
|
|
2263
2281
|
"span",
|
|
2264
2282
|
{
|
|
2265
2283
|
className: "nice-iot-dashboard__status-indicator",
|
|
2266
|
-
style: { background: I(
|
|
2284
|
+
style: { background: I(t) }
|
|
2267
2285
|
}
|
|
2268
2286
|
),
|
|
2269
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-count", children:
|
|
2270
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-label", children:
|
|
2271
|
-
] },
|
|
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);
|
|
2272
2290
|
}) });
|
|
2273
2291
|
case "telemetry-chart":
|
|
2274
2292
|
return /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__chart-placeholder", children: [
|
|
2275
|
-
/* @__PURE__ */ e(
|
|
2293
|
+
/* @__PURE__ */ e(p, { name: "bar-chart", size: 32 }),
|
|
2276
2294
|
/* @__PURE__ */ e("span", { children: "Telemetry Chart" }),
|
|
2277
2295
|
/* @__PURE__ */ e("small", { children: "Configure device and capability" })
|
|
2278
2296
|
] });
|
|
@@ -2301,30 +2319,30 @@ function ze({
|
|
|
2301
2319
|
] }) });
|
|
2302
2320
|
case "map":
|
|
2303
2321
|
return /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__map-placeholder", children: [
|
|
2304
|
-
/* @__PURE__ */ e(
|
|
2322
|
+
/* @__PURE__ */ e(p, { name: "map-pin", size: 32 }),
|
|
2305
2323
|
/* @__PURE__ */ e("span", { children: "Device Map" }),
|
|
2306
2324
|
/* @__PURE__ */ r("small", { children: [
|
|
2307
|
-
i.filter((
|
|
2325
|
+
i.filter((t) => t.location).length,
|
|
2308
2326
|
" devices with location"
|
|
2309
2327
|
] })
|
|
2310
2328
|
] });
|
|
2311
2329
|
case "alarms": {
|
|
2312
|
-
const
|
|
2313
|
-
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(
|
|
2314
2332
|
"div",
|
|
2315
2333
|
{
|
|
2316
|
-
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}`,
|
|
2317
2335
|
children: [
|
|
2318
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-severity", children:
|
|
2319
|
-
/* @__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 })
|
|
2320
2338
|
]
|
|
2321
2339
|
},
|
|
2322
|
-
|
|
2340
|
+
o.id
|
|
2323
2341
|
)) });
|
|
2324
2342
|
}
|
|
2325
2343
|
case "control-panel":
|
|
2326
2344
|
return /* @__PURE__ */ r("div", { className: "nice-iot-dashboard__control-placeholder", children: [
|
|
2327
|
-
/* @__PURE__ */ e(
|
|
2345
|
+
/* @__PURE__ */ e(p, { name: "settings", size: 32 }),
|
|
2328
2346
|
/* @__PURE__ */ e("span", { children: "Control Panel" }),
|
|
2329
2347
|
/* @__PURE__ */ e("small", { children: "Configure device controls" })
|
|
2330
2348
|
] });
|
|
@@ -2337,7 +2355,7 @@ function ze({
|
|
|
2337
2355
|
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__widget-placeholder", children: a.type });
|
|
2338
2356
|
}
|
|
2339
2357
|
}
|
|
2340
|
-
function
|
|
2358
|
+
function xe({ device: a, isSelected: i, onSelect: c }) {
|
|
2341
2359
|
return /* @__PURE__ */ r(
|
|
2342
2360
|
"div",
|
|
2343
2361
|
{
|
|
@@ -2381,7 +2399,7 @@ function ke({ device: a, isSelected: i, onSelect: c }) {
|
|
|
2381
2399
|
}
|
|
2382
2400
|
);
|
|
2383
2401
|
}
|
|
2384
|
-
function
|
|
2402
|
+
function Se({
|
|
2385
2403
|
device: a,
|
|
2386
2404
|
onCommand: i,
|
|
2387
2405
|
onClose: c
|
|
@@ -2454,7 +2472,7 @@ function xe({
|
|
|
2454
2472
|
] })
|
|
2455
2473
|
] });
|
|
2456
2474
|
}
|
|
2457
|
-
const
|
|
2475
|
+
const Le = [
|
|
2458
2476
|
{ name: "MQTT Broker", image: "eclipse-mosquitto:latest" },
|
|
2459
2477
|
{ name: "Node-RED", image: "nodered/node-red:latest" },
|
|
2460
2478
|
{ name: "InfluxDB", image: "influxdb:latest" },
|
|
@@ -2462,34 +2480,34 @@ const Se = [
|
|
|
2462
2480
|
{ name: "Telegraf", image: "telegraf:latest" },
|
|
2463
2481
|
{ name: "Protocol Adapter", image: "nice2dev/protocol-adapter:latest" }
|
|
2464
2482
|
];
|
|
2465
|
-
function
|
|
2483
|
+
function Oe({
|
|
2466
2484
|
nodes: a = [],
|
|
2467
2485
|
modules: i = [],
|
|
2468
2486
|
onNodeSelect: c,
|
|
2469
2487
|
onModuleDeploy: n,
|
|
2470
|
-
onModuleAction:
|
|
2471
|
-
onNodeSync:
|
|
2488
|
+
onModuleAction: t,
|
|
2489
|
+
onNodeSync: o,
|
|
2472
2490
|
className: d = ""
|
|
2473
2491
|
}) {
|
|
2474
|
-
const [l, b] =
|
|
2492
|
+
const [l, b] = u(null), [m, _] = u("nodes"), [w, g] = u(!1), [v, N] = u({
|
|
2475
2493
|
name: "",
|
|
2476
2494
|
image: "",
|
|
2477
2495
|
status: "pending"
|
|
2478
2496
|
}), H = C(
|
|
2479
|
-
(
|
|
2480
|
-
b(
|
|
2497
|
+
(y) => {
|
|
2498
|
+
b(y), c == null || c(y);
|
|
2481
2499
|
},
|
|
2482
2500
|
[c]
|
|
2483
2501
|
), L = C(async () => {
|
|
2484
2502
|
!l || !v.name || !v.image || (await (n == null ? void 0 : n(l.id, v)), g(!1), N({ name: "", image: "", status: "pending" }));
|
|
2485
2503
|
}, [l, v, n]), z = C(
|
|
2486
|
-
async (
|
|
2487
|
-
l && await (
|
|
2504
|
+
async (y, k) => {
|
|
2505
|
+
l && await (t == null ? void 0 : t(l.id, y, k));
|
|
2488
2506
|
},
|
|
2489
|
-
[l,
|
|
2507
|
+
[l, t]
|
|
2490
2508
|
), A = C(async () => {
|
|
2491
|
-
l && await (
|
|
2492
|
-
}, [l,
|
|
2509
|
+
l && await (o == null ? void 0 : o(l.id));
|
|
2510
|
+
}, [l, o]);
|
|
2493
2511
|
return /* @__PURE__ */ r("div", { className: `nice-edge-manager ${d}`, children: [
|
|
2494
2512
|
/* @__PURE__ */ r("header", { className: "nice-edge-manager__header", children: [
|
|
2495
2513
|
/* @__PURE__ */ e("h1", { children: "Edge Manager" }),
|
|
@@ -2504,14 +2522,14 @@ function Fe({
|
|
|
2504
2522
|
] }),
|
|
2505
2523
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__main", children: [
|
|
2506
2524
|
m === "nodes" && /* @__PURE__ */ e("div", { className: "nice-edge-manager__nodes", children: /* @__PURE__ */ r("div", { className: "nice-edge-manager__node-grid", children: [
|
|
2507
|
-
a.map((
|
|
2508
|
-
|
|
2525
|
+
a.map((y) => /* @__PURE__ */ e(
|
|
2526
|
+
Ve,
|
|
2509
2527
|
{
|
|
2510
|
-
node:
|
|
2511
|
-
isSelected: (l == null ? void 0 : l.id) ===
|
|
2512
|
-
onSelect: () => H(
|
|
2528
|
+
node: y,
|
|
2529
|
+
isSelected: (l == null ? void 0 : l.id) === y.id,
|
|
2530
|
+
onSelect: () => H(y)
|
|
2513
2531
|
},
|
|
2514
|
-
|
|
2532
|
+
y.id
|
|
2515
2533
|
)),
|
|
2516
2534
|
a.length === 0 && /* @__PURE__ */ e("div", { className: "nice-edge-manager__empty", children: "No edge nodes configured" })
|
|
2517
2535
|
] }) }),
|
|
@@ -2531,20 +2549,20 @@ function Fe({
|
|
|
2531
2549
|
)
|
|
2532
2550
|
] }),
|
|
2533
2551
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__module-grid", children: [
|
|
2534
|
-
l.deployedModules.map((
|
|
2535
|
-
|
|
2552
|
+
l.deployedModules.map((y) => /* @__PURE__ */ e(
|
|
2553
|
+
Ae,
|
|
2536
2554
|
{
|
|
2537
|
-
module:
|
|
2538
|
-
onAction: (k) => z(
|
|
2555
|
+
module: y,
|
|
2556
|
+
onAction: (k) => z(y.id, k)
|
|
2539
2557
|
},
|
|
2540
|
-
|
|
2558
|
+
y.id
|
|
2541
2559
|
)),
|
|
2542
2560
|
l.deployedModules.length === 0 && /* @__PURE__ */ e("div", { className: "nice-edge-manager__empty", children: "No modules deployed on this node" })
|
|
2543
2561
|
] })
|
|
2544
2562
|
] }),
|
|
2545
2563
|
m === "modules" && !l && /* @__PURE__ */ e("div", { className: "nice-edge-manager__no-selection", children: "Select a node from the Nodes tab to manage modules" }),
|
|
2546
2564
|
l && /* @__PURE__ */ e(
|
|
2547
|
-
|
|
2565
|
+
Pe,
|
|
2548
2566
|
{
|
|
2549
2567
|
node: l,
|
|
2550
2568
|
onSync: A,
|
|
@@ -2556,7 +2574,7 @@ function Fe({
|
|
|
2556
2574
|
De,
|
|
2557
2575
|
{
|
|
2558
2576
|
config: v,
|
|
2559
|
-
templates:
|
|
2577
|
+
templates: Le,
|
|
2560
2578
|
onChange: N,
|
|
2561
2579
|
onDeploy: L,
|
|
2562
2580
|
onClose: () => g(!1)
|
|
@@ -2583,11 +2601,11 @@ function ne(a) {
|
|
|
2583
2601
|
function j(a) {
|
|
2584
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`;
|
|
2585
2603
|
}
|
|
2586
|
-
function
|
|
2604
|
+
function Te(a) {
|
|
2587
2605
|
const i = Math.floor(a / 86400), c = Math.floor(a % 86400 / 3600), n = Math.floor(a % 3600 / 60);
|
|
2588
2606
|
return i > 0 ? `${i}d ${c}h` : c > 0 ? `${c}h ${n}m` : `${n}m`;
|
|
2589
2607
|
}
|
|
2590
|
-
function
|
|
2608
|
+
function Ve({ node: a, isSelected: i, onSelect: c }) {
|
|
2591
2609
|
return /* @__PURE__ */ r(
|
|
2592
2610
|
"div",
|
|
2593
2611
|
{
|
|
@@ -2608,18 +2626,18 @@ function Te({ node: a, isSelected: i, onSelect: c }) {
|
|
|
2608
2626
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__node-body", children: [
|
|
2609
2627
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__node-info", children: [
|
|
2610
2628
|
/* @__PURE__ */ r("span", { children: [
|
|
2611
|
-
/* @__PURE__ */ e(
|
|
2629
|
+
/* @__PURE__ */ e(p, { name: "server", size: 12 }),
|
|
2612
2630
|
" ",
|
|
2613
2631
|
a.hardware.cpu
|
|
2614
2632
|
] }),
|
|
2615
2633
|
/* @__PURE__ */ r("span", { children: [
|
|
2616
|
-
/* @__PURE__ */ e(
|
|
2634
|
+
/* @__PURE__ */ e(p, { name: "database", size: 12 }),
|
|
2617
2635
|
" ",
|
|
2618
2636
|
(a.hardware.memoryMB / 1024).toFixed(1),
|
|
2619
2637
|
" GB"
|
|
2620
2638
|
] })
|
|
2621
2639
|
] }),
|
|
2622
|
-
/* @__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: [
|
|
2623
2641
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__metric", children: [
|
|
2624
2642
|
/* @__PURE__ */ e("span", { className: "nice-edge-manager__metric-label", children: "CPU" }),
|
|
2625
2643
|
/* @__PURE__ */ e("div", { className: "nice-edge-manager__metric-bar", children: /* @__PURE__ */ e(
|
|
@@ -2658,7 +2676,7 @@ function Te({ node: a, isSelected: i, onSelect: c }) {
|
|
|
2658
2676
|
}
|
|
2659
2677
|
);
|
|
2660
2678
|
}
|
|
2661
|
-
function
|
|
2679
|
+
function Ae({ module: a, onAction: i }) {
|
|
2662
2680
|
return /* @__PURE__ */ r("div", { className: "nice-edge-manager__module-card", children: [
|
|
2663
2681
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__module-header", children: [
|
|
2664
2682
|
/* @__PURE__ */ e(
|
|
@@ -2700,7 +2718,7 @@ function Ve({ module: a, onAction: i }) {
|
|
|
2700
2718
|
] })
|
|
2701
2719
|
] }),
|
|
2702
2720
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__module-actions", children: [
|
|
2703
|
-
a.status === "running" && /* @__PURE__ */ r(
|
|
2721
|
+
a.status === "running" && /* @__PURE__ */ r(P, { children: [
|
|
2704
2722
|
/* @__PURE__ */ e("button", { onClick: () => i("stop"), children: "Stop" }),
|
|
2705
2723
|
/* @__PURE__ */ e("button", { onClick: () => i("restart"), children: "Restart" })
|
|
2706
2724
|
] }),
|
|
@@ -2709,16 +2727,16 @@ function Ve({ module: a, onAction: i }) {
|
|
|
2709
2727
|
] })
|
|
2710
2728
|
] });
|
|
2711
2729
|
}
|
|
2712
|
-
function
|
|
2730
|
+
function Pe({ node: a, onSync: i, onClose: c }) {
|
|
2713
2731
|
return /* @__PURE__ */ r("aside", { className: "nice-edge-manager__detail", children: [
|
|
2714
2732
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-header", children: [
|
|
2715
2733
|
/* @__PURE__ */ e("h3", { children: a.name }),
|
|
2716
2734
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-actions", children: [
|
|
2717
2735
|
/* @__PURE__ */ r("button", { onClick: i, children: [
|
|
2718
|
-
/* @__PURE__ */ e(
|
|
2736
|
+
/* @__PURE__ */ e(p, { name: "refresh", size: 14 }),
|
|
2719
2737
|
" Sync"
|
|
2720
2738
|
] }),
|
|
2721
|
-
/* @__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 }) })
|
|
2722
2740
|
] })
|
|
2723
2741
|
] }),
|
|
2724
2742
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-content", children: [
|
|
@@ -2737,7 +2755,7 @@ function Ae({ node: a, onSync: i, onClose: c }) {
|
|
|
2737
2755
|
] }),
|
|
2738
2756
|
a.metrics && /* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-row", children: [
|
|
2739
2757
|
/* @__PURE__ */ e("span", { children: "Uptime:" }),
|
|
2740
|
-
/* @__PURE__ */ e("span", { children:
|
|
2758
|
+
/* @__PURE__ */ e("span", { children: Te(a.metrics.uptime) })
|
|
2741
2759
|
] })
|
|
2742
2760
|
] }),
|
|
2743
2761
|
/* @__PURE__ */ r("section", { children: [
|
|
@@ -2802,7 +2820,7 @@ function Ae({ node: a, onSync: i, onClose: c }) {
|
|
|
2802
2820
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__detail-row", children: [
|
|
2803
2821
|
/* @__PURE__ */ e("span", { children: "Cloud:" }),
|
|
2804
2822
|
/* @__PURE__ */ r("span", { children: [
|
|
2805
|
-
/* @__PURE__ */ e(
|
|
2823
|
+
/* @__PURE__ */ e(p, { name: a.connectivity.cloudConnected ? "check" : "close", size: 12 }),
|
|
2806
2824
|
" ",
|
|
2807
2825
|
a.connectivity.cloudConnected ? "Connected" : "Disconnected"
|
|
2808
2826
|
] })
|
|
@@ -2885,12 +2903,12 @@ function De({
|
|
|
2885
2903
|
templates: i,
|
|
2886
2904
|
onChange: c,
|
|
2887
2905
|
onDeploy: n,
|
|
2888
|
-
onClose:
|
|
2906
|
+
onClose: t
|
|
2889
2907
|
}) {
|
|
2890
2908
|
return /* @__PURE__ */ e("div", { className: "nice-edge-manager__dialog-overlay", children: /* @__PURE__ */ r("div", { className: "nice-edge-manager__dialog", children: [
|
|
2891
2909
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__dialog-header", children: [
|
|
2892
2910
|
/* @__PURE__ */ e("h3", { children: "Deploy Module" }),
|
|
2893
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
2911
|
+
/* @__PURE__ */ e("button", { onClick: t, "aria-label": "Close", children: /* @__PURE__ */ e(p, { name: "close", size: 14 }) })
|
|
2894
2912
|
] }),
|
|
2895
2913
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__dialog-content", children: [
|
|
2896
2914
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__field", children: [
|
|
@@ -2899,8 +2917,8 @@ function De({
|
|
|
2899
2917
|
"select",
|
|
2900
2918
|
{
|
|
2901
2919
|
value: "",
|
|
2902
|
-
onChange: (
|
|
2903
|
-
const d = i.find((l) => l.image ===
|
|
2920
|
+
onChange: (o) => {
|
|
2921
|
+
const d = i.find((l) => l.image === o.target.value);
|
|
2904
2922
|
d && c({
|
|
2905
2923
|
...a,
|
|
2906
2924
|
name: d.name,
|
|
@@ -2909,7 +2927,7 @@ function De({
|
|
|
2909
2927
|
},
|
|
2910
2928
|
children: [
|
|
2911
2929
|
/* @__PURE__ */ e("option", { value: "", children: "Select a template..." }),
|
|
2912
|
-
i.map((
|
|
2930
|
+
i.map((o) => /* @__PURE__ */ e("option", { value: o.image, children: o.name }, o.image))
|
|
2913
2931
|
]
|
|
2914
2932
|
}
|
|
2915
2933
|
)
|
|
@@ -2921,7 +2939,7 @@ function De({
|
|
|
2921
2939
|
{
|
|
2922
2940
|
type: "text",
|
|
2923
2941
|
value: a.name || "",
|
|
2924
|
-
onChange: (
|
|
2942
|
+
onChange: (o) => c({ ...a, name: o.target.value }),
|
|
2925
2943
|
placeholder: "e.g., my-module"
|
|
2926
2944
|
}
|
|
2927
2945
|
)
|
|
@@ -2933,7 +2951,7 @@ function De({
|
|
|
2933
2951
|
{
|
|
2934
2952
|
type: "text",
|
|
2935
2953
|
value: a.image || "",
|
|
2936
|
-
onChange: (
|
|
2954
|
+
onChange: (o) => c({ ...a, image: o.target.value }),
|
|
2937
2955
|
placeholder: "e.g., nginx:latest"
|
|
2938
2956
|
}
|
|
2939
2957
|
)
|
|
@@ -2945,13 +2963,13 @@ function De({
|
|
|
2945
2963
|
{
|
|
2946
2964
|
type: "text",
|
|
2947
2965
|
value: a.version || "1.0.0",
|
|
2948
|
-
onChange: (
|
|
2966
|
+
onChange: (o) => c({ ...a, version: o.target.value })
|
|
2949
2967
|
}
|
|
2950
2968
|
)
|
|
2951
2969
|
] })
|
|
2952
2970
|
] }),
|
|
2953
2971
|
/* @__PURE__ */ r("div", { className: "nice-edge-manager__dialog-footer", children: [
|
|
2954
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
2972
|
+
/* @__PURE__ */ e("button", { onClick: t, children: "Cancel" }),
|
|
2955
2973
|
/* @__PURE__ */ e("button", { className: "nice-edge-manager__deploy-confirm", onClick: n, children: "Deploy" })
|
|
2956
2974
|
] })
|
|
2957
2975
|
] }) });
|
|
@@ -2983,22 +3001,22 @@ const Q = {
|
|
|
2983
3001
|
applicationName: "Nice2Dev IoT Client",
|
|
2984
3002
|
nodes: []
|
|
2985
3003
|
};
|
|
2986
|
-
function
|
|
3004
|
+
function qe({
|
|
2987
3005
|
protocol: a = "mqtt",
|
|
2988
3006
|
config: i,
|
|
2989
3007
|
onSave: c,
|
|
2990
3008
|
onTest: n,
|
|
2991
|
-
className:
|
|
3009
|
+
className: t = ""
|
|
2992
3010
|
}) {
|
|
2993
|
-
const { t } = R(), [d, l] =
|
|
3011
|
+
const { t: o } = R(), [d, l] = u(a), [b, m] = u(
|
|
2994
3012
|
(i == null ? void 0 : i.type) === "mqtt" ? { ...Q, ...i.config } : Q
|
|
2995
|
-
), [_, w] =
|
|
3013
|
+
), [_, w] = u(
|
|
2996
3014
|
(i == null ? void 0 : i.type) === "coap" ? { ...J, ...i.config } : J
|
|
2997
|
-
), [g, v] =
|
|
3015
|
+
), [g, v] = u(
|
|
2998
3016
|
(i == null ? void 0 : i.type) === "modbus" ? { ...K, ...i.config } : K
|
|
2999
|
-
), [N, H] =
|
|
3017
|
+
), [N, H] = u(
|
|
3000
3018
|
(i == null ? void 0 : i.type) === "opcua" ? { ...X, ...i.config } : X
|
|
3001
|
-
), [L, z] =
|
|
3019
|
+
), [L, z] = u(null), [A, y] = u(!1), k = C(() => {
|
|
3002
3020
|
switch (d) {
|
|
3003
3021
|
case "mqtt":
|
|
3004
3022
|
return b;
|
|
@@ -3012,40 +3030,40 @@ function Oe({
|
|
|
3012
3030
|
default:
|
|
3013
3031
|
return b;
|
|
3014
3032
|
}
|
|
3015
|
-
}, [d, b, _, g, N]),
|
|
3033
|
+
}, [d, b, _, g, N]), U = C(() => {
|
|
3016
3034
|
c == null || c(k());
|
|
3017
|
-
}, [k, c]),
|
|
3035
|
+
}, [k, c]), E = C(async () => {
|
|
3018
3036
|
if (n) {
|
|
3019
|
-
|
|
3037
|
+
y(!0), z(null);
|
|
3020
3038
|
try {
|
|
3021
3039
|
const T = await n(k());
|
|
3022
3040
|
z(T);
|
|
3023
3041
|
} catch (T) {
|
|
3024
3042
|
z({ success: !1, message: String(T) });
|
|
3025
3043
|
} finally {
|
|
3026
|
-
|
|
3044
|
+
y(!1);
|
|
3027
3045
|
}
|
|
3028
3046
|
}
|
|
3029
3047
|
}, [k, n]);
|
|
3030
|
-
return /* @__PURE__ */ r("div", { className: `nice-protocol-config ${
|
|
3048
|
+
return /* @__PURE__ */ r("div", { className: `nice-protocol-config ${t}`, children: [
|
|
3031
3049
|
/* @__PURE__ */ r("header", { className: "nice-protocol-config__header", children: [
|
|
3032
|
-
/* @__PURE__ */ e("h2", { children:
|
|
3050
|
+
/* @__PURE__ */ e("h2", { children: o("protocolConfig.title", "Protocol Configuration") }),
|
|
3033
3051
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__protocol-selector", children: [
|
|
3034
|
-
/* @__PURE__ */ e("label", { children: "Protocol:" }),
|
|
3052
|
+
/* @__PURE__ */ e("label", { children: o("protocolConfig.protocol", "Protocol:") }),
|
|
3035
3053
|
/* @__PURE__ */ r("select", { value: d, onChange: (T) => l(T.target.value), children: [
|
|
3036
|
-
/* @__PURE__ */ e("option", { value: "mqtt", children:
|
|
3037
|
-
/* @__PURE__ */ e("option", { value: "coap", children:
|
|
3038
|
-
/* @__PURE__ */ e("option", { value: "modbus-tcp", children:
|
|
3039
|
-
/* @__PURE__ */ e("option", { value: "modbus-rtu", children:
|
|
3040
|
-
/* @__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") })
|
|
3041
3059
|
] })
|
|
3042
3060
|
] })
|
|
3043
3061
|
] }),
|
|
3044
3062
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__content", children: [
|
|
3045
|
-
d === "mqtt" && /* @__PURE__ */ e(
|
|
3046
|
-
d === "coap" && /* @__PURE__ */ e(
|
|
3063
|
+
d === "mqtt" && /* @__PURE__ */ e(Re, { config: b, onChange: m }),
|
|
3064
|
+
d === "coap" && /* @__PURE__ */ e(Ie, { config: _, onChange: w }),
|
|
3047
3065
|
(d === "modbus-tcp" || d === "modbus-rtu") && /* @__PURE__ */ e(
|
|
3048
|
-
|
|
3066
|
+
Ue,
|
|
3049
3067
|
{
|
|
3050
3068
|
config: g,
|
|
3051
3069
|
type: d === "modbus-rtu" ? "rtu" : "tcp",
|
|
@@ -3059,7 +3077,7 @@ function Oe({
|
|
|
3059
3077
|
{
|
|
3060
3078
|
className: `nice-protocol-config__test-result nice-protocol-config__test-result--${L.success ? "success" : "error"}`,
|
|
3061
3079
|
children: [
|
|
3062
|
-
/* @__PURE__ */ e(
|
|
3080
|
+
/* @__PURE__ */ e(p, { name: L.success ? "check" : "close", size: 14 }),
|
|
3063
3081
|
" ",
|
|
3064
3082
|
L.message
|
|
3065
3083
|
]
|
|
@@ -3070,22 +3088,24 @@ function Oe({
|
|
|
3070
3088
|
"button",
|
|
3071
3089
|
{
|
|
3072
3090
|
className: "nice-protocol-config__test-btn",
|
|
3073
|
-
onClick:
|
|
3091
|
+
onClick: E,
|
|
3074
3092
|
disabled: A || !n,
|
|
3075
|
-
children: A ? "Testing..." : /* @__PURE__ */ r(
|
|
3076
|
-
/* @__PURE__ */ e(
|
|
3077
|
-
"
|
|
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")
|
|
3078
3097
|
] })
|
|
3079
3098
|
}
|
|
3080
3099
|
),
|
|
3081
|
-
/* @__PURE__ */ r("button", { className: "nice-protocol-config__save-btn", onClick:
|
|
3082
|
-
/* @__PURE__ */ e(
|
|
3083
|
-
"
|
|
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")
|
|
3084
3104
|
] })
|
|
3085
3105
|
] })
|
|
3086
3106
|
] });
|
|
3087
3107
|
}
|
|
3088
|
-
function
|
|
3108
|
+
function Re({ config: a, onChange: i }) {
|
|
3089
3109
|
const { t: c } = R();
|
|
3090
3110
|
return /* @__PURE__ */ r("div", { className: "nice-protocol-config__section", children: [
|
|
3091
3111
|
/* @__PURE__ */ e("h3", { children: c("protocolConfig.mqttConfiguration", "MQTT Configuration") }),
|
|
@@ -3158,7 +3178,7 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3158
3178
|
)
|
|
3159
3179
|
] }),
|
|
3160
3180
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3161
|
-
/* @__PURE__ */ e("label", { children: "Keep Alive (seconds)" }),
|
|
3181
|
+
/* @__PURE__ */ e("label", { children: c("protocolConfig.keepAlive", "Keep Alive (seconds)") }),
|
|
3162
3182
|
/* @__PURE__ */ e(
|
|
3163
3183
|
"input",
|
|
3164
3184
|
{
|
|
@@ -3182,15 +3202,15 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3182
3202
|
] }),
|
|
3183
3203
|
/* @__PURE__ */ e("h4", { children: c("protocolConfig.topics", "Topics") }),
|
|
3184
3204
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__topics", children: [
|
|
3185
|
-
a.topics.map((n,
|
|
3205
|
+
a.topics.map((n, t) => /* @__PURE__ */ r("div", { className: "nice-protocol-config__topic-row", children: [
|
|
3186
3206
|
/* @__PURE__ */ e(
|
|
3187
3207
|
"input",
|
|
3188
3208
|
{
|
|
3189
3209
|
type: "text",
|
|
3190
3210
|
value: n.pattern,
|
|
3191
|
-
onChange: (
|
|
3211
|
+
onChange: (o) => {
|
|
3192
3212
|
const d = [...a.topics];
|
|
3193
|
-
d[
|
|
3213
|
+
d[t] = { ...d[t], pattern: o.target.value }, i({ ...a, topics: d });
|
|
3194
3214
|
},
|
|
3195
3215
|
placeholder: c("protocolConfig.topicPatternPlaceholder", "e.g., sensors/+/data")
|
|
3196
3216
|
}
|
|
@@ -3199,9 +3219,9 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3199
3219
|
"select",
|
|
3200
3220
|
{
|
|
3201
3221
|
value: n.qos,
|
|
3202
|
-
onChange: (
|
|
3222
|
+
onChange: (o) => {
|
|
3203
3223
|
const d = [...a.topics];
|
|
3204
|
-
d[
|
|
3224
|
+
d[t] = { ...d[t], qos: parseInt(o.target.value, 10) }, i({ ...a, topics: d });
|
|
3205
3225
|
},
|
|
3206
3226
|
children: [
|
|
3207
3227
|
/* @__PURE__ */ e("option", { value: 0, children: c("protocolConfig.qos0", "QoS 0") }),
|
|
@@ -3214,11 +3234,11 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3214
3234
|
"select",
|
|
3215
3235
|
{
|
|
3216
3236
|
value: n.direction,
|
|
3217
|
-
onChange: (
|
|
3237
|
+
onChange: (o) => {
|
|
3218
3238
|
const d = [...a.topics];
|
|
3219
|
-
d[
|
|
3220
|
-
...d[
|
|
3221
|
-
direction:
|
|
3239
|
+
d[t] = {
|
|
3240
|
+
...d[t],
|
|
3241
|
+
direction: o.target.value
|
|
3222
3242
|
}, i({ ...a, topics: d });
|
|
3223
3243
|
},
|
|
3224
3244
|
children: [
|
|
@@ -3232,14 +3252,14 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3232
3252
|
"button",
|
|
3233
3253
|
{
|
|
3234
3254
|
onClick: () => {
|
|
3235
|
-
const
|
|
3236
|
-
i({ ...a, topics:
|
|
3255
|
+
const o = a.topics.filter((d, l) => l !== t);
|
|
3256
|
+
i({ ...a, topics: o });
|
|
3237
3257
|
},
|
|
3238
3258
|
children: "×"
|
|
3239
3259
|
}
|
|
3240
3260
|
)
|
|
3241
|
-
] },
|
|
3242
|
-
/* @__PURE__ */
|
|
3261
|
+
] }, t)),
|
|
3262
|
+
/* @__PURE__ */ r(
|
|
3243
3263
|
"button",
|
|
3244
3264
|
{
|
|
3245
3265
|
onClick: () => {
|
|
@@ -3251,13 +3271,17 @@ function Pe({ config: a, onChange: i }) {
|
|
|
3251
3271
|
]
|
|
3252
3272
|
});
|
|
3253
3273
|
},
|
|
3254
|
-
children:
|
|
3274
|
+
children: [
|
|
3275
|
+
/* @__PURE__ */ e(p, { name: "plus", size: 14 }),
|
|
3276
|
+
" ",
|
|
3277
|
+
c("protocolConfig.addTopic", "Add Topic")
|
|
3278
|
+
]
|
|
3255
3279
|
}
|
|
3256
3280
|
)
|
|
3257
3281
|
] })
|
|
3258
3282
|
] });
|
|
3259
3283
|
}
|
|
3260
|
-
function
|
|
3284
|
+
function Ie({ config: a, onChange: i }) {
|
|
3261
3285
|
const { t: c } = R();
|
|
3262
3286
|
return /* @__PURE__ */ r("div", { className: "nice-protocol-config__section", children: [
|
|
3263
3287
|
/* @__PURE__ */ e("h3", { children: c("protocolConfig.coapConfiguration", "CoAP Configuration") }),
|
|
@@ -3309,15 +3333,15 @@ function Re({ config: a, onChange: i }) {
|
|
|
3309
3333
|
] }),
|
|
3310
3334
|
/* @__PURE__ */ e("h4", { children: c("protocolConfig.resources", "Resources") }),
|
|
3311
3335
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__resources", children: [
|
|
3312
|
-
a.resources.map((n,
|
|
3336
|
+
a.resources.map((n, t) => /* @__PURE__ */ r("div", { className: "nice-protocol-config__resource-row", children: [
|
|
3313
3337
|
/* @__PURE__ */ e(
|
|
3314
3338
|
"input",
|
|
3315
3339
|
{
|
|
3316
3340
|
type: "text",
|
|
3317
3341
|
value: n.path,
|
|
3318
|
-
onChange: (
|
|
3342
|
+
onChange: (o) => {
|
|
3319
3343
|
const d = [...a.resources];
|
|
3320
|
-
d[
|
|
3344
|
+
d[t] = { ...d[t], path: o.target.value }, i({ ...a, resources: d });
|
|
3321
3345
|
},
|
|
3322
3346
|
placeholder: "/sensors/temperature"
|
|
3323
3347
|
}
|
|
@@ -3326,14 +3350,14 @@ function Re({ config: a, onChange: i }) {
|
|
|
3326
3350
|
"button",
|
|
3327
3351
|
{
|
|
3328
3352
|
onClick: () => {
|
|
3329
|
-
const
|
|
3330
|
-
i({ ...a, resources:
|
|
3353
|
+
const o = a.resources.filter((d, l) => l !== t);
|
|
3354
|
+
i({ ...a, resources: o });
|
|
3331
3355
|
},
|
|
3332
3356
|
children: "×"
|
|
3333
3357
|
}
|
|
3334
3358
|
)
|
|
3335
|
-
] },
|
|
3336
|
-
/* @__PURE__ */
|
|
3359
|
+
] }, t)),
|
|
3360
|
+
/* @__PURE__ */ r(
|
|
3337
3361
|
"button",
|
|
3338
3362
|
{
|
|
3339
3363
|
onClick: () => {
|
|
@@ -3345,13 +3369,17 @@ function Re({ config: a, onChange: i }) {
|
|
|
3345
3369
|
]
|
|
3346
3370
|
});
|
|
3347
3371
|
},
|
|
3348
|
-
children:
|
|
3372
|
+
children: [
|
|
3373
|
+
/* @__PURE__ */ e(p, { name: "plus", size: 14 }),
|
|
3374
|
+
" ",
|
|
3375
|
+
c("protocolConfig.addResource", "Add Resource")
|
|
3376
|
+
]
|
|
3349
3377
|
}
|
|
3350
3378
|
)
|
|
3351
3379
|
] })
|
|
3352
3380
|
] });
|
|
3353
3381
|
}
|
|
3354
|
-
function
|
|
3382
|
+
function Ue({
|
|
3355
3383
|
config: a,
|
|
3356
3384
|
type: i,
|
|
3357
3385
|
onChange: c
|
|
@@ -3364,7 +3392,7 @@ function Ie({
|
|
|
3364
3392
|
" Configuration"
|
|
3365
3393
|
] }),
|
|
3366
3394
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__grid", children: [
|
|
3367
|
-
i === "tcp" && /* @__PURE__ */ r(
|
|
3395
|
+
i === "tcp" && /* @__PURE__ */ r(P, { children: [
|
|
3368
3396
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3369
3397
|
/* @__PURE__ */ e("label", { children: n("protocolConfig.host", "Host") }),
|
|
3370
3398
|
/* @__PURE__ */ e(
|
|
@@ -3372,7 +3400,7 @@ function Ie({
|
|
|
3372
3400
|
{
|
|
3373
3401
|
type: "text",
|
|
3374
3402
|
value: a.host || "",
|
|
3375
|
-
onChange: (
|
|
3403
|
+
onChange: (t) => c({ ...a, host: t.target.value })
|
|
3376
3404
|
}
|
|
3377
3405
|
)
|
|
3378
3406
|
] }),
|
|
@@ -3383,12 +3411,12 @@ function Ie({
|
|
|
3383
3411
|
{
|
|
3384
3412
|
type: "number",
|
|
3385
3413
|
value: a.port || 502,
|
|
3386
|
-
onChange: (
|
|
3414
|
+
onChange: (t) => c({ ...a, port: parseInt(t.target.value, 10) || 502 })
|
|
3387
3415
|
}
|
|
3388
3416
|
)
|
|
3389
3417
|
] })
|
|
3390
3418
|
] }),
|
|
3391
|
-
i === "rtu" && /* @__PURE__ */ r(
|
|
3419
|
+
i === "rtu" && /* @__PURE__ */ r(P, { children: [
|
|
3392
3420
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3393
3421
|
/* @__PURE__ */ e("label", { children: n("protocolConfig.serialPort", "Serial Port") }),
|
|
3394
3422
|
/* @__PURE__ */ e(
|
|
@@ -3396,7 +3424,7 @@ function Ie({
|
|
|
3396
3424
|
{
|
|
3397
3425
|
type: "text",
|
|
3398
3426
|
value: a.serialPort || "",
|
|
3399
|
-
onChange: (
|
|
3427
|
+
onChange: (t) => c({ ...a, serialPort: t.target.value }),
|
|
3400
3428
|
placeholder: n("protocolConfig.serialPortPlaceholder", "COM1 or /dev/ttyUSB0")
|
|
3401
3429
|
}
|
|
3402
3430
|
)
|
|
@@ -3407,7 +3435,7 @@ function Ie({
|
|
|
3407
3435
|
"select",
|
|
3408
3436
|
{
|
|
3409
3437
|
value: a.baudRate || 9600,
|
|
3410
|
-
onChange: (
|
|
3438
|
+
onChange: (t) => c({ ...a, baudRate: parseInt(t.target.value, 10) }),
|
|
3411
3439
|
children: [
|
|
3412
3440
|
/* @__PURE__ */ e("option", { value: 9600, children: "9600" }),
|
|
3413
3441
|
/* @__PURE__ */ e("option", { value: 19200, children: "19200" }),
|
|
@@ -3424,11 +3452,11 @@ function Ie({
|
|
|
3424
3452
|
"select",
|
|
3425
3453
|
{
|
|
3426
3454
|
value: a.parity || "none",
|
|
3427
|
-
onChange: (
|
|
3455
|
+
onChange: (t) => c({ ...a, parity: t.target.value }),
|
|
3428
3456
|
children: [
|
|
3429
3457
|
/* @__PURE__ */ e("option", { value: "none", children: n("protocolConfig.none", "None") }),
|
|
3430
3458
|
/* @__PURE__ */ e("option", { value: "even", children: n("protocolConfig.even", "Even") }),
|
|
3431
|
-
/* @__PURE__ */ e("option", { value: "odd", children: "Odd" })
|
|
3459
|
+
/* @__PURE__ */ e("option", { value: "odd", children: n("protocolConfig.odd", "Odd") })
|
|
3432
3460
|
]
|
|
3433
3461
|
}
|
|
3434
3462
|
)
|
|
@@ -3441,20 +3469,20 @@ function Ie({
|
|
|
3441
3469
|
{
|
|
3442
3470
|
type: "number",
|
|
3443
3471
|
value: a.slaveId,
|
|
3444
|
-
onChange: (
|
|
3472
|
+
onChange: (t) => c({ ...a, slaveId: parseInt(t.target.value, 10) || 1 }),
|
|
3445
3473
|
min: 1,
|
|
3446
3474
|
max: 247
|
|
3447
3475
|
}
|
|
3448
3476
|
)
|
|
3449
3477
|
] }),
|
|
3450
3478
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3451
|
-
/* @__PURE__ */ e("label", { children: "Timeout (ms)" }),
|
|
3479
|
+
/* @__PURE__ */ e("label", { children: n("protocolConfig.timeoutMs", "Timeout (ms)") }),
|
|
3452
3480
|
/* @__PURE__ */ e(
|
|
3453
3481
|
"input",
|
|
3454
3482
|
{
|
|
3455
3483
|
type: "number",
|
|
3456
3484
|
value: a.timeout,
|
|
3457
|
-
onChange: (
|
|
3485
|
+
onChange: (t) => c({ ...a, timeout: parseInt(t.target.value, 10) || 1e3 })
|
|
3458
3486
|
}
|
|
3459
3487
|
)
|
|
3460
3488
|
] })
|
|
@@ -3466,18 +3494,18 @@ function Ie({
|
|
|
3466
3494
|
/* @__PURE__ */ e("th", { children: n("protocolConfig.address", "Address") }),
|
|
3467
3495
|
/* @__PURE__ */ e("th", { children: n("protocolConfig.type", "Type") }),
|
|
3468
3496
|
/* @__PURE__ */ e("th", { children: n("protocolConfig.dataType", "Data Type") }),
|
|
3469
|
-
/* @__PURE__ */ e("th", { children: "R/W" }),
|
|
3497
|
+
/* @__PURE__ */ e("th", { children: n("protocolConfig.readWrite", "R/W") }),
|
|
3470
3498
|
/* @__PURE__ */ e("th", {})
|
|
3471
3499
|
] }) }),
|
|
3472
|
-
/* @__PURE__ */ e("tbody", { children: a.registers.map((
|
|
3500
|
+
/* @__PURE__ */ e("tbody", { children: a.registers.map((t, o) => /* @__PURE__ */ r("tr", { children: [
|
|
3473
3501
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
3474
3502
|
"input",
|
|
3475
3503
|
{
|
|
3476
3504
|
type: "text",
|
|
3477
|
-
value:
|
|
3505
|
+
value: t.name,
|
|
3478
3506
|
onChange: (d) => {
|
|
3479
3507
|
const l = [...a.registers];
|
|
3480
|
-
l[
|
|
3508
|
+
l[o] = { ...l[o], name: d.target.value }, c({ ...a, registers: l });
|
|
3481
3509
|
}
|
|
3482
3510
|
}
|
|
3483
3511
|
) }),
|
|
@@ -3485,11 +3513,11 @@ function Ie({
|
|
|
3485
3513
|
"input",
|
|
3486
3514
|
{
|
|
3487
3515
|
type: "number",
|
|
3488
|
-
value:
|
|
3516
|
+
value: t.address,
|
|
3489
3517
|
onChange: (d) => {
|
|
3490
3518
|
const l = [...a.registers];
|
|
3491
|
-
l[
|
|
3492
|
-
...l[
|
|
3519
|
+
l[o] = {
|
|
3520
|
+
...l[o],
|
|
3493
3521
|
address: parseInt(d.target.value, 10) || 0
|
|
3494
3522
|
}, c({ ...a, registers: l });
|
|
3495
3523
|
}
|
|
@@ -3498,11 +3526,11 @@ function Ie({
|
|
|
3498
3526
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ r(
|
|
3499
3527
|
"select",
|
|
3500
3528
|
{
|
|
3501
|
-
value:
|
|
3529
|
+
value: t.type,
|
|
3502
3530
|
onChange: (d) => {
|
|
3503
3531
|
const l = [...a.registers];
|
|
3504
|
-
l[
|
|
3505
|
-
...l[
|
|
3532
|
+
l[o] = {
|
|
3533
|
+
...l[o],
|
|
3506
3534
|
type: d.target.value
|
|
3507
3535
|
}, c({ ...a, registers: l });
|
|
3508
3536
|
},
|
|
@@ -3517,11 +3545,11 @@ function Ie({
|
|
|
3517
3545
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ r(
|
|
3518
3546
|
"select",
|
|
3519
3547
|
{
|
|
3520
|
-
value:
|
|
3548
|
+
value: t.dataType,
|
|
3521
3549
|
onChange: (d) => {
|
|
3522
3550
|
const l = [...a.registers];
|
|
3523
|
-
l[
|
|
3524
|
-
...l[
|
|
3551
|
+
l[o] = {
|
|
3552
|
+
...l[o],
|
|
3525
3553
|
dataType: d.target.value
|
|
3526
3554
|
}, c({ ...a, registers: l });
|
|
3527
3555
|
},
|
|
@@ -3540,10 +3568,10 @@ function Ie({
|
|
|
3540
3568
|
"input",
|
|
3541
3569
|
{
|
|
3542
3570
|
type: "checkbox",
|
|
3543
|
-
checked:
|
|
3571
|
+
checked: t.readable,
|
|
3544
3572
|
onChange: (d) => {
|
|
3545
3573
|
const l = [...a.registers];
|
|
3546
|
-
l[
|
|
3574
|
+
l[o] = { ...l[o], readable: d.target.checked }, c({ ...a, registers: l });
|
|
3547
3575
|
},
|
|
3548
3576
|
title: n("protocolConfig.readable", "Readable")
|
|
3549
3577
|
}
|
|
@@ -3552,10 +3580,10 @@ function Ie({
|
|
|
3552
3580
|
"input",
|
|
3553
3581
|
{
|
|
3554
3582
|
type: "checkbox",
|
|
3555
|
-
checked:
|
|
3583
|
+
checked: t.writable,
|
|
3556
3584
|
onChange: (d) => {
|
|
3557
3585
|
const l = [...a.registers];
|
|
3558
|
-
l[
|
|
3586
|
+
l[o] = { ...l[o], writable: d.target.checked }, c({ ...a, registers: l });
|
|
3559
3587
|
},
|
|
3560
3588
|
title: n("protocolConfig.writable", "Writable")
|
|
3561
3589
|
}
|
|
@@ -3565,15 +3593,15 @@ function Ie({
|
|
|
3565
3593
|
"button",
|
|
3566
3594
|
{
|
|
3567
3595
|
onClick: () => {
|
|
3568
|
-
const d = a.registers.filter((l, b) => b !==
|
|
3596
|
+
const d = a.registers.filter((l, b) => b !== o);
|
|
3569
3597
|
c({ ...a, registers: d });
|
|
3570
3598
|
},
|
|
3571
3599
|
children: "×"
|
|
3572
3600
|
}
|
|
3573
3601
|
) })
|
|
3574
|
-
] },
|
|
3602
|
+
] }, o)) })
|
|
3575
3603
|
] }),
|
|
3576
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ r(
|
|
3577
3605
|
"button",
|
|
3578
3606
|
{
|
|
3579
3607
|
onClick: () => {
|
|
@@ -3592,7 +3620,11 @@ function Ie({
|
|
|
3592
3620
|
]
|
|
3593
3621
|
});
|
|
3594
3622
|
},
|
|
3595
|
-
children:
|
|
3623
|
+
children: [
|
|
3624
|
+
/* @__PURE__ */ e(p, { name: "plus", size: 14 }),
|
|
3625
|
+
" ",
|
|
3626
|
+
n("protocolConfig.addRegister", "Add Register")
|
|
3627
|
+
]
|
|
3596
3628
|
}
|
|
3597
3629
|
)
|
|
3598
3630
|
] });
|
|
@@ -3644,13 +3676,13 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3644
3676
|
}),
|
|
3645
3677
|
children: [
|
|
3646
3678
|
/* @__PURE__ */ e("option", { value: "anonymous", children: c("protocolConfig.anonymous", "Anonymous") }),
|
|
3647
|
-
/* @__PURE__ */ e("option", { value: "username", children: "Username/Password" }),
|
|
3679
|
+
/* @__PURE__ */ e("option", { value: "username", children: c("protocolConfig.usernamePassword", "Username/Password") }),
|
|
3648
3680
|
/* @__PURE__ */ e("option", { value: "certificate", children: c("protocolConfig.certificate", "Certificate") })
|
|
3649
3681
|
]
|
|
3650
3682
|
}
|
|
3651
3683
|
)
|
|
3652
3684
|
] }),
|
|
3653
|
-
a.authentication === "username" && /* @__PURE__ */ r(
|
|
3685
|
+
a.authentication === "username" && /* @__PURE__ */ r(P, { children: [
|
|
3654
3686
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__field", children: [
|
|
3655
3687
|
/* @__PURE__ */ e("label", { children: c("protocolConfig.username", "Username") }),
|
|
3656
3688
|
/* @__PURE__ */ e(
|
|
@@ -3688,15 +3720,15 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3688
3720
|
] }),
|
|
3689
3721
|
/* @__PURE__ */ e("h4", { children: c("protocolConfig.nodes", "Nodes") }),
|
|
3690
3722
|
/* @__PURE__ */ r("div", { className: "nice-protocol-config__nodes", children: [
|
|
3691
|
-
a.nodes.map((n,
|
|
3723
|
+
a.nodes.map((n, t) => /* @__PURE__ */ r("div", { className: "nice-protocol-config__node-row", children: [
|
|
3692
3724
|
/* @__PURE__ */ e(
|
|
3693
3725
|
"input",
|
|
3694
3726
|
{
|
|
3695
3727
|
type: "text",
|
|
3696
3728
|
value: n.nodeId,
|
|
3697
|
-
onChange: (
|
|
3729
|
+
onChange: (o) => {
|
|
3698
3730
|
const d = [...a.nodes];
|
|
3699
|
-
d[
|
|
3731
|
+
d[t] = { ...d[t], nodeId: o.target.value }, i({ ...a, nodes: d });
|
|
3700
3732
|
},
|
|
3701
3733
|
placeholder: c("protocolConfig.nodeIdPlaceholder", "ns=2;s=Temperature")
|
|
3702
3734
|
}
|
|
@@ -3706,9 +3738,9 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3706
3738
|
{
|
|
3707
3739
|
type: "text",
|
|
3708
3740
|
value: n.displayName,
|
|
3709
|
-
onChange: (
|
|
3741
|
+
onChange: (o) => {
|
|
3710
3742
|
const d = [...a.nodes];
|
|
3711
|
-
d[
|
|
3743
|
+
d[t] = { ...d[t], displayName: o.target.value }, i({ ...a, nodes: d });
|
|
3712
3744
|
},
|
|
3713
3745
|
placeholder: c("protocolConfig.displayNamePlaceholder", "Display Name")
|
|
3714
3746
|
}
|
|
@@ -3717,14 +3749,14 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3717
3749
|
"button",
|
|
3718
3750
|
{
|
|
3719
3751
|
onClick: () => {
|
|
3720
|
-
const
|
|
3721
|
-
i({ ...a, nodes:
|
|
3752
|
+
const o = a.nodes.filter((d, l) => l !== t);
|
|
3753
|
+
i({ ...a, nodes: o });
|
|
3722
3754
|
},
|
|
3723
3755
|
children: "×"
|
|
3724
3756
|
}
|
|
3725
3757
|
)
|
|
3726
|
-
] },
|
|
3727
|
-
/* @__PURE__ */
|
|
3758
|
+
] }, t)),
|
|
3759
|
+
/* @__PURE__ */ r(
|
|
3728
3760
|
"button",
|
|
3729
3761
|
{
|
|
3730
3762
|
onClick: () => {
|
|
@@ -3736,14 +3768,18 @@ function Ee({ config: a, onChange: i }) {
|
|
|
3736
3768
|
]
|
|
3737
3769
|
});
|
|
3738
3770
|
},
|
|
3739
|
-
children:
|
|
3771
|
+
children: [
|
|
3772
|
+
/* @__PURE__ */ e(p, { name: "plus", size: 14 }),
|
|
3773
|
+
" ",
|
|
3774
|
+
c("protocolConfig.addNode", "Add Node")
|
|
3775
|
+
]
|
|
3740
3776
|
}
|
|
3741
3777
|
)
|
|
3742
3778
|
] })
|
|
3743
3779
|
] });
|
|
3744
3780
|
}
|
|
3745
3781
|
export {
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3782
|
+
Oe as NiceEdgeManager,
|
|
3783
|
+
Fe as NiceIoTDashboard,
|
|
3784
|
+
qe as NiceProtocolConfig
|
|
3749
3785
|
};
|