Add firstboot onboarding and prep/check tooling
This commit is contained in:
@@ -17,8 +17,10 @@ export function createStatusController({
|
||||
releaseUIGetter = () => null,
|
||||
setUpdatesUI = null,
|
||||
updatesFlagEl = null,
|
||||
firstboot = null,
|
||||
}) {
|
||||
let lastStatusData = null;
|
||||
let lastFirstbootState = null;
|
||||
|
||||
function setTempFlag(tempC) {
|
||||
if (!tempFlagTop) return;
|
||||
@@ -77,7 +79,30 @@ export function createStatusController({
|
||||
}
|
||||
}
|
||||
}
|
||||
if (readyOverlay) {
|
||||
if (firstboot?.getStatus && firstboot?.ui) {
|
||||
let firstbootData = null;
|
||||
const shouldFetchFirstboot =
|
||||
lastFirstbootState === null || !data.ready || lastFirstbootState === "running" || lastFirstbootState === "error";
|
||||
if (shouldFetchFirstboot) {
|
||||
try {
|
||||
firstbootData = await firstboot.getStatus();
|
||||
lastFirstbootState = firstbootData?.state || lastFirstbootState;
|
||||
firstboot.ui.update(firstbootData);
|
||||
if (firstbootData?.state === "error" && firstboot.getError) {
|
||||
const err = await firstboot.getError();
|
||||
if (err?.present) {
|
||||
firstboot.ui.showError(err.text || "");
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logUi?.(`First-boot status failed: ${err?.message || err}`, "error");
|
||||
}
|
||||
}
|
||||
const readyNow = data.ready || firstbootData?.state === "done";
|
||||
const showOverlay = !readyNow || firstbootData?.state === "error";
|
||||
firstboot.ui.showOverlay(showOverlay);
|
||||
if (showOverlay) onReadyWait?.();
|
||||
} else if (readyOverlay) {
|
||||
if (data.ready) {
|
||||
readyOverlay.classList.add("hidden");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user