v0.2.12-pre.004
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!-- file: crates/ksp-app-solprices-desk/frontend/main.html -->
|
||||
<!-- version: 4 -->
|
||||
<!-- version: 5 -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -47,22 +47,48 @@
|
||||
<div class="d-flex align-items-center justify-content-between mb-4">
|
||||
<div>
|
||||
<h1 class="h3 mb-1">Prices</h1>
|
||||
<p class="text-body-secondary mb-0">Composition Config/Off-chain active. La projection provider-neutral du registry arrive dans la tranche suivante.</p>
|
||||
<p class="text-body-secondary mb-0">Inventaire provider-neutral du registry Off-chain. Aucun refresh réseau n'est encore déclenché dans cette tranche.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-placeholder">
|
||||
<div id="pricesLoading" class="app-placeholder">
|
||||
<div>
|
||||
<i class="fa-solid fa-chart-line fa-3x text-body-secondary mb-3" aria-hidden="true"></i>
|
||||
<h2 class="h5">Surface prix volontairement inactive</h2>
|
||||
<p class="text-body-secondary mb-0">`pre.003` initialise le service via Config, mais ne crée encore ni lignes provider, ni observation affichée, ni refresh réseau déclenché par l’UI.</p>
|
||||
<i class="fa-solid fa-spinner fa-spin text-body-secondary mb-3" aria-hidden="true"></i>
|
||||
<h2 class="h5">Chargement du registry</h2>
|
||||
<p class="text-body-secondary mb-0">Projection de l'inventaire provider-neutral depuis le runtime backend.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="pricesEmpty" class="app-placeholder" hidden>
|
||||
<div>
|
||||
<i class="fa-solid fa-table-list text-body-secondary mb-3" aria-hidden="true"></i>
|
||||
<h2 class="h5">Aucun provider configuré</h2>
|
||||
<p class="text-body-secondary mb-0">Le runtime Off-chain ne contient actuellement aucune ligne provider.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="pricesDiagnostic" class="alert alert-warning mb-3" hidden></div>
|
||||
<div id="pricesTableContainer" class="table-responsive" hidden>
|
||||
<table id="marketPriceTable" class="table table-hover align-middle mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Provider</th>
|
||||
<th scope="col">Pair</th>
|
||||
<th scope="col">Semantics</th>
|
||||
<th scope="col">Auth</th>
|
||||
<th scope="col">Availability</th>
|
||||
<th scope="col">Exact price</th>
|
||||
<th scope="col">Provider timestamp (ms)</th>
|
||||
<th scope="col">Received at (ms)</th>
|
||||
<th scope="col">Retry at (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="marketPriceRows"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<section data-view-panel="diagnostics" hidden>
|
||||
<div class="d-flex align-items-center justify-content-between mb-4">
|
||||
<div>
|
||||
<h1 class="h3 mb-1">Diagnostics</h1>
|
||||
<p class="text-body-secondary mb-0">État sûr du bootstrap Config, Logging et Off-chain Transport.</p>
|
||||
<p class="text-body-secondary mb-0">État sûr du bootstrap Config, Logging et runtime prix provider-neutral.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card shadow-sm">
|
||||
@@ -79,6 +105,12 @@
|
||||
<dd id="runtimeCompositeProfile" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Profil Off-chain</dt>
|
||||
<dd id="runtimeOffchainProfile" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Providers</dt>
|
||||
<dd id="runtimeProviderCount" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Providers ready</dt>
|
||||
<dd id="runtimeReadyProviderCount" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Providers unavailable</dt>
|
||||
<dd id="runtimeUnavailableProviderCount" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Profil Logging</dt>
|
||||
<dd id="runtimeLoggingProfile" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Fallback Logging</dt>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// file: crates/ksp-app-solprices-desk/frontend/ts/main.ts
|
||||
// version: 3
|
||||
// version: 4
|
||||
|
||||
import "bootstrap";
|
||||
import ResizeObserver from "resize-observer-polyfill";
|
||||
import "simplebar";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import type { RuntimeStatusDto } from "./bindings/ksp_app_solprices_desk/dto_common/RuntimeStatusDto.ts";
|
||||
import type { MarketPriceRuntimeStatusDto } from "./bindings/ksp_app_solprices_desk/dto_common/MarketPriceRuntimeStatusDto.ts";
|
||||
import type { MarketPriceProviderRowDto } from "./bindings/ksp_app_solprices_desk/market_price_runtime/MarketPriceProviderRowDto.ts";
|
||||
import { frontendDebug, frontendInfo, frontendTrace, frontendWarn, installFrontendConsoleBridge } from "./frontend_log";
|
||||
import { invokeKsp } from "./invoke";
|
||||
|
||||
@@ -53,13 +54,53 @@ function bindNavigation(): void {
|
||||
frontendTrace("main", "SOL Prices Desk navigation handlers installed");
|
||||
}
|
||||
|
||||
function renderRuntimeStatus(status: RuntimeStatusDto): void {
|
||||
function appendMarketPriceCell(row: HTMLTableRowElement, value: string): void {
|
||||
const cell = document.createElement("td");
|
||||
cell.textContent = value;
|
||||
row.append(cell);
|
||||
}
|
||||
|
||||
function renderMarketPriceRows(rows: MarketPriceProviderRowDto[]): void {
|
||||
const loading = document.querySelector<HTMLElement>("#pricesLoading");
|
||||
const empty = document.querySelector<HTMLElement>("#pricesEmpty");
|
||||
const tableContainer = document.querySelector<HTMLElement>("#pricesTableContainer");
|
||||
const tableBody = document.querySelector<HTMLTableSectionElement>("#marketPriceRows");
|
||||
if (loading) {
|
||||
loading.hidden = true;
|
||||
}
|
||||
if (!tableBody || !tableContainer || !empty) {
|
||||
frontendWarn("main", "SOL Prices Desk market-price table elements are missing");
|
||||
return;
|
||||
}
|
||||
tableBody.replaceChildren();
|
||||
empty.hidden = rows.length !== 0;
|
||||
tableContainer.hidden = rows.length === 0;
|
||||
for (const provider of rows) {
|
||||
const row = document.createElement("tr");
|
||||
appendMarketPriceCell(row, provider.displayName);
|
||||
appendMarketPriceCell(row, provider.pair);
|
||||
appendMarketPriceCell(row, provider.semantics);
|
||||
appendMarketPriceCell(row, provider.authMode);
|
||||
appendMarketPriceCell(row, provider.loading ? "loading" : provider.availability);
|
||||
appendMarketPriceCell(row, provider.price ?? "—");
|
||||
appendMarketPriceCell(row, provider.providerTimestampUnixMillis ?? "—");
|
||||
appendMarketPriceCell(row, provider.receivedAtUnixMillis ?? "—");
|
||||
appendMarketPriceCell(row, provider.retryAtUnixMillis ?? "—");
|
||||
tableBody.append(row);
|
||||
}
|
||||
frontendTrace("main", "SOL Prices Desk market-price registry rows rendered", { rowCount: rows.length });
|
||||
}
|
||||
|
||||
function renderRuntimeStatus(status: MarketPriceRuntimeStatusDto): void {
|
||||
const values: Record<string, string> = {
|
||||
runtimeCompositeProfile: status.activeCompositeProfile,
|
||||
runtimeOffchainProfile: status.activeOffchainProfile,
|
||||
runtimeVersion: status.applicationVersion,
|
||||
runtimeShellPhase: status.shellPhase,
|
||||
runtimeConfigDocuments: status.configDocumentCount.toString(),
|
||||
runtimeProviderCount: status.providerCount.toString(),
|
||||
runtimeReadyProviderCount: status.readyProviderCount.toString(),
|
||||
runtimeUnavailableProviderCount: status.unavailableProviderCount.toString(),
|
||||
runtimeLoggingProfile: status.activeLoggingProfile ?? "fallback",
|
||||
runtimeLoggingFallback: status.fallbackLoggingActive ? "oui" : "non",
|
||||
};
|
||||
@@ -74,14 +115,24 @@ function renderRuntimeStatus(status: RuntimeStatusDto): void {
|
||||
diagnostic.hidden = status.startupDiagnostic === null;
|
||||
diagnostic.textContent = status.startupDiagnostic === null ? "" : `${status.startupDiagnostic.domain}:${status.startupDiagnostic.code} — ${status.startupDiagnostic.message}`;
|
||||
}
|
||||
frontendTrace("main", "SOL Prices Desk scaffold runtime status rendered", {
|
||||
frontendTrace("main", "SOL Prices Desk market-price runtime status rendered", {
|
||||
fallbackLoggingActive: status.fallbackLoggingActive,
|
||||
configDocumentCount: status.configDocumentCount,
|
||||
providerCount: status.providerCount,
|
||||
readyProviderCount: status.readyProviderCount,
|
||||
unavailableProviderCount: status.unavailableProviderCount,
|
||||
});
|
||||
}
|
||||
|
||||
async function loadMarketPrices(): Promise<void> {
|
||||
frontendTrace("main", "SOL Prices Desk provider registry load started");
|
||||
const rows = await invokeKsp<MarketPriceProviderRowDto[]>("main", "list_market_prices");
|
||||
renderMarketPriceRows(rows);
|
||||
frontendTrace("main", "SOL Prices Desk provider registry load completed", { rowCount: rows.length });
|
||||
}
|
||||
|
||||
async function loadRuntimeStatus(): Promise<void> {
|
||||
const status = await invokeKsp<RuntimeStatusDto>("main", "get_runtime_status");
|
||||
const status = await invokeKsp<MarketPriceRuntimeStatusDto>("main", "get_runtime_status");
|
||||
renderRuntimeStatus(status);
|
||||
}
|
||||
|
||||
@@ -100,6 +151,20 @@ async function initializeMain(): Promise<void> {
|
||||
}
|
||||
frontendWarn("main", "SOL Prices Desk startup runtime status load failed");
|
||||
}
|
||||
try {
|
||||
await loadMarketPrices();
|
||||
} catch {
|
||||
const loading = document.querySelector<HTMLElement>("#pricesLoading");
|
||||
const diagnostic = document.querySelector<HTMLElement>("#pricesDiagnostic");
|
||||
if (loading) {
|
||||
loading.hidden = true;
|
||||
}
|
||||
if (diagnostic) {
|
||||
diagnostic.hidden = false;
|
||||
diagnostic.textContent = "L'inventaire provider-neutral n'a pas pu être chargé.";
|
||||
}
|
||||
frontendWarn("main", "SOL Prices Desk provider registry load failed");
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
Reference in New Issue
Block a user