0.7.23
This commit is contained in:
@@ -6,40 +6,13 @@ import ResizeObserver from "resize-observer-polyfill";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||
import { debug, takeoverConsole } from "@fltsci/tauri-plugin-tracing";
|
||||
import { KbDemoWsEndpointSummary } from './bindings/KbDemoWsEndpointSummary.ts';
|
||||
import { KbDemoWsStatusPayload } from './bindings/KbDemoWsStatusPayload.ts';
|
||||
import { KbDemoWsSubscribeRequest } from './bindings/KbDemoWsSubscribeRequest.ts';
|
||||
|
||||
(window as Window & typeof globalThis & { bootstrap?: typeof bootstrap }).bootstrap = bootstrap;
|
||||
(window as Window & typeof globalThis & { ResizeObserver?: typeof ResizeObserver }).ResizeObserver = ResizeObserver;
|
||||
|
||||
interface DemoWsEndpointSummary {
|
||||
name: string;
|
||||
resolvedUrl: string;
|
||||
provider: string;
|
||||
enabled: boolean;
|
||||
roles: string[];
|
||||
}
|
||||
|
||||
interface DemoWsStatusPayload {
|
||||
connectionState: string;
|
||||
endpointName: string | null;
|
||||
endpointUrl: string | null;
|
||||
currentSubscriptionId: number | null;
|
||||
currentSubscribeMethod: string | null;
|
||||
currentUnsubscribeMethod: string | null;
|
||||
currentNotificationMethod: string | null;
|
||||
eventCountTotal: number;
|
||||
notificationCountTotal: number;
|
||||
uiLogCount: number;
|
||||
suppressedLogCount: number;
|
||||
lastEventKind: string | null;
|
||||
}
|
||||
|
||||
interface DemoWsSubscribeRequest {
|
||||
method: string;
|
||||
mode: string;
|
||||
target: string | null;
|
||||
filterJson: string | null;
|
||||
configJson: string | null;
|
||||
}
|
||||
|
||||
function shortenLine(line: string, maxChars = 3000): string {
|
||||
if (line.length <= maxChars) {
|
||||
@@ -195,7 +168,7 @@ function updateFormVisibility(
|
||||
}
|
||||
|
||||
function applyStatusToUi(
|
||||
status: DemoWsStatusPayload,
|
||||
status: KbDemoWsStatusPayload,
|
||||
statusBadge: HTMLSpanElement,
|
||||
stateText: HTMLSpanElement,
|
||||
endpointText: HTMLSpanElement,
|
||||
@@ -323,7 +296,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
appendLogLine(logTextarea, event.payload);
|
||||
});
|
||||
|
||||
unlistenStatusEvent = await listen<DemoWsStatusPayload>("demo-ws-status", (event) => {
|
||||
unlistenStatusEvent = await listen<KbDemoWsStatusPayload>("demo-ws-status", (event) => {
|
||||
applyStatusToUi(
|
||||
event.payload,
|
||||
statusBadge,
|
||||
@@ -346,7 +319,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
}
|
||||
|
||||
try {
|
||||
const endpoints = await invoke<DemoWsEndpointSummary[]>("demo_ws_list_endpoints");
|
||||
const endpoints = await invoke<KbDemoWsEndpointSummary[]>("demo_ws_list_endpoints");
|
||||
|
||||
endpointSelect.innerHTML = "";
|
||||
for (const endpoint of endpoints) {
|
||||
@@ -401,7 +374,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
});
|
||||
|
||||
try {
|
||||
const status = await invoke<DemoWsStatusPayload>("demo_ws_get_status");
|
||||
const status = await invoke<KbDemoWsStatusPayload>("demo_ws_get_status");
|
||||
applyStatusToUi(
|
||||
status,
|
||||
statusBadge,
|
||||
@@ -426,7 +399,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
||||
connectButton.addEventListener("click", async () => {
|
||||
try {
|
||||
const status = await invoke<DemoWsStatusPayload>("demo_ws_connect", {
|
||||
const status = await invoke<KbDemoWsStatusPayload>("demo_ws_connect", {
|
||||
endpointName: endpointSelect.value,
|
||||
});
|
||||
|
||||
@@ -453,7 +426,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
||||
disconnectButton.addEventListener("click", async () => {
|
||||
try {
|
||||
const status = await invoke<DemoWsStatusPayload>("demo_ws_disconnect");
|
||||
const status = await invoke<KbDemoWsStatusPayload>("demo_ws_disconnect");
|
||||
|
||||
applyStatusToUi(
|
||||
status,
|
||||
@@ -477,7 +450,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
});
|
||||
|
||||
subscribeButton.addEventListener("click", async () => {
|
||||
const request: DemoWsSubscribeRequest = {
|
||||
const request: KbDemoWsSubscribeRequest = {
|
||||
method: methodSelect.value,
|
||||
mode: modeSelect.value,
|
||||
target: targetInput.value.trim() === "" ? null : targetInput.value.trim(),
|
||||
|
||||
Reference in New Issue
Block a user