0.3.5
This commit is contained in:
@@ -26,6 +26,11 @@ interface DemoWsStatusPayload {
|
||||
currentSubscribeMethod: string | null;
|
||||
currentUnsubscribeMethod: string | null;
|
||||
currentNotificationMethod: string | null;
|
||||
eventCountTotal: number;
|
||||
notificationCountTotal: number;
|
||||
uiLogCount: number;
|
||||
suppressedLogCount: number;
|
||||
lastEventKind: string | null;
|
||||
}
|
||||
|
||||
interface DemoWsSubscribeRequest {
|
||||
@@ -195,6 +200,11 @@ function applyStatusToUi(
|
||||
stateText: HTMLSpanElement,
|
||||
endpointText: HTMLSpanElement,
|
||||
subscriptionText: HTMLSpanElement,
|
||||
eventCountText: HTMLSpanElement,
|
||||
notificationCountText: HTMLSpanElement,
|
||||
uiLogCountText: HTMLSpanElement,
|
||||
suppressedLogCountText: HTMLSpanElement,
|
||||
lastEventKindText: HTMLSpanElement,
|
||||
connectButton: HTMLButtonElement,
|
||||
disconnectButton: HTMLButtonElement,
|
||||
subscribeButton: HTMLButtonElement,
|
||||
@@ -213,6 +223,12 @@ function applyStatusToUi(
|
||||
subscriptionText.textContent = "-";
|
||||
}
|
||||
|
||||
eventCountText.textContent = String(status.eventCountTotal);
|
||||
notificationCountText.textContent = String(status.notificationCountTotal);
|
||||
uiLogCountText.textContent = String(status.uiLogCount);
|
||||
suppressedLogCountText.textContent = String(status.suppressedLogCount);
|
||||
lastEventKindText.textContent = status.lastEventKind ?? "-";
|
||||
|
||||
const isConnected = status.connectionState === "Connected";
|
||||
const isBusy = status.connectionState === "Connecting" || status.connectionState === "Disconnecting";
|
||||
|
||||
@@ -273,6 +289,11 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
const endpointText = document.querySelector<HTMLSpanElement>("#demoWsEndpointText");
|
||||
const subscriptionText = document.querySelector<HTMLSpanElement>("#demoWsSubscriptionText");
|
||||
const requestText = document.querySelector<HTMLSpanElement>("#demoWsRequestText");
|
||||
const eventCountText = document.querySelector<HTMLSpanElement>("#demoWsEventCountText");
|
||||
const notificationCountText = document.querySelector<HTMLSpanElement>("#demoWsNotificationCountText");
|
||||
const uiLogCountText = document.querySelector<HTMLSpanElement>("#demoWsUiLogCountText");
|
||||
const suppressedLogCountText = document.querySelector<HTMLSpanElement>("#demoWsSuppressedLogCountText");
|
||||
const lastEventKindText = document.querySelector<HTMLSpanElement>("#demoWsLastEventKindText");
|
||||
const connectButton = document.querySelector<HTMLButtonElement>("#demoWsConnectButton");
|
||||
const disconnectButton = document.querySelector<HTMLButtonElement>("#demoWsDisconnectButton");
|
||||
const subscribeButton = document.querySelector<HTMLButtonElement>("#demoWsSubscribeButton");
|
||||
@@ -281,6 +302,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
const logTextarea = document.querySelector<HTMLTextAreaElement>("#demoWsLogTextarea");
|
||||
|
||||
if (
|
||||
!eventCountText || !notificationCountText || !uiLogCountText || !suppressedLogCountText || !lastEventKindText ||
|
||||
!endpointSelect || !methodSelect || !modeSelect || !targetGroup || !targetLabel || !targetInput ||
|
||||
!filterGroup || !filterTextarea || !configGroup || !configTextarea || !statusBadge ||
|
||||
!stateText || !endpointText || !subscriptionText || !requestText || !connectButton ||
|
||||
@@ -299,18 +321,23 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
});
|
||||
|
||||
unlistenStatusEvent = await listen<DemoWsStatusPayload>("demo-ws-status", (event) => {
|
||||
applyStatusToUi(
|
||||
event.payload,
|
||||
statusBadge,
|
||||
stateText,
|
||||
endpointText,
|
||||
subscriptionText,
|
||||
connectButton,
|
||||
disconnectButton,
|
||||
subscribeButton,
|
||||
unsubscribeButton,
|
||||
);
|
||||
});
|
||||
applyStatusToUi(
|
||||
event.payload,
|
||||
statusBadge,
|
||||
stateText,
|
||||
endpointText,
|
||||
subscriptionText,
|
||||
eventCountText,
|
||||
notificationCountText,
|
||||
uiLogCountText,
|
||||
suppressedLogCountText,
|
||||
lastEventKindText,
|
||||
connectButton,
|
||||
disconnectButton,
|
||||
subscribeButton,
|
||||
unsubscribeButton,
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
appendLogLine(logTextarea, `[ui] event listen error: ${String(error)}`);
|
||||
}
|
||||
@@ -373,16 +400,21 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
try {
|
||||
const status = await invoke<DemoWsStatusPayload>("demo_ws_get_status");
|
||||
applyStatusToUi(
|
||||
status,
|
||||
statusBadge,
|
||||
stateText,
|
||||
endpointText,
|
||||
subscriptionText,
|
||||
connectButton,
|
||||
disconnectButton,
|
||||
subscribeButton,
|
||||
unsubscribeButton,
|
||||
);
|
||||
status,
|
||||
statusBadge,
|
||||
stateText,
|
||||
endpointText,
|
||||
subscriptionText,
|
||||
eventCountText,
|
||||
notificationCountText,
|
||||
uiLogCountText,
|
||||
suppressedLogCountText,
|
||||
lastEventKindText,
|
||||
connectButton,
|
||||
disconnectButton,
|
||||
subscribeButton,
|
||||
unsubscribeButton,
|
||||
);
|
||||
} catch (error) {
|
||||
appendLogLine(logTextarea, `[ui] initial status error: ${String(error)}`);
|
||||
}
|
||||
@@ -396,16 +428,21 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
});
|
||||
|
||||
applyStatusToUi(
|
||||
status,
|
||||
statusBadge,
|
||||
stateText,
|
||||
endpointText,
|
||||
subscriptionText,
|
||||
connectButton,
|
||||
disconnectButton,
|
||||
subscribeButton,
|
||||
unsubscribeButton,
|
||||
);
|
||||
status,
|
||||
statusBadge,
|
||||
stateText,
|
||||
endpointText,
|
||||
subscriptionText,
|
||||
eventCountText,
|
||||
notificationCountText,
|
||||
uiLogCountText,
|
||||
suppressedLogCountText,
|
||||
lastEventKindText,
|
||||
connectButton,
|
||||
disconnectButton,
|
||||
subscribeButton,
|
||||
unsubscribeButton,
|
||||
);
|
||||
} catch (error) {
|
||||
appendLogLine(logTextarea, `[ui] connect error: ${String(error)}`);
|
||||
}
|
||||
@@ -416,16 +453,21 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
const status = await invoke<DemoWsStatusPayload>("demo_ws_disconnect");
|
||||
|
||||
applyStatusToUi(
|
||||
status,
|
||||
statusBadge,
|
||||
stateText,
|
||||
endpointText,
|
||||
subscriptionText,
|
||||
connectButton,
|
||||
disconnectButton,
|
||||
subscribeButton,
|
||||
unsubscribeButton,
|
||||
);
|
||||
status,
|
||||
statusBadge,
|
||||
stateText,
|
||||
endpointText,
|
||||
subscriptionText,
|
||||
eventCountText,
|
||||
notificationCountText,
|
||||
uiLogCountText,
|
||||
suppressedLogCountText,
|
||||
lastEventKindText,
|
||||
connectButton,
|
||||
disconnectButton,
|
||||
subscribeButton,
|
||||
unsubscribeButton,
|
||||
);
|
||||
} catch (error) {
|
||||
appendLogLine(logTextarea, `[ui] disconnect error: ${String(error)}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user