refactor(console-ui): split dashboard responsibilities
Reduce the root TanStack route to orchestration and shell state. Move backend-to-view mapping and binary invocation formatting into console-model, presentation views into components/views, and modal workflows into components/dialogs. Update the rendered artifact test to assert behavior at the new module boundaries without changing the generated UI or routes.
This commit is contained in:
@@ -83,9 +83,22 @@ test("server-renders the Wasm management console", async () => {
|
||||
});
|
||||
|
||||
test("uses TanStack Start routing and produces Node artifacts", async () => {
|
||||
const [rootRoute, indexRoute, apiClient, router, packageJson, viteConfig] = await Promise.all([
|
||||
const [
|
||||
rootRoute,
|
||||
indexRoute,
|
||||
views,
|
||||
dialogs,
|
||||
consoleModel,
|
||||
apiClient,
|
||||
router,
|
||||
packageJson,
|
||||
viteConfig,
|
||||
] = await Promise.all([
|
||||
readFile(new URL("../src/routes/__root.tsx", import.meta.url), "utf8"),
|
||||
readFile(new URL("../src/routes/index.tsx", import.meta.url), "utf8"),
|
||||
readFile(new URL("../src/components/views.tsx", import.meta.url), "utf8"),
|
||||
readFile(new URL("../src/components/dialogs.tsx", import.meta.url), "utf8"),
|
||||
readFile(new URL("../src/console-model.ts", import.meta.url), "utf8"),
|
||||
readFile(new URL("../src/api.ts", import.meta.url), "utf8"),
|
||||
readFile(new URL("../src/router.tsx", import.meta.url), "utf8"),
|
||||
readFile(new URL("../package.json", import.meta.url), "utf8"),
|
||||
@@ -96,11 +109,11 @@ test("uses TanStack Start routing and produces Node artifacts", async () => {
|
||||
assert.match(rootRoute, /<HeadContent \/>/);
|
||||
assert.match(rootRoute, /<Scripts \/>/);
|
||||
assert.match(indexRoute, /createFileRoute\("\/"\)/);
|
||||
assert.match(indexRoute, /切换对外版本/);
|
||||
assert.match(indexRoute, /Host 能力/);
|
||||
assert.match(indexRoute, /service\.capabilities/);
|
||||
assert.match(indexRoute, /TextDecoder\("utf-8", \{ fatal: true \}\)/);
|
||||
assert.match(indexRoute, /outputFormat\.automatic/);
|
||||
assert.match(dialogs, /切换对外版本/);
|
||||
assert.match(views, /Host 能力/);
|
||||
assert.match(views, /service\.capabilities/);
|
||||
assert.match(consoleModel, /TextDecoder\("utf-8", \{ fatal: true \}\)/);
|
||||
assert.match(dialogs, /outputFormat\.automatic/);
|
||||
assert.match(apiClient, /\/api\/v1\/deployments/);
|
||||
assert.match(apiClient, /capabilities: BackendCapability\[\]/);
|
||||
assert.match(router, /createRouter/);
|
||||
|
||||
Reference in New Issue
Block a user