v0.3.7-pre.010
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!-- file: crates/ksp-app-backfill-desk/frontend/main.html -->
|
||||
<!-- version: 5 -->
|
||||
<!-- version: 6 -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -134,11 +134,17 @@
|
||||
<div id="backfillRunStatusCard" class="card shadow-sm mt-4" hidden>
|
||||
<div class="card-header d-flex align-items-center justify-content-between gap-3 flex-wrap">
|
||||
<span class="fw-semibold">Monitoring latest-value</span>
|
||||
<button id="refreshBackfillStatus" class="btn btn-outline-primary btn-sm" type="button">
|
||||
<i class="fa-solid fa-rotate me-2" aria-hidden="true"></i>Resynchroniser
|
||||
</button>
|
||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||
<button id="cancelBackfillRun" class="btn btn-outline-danger btn-sm" type="button" disabled>
|
||||
<i class="fa-solid fa-ban me-2" aria-hidden="true"></i>Annuler
|
||||
</button>
|
||||
<button id="refreshBackfillStatus" class="btn btn-outline-primary btn-sm" type="button">
|
||||
<i class="fa-solid fa-rotate me-2" aria-hidden="true"></i>Resynchroniser
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="backfillCancelFeedback" class="alert alert-secondary py-2" role="status" aria-live="polite" hidden></div>
|
||||
<dl class="row mb-0 app-runtime-list">
|
||||
<dt class="col-sm-5">Job</dt><dd id="runStatusJobId" class="col-sm-7 font-monospace">—</dd>
|
||||
<dt class="col-sm-5">Lifecycle</dt><dd id="runStatusLifecycle" class="col-sm-7">—</dd>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!-- file: crates/ksp-app-backfill-desk/frontend/splash.html -->
|
||||
<!-- version: 1 -->
|
||||
<!-- version: 2 -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<body>
|
||||
<div id="splash-container" style="opacity: 0;">
|
||||
<img id="splash-image" src="imgs/splash.png" alt="Chargement de KSP Backfill Desk">
|
||||
<div id="app-name">Backfill Desk</div>
|
||||
<div id="app-name">Backfill</div>
|
||||
<div id="debug-info" aria-live="off" hidden></div>
|
||||
<div id="messages-container" aria-live="polite"></div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-backfill-desk/frontend/ts/main.ts
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
import "bootstrap";
|
||||
import ResizeObserver from "resize-observer-polyfill";
|
||||
@@ -7,6 +7,7 @@ import "simplebar";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import type { BackfillRunStatusDto } from "./bindings/ksp_app_backfill_desk/backfill_status/BackfillRunStatusDto.ts";
|
||||
import type { BackfillCancelResponseDto } from "./bindings/ksp_app_backfill_desk/dto_backfill/BackfillCancelResponseDto.ts";
|
||||
import type { BackfillRequestPreviewDto } from "./bindings/ksp_app_backfill_desk/dto_backfill/BackfillRequestPreviewDto.ts";
|
||||
import type { BackfillStartRequestDto } from "./bindings/ksp_app_backfill_desk/dto_backfill/BackfillStartRequestDto.ts";
|
||||
import type { BackfillStartResponseDto } from "./bindings/ksp_app_backfill_desk/dto_backfill/BackfillStartResponseDto.ts";
|
||||
@@ -39,6 +40,7 @@ const scopeLabels: Record<string, string> = {
|
||||
};
|
||||
|
||||
let compositionReadyForStart = false;
|
||||
let currentRunStatus: BackfillRunStatusDto | null = null;
|
||||
let runStartAccepted = false;
|
||||
|
||||
|
||||
@@ -451,10 +453,15 @@ function bindBackfillRouteSelection(): void {
|
||||
}
|
||||
|
||||
|
||||
function renderBackfillRunStatus(status: BackfillRunStatusDto | null, source: "event" | "startup" | "start" | "user"): void {
|
||||
function renderBackfillRunStatus(status: BackfillRunStatusDto | null, source: "cancel" | "event" | "startup" | "start" | "user"): void {
|
||||
const card = document.querySelector<HTMLElement>("#backfillRunStatusCard");
|
||||
const cancelButton = document.querySelector<HTMLButtonElement>("#cancelBackfillRun");
|
||||
currentRunStatus = status;
|
||||
if (!status) {
|
||||
runStartAccepted = false;
|
||||
if (cancelButton) {
|
||||
cancelButton.disabled = true;
|
||||
}
|
||||
refreshStartButton();
|
||||
if (card) {
|
||||
card.hidden = true;
|
||||
@@ -463,6 +470,9 @@ function renderBackfillRunStatus(status: BackfillRunStatusDto | null, source: "e
|
||||
return;
|
||||
}
|
||||
runStartAccepted = status.active;
|
||||
if (cancelButton) {
|
||||
cancelButton.disabled = !status.active;
|
||||
}
|
||||
refreshStartButton();
|
||||
if (card) {
|
||||
card.hidden = false;
|
||||
@@ -499,7 +509,7 @@ function renderBackfillRunStatus(status: BackfillRunStatusDto | null, source: "e
|
||||
});
|
||||
}
|
||||
|
||||
async function syncBackfillStatus(source: "startup" | "start" | "user"): Promise<void> {
|
||||
async function syncBackfillStatus(source: "cancel" | "startup" | "start" | "user"): Promise<void> {
|
||||
frontendDebug("main", "Backfill Desk latest-value status resynchronization started", { source });
|
||||
const status = await invokeKsp<BackfillRunStatusDto | null>("main", "backfill_status");
|
||||
renderBackfillRunStatus(status, source);
|
||||
@@ -517,7 +527,40 @@ async function bindBackfillStatusMonitoring(): Promise<void> {
|
||||
void syncBackfillStatus("user").catch(() => frontendWarn("main", "Backfill Desk latest-value status refresh failed"));
|
||||
});
|
||||
}
|
||||
frontendTrace("main", "Backfill Desk latest-value monitoring listener installed");
|
||||
const cancelButton = document.querySelector<HTMLButtonElement>("#cancelBackfillRun");
|
||||
if (cancelButton) {
|
||||
cancelButton.addEventListener("click", () => {
|
||||
const status = currentRunStatus;
|
||||
if (!status || !status.active) {
|
||||
return;
|
||||
}
|
||||
cancelButton.disabled = true;
|
||||
frontendDebug("main", "Backfill Desk cooperative cancellation requested", { jobId: status.jobId, state: status.state });
|
||||
void invokeKsp<BackfillCancelResponseDto>("main", "backfill_cancel", { jobId: status.jobId })
|
||||
.then(response => {
|
||||
const feedback = document.querySelector<HTMLElement>("#backfillCancelFeedback");
|
||||
if (feedback) {
|
||||
feedback.hidden = false;
|
||||
feedback.textContent = response.accepted
|
||||
? `Annulation coopérative acceptée pour ${response.jobId}.`
|
||||
: `Aucune nouvelle annulation acceptée pour ${response.jobId} (${response.state}).`;
|
||||
}
|
||||
frontendInfo("main", "Backfill Desk cooperative cancellation response received", {
|
||||
accepted: response.accepted,
|
||||
jobId: response.jobId,
|
||||
state: response.state,
|
||||
});
|
||||
return syncBackfillStatus("cancel");
|
||||
})
|
||||
.catch(() => {
|
||||
frontendWarn("main", "Backfill Desk cooperative cancellation failed");
|
||||
if (currentRunStatus?.active) {
|
||||
cancelButton.disabled = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
frontendTrace("main", "Backfill Desk latest-value monitoring and cancellation handlers installed");
|
||||
}
|
||||
|
||||
function renderRuntimeStatus(status: ShellStatusDto): void {
|
||||
|
||||
Reference in New Issue
Block a user