v0.1.4-pre.018
This commit is contained in:
70
crates/ksp-app-config-desk/frontend/ts/shell_registry.ts
Normal file
70
crates/ksp-app-config-desk/frontend/ts/shell_registry.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
// file: crates/ksp-app-config-desk/frontend/ts/shell_registry.ts
|
||||
// version: 1
|
||||
|
||||
//! Declarative shell and specialized-editor registry for Config Desk frontend extensibility.
|
||||
|
||||
export type ViewId = "overview" | "documents" | "profiles" | "environment" | "logging";
|
||||
|
||||
export interface ViewDescriptor {
|
||||
title: string;
|
||||
description: string;
|
||||
panelId: string;
|
||||
}
|
||||
|
||||
export interface SpecializedEditorDescriptor {
|
||||
fileId: string;
|
||||
viewId: ViewId;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export const viewRegistry: Record<ViewId, ViewDescriptor> = {
|
||||
overview: {
|
||||
title: "Vue d'ensemble",
|
||||
description: "État sûr du bootstrap Config Desk et du runtime Logging actuellement actif.",
|
||||
panelId: "overviewPanel",
|
||||
},
|
||||
documents: {
|
||||
title: "Documents",
|
||||
description: "Inventaire, diagnostics et réparation validée des documents Config enregistrés.",
|
||||
panelId: "documentsPanel",
|
||||
},
|
||||
profiles: {
|
||||
title: "Profils",
|
||||
description: "Sélection default/explicite, vues global/profil/effective sûre et provenance Config.",
|
||||
panelId: "profilesPanel",
|
||||
},
|
||||
environment: {
|
||||
title: "Environnement / .env",
|
||||
description: "Rapport sûr desired/effective/source/shadow et management atomique des variables .env KSP/KSPB.",
|
||||
panelId: "environmentPanel",
|
||||
},
|
||||
logging: {
|
||||
title: "Logging",
|
||||
description: "Édition typée, hot reload runtime, profils actifs et panneau de test du routing Logging KSP.",
|
||||
panelId: "loggingPanel",
|
||||
},
|
||||
};
|
||||
|
||||
const specializedEditorRegistry: SpecializedEditorDescriptor[] = [
|
||||
{
|
||||
fileId: "cfg.std.logging",
|
||||
viewId: "logging",
|
||||
label: "Ouvrir l'éditeur Logging",
|
||||
},
|
||||
];
|
||||
|
||||
export function registeredViewIds(): ViewId[] {
|
||||
return Object.keys(viewRegistry) as ViewId[];
|
||||
}
|
||||
|
||||
export function isViewId(value: string): value is ViewId {
|
||||
return Object.prototype.hasOwnProperty.call(viewRegistry, value);
|
||||
}
|
||||
|
||||
export function specializedEditorForFileId(fileId: string): SpecializedEditorDescriptor | null {
|
||||
return specializedEditorRegistry.find(descriptor => descriptor.fileId === fileId) ?? null;
|
||||
}
|
||||
|
||||
export function requestViewActivation(viewId: ViewId): void {
|
||||
window.dispatchEvent(new CustomEvent("ksp:activate-view", { detail: { viewId } }));
|
||||
}
|
||||
Reference in New Issue
Block a user