@nice2dev/ui-iot 1.0.11 → 1.0.14
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 +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +183 -182
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -14,16 +14,16 @@ const $ = [
|
|
|
14
14
|
];
|
|
15
15
|
function re({
|
|
16
16
|
devices: a = [],
|
|
17
|
-
widgets:
|
|
17
|
+
widgets: t = [],
|
|
18
18
|
alarms: n = [],
|
|
19
19
|
onDeviceSelect: r,
|
|
20
20
|
onWidgetChange: l,
|
|
21
|
-
onCommand:
|
|
21
|
+
onCommand: c,
|
|
22
22
|
onAlarmAcknowledge: d,
|
|
23
23
|
fetchTelemetry: o,
|
|
24
|
-
className:
|
|
24
|
+
className: S = ""
|
|
25
25
|
}) {
|
|
26
|
-
const [u, D] = p(
|
|
26
|
+
const [u, D] = p(t), [g, f] = p(null), [m, w] = p("dashboard"), [_, C] = p(!1), [b, M] = p(""), h = v(
|
|
27
27
|
(s) => {
|
|
28
28
|
D((N) => {
|
|
29
29
|
const y = s(N);
|
|
@@ -31,7 +31,7 @@ function re({
|
|
|
31
31
|
});
|
|
32
32
|
},
|
|
33
33
|
[l]
|
|
34
|
-
),
|
|
34
|
+
), k = v(
|
|
35
35
|
(s) => {
|
|
36
36
|
var y;
|
|
37
37
|
const N = {
|
|
@@ -49,17 +49,17 @@ function re({
|
|
|
49
49
|
f(s), r == null || r(s);
|
|
50
50
|
},
|
|
51
51
|
[r]
|
|
52
|
-
),
|
|
52
|
+
), T = v(
|
|
53
53
|
(s) => {
|
|
54
54
|
d == null || d(s);
|
|
55
55
|
},
|
|
56
56
|
[d]
|
|
57
57
|
), G = a.filter(
|
|
58
58
|
(s) => !b || s.name.toLowerCase().includes(b.toLowerCase()) || s.type.toLowerCase().includes(b.toLowerCase())
|
|
59
|
-
), I = n.filter((s) => !s.cleared),
|
|
59
|
+
), I = n.filter((s) => !s.cleared), x = I.filter(
|
|
60
60
|
(s) => s.severity === "critical" || s.severity === "high"
|
|
61
61
|
);
|
|
62
|
-
return /* @__PURE__ */ i("div", { className: `nice-iot-dashboard ${
|
|
62
|
+
return /* @__PURE__ */ i("div", { className: `nice-iot-dashboard ${S}`, children: [
|
|
63
63
|
/* @__PURE__ */ i("header", { className: "nice-iot-dashboard__header", children: [
|
|
64
64
|
/* @__PURE__ */ e("h1", { children: "IoT Dashboard" }),
|
|
65
65
|
/* @__PURE__ */ i("div", { className: "nice-iot-dashboard__stats", children: [
|
|
@@ -78,9 +78,9 @@ function re({
|
|
|
78
78
|
a.filter((s) => s.status === "offline").length,
|
|
79
79
|
" Offline"
|
|
80
80
|
] }),
|
|
81
|
-
|
|
81
|
+
x.length > 0 && /* @__PURE__ */ i("span", { className: "nice-iot-dashboard__stat nice-iot-dashboard__stat--alarms", children: [
|
|
82
82
|
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__stat-icon", children: "🚨" }),
|
|
83
|
-
|
|
83
|
+
x.length,
|
|
84
84
|
" Alarms"
|
|
85
85
|
] })
|
|
86
86
|
] }),
|
|
@@ -99,7 +99,7 @@ function re({
|
|
|
99
99
|
I.length > 0 && `(${I.length})`
|
|
100
100
|
] })
|
|
101
101
|
] }),
|
|
102
|
-
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__actions", children: m === "dashboard" && /* @__PURE__ */ e("button", { onClick: () =>
|
|
102
|
+
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__actions", children: m === "dashboard" && /* @__PURE__ */ e("button", { onClick: () => C(!_), children: _ ? "✓ Done" : "✏️ Edit" }) })
|
|
103
103
|
] }),
|
|
104
104
|
m === "dashboard" && /* @__PURE__ */ i("div", { className: "nice-iot-dashboard__main", children: [
|
|
105
105
|
_ && /* @__PURE__ */ i("aside", { className: "nice-iot-dashboard__palette", children: [
|
|
@@ -108,7 +108,7 @@ function re({
|
|
|
108
108
|
"button",
|
|
109
109
|
{
|
|
110
110
|
className: "nice-iot-dashboard__palette-item",
|
|
111
|
-
onClick: () =>
|
|
111
|
+
onClick: () => k(s.type),
|
|
112
112
|
children: [
|
|
113
113
|
/* @__PURE__ */ e("span", { children: s.icon }),
|
|
114
114
|
/* @__PURE__ */ e("span", { children: s.label })
|
|
@@ -125,7 +125,7 @@ function re({
|
|
|
125
125
|
devices: a,
|
|
126
126
|
alarms: n,
|
|
127
127
|
isEditing: _,
|
|
128
|
-
onCommand:
|
|
128
|
+
onCommand: c,
|
|
129
129
|
onDelete: () => h((N) => N.filter((y) => y.id !== s.id))
|
|
130
130
|
},
|
|
131
131
|
s.id
|
|
@@ -156,7 +156,7 @@ function re({
|
|
|
156
156
|
H,
|
|
157
157
|
{
|
|
158
158
|
device: g,
|
|
159
|
-
onCommand:
|
|
159
|
+
onCommand: c,
|
|
160
160
|
onClose: () => f(null)
|
|
161
161
|
}
|
|
162
162
|
)
|
|
@@ -188,7 +188,7 @@ function re({
|
|
|
188
188
|
/* @__PURE__ */ e("td", { children: s.message }),
|
|
189
189
|
/* @__PURE__ */ e("td", { children: s.timestamp.toLocaleString() }),
|
|
190
190
|
/* @__PURE__ */ e("td", { children: s.acknowledged ? "Acknowledged" : "Active" }),
|
|
191
|
-
/* @__PURE__ */ e("td", { children: !s.acknowledged && /* @__PURE__ */ e("button", { onClick: () =>
|
|
191
|
+
/* @__PURE__ */ e("td", { children: !s.acknowledged && /* @__PURE__ */ e("button", { onClick: () => T(s.id), children: "Acknowledge" }) })
|
|
192
192
|
]
|
|
193
193
|
},
|
|
194
194
|
s.id
|
|
@@ -198,31 +198,31 @@ function re({
|
|
|
198
198
|
] });
|
|
199
199
|
}
|
|
200
200
|
function Q(a) {
|
|
201
|
-
return a.length === 0 ? 0 : Math.max(...a.map((
|
|
201
|
+
return a.length === 0 ? 0 : Math.max(...a.map((t) => t.position.y + t.position.height));
|
|
202
202
|
}
|
|
203
203
|
function U(a) {
|
|
204
204
|
switch (a) {
|
|
205
205
|
case "online":
|
|
206
|
-
return "#28a745";
|
|
206
|
+
return "var(--nice-success, #28a745)";
|
|
207
207
|
case "offline":
|
|
208
|
-
return "#6c757d";
|
|
208
|
+
return "var(--nice-text-secondary, #6c757d)";
|
|
209
209
|
case "warning":
|
|
210
|
-
return "#ffc107";
|
|
210
|
+
return "var(--nice-warning, #ffc107)";
|
|
211
211
|
case "error":
|
|
212
|
-
return "#dc3545";
|
|
212
|
+
return "var(--nice-danger, #dc3545)";
|
|
213
213
|
case "maintenance":
|
|
214
|
-
return "#17a2b8";
|
|
214
|
+
return "var(--nice-info, #17a2b8)";
|
|
215
215
|
default:
|
|
216
|
-
return "#6c757d";
|
|
216
|
+
return "var(--nice-text-secondary, #6c757d)";
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function W({
|
|
220
220
|
widget: a,
|
|
221
|
-
devices:
|
|
221
|
+
devices: t,
|
|
222
222
|
alarms: n,
|
|
223
223
|
isEditing: r,
|
|
224
224
|
onCommand: l,
|
|
225
|
-
onDelete:
|
|
225
|
+
onDelete: c
|
|
226
226
|
}) {
|
|
227
227
|
const d = $.find((o) => o.type === a.type);
|
|
228
228
|
return /* @__PURE__ */ i(
|
|
@@ -237,46 +237,46 @@ function W({
|
|
|
237
237
|
/* @__PURE__ */ i("div", { className: "nice-iot-dashboard__widget-header", children: [
|
|
238
238
|
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__widget-icon", children: d == null ? void 0 : d.icon }),
|
|
239
239
|
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__widget-title", children: a.title }),
|
|
240
|
-
r && /* @__PURE__ */ e("button", { className: "nice-iot-dashboard__widget-delete", onClick:
|
|
240
|
+
r && /* @__PURE__ */ e("button", { className: "nice-iot-dashboard__widget-delete", onClick: c, children: "×" })
|
|
241
241
|
] }),
|
|
242
|
-
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__widget-content", children: /* @__PURE__ */ e(V, { widget: a, devices:
|
|
242
|
+
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__widget-content", children: /* @__PURE__ */ e(V, { widget: a, devices: t, alarms: n, onCommand: l }) })
|
|
243
243
|
]
|
|
244
244
|
}
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
function V({
|
|
248
248
|
widget: a,
|
|
249
|
-
devices:
|
|
249
|
+
devices: t,
|
|
250
250
|
alarms: n,
|
|
251
251
|
onCommand: r
|
|
252
252
|
}) {
|
|
253
253
|
switch (a.type) {
|
|
254
254
|
case "device-list":
|
|
255
|
-
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__device-list", children:
|
|
255
|
+
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__device-list", children: t.slice(0, 10).map((l) => /* @__PURE__ */ i("div", { className: "nice-iot-dashboard__device-list-item", children: [
|
|
256
256
|
/* @__PURE__ */ e(
|
|
257
257
|
"span",
|
|
258
258
|
{
|
|
259
259
|
className: "nice-iot-dashboard__device-status",
|
|
260
|
-
style: { background: U(
|
|
260
|
+
style: { background: U(l.status) }
|
|
261
261
|
}
|
|
262
262
|
),
|
|
263
|
-
/* @__PURE__ */ e("span", { children:
|
|
264
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__device-type", children:
|
|
265
|
-
] },
|
|
263
|
+
/* @__PURE__ */ e("span", { children: l.name }),
|
|
264
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__device-type", children: l.type })
|
|
265
|
+
] }, l.id)) });
|
|
266
266
|
case "device-status":
|
|
267
|
-
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__status-grid", children: ["online", "offline", "warning", "error"].map((
|
|
268
|
-
const
|
|
267
|
+
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__status-grid", children: ["online", "offline", "warning", "error"].map((l) => {
|
|
268
|
+
const c = t.filter((d) => d.status === l).length;
|
|
269
269
|
return /* @__PURE__ */ i("div", { className: "nice-iot-dashboard__status-card", children: [
|
|
270
270
|
/* @__PURE__ */ e(
|
|
271
271
|
"span",
|
|
272
272
|
{
|
|
273
273
|
className: "nice-iot-dashboard__status-indicator",
|
|
274
|
-
style: { background: U(
|
|
274
|
+
style: { background: U(l) }
|
|
275
275
|
}
|
|
276
276
|
),
|
|
277
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-count", children:
|
|
278
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-label", children:
|
|
279
|
-
] },
|
|
277
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-count", children: c }),
|
|
278
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__status-label", children: l })
|
|
279
|
+
] }, l);
|
|
280
280
|
}) });
|
|
281
281
|
case "telemetry-chart":
|
|
282
282
|
return /* @__PURE__ */ i("div", { className: "nice-iot-dashboard__chart-placeholder", children: [
|
|
@@ -286,13 +286,13 @@ function V({
|
|
|
286
286
|
] });
|
|
287
287
|
case "gauge":
|
|
288
288
|
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__gauge", children: /* @__PURE__ */ i("svg", { viewBox: "0 0 100 60", children: [
|
|
289
|
-
/* @__PURE__ */ e("path", { d: "M 10 55 A 40 40 0 0 1 90 55", fill: "none", stroke: "#e0e0e0", strokeWidth: "8" }),
|
|
289
|
+
/* @__PURE__ */ e("path", { d: "M 10 55 A 40 40 0 0 1 90 55", fill: "none", stroke: "var(--nice-border, #e0e0e0)", strokeWidth: "8" }),
|
|
290
290
|
/* @__PURE__ */ e(
|
|
291
291
|
"path",
|
|
292
292
|
{
|
|
293
293
|
d: "M 10 55 A 40 40 0 0 1 90 55",
|
|
294
294
|
fill: "none",
|
|
295
|
-
stroke: "#0066cc",
|
|
295
|
+
stroke: "var(--nice-primary, #0066cc)",
|
|
296
296
|
strokeWidth: "8",
|
|
297
297
|
strokeDasharray: "63 126"
|
|
298
298
|
}
|
|
@@ -304,23 +304,24 @@ function V({
|
|
|
304
304
|
/* @__PURE__ */ e("span", { children: "🗺️" }),
|
|
305
305
|
/* @__PURE__ */ e("span", { children: "Device Map" }),
|
|
306
306
|
/* @__PURE__ */ i("small", { children: [
|
|
307
|
-
|
|
307
|
+
t.filter((l) => l.location).length,
|
|
308
308
|
" devices with location"
|
|
309
309
|
] })
|
|
310
310
|
] });
|
|
311
|
-
case "alarms":
|
|
312
|
-
const l = n.filter((
|
|
313
|
-
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__alarm-list", children: l.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__alarm-empty", children: "No active alarms" }) : l.map((
|
|
311
|
+
case "alarms": {
|
|
312
|
+
const l = n.filter((c) => !c.cleared).slice(0, 5);
|
|
313
|
+
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__alarm-list", children: l.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__alarm-empty", children: "No active alarms" }) : l.map((c) => /* @__PURE__ */ i(
|
|
314
314
|
"div",
|
|
315
315
|
{
|
|
316
|
-
className: `nice-iot-dashboard__alarm-item nice-iot-dashboard__alarm-item--${
|
|
316
|
+
className: `nice-iot-dashboard__alarm-item nice-iot-dashboard__alarm-item--${c.severity}`,
|
|
317
317
|
children: [
|
|
318
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-severity", children:
|
|
319
|
-
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-message", children:
|
|
318
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-severity", children: c.severity }),
|
|
319
|
+
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__alarm-message", children: c.message })
|
|
320
320
|
]
|
|
321
321
|
},
|
|
322
|
-
|
|
322
|
+
c.id
|
|
323
323
|
)) });
|
|
324
|
+
}
|
|
324
325
|
case "control-panel":
|
|
325
326
|
return /* @__PURE__ */ i("div", { className: "nice-iot-dashboard__control-placeholder", children: [
|
|
326
327
|
/* @__PURE__ */ e("span", { children: "🎛️" }),
|
|
@@ -329,18 +330,18 @@ function V({
|
|
|
329
330
|
] });
|
|
330
331
|
case "kpi":
|
|
331
332
|
return /* @__PURE__ */ i("div", { className: "nice-iot-dashboard__kpi", children: [
|
|
332
|
-
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__kpi-value", children:
|
|
333
|
+
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__kpi-value", children: t.length }),
|
|
333
334
|
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__kpi-label", children: "Total Devices" })
|
|
334
335
|
] });
|
|
335
336
|
default:
|
|
336
337
|
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__widget-placeholder", children: a.type });
|
|
337
338
|
}
|
|
338
339
|
}
|
|
339
|
-
function j({ device: a, isSelected:
|
|
340
|
+
function j({ device: a, isSelected: t, onSelect: n }) {
|
|
340
341
|
return /* @__PURE__ */ i(
|
|
341
342
|
"div",
|
|
342
343
|
{
|
|
343
|
-
className: `nice-iot-dashboard__device-card ${
|
|
344
|
+
className: `nice-iot-dashboard__device-card ${t ? "nice-iot-dashboard__device-card--selected" : ""}`,
|
|
344
345
|
onClick: n,
|
|
345
346
|
children: [
|
|
346
347
|
/* @__PURE__ */ i("div", { className: "nice-iot-dashboard__device-card-header", children: [
|
|
@@ -382,7 +383,7 @@ function j({ device: a, isSelected: c, onSelect: n }) {
|
|
|
382
383
|
}
|
|
383
384
|
function H({
|
|
384
385
|
device: a,
|
|
385
|
-
onCommand:
|
|
386
|
+
onCommand: t,
|
|
386
387
|
onClose: n
|
|
387
388
|
}) {
|
|
388
389
|
return /* @__PURE__ */ i("aside", { className: "nice-iot-dashboard__device-detail", children: [
|
|
@@ -440,11 +441,11 @@ function H({
|
|
|
440
441
|
/* @__PURE__ */ e("div", { className: "nice-iot-dashboard__capabilities-list", children: a.capabilities.map((r) => /* @__PURE__ */ i("div", { className: "nice-iot-dashboard__capability-item", children: [
|
|
441
442
|
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__capability-name", children: r.name }),
|
|
442
443
|
/* @__PURE__ */ e("span", { className: "nice-iot-dashboard__capability-type", children: r.type }),
|
|
443
|
-
r.writable &&
|
|
444
|
+
r.writable && t && /* @__PURE__ */ e(
|
|
444
445
|
"button",
|
|
445
446
|
{
|
|
446
447
|
className: "nice-iot-dashboard__capability-control",
|
|
447
|
-
onClick: () =>
|
|
448
|
+
onClick: () => t(a.id, r.id, !0),
|
|
448
449
|
children: "Control"
|
|
449
450
|
}
|
|
450
451
|
)
|
|
@@ -463,32 +464,32 @@ const K = [
|
|
|
463
464
|
];
|
|
464
465
|
function le({
|
|
465
466
|
nodes: a = [],
|
|
466
|
-
modules:
|
|
467
|
+
modules: t = [],
|
|
467
468
|
onNodeSelect: n,
|
|
468
469
|
onModuleDeploy: r,
|
|
469
470
|
onModuleAction: l,
|
|
470
|
-
onNodeSync:
|
|
471
|
+
onNodeSync: c,
|
|
471
472
|
className: d = ""
|
|
472
473
|
}) {
|
|
473
|
-
const [o,
|
|
474
|
+
const [o, S] = p(null), [u, D] = p("nodes"), [g, f] = p(!1), [m, w] = p({
|
|
474
475
|
name: "",
|
|
475
476
|
image: "",
|
|
476
477
|
status: "pending"
|
|
477
478
|
}), _ = v(
|
|
478
479
|
(h) => {
|
|
479
|
-
|
|
480
|
+
S(h), n == null || n(h);
|
|
480
481
|
},
|
|
481
482
|
[n]
|
|
482
|
-
),
|
|
483
|
+
), C = v(async () => {
|
|
483
484
|
!o || !m.name || !m.image || (await (r == null ? void 0 : r(o.id, m)), f(!1), w({ name: "", image: "", status: "pending" }));
|
|
484
485
|
}, [o, m, r]), b = v(
|
|
485
|
-
async (h,
|
|
486
|
-
o && await (l == null ? void 0 : l(o.id, h,
|
|
486
|
+
async (h, k) => {
|
|
487
|
+
o && await (l == null ? void 0 : l(o.id, h, k));
|
|
487
488
|
},
|
|
488
489
|
[o, l]
|
|
489
490
|
), M = v(async () => {
|
|
490
|
-
o && await (
|
|
491
|
-
}, [o,
|
|
491
|
+
o && await (c == null ? void 0 : c(o.id));
|
|
492
|
+
}, [o, c]);
|
|
492
493
|
return /* @__PURE__ */ i("div", { className: `nice-edge-manager ${d}`, children: [
|
|
493
494
|
/* @__PURE__ */ i("header", { className: "nice-edge-manager__header", children: [
|
|
494
495
|
/* @__PURE__ */ e("h1", { children: "Edge Manager" }),
|
|
@@ -534,7 +535,7 @@ function le({
|
|
|
534
535
|
J,
|
|
535
536
|
{
|
|
536
537
|
module: h,
|
|
537
|
-
onAction: (
|
|
538
|
+
onAction: (k) => b(h.id, k)
|
|
538
539
|
},
|
|
539
540
|
h.id
|
|
540
541
|
)),
|
|
@@ -547,7 +548,7 @@ function le({
|
|
|
547
548
|
{
|
|
548
549
|
node: o,
|
|
549
550
|
onSync: M,
|
|
550
|
-
onClose: () =>
|
|
551
|
+
onClose: () => S(null)
|
|
551
552
|
}
|
|
552
553
|
)
|
|
553
554
|
] }),
|
|
@@ -557,7 +558,7 @@ function le({
|
|
|
557
558
|
config: m,
|
|
558
559
|
templates: K,
|
|
559
560
|
onChange: w,
|
|
560
|
-
onDeploy:
|
|
561
|
+
onDeploy: C,
|
|
561
562
|
onClose: () => f(!1)
|
|
562
563
|
}
|
|
563
564
|
)
|
|
@@ -566,31 +567,31 @@ function le({
|
|
|
566
567
|
function q(a) {
|
|
567
568
|
switch (a) {
|
|
568
569
|
case "running":
|
|
569
|
-
return "#28a745";
|
|
570
|
+
return "var(--nice-success, #28a745)";
|
|
570
571
|
case "stopped":
|
|
571
|
-
return "#6c757d";
|
|
572
|
+
return "var(--nice-text-secondary, #6c757d)";
|
|
572
573
|
case "updating":
|
|
573
|
-
return "#ffc107";
|
|
574
|
+
return "var(--nice-warning, #ffc107)";
|
|
574
575
|
case "error":
|
|
575
|
-
return "#dc3545";
|
|
576
|
+
return "var(--nice-danger, #dc3545)";
|
|
576
577
|
case "unreachable":
|
|
577
|
-
return "#868e96";
|
|
578
|
+
return "var(--nice-text-secondary, #868e96)";
|
|
578
579
|
default:
|
|
579
|
-
return "#6c757d";
|
|
580
|
+
return "var(--nice-text-secondary, #6c757d)";
|
|
580
581
|
}
|
|
581
582
|
}
|
|
582
|
-
function
|
|
583
|
+
function E(a) {
|
|
583
584
|
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`;
|
|
584
585
|
}
|
|
585
586
|
function Y(a) {
|
|
586
|
-
const
|
|
587
|
-
return
|
|
587
|
+
const t = Math.floor(a / 86400), n = Math.floor(a % 86400 / 3600), r = Math.floor(a % 3600 / 60);
|
|
588
|
+
return t > 0 ? `${t}d ${n}h` : n > 0 ? `${n}h ${r}m` : `${r}m`;
|
|
588
589
|
}
|
|
589
|
-
function z({ node: a, isSelected:
|
|
590
|
+
function z({ node: a, isSelected: t, onSelect: n }) {
|
|
590
591
|
return /* @__PURE__ */ i(
|
|
591
592
|
"div",
|
|
592
593
|
{
|
|
593
|
-
className: `nice-edge-manager__node-card ${
|
|
594
|
+
className: `nice-edge-manager__node-card ${t ? "nice-edge-manager__node-card--selected" : ""}`,
|
|
594
595
|
onClick: n,
|
|
595
596
|
children: [
|
|
596
597
|
/* @__PURE__ */ i("div", { className: "nice-edge-manager__node-header", children: [
|
|
@@ -655,7 +656,7 @@ function z({ node: a, isSelected: c, onSelect: n }) {
|
|
|
655
656
|
}
|
|
656
657
|
);
|
|
657
658
|
}
|
|
658
|
-
function J({ module: a, onAction:
|
|
659
|
+
function J({ module: a, onAction: t }) {
|
|
659
660
|
return /* @__PURE__ */ i("div", { className: "nice-edge-manager__module-card", children: [
|
|
660
661
|
/* @__PURE__ */ i("div", { className: "nice-edge-manager__module-header", children: [
|
|
661
662
|
/* @__PURE__ */ e(
|
|
@@ -663,11 +664,11 @@ function J({ module: a, onAction: c }) {
|
|
|
663
664
|
{
|
|
664
665
|
className: "nice-edge-manager__module-status",
|
|
665
666
|
style: { background: {
|
|
666
|
-
running: "#28a745",
|
|
667
|
-
stopped: "#6c757d",
|
|
668
|
-
error: "#dc3545",
|
|
669
|
-
pending: "#ffc107"
|
|
670
|
-
}[a.status] || "#6c757d" }
|
|
667
|
+
running: "var(--nice-success, #28a745)",
|
|
668
|
+
stopped: "var(--nice-text-secondary, #6c757d)",
|
|
669
|
+
error: "var(--nice-danger, #dc3545)",
|
|
670
|
+
pending: "var(--nice-warning, #ffc107)"
|
|
671
|
+
}[a.status] || "var(--nice-text-secondary, #6c757d)" }
|
|
671
672
|
}
|
|
672
673
|
),
|
|
673
674
|
/* @__PURE__ */ e("span", { className: "nice-edge-manager__module-name", children: a.name }),
|
|
@@ -696,20 +697,20 @@ function J({ module: a, onAction: c }) {
|
|
|
696
697
|
] }),
|
|
697
698
|
/* @__PURE__ */ i("div", { className: "nice-edge-manager__module-actions", children: [
|
|
698
699
|
a.status === "running" && /* @__PURE__ */ i(P, { children: [
|
|
699
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
700
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
700
|
+
/* @__PURE__ */ e("button", { onClick: () => t("stop"), children: "Stop" }),
|
|
701
|
+
/* @__PURE__ */ e("button", { onClick: () => t("restart"), children: "Restart" })
|
|
701
702
|
] }),
|
|
702
|
-
a.status === "stopped" && /* @__PURE__ */ e("button", { onClick: () =>
|
|
703
|
-
/* @__PURE__ */ e("button", { className: "nice-edge-manager__module-remove", onClick: () =>
|
|
703
|
+
a.status === "stopped" && /* @__PURE__ */ e("button", { onClick: () => t("start"), children: "Start" }),
|
|
704
|
+
/* @__PURE__ */ e("button", { className: "nice-edge-manager__module-remove", onClick: () => t("remove"), children: "Remove" })
|
|
704
705
|
] })
|
|
705
706
|
] });
|
|
706
707
|
}
|
|
707
|
-
function X({ node: a, onSync:
|
|
708
|
+
function X({ node: a, onSync: t, onClose: n }) {
|
|
708
709
|
return /* @__PURE__ */ i("aside", { className: "nice-edge-manager__detail", children: [
|
|
709
710
|
/* @__PURE__ */ i("div", { className: "nice-edge-manager__detail-header", children: [
|
|
710
711
|
/* @__PURE__ */ e("h3", { children: a.name }),
|
|
711
712
|
/* @__PURE__ */ i("div", { className: "nice-edge-manager__detail-actions", children: [
|
|
712
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
713
|
+
/* @__PURE__ */ e("button", { onClick: t, children: "🔄 Sync" }),
|
|
713
714
|
/* @__PURE__ */ e("button", { onClick: n, children: "×" })
|
|
714
715
|
] })
|
|
715
716
|
] }),
|
|
@@ -857,11 +858,11 @@ function X({ node: a, onSync: c, onClose: n }) {
|
|
|
857
858
|
/* @__PURE__ */ i("div", { className: "nice-edge-manager__network-stats", children: [
|
|
858
859
|
/* @__PURE__ */ i("span", { children: [
|
|
859
860
|
"↓ ",
|
|
860
|
-
|
|
861
|
+
E(a.metrics.networkIn)
|
|
861
862
|
] }),
|
|
862
863
|
/* @__PURE__ */ i("span", { children: [
|
|
863
864
|
"↑ ",
|
|
864
|
-
|
|
865
|
+
E(a.metrics.networkOut)
|
|
865
866
|
] })
|
|
866
867
|
] })
|
|
867
868
|
] })
|
|
@@ -870,7 +871,7 @@ function X({ node: a, onSync: c, onClose: n }) {
|
|
|
870
871
|
}
|
|
871
872
|
function Z({
|
|
872
873
|
config: a,
|
|
873
|
-
templates:
|
|
874
|
+
templates: t,
|
|
874
875
|
onChange: n,
|
|
875
876
|
onDeploy: r,
|
|
876
877
|
onClose: l
|
|
@@ -887,8 +888,8 @@ function Z({
|
|
|
887
888
|
"select",
|
|
888
889
|
{
|
|
889
890
|
value: "",
|
|
890
|
-
onChange: (
|
|
891
|
-
const d =
|
|
891
|
+
onChange: (c) => {
|
|
892
|
+
const d = t.find((o) => o.image === c.target.value);
|
|
892
893
|
d && n({
|
|
893
894
|
...a,
|
|
894
895
|
name: d.name,
|
|
@@ -897,7 +898,7 @@ function Z({
|
|
|
897
898
|
},
|
|
898
899
|
children: [
|
|
899
900
|
/* @__PURE__ */ e("option", { value: "", children: "Select a template..." }),
|
|
900
|
-
|
|
901
|
+
t.map((c) => /* @__PURE__ */ e("option", { value: c.image, children: c.name }, c.image))
|
|
901
902
|
]
|
|
902
903
|
}
|
|
903
904
|
)
|
|
@@ -909,7 +910,7 @@ function Z({
|
|
|
909
910
|
{
|
|
910
911
|
type: "text",
|
|
911
912
|
value: a.name || "",
|
|
912
|
-
onChange: (
|
|
913
|
+
onChange: (c) => n({ ...a, name: c.target.value }),
|
|
913
914
|
placeholder: "e.g., my-module"
|
|
914
915
|
}
|
|
915
916
|
)
|
|
@@ -921,7 +922,7 @@ function Z({
|
|
|
921
922
|
{
|
|
922
923
|
type: "text",
|
|
923
924
|
value: a.image || "",
|
|
924
|
-
onChange: (
|
|
925
|
+
onChange: (c) => n({ ...a, image: c.target.value }),
|
|
925
926
|
placeholder: "e.g., nginx:latest"
|
|
926
927
|
}
|
|
927
928
|
)
|
|
@@ -933,7 +934,7 @@ function Z({
|
|
|
933
934
|
{
|
|
934
935
|
type: "text",
|
|
935
936
|
value: a.version || "1.0.0",
|
|
936
|
-
onChange: (
|
|
937
|
+
onChange: (c) => n({ ...a, version: c.target.value })
|
|
937
938
|
}
|
|
938
939
|
)
|
|
939
940
|
] })
|
|
@@ -944,7 +945,7 @@ function Z({
|
|
|
944
945
|
] })
|
|
945
946
|
] }) });
|
|
946
947
|
}
|
|
947
|
-
const
|
|
948
|
+
const B = {
|
|
948
949
|
broker: "localhost",
|
|
949
950
|
port: 1883,
|
|
950
951
|
clientId: `nice2dev-${Date.now()}`,
|
|
@@ -973,21 +974,21 @@ const x = {
|
|
|
973
974
|
};
|
|
974
975
|
function se({
|
|
975
976
|
protocol: a = "mqtt",
|
|
976
|
-
config:
|
|
977
|
+
config: t,
|
|
977
978
|
onSave: n,
|
|
978
979
|
onTest: r,
|
|
979
980
|
className: l = ""
|
|
980
981
|
}) {
|
|
981
|
-
const [
|
|
982
|
-
(
|
|
982
|
+
const [c, d] = p(a), [o, S] = p(
|
|
983
|
+
(t == null ? void 0 : t.type) === "mqtt" ? { ...B, ...t.config } : B
|
|
983
984
|
), [u, D] = p(
|
|
984
|
-
(
|
|
985
|
+
(t == null ? void 0 : t.type) === "coap" ? { ...F, ...t.config } : F
|
|
985
986
|
), [g, f] = p(
|
|
986
|
-
(
|
|
987
|
+
(t == null ? void 0 : t.type) === "modbus" ? { ...R, ...t.config } : R
|
|
987
988
|
), [m, w] = p(
|
|
988
|
-
(
|
|
989
|
-
), [_,
|
|
990
|
-
switch (
|
|
989
|
+
(t == null ? void 0 : t.type) === "opcua" ? { ...O, ...t.config } : O
|
|
990
|
+
), [_, C] = p(null), [b, M] = p(!1), h = v(() => {
|
|
991
|
+
switch (c) {
|
|
991
992
|
case "mqtt":
|
|
992
993
|
return o;
|
|
993
994
|
case "coap":
|
|
@@ -1000,16 +1001,16 @@ function se({
|
|
|
1000
1001
|
default:
|
|
1001
1002
|
return o;
|
|
1002
1003
|
}
|
|
1003
|
-
}, [
|
|
1004
|
+
}, [c, o, u, g, m]), k = v(() => {
|
|
1004
1005
|
n == null || n(h());
|
|
1005
1006
|
}, [h, n]), A = v(async () => {
|
|
1006
1007
|
if (r) {
|
|
1007
|
-
M(!0),
|
|
1008
|
+
M(!0), C(null);
|
|
1008
1009
|
try {
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1011
|
-
} catch (
|
|
1012
|
-
|
|
1010
|
+
const T = await r(h());
|
|
1011
|
+
C(T);
|
|
1012
|
+
} catch (T) {
|
|
1013
|
+
C({ success: !1, message: String(T) });
|
|
1013
1014
|
} finally {
|
|
1014
1015
|
M(!1);
|
|
1015
1016
|
}
|
|
@@ -1020,7 +1021,7 @@ function se({
|
|
|
1020
1021
|
/* @__PURE__ */ e("h2", { children: "Protocol Configuration" }),
|
|
1021
1022
|
/* @__PURE__ */ i("div", { className: "nice-protocol-config__protocol-selector", children: [
|
|
1022
1023
|
/* @__PURE__ */ e("label", { children: "Protocol:" }),
|
|
1023
|
-
/* @__PURE__ */ i("select", { value:
|
|
1024
|
+
/* @__PURE__ */ i("select", { value: c, onChange: (T) => d(T.target.value), children: [
|
|
1024
1025
|
/* @__PURE__ */ e("option", { value: "mqtt", children: "MQTT" }),
|
|
1025
1026
|
/* @__PURE__ */ e("option", { value: "coap", children: "CoAP" }),
|
|
1026
1027
|
/* @__PURE__ */ e("option", { value: "modbus-tcp", children: "Modbus TCP" }),
|
|
@@ -1030,17 +1031,17 @@ function se({
|
|
|
1030
1031
|
] })
|
|
1031
1032
|
] }),
|
|
1032
1033
|
/* @__PURE__ */ i("div", { className: "nice-protocol-config__content", children: [
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
(
|
|
1034
|
+
c === "mqtt" && /* @__PURE__ */ e(ee, { config: o, onChange: S }),
|
|
1035
|
+
c === "coap" && /* @__PURE__ */ e(ae, { config: u, onChange: D }),
|
|
1036
|
+
(c === "modbus-tcp" || c === "modbus-rtu") && /* @__PURE__ */ e(
|
|
1036
1037
|
ie,
|
|
1037
1038
|
{
|
|
1038
1039
|
config: g,
|
|
1039
|
-
type:
|
|
1040
|
+
type: c === "modbus-rtu" ? "rtu" : "tcp",
|
|
1040
1041
|
onChange: f
|
|
1041
1042
|
}
|
|
1042
1043
|
),
|
|
1043
|
-
|
|
1044
|
+
c === "opcua" && /* @__PURE__ */ e(ne, { config: m, onChange: w })
|
|
1044
1045
|
] }),
|
|
1045
1046
|
_ && /* @__PURE__ */ i(
|
|
1046
1047
|
"div",
|
|
@@ -1063,11 +1064,11 @@ function se({
|
|
|
1063
1064
|
children: b ? "Testing..." : "🔌 Test Connection"
|
|
1064
1065
|
}
|
|
1065
1066
|
),
|
|
1066
|
-
/* @__PURE__ */ e("button", { className: "nice-protocol-config__save-btn", onClick:
|
|
1067
|
+
/* @__PURE__ */ e("button", { className: "nice-protocol-config__save-btn", onClick: k, children: "💾 Save" })
|
|
1067
1068
|
] })
|
|
1068
1069
|
] });
|
|
1069
1070
|
}
|
|
1070
|
-
function ee({ config: a, onChange:
|
|
1071
|
+
function ee({ config: a, onChange: t }) {
|
|
1071
1072
|
return /* @__PURE__ */ i("div", { className: "nice-protocol-config__section", children: [
|
|
1072
1073
|
/* @__PURE__ */ e("h3", { children: "MQTT Configuration" }),
|
|
1073
1074
|
/* @__PURE__ */ i("div", { className: "nice-protocol-config__grid", children: [
|
|
@@ -1078,7 +1079,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1078
1079
|
{
|
|
1079
1080
|
type: "text",
|
|
1080
1081
|
value: a.broker,
|
|
1081
|
-
onChange: (n) =>
|
|
1082
|
+
onChange: (n) => t({ ...a, broker: n.target.value }),
|
|
1082
1083
|
placeholder: "localhost"
|
|
1083
1084
|
}
|
|
1084
1085
|
)
|
|
@@ -1090,7 +1091,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1090
1091
|
{
|
|
1091
1092
|
type: "number",
|
|
1092
1093
|
value: a.port,
|
|
1093
|
-
onChange: (n) =>
|
|
1094
|
+
onChange: (n) => t({ ...a, port: parseInt(n.target.value, 10) || 1883 })
|
|
1094
1095
|
}
|
|
1095
1096
|
)
|
|
1096
1097
|
] }),
|
|
@@ -1101,7 +1102,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1101
1102
|
{
|
|
1102
1103
|
type: "text",
|
|
1103
1104
|
value: a.clientId,
|
|
1104
|
-
onChange: (n) =>
|
|
1105
|
+
onChange: (n) => t({ ...a, clientId: n.target.value })
|
|
1105
1106
|
}
|
|
1106
1107
|
)
|
|
1107
1108
|
] }),
|
|
@@ -1111,7 +1112,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1111
1112
|
{
|
|
1112
1113
|
type: "checkbox",
|
|
1113
1114
|
checked: a.useTLS,
|
|
1114
|
-
onChange: (n) =>
|
|
1115
|
+
onChange: (n) => t({ ...a, useTLS: n.target.checked })
|
|
1115
1116
|
}
|
|
1116
1117
|
),
|
|
1117
1118
|
"Use TLS"
|
|
@@ -1123,7 +1124,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1123
1124
|
{
|
|
1124
1125
|
type: "text",
|
|
1125
1126
|
value: a.username || "",
|
|
1126
|
-
onChange: (n) =>
|
|
1127
|
+
onChange: (n) => t({ ...a, username: n.target.value })
|
|
1127
1128
|
}
|
|
1128
1129
|
)
|
|
1129
1130
|
] }),
|
|
@@ -1134,7 +1135,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1134
1135
|
{
|
|
1135
1136
|
type: "password",
|
|
1136
1137
|
value: a.password || "",
|
|
1137
|
-
onChange: (n) =>
|
|
1138
|
+
onChange: (n) => t({ ...a, password: n.target.value })
|
|
1138
1139
|
}
|
|
1139
1140
|
)
|
|
1140
1141
|
] }),
|
|
@@ -1145,7 +1146,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1145
1146
|
{
|
|
1146
1147
|
type: "number",
|
|
1147
1148
|
value: a.keepAlive,
|
|
1148
|
-
onChange: (n) =>
|
|
1149
|
+
onChange: (n) => t({ ...a, keepAlive: parseInt(n.target.value, 10) || 60 })
|
|
1149
1150
|
}
|
|
1150
1151
|
)
|
|
1151
1152
|
] }),
|
|
@@ -1155,7 +1156,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1155
1156
|
{
|
|
1156
1157
|
type: "checkbox",
|
|
1157
1158
|
checked: a.cleanSession,
|
|
1158
|
-
onChange: (n) =>
|
|
1159
|
+
onChange: (n) => t({ ...a, cleanSession: n.target.checked })
|
|
1159
1160
|
}
|
|
1160
1161
|
),
|
|
1161
1162
|
"Clean Session"
|
|
@@ -1170,8 +1171,8 @@ function ee({ config: a, onChange: c }) {
|
|
|
1170
1171
|
type: "text",
|
|
1171
1172
|
value: n.pattern,
|
|
1172
1173
|
onChange: (l) => {
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1174
|
+
const c = [...a.topics];
|
|
1175
|
+
c[r] = { ...c[r], pattern: l.target.value }, t({ ...a, topics: c });
|
|
1175
1176
|
},
|
|
1176
1177
|
placeholder: "e.g., sensors/+/data"
|
|
1177
1178
|
}
|
|
@@ -1181,8 +1182,8 @@ function ee({ config: a, onChange: c }) {
|
|
|
1181
1182
|
{
|
|
1182
1183
|
value: n.qos,
|
|
1183
1184
|
onChange: (l) => {
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1185
|
+
const c = [...a.topics];
|
|
1186
|
+
c[r] = { ...c[r], qos: parseInt(l.target.value, 10) }, t({ ...a, topics: c });
|
|
1186
1187
|
},
|
|
1187
1188
|
children: [
|
|
1188
1189
|
/* @__PURE__ */ e("option", { value: 0, children: "QoS 0" }),
|
|
@@ -1196,11 +1197,11 @@ function ee({ config: a, onChange: c }) {
|
|
|
1196
1197
|
{
|
|
1197
1198
|
value: n.direction,
|
|
1198
1199
|
onChange: (l) => {
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1201
|
-
...
|
|
1200
|
+
const c = [...a.topics];
|
|
1201
|
+
c[r] = {
|
|
1202
|
+
...c[r],
|
|
1202
1203
|
direction: l.target.value
|
|
1203
|
-
},
|
|
1204
|
+
}, t({ ...a, topics: c });
|
|
1204
1205
|
},
|
|
1205
1206
|
children: [
|
|
1206
1207
|
/* @__PURE__ */ e("option", { value: "subscribe", children: "Subscribe" }),
|
|
@@ -1213,8 +1214,8 @@ function ee({ config: a, onChange: c }) {
|
|
|
1213
1214
|
"button",
|
|
1214
1215
|
{
|
|
1215
1216
|
onClick: () => {
|
|
1216
|
-
const l = a.topics.filter((
|
|
1217
|
-
|
|
1217
|
+
const l = a.topics.filter((c, d) => d !== r);
|
|
1218
|
+
t({ ...a, topics: l });
|
|
1218
1219
|
},
|
|
1219
1220
|
children: "×"
|
|
1220
1221
|
}
|
|
@@ -1224,7 +1225,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1224
1225
|
"button",
|
|
1225
1226
|
{
|
|
1226
1227
|
onClick: () => {
|
|
1227
|
-
|
|
1228
|
+
t({
|
|
1228
1229
|
...a,
|
|
1229
1230
|
topics: [
|
|
1230
1231
|
...a.topics,
|
|
@@ -1238,7 +1239,7 @@ function ee({ config: a, onChange: c }) {
|
|
|
1238
1239
|
] })
|
|
1239
1240
|
] });
|
|
1240
1241
|
}
|
|
1241
|
-
function ae({ config: a, onChange:
|
|
1242
|
+
function ae({ config: a, onChange: t }) {
|
|
1242
1243
|
return /* @__PURE__ */ i("div", { className: "nice-protocol-config__section", children: [
|
|
1243
1244
|
/* @__PURE__ */ e("h3", { children: "CoAP Configuration" }),
|
|
1244
1245
|
/* @__PURE__ */ i("div", { className: "nice-protocol-config__grid", children: [
|
|
@@ -1249,7 +1250,7 @@ function ae({ config: a, onChange: c }) {
|
|
|
1249
1250
|
{
|
|
1250
1251
|
type: "text",
|
|
1251
1252
|
value: a.host,
|
|
1252
|
-
onChange: (n) =>
|
|
1253
|
+
onChange: (n) => t({ ...a, host: n.target.value })
|
|
1253
1254
|
}
|
|
1254
1255
|
)
|
|
1255
1256
|
] }),
|
|
@@ -1260,7 +1261,7 @@ function ae({ config: a, onChange: c }) {
|
|
|
1260
1261
|
{
|
|
1261
1262
|
type: "number",
|
|
1262
1263
|
value: a.port,
|
|
1263
|
-
onChange: (n) =>
|
|
1264
|
+
onChange: (n) => t({ ...a, port: parseInt(n.target.value, 10) || 5683 })
|
|
1264
1265
|
}
|
|
1265
1266
|
)
|
|
1266
1267
|
] }),
|
|
@@ -1270,7 +1271,7 @@ function ae({ config: a, onChange: c }) {
|
|
|
1270
1271
|
{
|
|
1271
1272
|
type: "checkbox",
|
|
1272
1273
|
checked: a.useDTLS,
|
|
1273
|
-
onChange: (n) =>
|
|
1274
|
+
onChange: (n) => t({ ...a, useDTLS: n.target.checked })
|
|
1274
1275
|
}
|
|
1275
1276
|
),
|
|
1276
1277
|
"Use DTLS"
|
|
@@ -1281,7 +1282,7 @@ function ae({ config: a, onChange: c }) {
|
|
|
1281
1282
|
{
|
|
1282
1283
|
type: "checkbox",
|
|
1283
1284
|
checked: a.observe || !1,
|
|
1284
|
-
onChange: (n) =>
|
|
1285
|
+
onChange: (n) => t({ ...a, observe: n.target.checked })
|
|
1285
1286
|
}
|
|
1286
1287
|
),
|
|
1287
1288
|
"Enable Observe"
|
|
@@ -1296,8 +1297,8 @@ function ae({ config: a, onChange: c }) {
|
|
|
1296
1297
|
type: "text",
|
|
1297
1298
|
value: n.path,
|
|
1298
1299
|
onChange: (l) => {
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1300
|
+
const c = [...a.resources];
|
|
1301
|
+
c[r] = { ...c[r], path: l.target.value }, t({ ...a, resources: c });
|
|
1301
1302
|
},
|
|
1302
1303
|
placeholder: "/sensors/temperature"
|
|
1303
1304
|
}
|
|
@@ -1306,8 +1307,8 @@ function ae({ config: a, onChange: c }) {
|
|
|
1306
1307
|
"button",
|
|
1307
1308
|
{
|
|
1308
1309
|
onClick: () => {
|
|
1309
|
-
const l = a.resources.filter((
|
|
1310
|
-
|
|
1310
|
+
const l = a.resources.filter((c, d) => d !== r);
|
|
1311
|
+
t({ ...a, resources: l });
|
|
1311
1312
|
},
|
|
1312
1313
|
children: "×"
|
|
1313
1314
|
}
|
|
@@ -1317,7 +1318,7 @@ function ae({ config: a, onChange: c }) {
|
|
|
1317
1318
|
"button",
|
|
1318
1319
|
{
|
|
1319
1320
|
onClick: () => {
|
|
1320
|
-
|
|
1321
|
+
t({
|
|
1321
1322
|
...a,
|
|
1322
1323
|
resources: [
|
|
1323
1324
|
...a.resources,
|
|
@@ -1333,17 +1334,17 @@ function ae({ config: a, onChange: c }) {
|
|
|
1333
1334
|
}
|
|
1334
1335
|
function ie({
|
|
1335
1336
|
config: a,
|
|
1336
|
-
type:
|
|
1337
|
+
type: t,
|
|
1337
1338
|
onChange: n
|
|
1338
1339
|
}) {
|
|
1339
1340
|
return /* @__PURE__ */ i("div", { className: "nice-protocol-config__section", children: [
|
|
1340
1341
|
/* @__PURE__ */ i("h3", { children: [
|
|
1341
1342
|
"Modbus ",
|
|
1342
|
-
|
|
1343
|
+
t.toUpperCase(),
|
|
1343
1344
|
" Configuration"
|
|
1344
1345
|
] }),
|
|
1345
1346
|
/* @__PURE__ */ i("div", { className: "nice-protocol-config__grid", children: [
|
|
1346
|
-
|
|
1347
|
+
t === "tcp" && /* @__PURE__ */ i(P, { children: [
|
|
1347
1348
|
/* @__PURE__ */ i("div", { className: "nice-protocol-config__field", children: [
|
|
1348
1349
|
/* @__PURE__ */ e("label", { children: "Host" }),
|
|
1349
1350
|
/* @__PURE__ */ e(
|
|
@@ -1367,7 +1368,7 @@ function ie({
|
|
|
1367
1368
|
)
|
|
1368
1369
|
] })
|
|
1369
1370
|
] }),
|
|
1370
|
-
|
|
1371
|
+
t === "rtu" && /* @__PURE__ */ i(P, { children: [
|
|
1371
1372
|
/* @__PURE__ */ i("div", { className: "nice-protocol-config__field", children: [
|
|
1372
1373
|
/* @__PURE__ */ e("label", { children: "Serial Port" }),
|
|
1373
1374
|
/* @__PURE__ */ e(
|
|
@@ -1454,9 +1455,9 @@ function ie({
|
|
|
1454
1455
|
{
|
|
1455
1456
|
type: "text",
|
|
1456
1457
|
value: r.name,
|
|
1457
|
-
onChange: (
|
|
1458
|
+
onChange: (c) => {
|
|
1458
1459
|
const d = [...a.registers];
|
|
1459
|
-
d[l] = { ...d[l], name:
|
|
1460
|
+
d[l] = { ...d[l], name: c.target.value }, n({ ...a, registers: d });
|
|
1460
1461
|
}
|
|
1461
1462
|
}
|
|
1462
1463
|
) }),
|
|
@@ -1465,11 +1466,11 @@ function ie({
|
|
|
1465
1466
|
{
|
|
1466
1467
|
type: "number",
|
|
1467
1468
|
value: r.address,
|
|
1468
|
-
onChange: (
|
|
1469
|
+
onChange: (c) => {
|
|
1469
1470
|
const d = [...a.registers];
|
|
1470
1471
|
d[l] = {
|
|
1471
1472
|
...d[l],
|
|
1472
|
-
address: parseInt(
|
|
1473
|
+
address: parseInt(c.target.value, 10) || 0
|
|
1473
1474
|
}, n({ ...a, registers: d });
|
|
1474
1475
|
}
|
|
1475
1476
|
}
|
|
@@ -1478,11 +1479,11 @@ function ie({
|
|
|
1478
1479
|
"select",
|
|
1479
1480
|
{
|
|
1480
1481
|
value: r.type,
|
|
1481
|
-
onChange: (
|
|
1482
|
+
onChange: (c) => {
|
|
1482
1483
|
const d = [...a.registers];
|
|
1483
1484
|
d[l] = {
|
|
1484
1485
|
...d[l],
|
|
1485
|
-
type:
|
|
1486
|
+
type: c.target.value
|
|
1486
1487
|
}, n({ ...a, registers: d });
|
|
1487
1488
|
},
|
|
1488
1489
|
children: [
|
|
@@ -1497,11 +1498,11 @@ function ie({
|
|
|
1497
1498
|
"select",
|
|
1498
1499
|
{
|
|
1499
1500
|
value: r.dataType,
|
|
1500
|
-
onChange: (
|
|
1501
|
+
onChange: (c) => {
|
|
1501
1502
|
const d = [...a.registers];
|
|
1502
1503
|
d[l] = {
|
|
1503
1504
|
...d[l],
|
|
1504
|
-
dataType:
|
|
1505
|
+
dataType: c.target.value
|
|
1505
1506
|
}, n({ ...a, registers: d });
|
|
1506
1507
|
},
|
|
1507
1508
|
children: [
|
|
@@ -1520,9 +1521,9 @@ function ie({
|
|
|
1520
1521
|
{
|
|
1521
1522
|
type: "checkbox",
|
|
1522
1523
|
checked: r.readable,
|
|
1523
|
-
onChange: (
|
|
1524
|
+
onChange: (c) => {
|
|
1524
1525
|
const d = [...a.registers];
|
|
1525
|
-
d[l] = { ...d[l], readable:
|
|
1526
|
+
d[l] = { ...d[l], readable: c.target.checked }, n({ ...a, registers: d });
|
|
1526
1527
|
},
|
|
1527
1528
|
title: "Readable"
|
|
1528
1529
|
}
|
|
@@ -1532,9 +1533,9 @@ function ie({
|
|
|
1532
1533
|
{
|
|
1533
1534
|
type: "checkbox",
|
|
1534
1535
|
checked: r.writable,
|
|
1535
|
-
onChange: (
|
|
1536
|
+
onChange: (c) => {
|
|
1536
1537
|
const d = [...a.registers];
|
|
1537
|
-
d[l] = { ...d[l], writable:
|
|
1538
|
+
d[l] = { ...d[l], writable: c.target.checked }, n({ ...a, registers: d });
|
|
1538
1539
|
},
|
|
1539
1540
|
title: "Writable"
|
|
1540
1541
|
}
|
|
@@ -1544,8 +1545,8 @@ function ie({
|
|
|
1544
1545
|
"button",
|
|
1545
1546
|
{
|
|
1546
1547
|
onClick: () => {
|
|
1547
|
-
const
|
|
1548
|
-
n({ ...a, registers:
|
|
1548
|
+
const c = a.registers.filter((d, o) => o !== l);
|
|
1549
|
+
n({ ...a, registers: c });
|
|
1549
1550
|
},
|
|
1550
1551
|
children: "×"
|
|
1551
1552
|
}
|
|
@@ -1576,7 +1577,7 @@ function ie({
|
|
|
1576
1577
|
)
|
|
1577
1578
|
] });
|
|
1578
1579
|
}
|
|
1579
|
-
function ne({ config: a, onChange:
|
|
1580
|
+
function ne({ config: a, onChange: t }) {
|
|
1580
1581
|
return /* @__PURE__ */ i("div", { className: "nice-protocol-config__section", children: [
|
|
1581
1582
|
/* @__PURE__ */ e("h3", { children: "OPC-UA Configuration" }),
|
|
1582
1583
|
/* @__PURE__ */ i("div", { className: "nice-protocol-config__grid", children: [
|
|
@@ -1587,7 +1588,7 @@ function ne({ config: a, onChange: c }) {
|
|
|
1587
1588
|
{
|
|
1588
1589
|
type: "text",
|
|
1589
1590
|
value: a.endpointUrl,
|
|
1590
|
-
onChange: (n) =>
|
|
1591
|
+
onChange: (n) => t({ ...a, endpointUrl: n.target.value }),
|
|
1591
1592
|
placeholder: "opc.tcp://localhost:4840"
|
|
1592
1593
|
}
|
|
1593
1594
|
)
|
|
@@ -1598,7 +1599,7 @@ function ne({ config: a, onChange: c }) {
|
|
|
1598
1599
|
"select",
|
|
1599
1600
|
{
|
|
1600
1601
|
value: a.securityMode,
|
|
1601
|
-
onChange: (n) =>
|
|
1602
|
+
onChange: (n) => t({
|
|
1602
1603
|
...a,
|
|
1603
1604
|
securityMode: n.target.value
|
|
1604
1605
|
}),
|
|
@@ -1616,7 +1617,7 @@ function ne({ config: a, onChange: c }) {
|
|
|
1616
1617
|
"select",
|
|
1617
1618
|
{
|
|
1618
1619
|
value: a.authentication,
|
|
1619
|
-
onChange: (n) =>
|
|
1620
|
+
onChange: (n) => t({
|
|
1620
1621
|
...a,
|
|
1621
1622
|
authentication: n.target.value
|
|
1622
1623
|
}),
|
|
@@ -1636,7 +1637,7 @@ function ne({ config: a, onChange: c }) {
|
|
|
1636
1637
|
{
|
|
1637
1638
|
type: "text",
|
|
1638
1639
|
value: a.username || "",
|
|
1639
|
-
onChange: (n) =>
|
|
1640
|
+
onChange: (n) => t({ ...a, username: n.target.value })
|
|
1640
1641
|
}
|
|
1641
1642
|
)
|
|
1642
1643
|
] }),
|
|
@@ -1647,7 +1648,7 @@ function ne({ config: a, onChange: c }) {
|
|
|
1647
1648
|
{
|
|
1648
1649
|
type: "password",
|
|
1649
1650
|
value: a.password || "",
|
|
1650
|
-
onChange: (n) =>
|
|
1651
|
+
onChange: (n) => t({ ...a, password: n.target.value })
|
|
1651
1652
|
}
|
|
1652
1653
|
)
|
|
1653
1654
|
] })
|
|
@@ -1659,7 +1660,7 @@ function ne({ config: a, onChange: c }) {
|
|
|
1659
1660
|
{
|
|
1660
1661
|
type: "text",
|
|
1661
1662
|
value: a.applicationName,
|
|
1662
|
-
onChange: (n) =>
|
|
1663
|
+
onChange: (n) => t({ ...a, applicationName: n.target.value })
|
|
1663
1664
|
}
|
|
1664
1665
|
)
|
|
1665
1666
|
] })
|
|
@@ -1673,8 +1674,8 @@ function ne({ config: a, onChange: c }) {
|
|
|
1673
1674
|
type: "text",
|
|
1674
1675
|
value: n.nodeId,
|
|
1675
1676
|
onChange: (l) => {
|
|
1676
|
-
const
|
|
1677
|
-
|
|
1677
|
+
const c = [...a.nodes];
|
|
1678
|
+
c[r] = { ...c[r], nodeId: l.target.value }, t({ ...a, nodes: c });
|
|
1678
1679
|
},
|
|
1679
1680
|
placeholder: "ns=2;s=Temperature"
|
|
1680
1681
|
}
|
|
@@ -1685,8 +1686,8 @@ function ne({ config: a, onChange: c }) {
|
|
|
1685
1686
|
type: "text",
|
|
1686
1687
|
value: n.displayName,
|
|
1687
1688
|
onChange: (l) => {
|
|
1688
|
-
const
|
|
1689
|
-
|
|
1689
|
+
const c = [...a.nodes];
|
|
1690
|
+
c[r] = { ...c[r], displayName: l.target.value }, t({ ...a, nodes: c });
|
|
1690
1691
|
},
|
|
1691
1692
|
placeholder: "Display Name"
|
|
1692
1693
|
}
|
|
@@ -1695,8 +1696,8 @@ function ne({ config: a, onChange: c }) {
|
|
|
1695
1696
|
"button",
|
|
1696
1697
|
{
|
|
1697
1698
|
onClick: () => {
|
|
1698
|
-
const l = a.nodes.filter((
|
|
1699
|
-
|
|
1699
|
+
const l = a.nodes.filter((c, d) => d !== r);
|
|
1700
|
+
t({ ...a, nodes: l });
|
|
1700
1701
|
},
|
|
1701
1702
|
children: "×"
|
|
1702
1703
|
}
|
|
@@ -1706,7 +1707,7 @@ function ne({ config: a, onChange: c }) {
|
|
|
1706
1707
|
"button",
|
|
1707
1708
|
{
|
|
1708
1709
|
onClick: () => {
|
|
1709
|
-
|
|
1710
|
+
t({
|
|
1710
1711
|
...a,
|
|
1711
1712
|
nodes: [
|
|
1712
1713
|
...a.nodes,
|