feat(demo): add reset UI and wire truthful integration status into pages

Add a "Reset demo data" action to the sidebar (Operations Manager only,
explicit confirmation, progress, error handling) -- POST /api/v1/demo/reset
already existed and was already role-gated server-side, but had no UI
trigger. Reset invalidates the acting session server-side, so the flow
signs the user out and returns them to login afterward.

Wire the new GET /api/v1/integrations/status into Automation.tsx and
Dashboard.tsx so both show the aggregate n8n state instead of the most
recent event's status, and the MCP Hub card reflects the actual
registration_enabled setting instead of a hardcoded "not configured" label.
This commit is contained in:
NuklearRabbit
2026-08-02 06:42:27 +02:00
parent 4437b8792a
commit 1867828a9d
3 changed files with 112 additions and 6 deletions
+24
View File
@@ -362,6 +362,30 @@ test("rental employee role has a restricted nav and cannot reach manager-only pa
await page.goto("/audit");
await expect(page.getByText("Audit history is visible to Operations Managers only.")).toBeVisible();
await expect(page.getByRole("button", { name: "Reset demo data" })).toHaveCount(0);
});
test("operations manager can reset demo data and is returned to login", async ({ page }) => {
await expect(page.getByRole("button", { name: "Reset demo data" })).toBeVisible();
await page.getByRole("button", { name: "Reset demo data" }).click();
await page.getByRole("button", { name: "Yes, reset" }).click();
await expect(page).toHaveURL(/\/login$/);
// The reset must not have affected the ability to log back in against fresh data.
await page.getByRole("button", { name: "Open as Operations Manager" }).click();
await expect(page).toHaveURL(/\/dashboard$/);
});
test("automation page shows the aggregate n8n integration status, not just the latest event", async ({
page,
request,
}) => {
await resetDemoData(request);
await page.goto("/automation");
await expect(page.locator(".integration-cards")).toContainText("succeeded");
await expect(page.locator(".integration-cards")).toContainText("failed");
});
test("rental employee direct API access to manager-only endpoints is rejected", async ({