Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/app/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3921,6 +3921,10 @@ export default function App() {
updateOpenworkServerSettings,
resetOpenworkServerSettings,
testOpenworkServerConnection,
canReloadWorkspace: canReloadWorkspace(),
reloadWorkspaceEngine,
reloadBusy: reloadBusy(),
reloadError: reloadError(),
activeWorkspaceDisplay: activeWorkspaceDisplay(),
workspaceSearch: workspaceStore.workspaceSearch(),
setWorkspaceSearch: workspaceStore.setWorkspaceSearch,
Expand Down
9 changes: 9 additions & 0 deletions packages/app/src/app/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export type DashboardViewProps = {
updateOpenworkServerSettings: (next: OpenworkServerSettings) => void;
resetOpenworkServerSettings: () => void;
testOpenworkServerConnection: (next: OpenworkServerSettings) => Promise<boolean>;
canReloadWorkspace: boolean;
reloadWorkspaceEngine: () => Promise<void>;
reloadBusy: boolean;
reloadError: string | null;
keybindItems: KeybindSetting[];
onOverrideKeybind: (id: string, keybind: string | null) => void;
onResetKeybind: (id: string) => void;
Expand Down Expand Up @@ -975,6 +979,11 @@ export default function DashboardView(props: DashboardViewProps) {
openworkServerCapabilities={props.openworkServerCapabilities}
openworkServerDiagnostics={props.openworkServerDiagnostics}
openworkServerWorkspaceId={props.openworkServerWorkspaceId}
clientConnected={props.clientConnected}
canReloadWorkspace={props.canReloadWorkspace}
reloadWorkspaceEngine={props.reloadWorkspaceEngine}
reloadBusy={props.reloadBusy}
reloadError={props.reloadError}
openworkAuditEntries={props.openworkAuditEntries}
openworkAuditStatus={props.openworkAuditStatus}
openworkAuditError={props.openworkAuditError}
Expand Down
49 changes: 49 additions & 0 deletions packages/app/src/app/pages/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ export type SettingsViewProps = {
openworkServerCapabilities: OpenworkServerCapabilities | null;
openworkServerDiagnostics: OpenworkServerDiagnostics | null;
openworkServerWorkspaceId: string | null;
clientConnected: boolean;
canReloadWorkspace: boolean;
openworkAuditEntries: OpenworkAuditEntry[];
openworkAuditStatus: "idle" | "loading" | "error";
openworkAuditError: string | null;
opencodeConnectStatus: OpencodeConnectStatus | null;
engineInfo: EngineInfo | null;
openwrkStatus: OpenwrkStatus | null;
owpenbotInfo: OwpenbotInfo | null;
reloadWorkspaceEngine: () => Promise<void>;
reloadBusy: boolean;
reloadError: string | null;
updateOpenworkServerSettings: (next: OpenworkServerSettings) => void;
resetOpenworkServerSettings: () => void;
testOpenworkServerConnection: (next: OpenworkServerSettings) => Promise<boolean>;
Expand Down Expand Up @@ -941,6 +946,18 @@ export default function SettingsView(props: SettingsViewProps) {
}
});

const reloadAvailabilityReason = createMemo(() => {
if (!props.clientConnected) return "Connect to this workspace to reload.";
if (!props.canReloadWorkspace) {
return "Reloading is only available for local workspaces or connected OpenWork servers.";
}
return null;
});

const reloadButtonLabel = createMemo(() => (props.reloadBusy ? "Reloading..." : "Reload engine"));
const reloadButtonTone = createMemo(() => (props.anyActiveRuns ? "danger" : "secondary"));
const reloadButtonDisabled = createMemo(() => props.reloadBusy || Boolean(reloadAvailabilityReason()));

const engineStatusLabel = createMemo(() => {
if (!isTauriRuntime()) return "Unavailable";
return props.engineInfo?.running ? "Running" : "Offline";
Expand Down Expand Up @@ -1927,6 +1944,38 @@ export default function SettingsView(props: SettingsViewProps) {
</div>
</Show>
</div>

<div class="bg-gray-2/30 border border-gray-6/50 rounded-2xl p-5 space-y-4">
<div>
<div class="text-sm font-medium text-gray-12">Engine reload</div>
<div class="text-xs text-gray-10">Restart the OpenCode server for this workspace.</div>
</div>

<div class="flex items-center justify-between bg-gray-1 p-3 rounded-xl border border-gray-6 gap-3">
<div class="min-w-0 space-y-1">
<div class="text-sm text-gray-12">Reload now</div>
<div class="text-xs text-gray-7">Applies config updates and reconnects your session.</div>
<Show when={props.anyActiveRuns}>
<div class="text-[11px] text-amber-11">Reloading will stop active tasks.</div>
</Show>
<Show when={props.reloadError}>
<div class="text-[11px] text-red-11">{props.reloadError}</div>
</Show>
<Show when={reloadAvailabilityReason()}>
<div class="text-[11px] text-gray-9">{reloadAvailabilityReason()}</div>
</Show>
</div>
<Button
variant={reloadButtonTone()}
class="text-xs h-8 py-0 px-3 shrink-0"
onClick={props.reloadWorkspaceEngine}
disabled={reloadButtonDisabled()}
>
<RefreshCcw size={14} class={props.reloadBusy ? "animate-spin" : ""} />
{reloadButtonLabel()}
</Button>
</div>
</div>
</div>
</div>
</Match>
Expand Down
Loading