v0.1.4-pre.012-fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!-- file: crates/ksp-app-config-desk/frontend/main.html -->
|
||||
<!-- version: 7 -->
|
||||
<!-- version: 8 -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -306,6 +306,25 @@
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div id="environmentRemoveConfirmModal" class="modal fade" tabindex="-1" aria-labelledby="environmentRemoveConfirmTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 id="environmentRemoveConfirmTitle" class="modal-title fs-5">Confirmer la suppression .env</h2>
|
||||
<button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="Annuler"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="mb-2">Supprimer l'entrée <code id="environmentRemoveConfirmVariable" class="font-monospace"></code> de <code>.env</code> ?</p>
|
||||
<p class="text-body-secondary small mb-0">L'environnement process déjà hérité ne sera pas modifié.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-outline-secondary" type="button" data-bs-dismiss="modal">Annuler</button>
|
||||
<button id="environmentRemoveConfirmAction" class="btn btn-danger" type="button">Supprimer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="app-footer bg-dark text-light">
|
||||
<div class="container h-100 d-flex align-items-center justify-content-center">
|
||||
<small>© 2026 SASEDEV</small>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// file: crates/ksp-app-config-desk/frontend/ts/environment.ts
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Safe environment report and `.env` management panel backed exclusively by ConfigManagement.
|
||||
|
||||
import { Modal } from "bootstrap";
|
||||
import DataTable from "datatables.net-bs5";
|
||||
import "datatables.net-bs5/css/dataTables.bootstrap5.css";
|
||||
import type { ConfigEnvironmentChangeDto } from "./bindings/ksp_app_config_desk/environment/ConfigEnvironmentChangeDto";
|
||||
@@ -221,6 +222,35 @@ function setMutationControlsDisabled(disabled: boolean): void {
|
||||
document.querySelector<HTMLButtonElement>("#removeEnvironmentValue")?.toggleAttribute("disabled", disabled);
|
||||
}
|
||||
|
||||
function confirmEnvironmentRemoval(variableName: string): Promise<boolean> {
|
||||
const modalElement = document.querySelector<HTMLElement>("#environmentRemoveConfirmModal");
|
||||
const variable = document.querySelector<HTMLElement>("#environmentRemoveConfirmVariable");
|
||||
const confirmButton = document.querySelector<HTMLButtonElement>("#environmentRemoveConfirmAction");
|
||||
if (!modalElement || !variable || !confirmButton) {
|
||||
frontendDebug("main", "Environment removal confirmation modal is unavailable", { variableName });
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
variable.textContent = variableName;
|
||||
const modal = Modal.getOrCreateInstance(modalElement);
|
||||
frontendDebug("main", "Environment .env removal confirmation opened", { variableName });
|
||||
return new Promise<boolean>(resolve => {
|
||||
let confirmed = false;
|
||||
const onConfirm = (): void => {
|
||||
confirmed = true;
|
||||
modal.hide();
|
||||
};
|
||||
const onHidden = (): void => {
|
||||
confirmButton.removeEventListener("click", onConfirm);
|
||||
variable.textContent = "";
|
||||
frontendDebug("main", "Environment .env removal confirmation answered", { variableName, confirmed });
|
||||
resolve(confirmed);
|
||||
};
|
||||
confirmButton.addEventListener("click", onConfirm, { once: true });
|
||||
modalElement.addEventListener("hidden.bs.modal", onHidden, { once: true });
|
||||
modal.show();
|
||||
});
|
||||
}
|
||||
|
||||
async function refreshEnvironmentReport(): Promise<void> {
|
||||
frontendDebug("main", "Config environment report refresh requested");
|
||||
setEnvironmentStatus("Chargement du rapport environnement sûr...", "primary");
|
||||
@@ -289,14 +319,14 @@ async function removeEnvironmentValue(): Promise<void> {
|
||||
setMutationStatus("Saisis ou sélectionne la variable .env à supprimer.", "warning");
|
||||
return;
|
||||
}
|
||||
const confirmed = window.confirm(`Supprimer l'entrée .env ${variableName} ? L'environnement process hérité ne sera pas modifié.`);
|
||||
frontendTrace("main", "Environment .env removal confirmation answered", { variableName, confirmed });
|
||||
setMutationControlsDisabled(true);
|
||||
const confirmed = await confirmEnvironmentRemoval(variableName);
|
||||
if (!confirmed) {
|
||||
setMutationControlsDisabled(false);
|
||||
return;
|
||||
}
|
||||
const sensitivity = classifyEditorSensitivity(variableName);
|
||||
frontendDebug("main", "Environment .env mutation requested", { operation: "remove", variableName, sensitivity });
|
||||
setMutationControlsDisabled(true);
|
||||
setMutationStatus("Suppression atomique par Config...", "secondary");
|
||||
try {
|
||||
const result = await invokeKsp<ConfigEnvironmentChangeDto>("main", "remove_environment_value", { variableName });
|
||||
|
||||
Reference in New Issue
Block a user