feat(studio): recover matching Nitro sources and persist import phases
This commit is contained in:
1 parent
00e33623f7
commit
13bd3695cb
45 files changed
+903
-28
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { FurnitureJobHistory } from "@/components/admin/studio/furniture-jobs";
|
||||
import { useFurnitureJobs } from "@/components/admin/studio/use-furniture-jobs";
|
||||
|
||||
export function FurnitureJobsHarness() {
|
||||
@@ -32,6 +33,9 @@ export function FurnitureJobsHarness() {
|
||||
>
|
||||
Previous page
|
||||
</button>
|
||||
{window.location.search.includes("progress") && (
|
||||
<FurnitureJobHistory state={history} expanded />
|
||||
)}
|
||||
<output aria-label="Page">{history.page}</output>
|
||||
<output aria-label="Completions">{completions}</output>
|
||||
<output aria-label="Loading">{String(history.loading)}</output>
|
||||
|
||||
@@ -98,3 +98,48 @@ test("history polling pauses while hidden and refreshes on visibility return", a
|
||||
});
|
||||
await expect.poll(() => requests).toBe(hiddenCount + 1);
|
||||
});
|
||||
|
||||
test("history shows the current phase and validated recovery source", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.route("**/api/admin/studio/import-jobs?*", (route) =>
|
||||
route.fulfill({
|
||||
json: {
|
||||
ok: true,
|
||||
jobs: [
|
||||
{
|
||||
...furnitureJobFixture,
|
||||
state: "running",
|
||||
items: [
|
||||
{
|
||||
...furnitureJobFixture.items[0],
|
||||
state: "running",
|
||||
phase: "writing_db",
|
||||
phaseStartedAt: new Date().toISOString(),
|
||||
recoveredSource: {
|
||||
sourceId: "configured",
|
||||
sourceName: "Configured source",
|
||||
revision: 42,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
nextCursor: null,
|
||||
},
|
||||
}),
|
||||
);
|
||||
await page.goto("/admin/jobs-harness?progress");
|
||||
await page.locator("details details summary").click();
|
||||
await expect(
|
||||
page.getByText("Current phase: Saving SQL and catalog"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/Bundle recovered from Configured source/),
|
||||
).toBeVisible();
|
||||
expect(
|
||||
await page.evaluate(
|
||||
() => document.documentElement.scrollWidth > innerWidth,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
Reference in new issue
Block a user