improvements for first-time setup
This commit is contained in:
parent
e59d85cf57
commit
979d27ec7a
16 changed files with 901 additions and 33 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { api } from "./api";
|
||||
import { BootScreen, Shell } from "./components/Layout";
|
||||
import { SetupWizard } from "./components/SetupWizard";
|
||||
import { LoginPage } from "./pages/LoginPage";
|
||||
import { PermissionsProvider } from "./permissions";
|
||||
import { permissionAll, permissionServerManage, PermissionsProvider } from "./permissions";
|
||||
import { Routes } from "./pages/Routes";
|
||||
import { currentRoute, type RouteState } from "./routing";
|
||||
import type { AdminSession } from "./types";
|
||||
|
|
@ -55,6 +56,18 @@ export function App() {
|
|||
);
|
||||
}
|
||||
|
||||
// The wizard only ever shows to whoever can actually act on it -- a
|
||||
// limited operator signing in before setup is finished just sees the
|
||||
// normal (mostly empty) shell instead of a wizard whose every step would
|
||||
// 403. setup_completed undefined (an admin binary old enough to predate
|
||||
// the field) reads as "done", same convention as the type's doc comment.
|
||||
const canRunSetupWizard = (session.permissions ?? []).some(
|
||||
(permission) => permission === permissionAll || permission === permissionServerManage
|
||||
);
|
||||
if (session.setup_completed === false && canRunSetupWizard) {
|
||||
return <SetupWizard />;
|
||||
}
|
||||
|
||||
return (
|
||||
<PermissionsProvider permissions={session.permissions ?? []} hideThirdPartyVerification={session.hide_third_party_verification ?? true}>
|
||||
<Shell actor={session.actor} apiLayers={session.api_layers} build={session.build} route={route} navigate={navigate} onLogout={() => setSession(null)}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue