Skip to content

Commit 7dfa9a3

Browse files
authored
fix(app): explain blocked update restart (anomalyco#1157)
1 parent 3610689 commit 7dfa9a3

1 file changed

Lines changed: 133 additions & 121 deletions

File tree

‎apps/app/src/app/pages/settings.tsx‎

Lines changed: 133 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,11 @@ export default function SettingsView(props: SettingsViewProps) {
475475
return props.busy;
476476
});
477477

478+
const updateRestartBlockedMessage = createMemo(() => {
479+
if (updateState() !== "ready" || !props.anyActiveRuns) return null;
480+
return "OpenWork needs to restart to finish this update. To avoid interrupting your current work, install is paused until your active runs finish or you stop them.";
481+
});
482+
478483
const handleUpdateToolbarAction = () => {
479484
if (updateToolbarDisabled()) return;
480485
const state = updateState();
@@ -1505,32 +1510,35 @@ export default function SettingsView(props: SettingsViewProps) {
15051510
</p>
15061511
</div>
15071512
<Show when={showUpdateToolbar() && activeTab() === "general"}>
1508-
<div class="mt-4 flex flex-wrap items-center gap-2 md:mt-0 md:justify-end">
1509-
<div
1510-
class={`rounded-full border px-3 py-1.5 text-xs shadow-sm flex items-center gap-2 ${updateToolbarTone()}`}
1511-
title={updateToolbarTitle()}
1512-
>
1513-
<Show when={updateToolbarSpinning()}>
1514-
<RefreshCcw size={12} class="animate-spin" />
1513+
<div class="mt-4 space-y-2 md:mt-0 md:max-w-sm md:text-right">
1514+
<div class="flex flex-wrap items-center gap-2 md:justify-end">
1515+
<div
1516+
class={`rounded-full border px-3 py-1.5 text-xs shadow-sm flex items-center gap-2 ${updateToolbarTone()}`}
1517+
title={updateToolbarTitle()}
1518+
>
1519+
<Show when={updateToolbarSpinning()}>
1520+
<RefreshCcw size={12} class="animate-spin" />
1521+
</Show>
1522+
<span class="tabular-nums whitespace-nowrap">
1523+
{updateToolbarLabel()}
1524+
</span>
1525+
</div>
1526+
<Show when={updateToolbarActionLabel()}>
1527+
<Button
1528+
variant="outline"
1529+
class="text-xs h-8 py-0 px-3 rounded-full border-gray-6/60 bg-gray-1/70 hover:bg-gray-2/70"
1530+
onClick={handleUpdateToolbarAction}
1531+
disabled={updateToolbarDisabled()}
1532+
title={updateRestartBlockedMessage() ?? ""}
1533+
>
1534+
{updateToolbarActionLabel()}
1535+
</Button>
15151536
</Show>
1516-
<span class="tabular-nums whitespace-nowrap">
1517-
{updateToolbarLabel()}
1518-
</span>
15191537
</div>
1520-
<Show when={updateToolbarActionLabel()}>
1521-
<Button
1522-
variant="outline"
1523-
class="text-xs h-8 py-0 px-3 rounded-full border-gray-6/60 bg-gray-1/70 hover:bg-gray-2/70"
1524-
onClick={handleUpdateToolbarAction}
1525-
disabled={updateToolbarDisabled()}
1526-
title={
1527-
updateState() === "ready" && props.anyActiveRuns
1528-
? "Stop active runs to update"
1529-
: ""
1530-
}
1531-
>
1532-
{updateToolbarActionLabel()}
1533-
</Button>
1538+
<Show when={updateRestartBlockedMessage()}>
1539+
<div class="text-xs leading-relaxed text-amber-11/90 md:max-w-sm">
1540+
{updateRestartBlockedMessage()}
1541+
</div>
15341542
</Show>
15351543
</div>
15361544
</Show>
@@ -2546,111 +2554,115 @@ export default function SettingsView(props: SettingsViewProps) {
25462554
</button>
25472555
</div>
25482556

2549-
<div class="flex items-center justify-between gap-3 bg-gray-1 p-3 rounded-xl border border-gray-6">
2550-
<div class="space-y-0.5">
2551-
<div class="text-sm text-gray-12">
2552-
<Switch>
2553-
<Match when={updateState() === "checking"}>
2554-
Checking...
2555-
</Match>
2556-
<Match when={updateState() === "available"}>
2557-
Update available: v{updateVersion()}
2558-
</Match>
2559-
<Match when={updateState() === "downloading"}>
2560-
Downloading...
2561-
</Match>
2562-
<Match when={updateState() === "ready"}>
2563-
Ready to install: v{updateVersion()}
2564-
</Match>
2565-
<Match when={updateState() === "error"}>
2566-
Update check failed
2567-
</Match>
2568-
<Match when={true}>Up to date</Match>
2569-
</Switch>
2570-
</div>
2571-
<Show
2572-
when={
2573-
updateState() === "idle" &&
2574-
updateLastCheckedAt()
2575-
}
2576-
>
2577-
<div class="text-xs text-gray-7">
2578-
Last checked{" "}
2579-
{formatRelativeTime(
2580-
updateLastCheckedAt() as number,
2581-
)}
2557+
<div class="bg-gray-1 p-3 rounded-xl border border-gray-6 space-y-3">
2558+
<div class="flex items-center justify-between gap-3">
2559+
<div class="space-y-0.5">
2560+
<div class="text-sm text-gray-12">
2561+
<Switch>
2562+
<Match when={updateState() === "checking"}>
2563+
Checking...
2564+
</Match>
2565+
<Match when={updateState() === "available"}>
2566+
Update available: v{updateVersion()}
2567+
</Match>
2568+
<Match when={updateState() === "downloading"}>
2569+
Downloading...
2570+
</Match>
2571+
<Match when={updateState() === "ready"}>
2572+
Ready to install: v{updateVersion()}
2573+
</Match>
2574+
<Match when={updateState() === "error"}>
2575+
Update check failed
2576+
</Match>
2577+
<Match when={true}>Up to date</Match>
2578+
</Switch>
25822579
</div>
2583-
</Show>
2584-
<Show
2585-
when={
2586-
updateState() === "available" && updateDate()
2587-
}
2588-
>
2589-
<div class="text-xs text-gray-7">
2590-
Published {updateDate()}
2591-
</div>
2592-
</Show>
2593-
<Show when={updateState() === "downloading"}>
2594-
<div class="text-xs text-gray-7">
2595-
{formatBytes(
2596-
(updateDownloadedBytes() as number) ?? 0,
2597-
)}
2598-
<Show when={updateTotalBytes() != null}>
2599-
{` / ${formatBytes(updateTotalBytes() as number)}`}
2600-
</Show>
2601-
</div>
2602-
</Show>
2603-
<Show when={updateState() === "error"}>
2604-
<div class="text-xs text-red-11">
2605-
{updateErrorMessage()}
2606-
</div>
2607-
</Show>
2608-
</div>
2609-
2610-
<div class="flex items-center gap-2">
2611-
<Button
2612-
variant="outline"
2613-
class="text-xs h-9 py-0 px-4 rounded-full border-gray-6/60 bg-gray-1/70 hover:bg-gray-2/70"
2614-
onClick={props.checkForUpdates}
2615-
disabled={
2616-
props.busy ||
2617-
updateState() === "checking" ||
2618-
updateState() === "downloading"
2619-
}
2620-
>
2621-
Check
2622-
</Button>
2623-
2624-
<Show when={updateState() === "available"}>
2625-
<Button
2626-
variant="secondary"
2627-
class="text-xs h-9 py-0 px-4 rounded-full"
2628-
onClick={props.downloadUpdate}
2629-
disabled={
2630-
props.busy || updateState() === "downloading"
2580+
<Show
2581+
when={
2582+
updateState() === "idle" &&
2583+
updateLastCheckedAt()
26312584
}
26322585
>
2633-
Download
2634-
</Button>
2635-
</Show>
2586+
<div class="text-xs text-gray-7">
2587+
Last checked{" "}
2588+
{formatRelativeTime(
2589+
updateLastCheckedAt() as number,
2590+
)}
2591+
</div>
2592+
</Show>
2593+
<Show
2594+
when={
2595+
updateState() === "available" && updateDate()
2596+
}
2597+
>
2598+
<div class="text-xs text-gray-7">
2599+
Published {updateDate()}
2600+
</div>
2601+
</Show>
2602+
<Show when={updateState() === "downloading"}>
2603+
<div class="text-xs text-gray-7">
2604+
{formatBytes(
2605+
(updateDownloadedBytes() as number) ?? 0,
2606+
)}
2607+
<Show when={updateTotalBytes() != null}>
2608+
{` / ${formatBytes(updateTotalBytes() as number)}`}
2609+
</Show>
2610+
</div>
2611+
</Show>
2612+
<Show when={updateState() === "error"}>
2613+
<div class="text-xs text-red-11">
2614+
{updateErrorMessage()}
2615+
</div>
2616+
</Show>
2617+
</div>
26362618

2637-
<Show when={updateState() === "ready"}>
2619+
<div class="flex items-center gap-2">
26382620
<Button
2639-
variant="secondary"
2640-
class="text-xs h-9 py-0 px-4 rounded-full"
2641-
onClick={props.installUpdateAndRestart}
2642-
disabled={props.busy || props.anyActiveRuns}
2643-
title={
2644-
props.anyActiveRuns
2645-
? "Stop active runs to update"
2646-
: ""
2621+
variant="outline"
2622+
class="text-xs h-9 py-0 px-4 rounded-full border-gray-6/60 bg-gray-1/70 hover:bg-gray-2/70"
2623+
onClick={props.checkForUpdates}
2624+
disabled={
2625+
props.busy ||
2626+
updateState() === "checking" ||
2627+
updateState() === "downloading"
26472628
}
26482629
>
2649-
Install & Restart
2630+
Check
26502631
</Button>
2651-
</Show>
2652-
</div>
2653-
</div>
2632+
2633+
<Show when={updateState() === "available"}>
2634+
<Button
2635+
variant="secondary"
2636+
class="text-xs h-9 py-0 px-4 rounded-full"
2637+
onClick={props.downloadUpdate}
2638+
disabled={
2639+
props.busy || updateState() === "downloading"
2640+
}
2641+
>
2642+
Download
2643+
</Button>
2644+
</Show>
2645+
2646+
<Show when={updateState() === "ready"}>
2647+
<Button
2648+
variant="secondary"
2649+
class="text-xs h-9 py-0 px-4 rounded-full"
2650+
onClick={props.installUpdateAndRestart}
2651+
disabled={props.busy || props.anyActiveRuns}
2652+
title={updateRestartBlockedMessage() ?? ""}
2653+
>
2654+
Install & Restart
2655+
</Button>
2656+
</Show>
2657+
</div>
2658+
</div>
2659+
2660+
<Show when={updateRestartBlockedMessage()}>
2661+
<div class="rounded-xl border border-amber-7/25 bg-amber-3/10 px-3 py-2 text-xs leading-relaxed text-amber-11">
2662+
{updateRestartBlockedMessage()}
2663+
</div>
2664+
</Show>
2665+
</div>
26542666

26552667
<Show
26562668
when={updateState() === "available" && updateNotes()}

0 commit comments

Comments
 (0)