From 1e0f36f134dfda06011b966c7abf629beb096c5e Mon Sep 17 00:00:00 2001 From: Wira Basalamah Date: Sun, 7 Jun 2026 03:12:18 +0700 Subject: [PATCH] Split MQTT trace and commands pages --- scripts/ui-qa-check.mjs | 4 +- src/routes/admin.ts | 18 +- ui/config-commands/index.html | 327 +++++++++++++++++++++++ ui/device-registry-monitoring/index.html | 4 +- ui/device-technical-detail/index.html | 6 +- ui/mqtt-trace/index.html | 326 ++++++++++++++++++++++ ui/soundbox-catalog/index.html | 4 +- ui/soundbox-ops/index.html | 4 +- 8 files changed, 681 insertions(+), 12 deletions(-) create mode 100644 ui/config-commands/index.html create mode 100644 ui/mqtt-trace/index.html diff --git a/scripts/ui-qa-check.mjs b/scripts/ui-qa-check.mjs index f4937cf..8c74946 100644 --- a/scripts/ui-qa-check.mjs +++ b/scripts/ui-qa-check.mjs @@ -7,7 +7,9 @@ const pages = [ "ui/admin-system-audit-logs/index.html", "ui/settlement-batch-management/index.html", "ui/merchant-settlement-history/index.html", - "ui/device-technical-detail/index.html" + "ui/device-technical-detail/index.html", + "ui/mqtt-trace/index.html", + "ui/config-commands/index.html" ]; const checks = []; diff --git a/src/routes/admin.ts b/src/routes/admin.ts index 81e7957..626cb6e 100644 --- a/src/routes/admin.ts +++ b/src/routes/admin.ts @@ -2551,13 +2551,27 @@ router.get("/dashboard/summary", requireAdminToken, async (req: Request, res: Re router.get("/mqtt/status", requireAdminToken, async (req: Request, res: Response) => { const limitRaw = req.query.limit; const limit = limitRaw === undefined || limitRaw === "" ? 10 : Number(limitRaw); - const safeLimit = Number.isFinite(limit) ? Math.min(Math.max(limit, 1), 50) : 10; + const safeLimit = Number.isFinite(limit) ? Math.min(Math.max(limit, 1), 500) : 10; + const direction = req.query.direction === "uplink" || req.query.direction === "downlink" + ? req.query.direction + : undefined; + const messageType = typeof req.query.message_type === "string" && req.query.message_type.trim() + ? req.query.message_type.trim() + : undefined; + const deviceId = typeof req.query.device_id === "string" && req.query.device_id.trim() + ? req.query.device_id.trim() + : undefined; res.json( successResponse(req, { publisher: getMqttPublisherStatus(), subscriber: getMqttSubscriberStatus(), - last_messages: (await listMqttMessages({ limit: safeLimit })).map(toMqttMessagePayload) + last_messages: (await listMqttMessages({ + limit: safeLimit, + direction, + message_type: messageType, + device_id: deviceId + })).map(toMqttMessagePayload) }) ); }); diff --git a/ui/config-commands/index.html b/ui/config-commands/index.html new file mode 100644 index 0000000..7262bd4 --- /dev/null +++ b/ui/config-commands/index.html @@ -0,0 +1,327 @@ + + + + + + Config & Commands | Soundbox Ops + + + + + + + + +
+
+
+
+ settings_remote + Operational workflow +
+

Config & Commands

+
+ +
+
+ +
+
+ + +
+
+

Database

+

-

+

application persistence

+
+
+

Pending Notification

+

0

+

waiting to publish

+
+
+

Failed Notification

+

0

+

needs operator review

+
+
+

Export Worker

+

-

+

-

+
+
+ +
+
+
+

Remote Actions

+

Select a registered soundbox and send operational commands.

+
+
+ + + + +
+ + +
+

+
+
+ + +
+
+
+ + + + + diff --git a/ui/device-registry-monitoring/index.html b/ui/device-registry-monitoring/index.html index ed9194b..f98a325 100644 --- a/ui/device-registry-monitoring/index.html +++ b/ui/device-registry-monitoring/index.html @@ -148,11 +148,11 @@ speaker_group Registry - + lan MQTT Trace - + settings_remote Config & Commands diff --git a/ui/device-technical-detail/index.html b/ui/device-technical-detail/index.html index 607b785..15c694d 100644 --- a/ui/device-technical-detail/index.html +++ b/ui/device-technical-detail/index.html @@ -134,11 +134,11 @@ speaker_group Registry - + lan MQTT Trace - + settings_remote Config & Commands @@ -1503,7 +1503,7 @@ Copy Command }); notificationButton?.addEventListener("click", () => { window.location.href = activeDeviceId - ? `/ui/soundbox-ops#mqtt-trace` + ? `/ui/mqtt-trace` : "/ui/soundbox-ops"; }); calendarButton?.addEventListener("click", () => { diff --git a/ui/mqtt-trace/index.html b/ui/mqtt-trace/index.html new file mode 100644 index 0000000..6cc7d43 --- /dev/null +++ b/ui/mqtt-trace/index.html @@ -0,0 +1,326 @@ + + + + + + MQTT Trace | Soundbox Ops + + + + + + + + +
+
+
+
+ lan + Uplink and downlink audit trail +
+

MQTT Trace

+
+
+
+ search + +
+ +
+
+
+ +
+
+ + +
+
+

Broker

+

-

+

-

+
+
+

Subscriber

+

-

+

-

+
+
+

Visible Events

+

0

+

after filters

+
+
+

Last Message

+

-

+

auto refresh every 10s

+
+
+ +
+
+
+ filter_list + Filters +
+ + + + +
+
+

Loading MQTT trace...

+
+
+
+
+ + + + + + + diff --git a/ui/soundbox-catalog/index.html b/ui/soundbox-catalog/index.html index 3d72d32..1e89d04 100644 --- a/ui/soundbox-catalog/index.html +++ b/ui/soundbox-catalog/index.html @@ -28,11 +28,11 @@ speaker_group Registry - + lan MQTT Trace - + settings_remote Config & Commands diff --git a/ui/soundbox-ops/index.html b/ui/soundbox-ops/index.html index 09a44e1..33ddad7 100644 --- a/ui/soundbox-ops/index.html +++ b/ui/soundbox-ops/index.html @@ -30,11 +30,11 @@ speaker_group Registry - + lan MQTT Trace - + settings_remote Config & Commands