v0.3.7-pre.006
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!-- file: crates/ksp-app-backfill-desk/frontend/main.html -->
|
||||
<!-- version: 1 -->
|
||||
<!-- version: 2 -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -51,11 +51,34 @@
|
||||
</div>
|
||||
<span id="appVersionBadge" class="badge text-bg-secondary">—</span>
|
||||
</div>
|
||||
<div class="app-placeholder">
|
||||
<i class="fa-solid fa-clock-rotate-left text-body-secondary" aria-hidden="true"></i>
|
||||
<div>
|
||||
<h2 class="h5">Backfill runtime non ouvert dans pre.002</h2>
|
||||
<p class="text-body-secondary mb-0">Aucun Transport, Store ou Job Backfill n'est encore créé par le frontend.</p>
|
||||
<div class="row g-4">
|
||||
<div class="col-xl-7">
|
||||
<div class="card shadow-sm h-100">
|
||||
<div class="card-header fw-semibold">Transport HTTP</div>
|
||||
<div class="card-body">
|
||||
<label for="backfillHttpRoute" class="form-label">Route de lecture</label>
|
||||
<select id="backfillHttpRoute" class="form-select" disabled>
|
||||
<option value="">Chargement des routes…</option>
|
||||
</select>
|
||||
<div id="backfillHttpRouteHelp" class="form-text">Le choix reste logique : aucune URL ni clé provider n'est exposée au frontend.</div>
|
||||
<dl class="row mt-4 mb-0 app-runtime-list">
|
||||
<dt class="col-sm-5">Réseau</dt><dd id="backfillNetwork" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Transport</dt><dd id="backfillTransportReady" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Store</dt><dd id="backfillStoreReady" class="col-sm-7">—</dd>
|
||||
<dt class="col-sm-5">Composition</dt><dd id="backfillCompositionReady" class="col-sm-7">—</dd>
|
||||
</dl>
|
||||
<div id="backfillOptionsDiagnostic" class="alert alert-warning mt-3 mb-0" role="status" aria-live="polite" hidden></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-5">
|
||||
<div class="app-placeholder h-100">
|
||||
<i class="fa-solid fa-clock-rotate-left text-body-secondary" aria-hidden="true"></i>
|
||||
<div>
|
||||
<h2 class="h5">Campagne Backfill</h2>
|
||||
<p class="text-body-secondary mb-0">Les scopes, commitments et le bouton Start seront branchés dans la tranche suivante. Le transport reste HTTP uniquement en v0.3.7.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// file: crates/ksp-app-backfill-desk/frontend/ts/main.ts
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
import "bootstrap";
|
||||
import ResizeObserver from "resize-observer-polyfill";
|
||||
import "simplebar";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import type { BackfillDeskOptionsDto } from "./bindings/ksp_app_backfill_desk/dto_common/BackfillDeskOptionsDto.ts";
|
||||
import type { BackfillHttpRouteOptionDto } from "./bindings/ksp_app_backfill_desk/dto_common/BackfillHttpRouteOptionDto.ts";
|
||||
import type { ShellStatusDto } from "./bindings/ksp_app_backfill_desk/dto_common/ShellStatusDto.ts";
|
||||
import { frontendDebug, frontendInfo, frontendTrace, frontendWarn, installFrontendConsoleBridge } from "./frontend_log";
|
||||
import { invokeKsp } from "./invoke";
|
||||
@@ -77,6 +79,74 @@ function bindNavigation(): void {
|
||||
frontendTrace("main", "Backfill Desk navigation handlers installed");
|
||||
}
|
||||
|
||||
|
||||
function routeLabel(route: BackfillHttpRouteOptionDto): string {
|
||||
if (route.pooled) {
|
||||
return `Pool multi-provider — ${route.providers.join(" + ")}`;
|
||||
}
|
||||
return route.providers.length === 1 ? `Provider — ${route.providers[0]}` : route.role;
|
||||
}
|
||||
|
||||
function renderBackfillOptions(options: BackfillDeskOptionsDto): void {
|
||||
const select = document.querySelector<HTMLSelectElement>("#backfillHttpRoute");
|
||||
if (select) {
|
||||
const previous = select.value;
|
||||
select.replaceChildren();
|
||||
for (const route of options.httpRoutes) {
|
||||
const option = document.createElement("option");
|
||||
option.value = route.role;
|
||||
option.textContent = routeLabel(route);
|
||||
select.append(option);
|
||||
}
|
||||
select.disabled = !options.transportReady || options.httpRoutes.length === 0;
|
||||
const reusable = options.httpRoutes.some(route => route.role === previous);
|
||||
if (reusable) {
|
||||
select.value = previous;
|
||||
}
|
||||
}
|
||||
const values: Record<string, string> = {
|
||||
backfillNetwork: options.configuredNetworks.length === 1 ? options.configuredNetworks[0] : options.configuredNetworks.join(", ") || "indisponible",
|
||||
backfillTransportReady: options.transportReady ? "ready" : "non ready",
|
||||
backfillStoreReady: options.storeReady ? "ready" : "non ready",
|
||||
backfillCompositionReady: options.compositionReady ? "ready" : "non ready",
|
||||
};
|
||||
for (const [id, value] of Object.entries(values)) {
|
||||
const element = document.querySelector<HTMLElement>(`#${id}`);
|
||||
if (element) {
|
||||
element.textContent = value;
|
||||
}
|
||||
}
|
||||
const diagnostic = document.querySelector<HTMLElement>("#backfillOptionsDiagnostic");
|
||||
if (diagnostic) {
|
||||
const error = options.transportDiagnostic ?? options.storeDiagnostic;
|
||||
diagnostic.hidden = error === null;
|
||||
diagnostic.textContent = error === null ? "" : `${error.domain}/${error.code}: ${error.message}`;
|
||||
}
|
||||
frontendTrace("main", "Backfill Desk HTTP route options rendered", {
|
||||
compositionReady: options.compositionReady,
|
||||
routeCount: options.httpRoutes.length,
|
||||
transportReady: options.transportReady,
|
||||
});
|
||||
}
|
||||
|
||||
async function loadBackfillOptions(source: "startup" | "user"): Promise<void> {
|
||||
frontendDebug("main", "Backfill Desk HTTP route options load started", { source });
|
||||
const options = await invokeKsp<BackfillDeskOptionsDto>("main", "backfill_options");
|
||||
renderBackfillOptions(options);
|
||||
frontendDebug("main", "Backfill Desk HTTP route options load completed", { source, routeCount: options.httpRoutes.length });
|
||||
}
|
||||
|
||||
function bindBackfillRouteSelection(): void {
|
||||
const select = document.querySelector<HTMLSelectElement>("#backfillHttpRoute");
|
||||
if (!select) {
|
||||
return;
|
||||
}
|
||||
select.addEventListener("change", () => {
|
||||
frontendDebug("main", "Backfill Desk HTTP route selection changed", { role: select.value || "none" });
|
||||
});
|
||||
frontendTrace("main", "Backfill Desk HTTP route selection handler installed");
|
||||
}
|
||||
|
||||
function renderRuntimeStatus(status: ShellStatusDto): void {
|
||||
const values: Record<string, string> = {
|
||||
runtimeVersion: status.applicationVersion,
|
||||
@@ -131,9 +201,10 @@ async function initializeMain(): Promise<void> {
|
||||
bindFrontendInteractions();
|
||||
bindNavigation();
|
||||
bindRuntimeStatusRefresh();
|
||||
bindBackfillRouteSelection();
|
||||
activateView("backfill", "startup");
|
||||
try {
|
||||
await loadRuntimeStatus("startup");
|
||||
await Promise.all([loadRuntimeStatus("startup"), loadBackfillOptions("startup")]);
|
||||
} catch {
|
||||
frontendWarn("main", "Backfill Desk startup runtime status load failed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user