feat(FN-3764): add manage view with edit modal for CLI printing press plugi

FN-3764 adds a manage view and edit draft modal to the CLI printing press plugin, wiring in draft storage, wizard routes, and plugin view registry integration so users can view and edit their printing press drafts directly from the dashboard. Includes corresponding tests, documentation updates, and

Fusion-Task-Id: FN-3764
This commit is contained in:
Fusion
2026-05-10 15:59:15 -07:00
committed by gsxdsm
parent d7980d5a59
commit 0fb9bb5b91
20 changed files with 646 additions and 19 deletions

View File

@@ -35,10 +35,13 @@ describe("pluginViewRegistry", () => {
expect(getPluginViewComponent("plugin-b", "missing")).toBeNull();
});
it("resolves cli printing press wizard entries", () => {
const View = lazy(async () => ({ default: () => <div>Wizard</div> }));
registerPluginView("fusion-plugin-cli-printing-press", "wizard", View);
expect(getPluginViewComponent("fusion-plugin-cli-printing-press", "wizard")).toBe(View);
it("resolves cli printing press wizard and manage entries", () => {
const WizardView = lazy(async () => ({ default: () => <div>Wizard</div> }));
const ManageView = lazy(async () => ({ default: () => <div>Manage</div> }));
registerPluginView("fusion-plugin-cli-printing-press", "wizard", WizardView);
registerPluginView("fusion-plugin-cli-printing-press", "manage", ManageView);
expect(getPluginViewComponent("fusion-plugin-cli-printing-press", "wizard")).toBe(WizardView);
expect(getPluginViewComponent("fusion-plugin-cli-printing-press", "manage")).toBe(ManageView);
});
it("keeps all registered plugin views discoverable by key iteration", () => {

View File

@@ -9,6 +9,7 @@ import {
const MockDependencyGraphDashboardView = () => createElement("div", { "data-testid": "dep-graph-view" });
const MockRoadmapDashboardView = () => createElement("div", { "data-testid": "roadmap-view" });
const MockCliPrintingPressWizardView = () => createElement("div", { "data-testid": "cli-printing-press-view" });
const MockCliPrintingPressManageView = () => createElement("div", { "data-testid": "cli-printing-press-manage-view" });
vi.mock("@fusion-plugin-examples/dependency-graph/dashboard-view", () => ({
DependencyGraphDashboardView: (...args: unknown[]) => MockDependencyGraphDashboardView(...args),
@@ -22,6 +23,10 @@ vi.mock("@fusion-plugin-examples/cli-printing-press/dashboard-view", () => ({
CliPrintingPressWizardView: (...args: unknown[]) => MockCliPrintingPressWizardView(...args),
}));
vi.mock("@fusion-plugin-examples/cli-printing-press/manage-view", () => ({
CliPrintingPressManageView: (...args: unknown[]) => MockCliPrintingPressManageView(...args),
}));
describe("registerBundledPluginViews", () => {
beforeEach(() => {
__test_clearPluginViewRegistry();
@@ -34,6 +39,7 @@ describe("registerBundledPluginViews", () => {
expect(getPluginViewComponent("fusion-plugin-dependency-graph", "graph")).toBeTruthy();
expect(getPluginViewComponent("roadmap-planner", "roadmaps")).toBeTruthy();
expect(getPluginViewComponent("fusion-plugin-cli-printing-press", "wizard")).toBeTruthy();
expect(getPluginViewComponent("fusion-plugin-cli-printing-press", "manage")).toBeTruthy();
});
it("is idempotent when called more than once", () => {
@@ -52,6 +58,7 @@ describe("registerBundledPluginViews", () => {
expect(isPluginViewRegistered("fusion-plugin-dependency-graph", "graph")).toBe(true);
expect(isPluginViewRegistered("roadmap-planner", "roadmaps")).toBe(true);
expect(isPluginViewRegistered("fusion-plugin-cli-printing-press", "wizard")).toBe(true);
expect(isPluginViewRegistered("fusion-plugin-cli-printing-press", "manage")).toBe(true);
// Unknown plugin/view should not be registered
expect(isPluginViewRegistered("unknown-plugin", "unknown")).toBe(false);
});

View File

@@ -49,6 +49,18 @@ async function loadCliPrintingPressWizardView(): Promise<{ default: PluginViewCo
return { default: component as PluginViewComponent };
}
async function loadCliPrintingPressManageView(): Promise<{ default: PluginViewComponent }> {
const moduleId = "@fusion-plugin-examples/cli-printing-press/manage-view";
const exportName = "CliPrintingPressManageView";
const mod = await import("@fusion-plugin-examples/cli-printing-press/manage-view") as unknown as Record<string, ComponentType<{ context?: PluginDashboardViewContext }>>;
const component = mod[exportName];
if (!component) {
console.warn(`[plugin-views] Missing export ${exportName} from ${moduleId}`);
return { default: createMissingPluginView(moduleId, exportName) };
}
return { default: component as PluginViewComponent };
}
export function registerBundledPluginViews(): void {
if (registered) return;
registered = true;
@@ -70,6 +82,12 @@ export function registerBundledPluginViews(): void {
"wizard",
lazy(loadCliPrintingPressWizardView),
);
registerPluginView(
"fusion-plugin-cli-printing-press",
"manage",
lazy(loadCliPrintingPressManageView),
);
}
export function __test_resetBundledPluginViewRegistration(): void {