0.7.25
This commit is contained in:
@@ -38,6 +38,24 @@ interface PairCandle {
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
|
||||
interface KbLocalPipelineReplayResult {
|
||||
selectedTransactionCount: number;
|
||||
replayedTransactionCount: number;
|
||||
decodeErrorCount: number;
|
||||
detectErrorCount: number;
|
||||
tradeAggregationErrorCount: number;
|
||||
pairCandleErrorCount: number;
|
||||
analyticSignalErrorCount: number;
|
||||
decodedEventCount: number;
|
||||
detectionCount: number;
|
||||
tradeEventCount: number;
|
||||
pairCandleCount: number;
|
||||
analyticSignalCount: number;
|
||||
tokenMetadataUpdatedCount: number;
|
||||
pairSymbolUpdatedCount: number;
|
||||
globalErrorCount: number;
|
||||
}
|
||||
function appendLogLine(textarea: HTMLTextAreaElement, line: string): void {
|
||||
const now = new Date();
|
||||
const timestamp = now.toLocaleTimeString("fr-CH", { hour12: false });
|
||||
@@ -94,6 +112,25 @@ function readPositiveIntegerInput(
|
||||
return parsed;
|
||||
}
|
||||
|
||||
|
||||
function readOptionalPositiveIntegerInput(
|
||||
input: HTMLInputElement,
|
||||
logTextarea: HTMLTextAreaElement,
|
||||
label: string,
|
||||
): number | null | undefined {
|
||||
const text = input.value.trim();
|
||||
if (text === "") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const parsed = Number.parseInt(text, 10);
|
||||
if (Number.isNaN(parsed) || parsed <= 0) {
|
||||
appendLogLine(logTextarea, `[ui] invalid ${label} '${text}'`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
function refreshPairSelect(
|
||||
catalog: KbDemoPipeline2CatalogPayload,
|
||||
select: HTMLSelectElement,
|
||||
@@ -308,6 +345,11 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
const poolSignatureLimitInput = document.querySelector<HTMLInputElement>("#demoPipeline2PoolSignatureLimitInput");
|
||||
const backfillPoolButton = document.querySelector<HTMLButtonElement>("#demoPipeline2BackfillPoolButton");
|
||||
|
||||
const replayLimitInput = document.querySelector<HTMLInputElement>("#demoPipeline2ReplayLimitInput");
|
||||
const replayMetadataCheckbox = document.querySelector<HTMLInputElement>("#demoPipeline2ReplayMetadataCheckbox");
|
||||
const replayMetadataLimitInput = document.querySelector<HTMLInputElement>("#demoPipeline2ReplayMetadataLimitInput");
|
||||
const replayLocalPipelineButton = document.querySelector<HTMLButtonElement>("#demoPipeline2ReplayLocalPipelineButton");
|
||||
|
||||
const pairSelect = document.querySelector<HTMLSelectElement>("#demoPipeline2PairSelect");
|
||||
const timeframeSelect = document.querySelector<HTMLSelectElement>("#demoPipeline2TimeframeSelect");
|
||||
const customTimeframeInput = document.querySelector<HTMLInputElement>("#demoPipeline2CustomTimeframeInput");
|
||||
@@ -334,6 +376,10 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
!poolInput ||
|
||||
!poolSignatureLimitInput ||
|
||||
!backfillPoolButton ||
|
||||
!replayLimitInput ||
|
||||
!replayMetadataCheckbox ||
|
||||
!replayMetadataLimitInput ||
|
||||
!replayLocalPipelineButton ||
|
||||
!pairSelect ||
|
||||
!timeframeSelect ||
|
||||
!customTimeframeInput ||
|
||||
@@ -497,6 +543,53 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
}
|
||||
});
|
||||
|
||||
replayLocalPipelineButton.addEventListener("click", async () => {
|
||||
const replayLimit = readOptionalPositiveIntegerInput(
|
||||
replayLimitInput,
|
||||
logTextarea,
|
||||
"replayLimit",
|
||||
);
|
||||
if (replayLimit === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tokenMetadataLimit = readOptionalPositiveIntegerInput(
|
||||
replayMetadataLimitInput,
|
||||
logTextarea,
|
||||
"tokenMetadataLimit",
|
||||
);
|
||||
if (tokenMetadataLimit === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
appendLogLine(
|
||||
logTextarea,
|
||||
`[ui] launching local pipeline replay limit='${replayLimit ?? "none"}' metadata='${replayMetadataCheckbox.checked ? "yes" : "no"}'`,
|
||||
);
|
||||
|
||||
try {
|
||||
const result = await invoke<KbLocalPipelineReplayResult>(
|
||||
"demo_pipeline2_replay_local_pipeline",
|
||||
{
|
||||
limit: replayLimit,
|
||||
refreshMissingTokenMetadata: replayMetadataCheckbox.checked,
|
||||
tokenMetadataLimit,
|
||||
},
|
||||
);
|
||||
|
||||
backfillSummaryTextarea.value = JSON.stringify(result, null, 2);
|
||||
|
||||
appendLogLine(
|
||||
logTextarea,
|
||||
`[ui] local pipeline replay completed: ${result.replayedTransactionCount.toString()} replayed, ${result.tradeEventCount.toString()} trades, ${result.pairCandleCount.toString()} candles`,
|
||||
);
|
||||
|
||||
await refreshCatalog();
|
||||
} catch (error) {
|
||||
appendLogLine(logTextarea, `[ui] local pipeline replay error: ${String(error)}`);
|
||||
}
|
||||
});
|
||||
|
||||
loadCandlesButton.addEventListener("click", async () => {
|
||||
const pairIdText = pairSelect.value.trim();
|
||||
if (pairIdText === "") {
|
||||
|
||||
Reference in New Issue
Block a user