feat(FN-3737): add even realities integration research report
Adds a new Even Realities integration research report to the documentation. Fusion-Task-Id: FN-3737
This commit is contained in:
@@ -3,7 +3,8 @@ import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it, vi, afterEach } from "vitest";
|
||||
import { definePlugin } from "@fusion/plugin-sdk";
|
||||
import { validatePluginManifest } from "@fusion/core";
|
||||
import plugin, { DependencyGraphDashboardView } from "../index";
|
||||
import plugin from "../index";
|
||||
import { DependencyGraphDashboardView } from "../dashboard-view";
|
||||
import { getPluginViewId } from "../../../../packages/dashboard/app/plugins/pluginViewRegistry";
|
||||
|
||||
vi.mock("@fusion/dashboard/app/components/TaskCard", () => ({
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import { mkdtempSync } from "node:fs";
|
||||
import { rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { PluginLoader, PluginStore } from "@fusion/core";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import plugin from "../index";
|
||||
|
||||
const testDirs: string[] = [];
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(testDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })));
|
||||
});
|
||||
|
||||
describe("dependency graph plugin index", () => {
|
||||
it("exports node-importable plugin metadata", () => {
|
||||
expect(plugin).toBeDefined();
|
||||
expect(plugin.manifest.id).toBe("fusion-plugin-dependency-graph");
|
||||
expect(plugin.dashboardViews?.[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
viewId: "graph",
|
||||
componentPath: "./dashboard-view",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("loads src/index.ts via Node dynamic import", async () => {
|
||||
const moduleUrl = pathToFileURL(join(process.cwd(), "src/index.ts")).href;
|
||||
const module = await import(moduleUrl);
|
||||
expect(module.default?.manifest?.id).toBe("fusion-plugin-dependency-graph");
|
||||
});
|
||||
|
||||
it("is loadable by PluginLoader without throwing", async () => {
|
||||
const rootDir = mkdtempSync(join(tmpdir(), "fn-3737-plugin-loader-"));
|
||||
testDirs.push(rootDir);
|
||||
|
||||
const pluginStore = new PluginStore(rootDir, { inMemoryDb: true, centralGlobalDir: rootDir });
|
||||
await pluginStore.init();
|
||||
|
||||
const pluginPath = join(process.cwd(), "src/index.ts");
|
||||
await pluginStore.registerPlugin({ manifest: plugin.manifest, path: pluginPath });
|
||||
|
||||
const loader = new PluginLoader({
|
||||
pluginStore,
|
||||
taskStore: { logActivity: async () => undefined } as never,
|
||||
pluginDirs: [dirname(dirname(pluginPath))],
|
||||
});
|
||||
|
||||
await loader.loadPlugin(plugin.manifest.id);
|
||||
|
||||
const loaded = loader.getPlugin(plugin.manifest.id);
|
||||
expect(loaded?.state).toBe("started");
|
||||
expect(loaded?.dashboardViews?.[0]).toEqual(
|
||||
expect.objectContaining({ viewId: "graph", componentPath: "./dashboard-view" }),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { Task, TaskDetail, WorkflowStep } from "@fusion/core";
|
||||
import type { PluginDashboardViewContext } from "@fusion/dashboard/app/plugins/types";
|
||||
import { createElement } from "react";
|
||||
import { DependencyGraph } from "./DependencyGraph";
|
||||
|
||||
function createWorkflowStepNameLookup(workflowSteps: WorkflowStep[] | undefined): ReadonlyMap<string, string> {
|
||||
return new Map((workflowSteps ?? []).map((step) => [step.id, step.name] as const));
|
||||
}
|
||||
|
||||
export function DependencyGraphDashboardView({ context }: { context?: PluginDashboardViewContext }) {
|
||||
return createElement(DependencyGraph, {
|
||||
tasks: context?.tasks ?? [],
|
||||
projectId: context?.projectId,
|
||||
workflowStepNameLookup: createWorkflowStepNameLookup(context?.workflowSteps),
|
||||
onOpenDetail: context?.openTaskDetail as ((task: Task | TaskDetail) => void) | undefined,
|
||||
});
|
||||
}
|
||||
|
||||
export { DependencyGraph };
|
||||
@@ -1,8 +1,4 @@
|
||||
import type { Task, TaskDetail, WorkflowStep } from "@fusion/core";
|
||||
import type { PluginDashboardViewContext } from "@fusion/dashboard/app/plugins/types";
|
||||
import { definePlugin } from "@fusion/plugin-sdk";
|
||||
import { createElement } from "react";
|
||||
import { DependencyGraph } from "./DependencyGraph";
|
||||
|
||||
const plugin = definePlugin({
|
||||
manifest: {
|
||||
@@ -25,18 +21,4 @@ const plugin = definePlugin({
|
||||
],
|
||||
});
|
||||
|
||||
function createWorkflowStepNameLookup(workflowSteps: WorkflowStep[] | undefined): ReadonlyMap<string, string> {
|
||||
return new Map((workflowSteps ?? []).map((step) => [step.id, step.name] as const));
|
||||
}
|
||||
|
||||
export function DependencyGraphDashboardView({ context }: { context?: PluginDashboardViewContext }) {
|
||||
return createElement(DependencyGraph, {
|
||||
tasks: context?.tasks ?? [],
|
||||
projectId: context?.projectId,
|
||||
workflowStepNameLookup: createWorkflowStepNameLookup(context?.workflowSteps),
|
||||
onOpenDetail: context?.openTaskDetail as ((task: Task | TaskDetail) => void) | undefined,
|
||||
});
|
||||
}
|
||||
|
||||
export default plugin;
|
||||
export { DependencyGraph };
|
||||
|
||||
Reference in New Issue
Block a user