feat: add modal dialog, paged results, scan status, and trend value table components
- Introduced ModalDialog component for displaying modal dialogs with accessibility features. - Added PagedResults component to handle pagination of items with customizable rendering. - Created ScanStatus component to display the status of a scan with elapsed time. - Implemented TrendValueTable component for displaying trend data in a paginated table format. - Added measurement utility functions for formatting and validating measurement values. - Included tests for measurement functions and trend series fetching logic to ensure correctness.
This commit is contained in:
1 parent
c19c77334f
commit
a8b6cd4061
23 files changed
+1479
-2157
No files matched your search
+16
-2
@@ -776,6 +776,8 @@ async function scanOpcuaEndpoint(body) {
|
||||
endpoints: [{ url: endpointUrl, securityMode: "auto", securityPolicy: "auto" }],
|
||||
tree,
|
||||
nodes: state.nodes,
|
||||
maxNodes: state.maxNodes,
|
||||
nodeLimitReached: state.nodes.length >= state.maxNodes,
|
||||
sampleNodes: state.nodes,
|
||||
scannedAt: new Date().toISOString(),
|
||||
};
|
||||
@@ -804,6 +806,7 @@ async function readOpcuaValue(source, datapoint) {
|
||||
const dataValue = await session.readVariableValue(nodeId);
|
||||
await session.close();
|
||||
const value = dataValue?.value?.value;
|
||||
if (value == null || (typeof value === "string" && !value.trim())) return null;
|
||||
if (typeof value === "boolean") {
|
||||
return value ? 1 : 0;
|
||||
}
|
||||
@@ -994,6 +997,7 @@ async function readIpsymconValue(source, datapoint) {
|
||||
}
|
||||
const response = await requestIpsymconApi(source, { function: "getvalue", id: variableId });
|
||||
const raw = response.value ?? response.variable?.value;
|
||||
if (raw == null || (typeof raw === "string" && !raw.trim())) return null;
|
||||
if (typeof raw === "boolean") {
|
||||
return raw ? 1 : 0;
|
||||
}
|
||||
@@ -1339,7 +1343,7 @@ async function scanBacnetObjects(client, device, portNumber) {
|
||||
hasValue: raw !== null,
|
||||
});
|
||||
}
|
||||
return points;
|
||||
return { points, pointLimitReached: values.length > LOCAL_POINT_LIMIT };
|
||||
}
|
||||
|
||||
async function requestExternalBacnetScan(body) {
|
||||
@@ -1368,6 +1372,7 @@ async function scanBacnetNetwork(body) {
|
||||
const bacnet = await loadOptionalPackage("node-bacnet");
|
||||
const portNumber = Number(body.port || 47808);
|
||||
const timeout = Number(body.timeout || 6000);
|
||||
const includeObjects = body.includeObjects === true || String(body.includeObjects).toLowerCase() === "true";
|
||||
const { client, routing } = createBacnetClientInstance(bacnet, body, timeout);
|
||||
const devices = [];
|
||||
|
||||
@@ -1381,13 +1386,18 @@ async function scanBacnetNetwork(body) {
|
||||
if (resolvedName) {
|
||||
device.name = resolvedName;
|
||||
}
|
||||
device.points = await scanBacnetObjects(client, device, portNumber);
|
||||
if (includeObjects) {
|
||||
const scan = await scanBacnetObjects(client, device, portNumber);
|
||||
device.points = scan.points;
|
||||
device.pointLimitReached = scan.pointLimitReached;
|
||||
}
|
||||
}
|
||||
try { client.close(); } catch {}
|
||||
resolve({
|
||||
routing,
|
||||
devices,
|
||||
points: devices.flatMap((device) => device.points || []),
|
||||
pointLimitReached: devices.some((device) => device.pointLimitReached),
|
||||
scannedAt: new Date().toISOString(),
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -1475,6 +1485,10 @@ async function readBacnetValue(source, datapoint) {
|
||||
return;
|
||||
}
|
||||
const raw = value?.values?.[0]?.value;
|
||||
if (raw == null || (typeof raw === "string" && !raw.trim())) {
|
||||
resolve(null);
|
||||
return;
|
||||
}
|
||||
if (typeof raw === "boolean") {
|
||||
resolve(raw ? 1 : 0);
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user