Space Manager: navigate to space list after hitting Save
This commit is contained in:
@@ -57,7 +57,9 @@ export function SpaceEditor({
|
|||||||
// screen, so its remaining settings are one step away rather than
|
// screen, so its remaining settings are one step away rather than
|
||||||
// behind another round trip through the list.
|
// behind another round trip through the list.
|
||||||
onSaved={(savedId) =>
|
onSaved={(savedId) =>
|
||||||
navigate(id ? spacesUrl("/") : spacesUrl(`/${encodeURIComponent(savedId)}`))
|
navigate(
|
||||||
|
id ? spacesUrl("/") : spacesUrl(`/${encodeURIComponent(savedId)}`),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
onDeleted={() => navigate(spacesUrl("/"))}
|
onDeleted={() => navigate(spacesUrl("/"))}
|
||||||
onUnauthorized={onUnauthorized}
|
onUnauthorized={onUnauthorized}
|
||||||
|
|||||||
@@ -75,9 +75,8 @@ export function SpaceForm({
|
|||||||
);
|
);
|
||||||
// Matches the server's own `runtimeApi` default for a fresh space.
|
// Matches the server's own `runtimeApi` default for a fresh space.
|
||||||
const [runtimeApi, setRuntimeApi] = useState(initial?.runtimeApi ?? true);
|
const [runtimeApi, setRuntimeApi] = useState(initial?.runtimeApi ?? true);
|
||||||
const [runtimeAvailability, setRuntimeAvailability] = useState<
|
const [runtimeAvailability, setRuntimeAvailability] =
|
||||||
RuntimeAvailability | null
|
useState<RuntimeAvailability | null>(null);
|
||||||
>(null);
|
|
||||||
const [indexPage, setIndexPage] = useState(initial?.indexPage ?? "index");
|
const [indexPage, setIndexPage] = useState(initial?.indexPage ?? "index");
|
||||||
const [errors, setErrors] = useState<FieldError[]>([]);
|
const [errors, setErrors] = useState<FieldError[]>([]);
|
||||||
// Only ever "saving": a successful save navigates away — to the space list
|
// Only ever "saving": a successful save navigates away — to the space list
|
||||||
@@ -149,9 +148,8 @@ export function SpaceForm({
|
|||||||
.then((info) => setRuntimeAvailability(info.runtimeApi))
|
.then((info) => setRuntimeAvailability(info.runtimeApi))
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}, []);
|
}, []);
|
||||||
const runtimeApiUnavailable = runtimeApiUnavailableReason(
|
const runtimeApiUnavailable =
|
||||||
runtimeAvailability,
|
runtimeApiUnavailableReason(runtimeAvailability);
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form
|
<form
|
||||||
|
|||||||
@@ -149,7 +149,9 @@ test("saving an existing space returns to the list showing the change", async ({
|
|||||||
// they just edited carrying its new name, rather than an unchanged-looking
|
// they just edited carrying its new name, rather than an unchanged-looking
|
||||||
// form they have to take on trust.
|
// form they have to take on trust.
|
||||||
await expect(page).toHaveURL(`${base}/.spaces/`);
|
await expect(page).toHaveURL(`${base}/.spaces/`);
|
||||||
await expect(page.getByRole("link", { name: "Feedback Renamed" })).toBeVisible();
|
await expect(
|
||||||
|
page.getByRole("link", { name: "Feedback Renamed" }),
|
||||||
|
).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("the shell allow list is editable, and only shown when shell is enabled", async ({
|
test("the shell allow list is editable, and only shown when shell is enabled", async ({
|
||||||
|
|||||||
Reference in New Issue
Block a user