fix(3d): restore complete SCADA scene context
Generic Container CI/CD / test-build-publish (push) Successful in 1m5s
Frontend CI/CD v2 / build-test-publish-and-deploy (push) Successful in 1m5s

The scene previously returned early when realtime rows were absent and selected map-tier assets for network mode, hiding SCADA markers and station interiors and floors.

Use SCADA timestamps as valid frames, render node-aligned monitor markers, and pin the full network context in the manifest regression test. Keep the timeline close action inside its drag header.
This commit is contained in:
2026-09-14 16:57:41 +08:00
parent a9b25b94d8
commit 1622eaa2da
9 changed files with 154 additions and 13 deletions
@@ -149,6 +149,42 @@ describe("buildSceneFrame", () => {
expect(frame.stats.missingLinks).toBe(2);
});
it("builds a SCADA-only frame when the matching simulation frame is absent", () => {
const frame = buildSceneFrame({
queryTime: new Date("2026-09-14T09:30:00.000Z"),
model,
nodeRows: [],
linkRows: [],
pressureDevices: [
{ device_id: "S-1", device_type: "pressure", node_id: "J-1" },
],
scadaRows: [
{
time: "2026-09-14T09:30:00.000Z",
device_id: "S-1",
monitored_value: 30.8,
cleaned_value: 30.9,
},
],
});
expect(frame.resultTime).toBe("2026-09-14T09:30:00.000Z");
expect(frame.payload?.nodes["J-1"]).toEqual({
pressure: 30.9,
source: "scada",
deviceId: "S-1",
});
expect(frame.payload?.links).toEqual({});
expect(frame.stats).toMatchObject({
simulationNodes: 0,
simulationLinks: 0,
scadaOverrides: 1,
});
expect(frame.warnings).toEqual([
"当前时刻无在线模拟结果,已显示 SCADA 监测点。",
]);
});
it("ignores IDs outside the scene model instead of rejecting the frame", () => {
const frame = buildSceneFrame({
queryTime: new Date("2026-09-11T03:00:00.000Z"),
@@ -261,4 +297,39 @@ describe("buildSceneFrame", () => {
"SCADA 数据暂不可用,当前仅显示模拟结果。",
]);
});
it("keeps the SCADA-only warning returned by the frame builder", async () => {
mockApiFetch
.mockResolvedValueOnce({ ok: true, json: async () => [] })
.mockResolvedValueOnce({ ok: true, json: async () => [] })
.mockResolvedValueOnce({
ok: true,
json: async () => ({ FLOW_UNITS: "LPS", PRESSURE_UNITS: "METERS" }),
})
.mockResolvedValueOnce({
ok: true,
json: async () => [
{
time: "2026-09-14T09:30:00.000Z",
device_id: "S-1",
monitored_value: 30.8,
cleaned_value: 30.9,
},
],
});
const frame = await fetchSceneFrame({
queryTime: new Date("2026-09-14T09:30:00.000Z"),
model,
pressureDevices: [
{ device_id: "S-1", device_type: "pressure", node_id: "J-1" },
],
signal: new AbortController().signal,
});
expect(frame.stats.scadaOverrides).toBe(1);
expect(frame.warnings).toEqual([
"当前时刻无在线模拟结果,已显示 SCADA 监测点。",
]);
});
});