mirror of
https://github.com/stablyai/orca.git
synced 2026-10-16 08:03:09 +00:00
Remove redundant 'Focus this host' from the host header menu
The host scope strip is the single scoping control (the design doc explicitly forbids a separate focused-host toggle), and decluttering is now served by collapsing host sections. A second entry point with a different verb invented a third concept where two suffice: the strip is where work goes, the header is a group you can fold. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -74,7 +74,6 @@ export function HostSectionHeaderMenu({ row }: { row: HostHeaderRow }): React.JS
|
||||
const [renameOpen, setRenameOpen] = useState(false)
|
||||
const [removeOpen, setRemoveOpen] = useState(false)
|
||||
const mountedRef = useMountedRef()
|
||||
const setWorkspaceHostScope = useAppStore((s) => s.setWorkspaceHostScope)
|
||||
const sshConnected = useAppStore((s) => {
|
||||
const parsed = parseExecutionHostId(row.hostId)
|
||||
if (parsed?.kind !== 'ssh') {
|
||||
@@ -91,10 +90,6 @@ export function HostSectionHeaderMenu({ row }: { row: HostHeaderRow }): React.JS
|
||||
})
|
||||
const removalTarget = resolveHostRemoval(row.hostId)
|
||||
|
||||
const handleFocus = useCallback(() => {
|
||||
setWorkspaceHostScope(row.hostId)
|
||||
}, [row.hostId, setWorkspaceHostScope])
|
||||
|
||||
const handleManage = useCallback(() => {
|
||||
openManageHost(row)
|
||||
}, [row])
|
||||
@@ -238,9 +233,6 @@ export function HostSectionHeaderMenu({ row }: { row: HostHeaderRow }): React.JS
|
||||
<DropdownMenuLabel className="truncate text-[11px] font-medium text-muted-foreground">
|
||||
{row.label}
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuItem onSelect={handleFocus}>
|
||||
{translate('auto.components.sidebar.HostSectionHeaderMenu.1a2b3c4d5e', 'Focus this host')}
|
||||
</DropdownMenuItem>
|
||||
{model.actions.includes('rename') && (
|
||||
<DropdownMenuItem onSelect={() => setRenameOpen(true)}>
|
||||
<Pencil className="size-3.5" />
|
||||
|
||||
@@ -4,7 +4,7 @@ import { buildHostHeaderMenuModel } from './host-header-menu-items'
|
||||
describe('buildHostHeaderMenuModel', () => {
|
||||
it('offers Focus + Rename + Manage for the local host (no Remove)', () => {
|
||||
const model = buildHostHeaderMenuModel({ kind: 'local', health: 'local' })
|
||||
expect(model.actions).toEqual(['focus', 'rename', 'manage'])
|
||||
expect(model.actions).toEqual(['rename', 'manage'])
|
||||
expect(model.actions).not.toContain('remove')
|
||||
expect(model.blocked).toBeNull()
|
||||
})
|
||||
@@ -15,7 +15,7 @@ describe('buildHostHeaderMenuModel', () => {
|
||||
health: 'disconnected',
|
||||
sshConnected: false
|
||||
})
|
||||
expect(model.actions).toEqual(['focus', 'rename', 'ssh-reconnect', 'manage', 'remove'])
|
||||
expect(model.actions).toEqual(['rename', 'ssh-reconnect', 'manage', 'remove'])
|
||||
})
|
||||
|
||||
it('offers Disconnect + Remove for a connected SSH host', () => {
|
||||
@@ -24,18 +24,12 @@ describe('buildHostHeaderMenuModel', () => {
|
||||
health: 'available',
|
||||
sshConnected: true
|
||||
})
|
||||
expect(model.actions).toEqual(['focus', 'rename', 'ssh-disconnect', 'manage', 'remove'])
|
||||
expect(model.actions).toEqual(['rename', 'ssh-disconnect', 'manage', 'remove'])
|
||||
})
|
||||
|
||||
it('offers Check connection + Remove for a runtime host', () => {
|
||||
const model = buildHostHeaderMenuModel({ kind: 'runtime', health: 'available' })
|
||||
expect(model.actions).toEqual([
|
||||
'focus',
|
||||
'rename',
|
||||
'runtime-check-connection',
|
||||
'manage',
|
||||
'remove'
|
||||
])
|
||||
expect(model.actions).toEqual(['rename', 'runtime-check-connection', 'manage', 'remove'])
|
||||
})
|
||||
|
||||
it('offers Rename for every host kind', () => {
|
||||
|
||||
@@ -5,8 +5,10 @@ import type { RuntimeCompatVerdict } from '../../../../shared/protocol-compat'
|
||||
// Why: the host-header dropdown shows different lifecycle actions per host kind.
|
||||
// Keeping the availability rules in a pure function makes them unit-testable
|
||||
// without rendering the sidebar.
|
||||
// Why: no 'focus' action here — the host scope strip is the single scoping
|
||||
// control (the design doc forbids a separate focused-host toggle), and
|
||||
// decluttering is served by collapsing the section.
|
||||
export type HostHeaderMenuAction =
|
||||
| 'focus'
|
||||
| 'rename'
|
||||
| 'manage'
|
||||
| 'ssh-reconnect'
|
||||
@@ -40,7 +42,7 @@ function sshActions(connected: boolean): HostHeaderMenuAction[] {
|
||||
export function buildHostHeaderMenuModel(input: HostHeaderMenuInput): HostHeaderMenuModel {
|
||||
// Why: Rename edits only the client-side display label, so it's offered for
|
||||
// every host kind including local.
|
||||
const actions: HostHeaderMenuAction[] = ['focus', 'rename']
|
||||
const actions: HostHeaderMenuAction[] = ['rename']
|
||||
|
||||
switch (input.kind) {
|
||||
case 'ssh':
|
||||
|
||||
@@ -3778,7 +3778,6 @@
|
||||
"7f1a2b3c4d": "{{value0}} is reachable",
|
||||
"4f2c8a9b10": "Host actions for {{value0}}",
|
||||
"6b7c8d9e10": "Host actions",
|
||||
"1a2b3c4d5e": "Focus this host",
|
||||
"8d1e2f3a4b": "Rename…",
|
||||
"63f36455cc": "Reconnect",
|
||||
"59b553e2aa": "Disconnect",
|
||||
|
||||
@@ -3747,6 +3747,42 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sidebarHostOptions": {
|
||||
"3e102f111c": "All hosts"
|
||||
},
|
||||
"HostRemoveDialog": {
|
||||
"1a2b3c4d5e": "Removed {{value0}}",
|
||||
"2b3c4d5e6f": "Failed to remove host",
|
||||
"3c4d5e6f7a": "Remove {{value0}}?",
|
||||
"4d5e6f7a8b": "This opens the Orca servers settings where you can remove this server.",
|
||||
"5e6f7a8b9c": "This removes the saved SSH host and its credentials from this computer. Remote files are not deleted.",
|
||||
"6f7a8b9c0d": "Cancel",
|
||||
"7a8b9c0d1e": "Open settings",
|
||||
"8b9c0d1e2f": "Remove host"
|
||||
},
|
||||
"HostRenameDialog": {
|
||||
"1a2b3c4d5e": "Rename host",
|
||||
"2b3c4d5e6f": "This label is shown only on this computer. Leave it blank to use the default name.",
|
||||
"3c4d5e6f7a": "Display name",
|
||||
"4d5e6f7a8b": "Reset to default",
|
||||
"5e6f7a8b9c": "Cancel",
|
||||
"6f7a8b9c0d": "Save"
|
||||
},
|
||||
"HostSectionHeaderMenu": {
|
||||
"5b8b4b6a01": "Update server required",
|
||||
"9b3c1d2e44": "Update client required",
|
||||
"2c29e2de68": "Connection failed",
|
||||
"bf07aee59e": "Disconnect failed",
|
||||
"7f1a2b3c4d": "{{value0}} is reachable",
|
||||
"4f2c8a9b10": "Host actions for {{value0}}",
|
||||
"6b7c8d9e10": "Host actions",
|
||||
"8d1e2f3a4b": "Rename…",
|
||||
"63f36455cc": "Reconnect",
|
||||
"59b553e2aa": "Disconnect",
|
||||
"2d3e4f5a6b": "Check connection",
|
||||
"3c4d5e6f7a": "Manage host…",
|
||||
"6e7f8a9b0c": "Remove host…"
|
||||
}
|
||||
},
|
||||
"shared": {
|
||||
|
||||
@@ -3747,6 +3747,42 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sidebarHostOptions": {
|
||||
"3e102f111c": "All hosts"
|
||||
},
|
||||
"HostRemoveDialog": {
|
||||
"1a2b3c4d5e": "Removed {{value0}}",
|
||||
"2b3c4d5e6f": "Failed to remove host",
|
||||
"3c4d5e6f7a": "Remove {{value0}}?",
|
||||
"4d5e6f7a8b": "This opens the Orca servers settings where you can remove this server.",
|
||||
"5e6f7a8b9c": "This removes the saved SSH host and its credentials from this computer. Remote files are not deleted.",
|
||||
"6f7a8b9c0d": "Cancel",
|
||||
"7a8b9c0d1e": "Open settings",
|
||||
"8b9c0d1e2f": "Remove host"
|
||||
},
|
||||
"HostRenameDialog": {
|
||||
"1a2b3c4d5e": "Rename host",
|
||||
"2b3c4d5e6f": "This label is shown only on this computer. Leave it blank to use the default name.",
|
||||
"3c4d5e6f7a": "Display name",
|
||||
"4d5e6f7a8b": "Reset to default",
|
||||
"5e6f7a8b9c": "Cancel",
|
||||
"6f7a8b9c0d": "Save"
|
||||
},
|
||||
"HostSectionHeaderMenu": {
|
||||
"5b8b4b6a01": "Update server required",
|
||||
"9b3c1d2e44": "Update client required",
|
||||
"2c29e2de68": "Connection failed",
|
||||
"bf07aee59e": "Disconnect failed",
|
||||
"7f1a2b3c4d": "{{value0}} is reachable",
|
||||
"4f2c8a9b10": "Host actions for {{value0}}",
|
||||
"6b7c8d9e10": "Host actions",
|
||||
"8d1e2f3a4b": "Rename…",
|
||||
"63f36455cc": "Reconnect",
|
||||
"59b553e2aa": "Disconnect",
|
||||
"2d3e4f5a6b": "Check connection",
|
||||
"3c4d5e6f7a": "Manage host…",
|
||||
"6e7f8a9b0c": "Remove host…"
|
||||
}
|
||||
},
|
||||
"shared": {
|
||||
|
||||
@@ -3747,6 +3747,42 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sidebarHostOptions": {
|
||||
"3e102f111c": "All hosts"
|
||||
},
|
||||
"HostRemoveDialog": {
|
||||
"1a2b3c4d5e": "Removed {{value0}}",
|
||||
"2b3c4d5e6f": "Failed to remove host",
|
||||
"3c4d5e6f7a": "Remove {{value0}}?",
|
||||
"4d5e6f7a8b": "This opens the Orca servers settings where you can remove this server.",
|
||||
"5e6f7a8b9c": "This removes the saved SSH host and its credentials from this computer. Remote files are not deleted.",
|
||||
"6f7a8b9c0d": "Cancel",
|
||||
"7a8b9c0d1e": "Open settings",
|
||||
"8b9c0d1e2f": "Remove host"
|
||||
},
|
||||
"HostRenameDialog": {
|
||||
"1a2b3c4d5e": "Rename host",
|
||||
"2b3c4d5e6f": "This label is shown only on this computer. Leave it blank to use the default name.",
|
||||
"3c4d5e6f7a": "Display name",
|
||||
"4d5e6f7a8b": "Reset to default",
|
||||
"5e6f7a8b9c": "Cancel",
|
||||
"6f7a8b9c0d": "Save"
|
||||
},
|
||||
"HostSectionHeaderMenu": {
|
||||
"5b8b4b6a01": "Update server required",
|
||||
"9b3c1d2e44": "Update client required",
|
||||
"2c29e2de68": "Connection failed",
|
||||
"bf07aee59e": "Disconnect failed",
|
||||
"7f1a2b3c4d": "{{value0}} is reachable",
|
||||
"4f2c8a9b10": "Host actions for {{value0}}",
|
||||
"6b7c8d9e10": "Host actions",
|
||||
"8d1e2f3a4b": "Rename…",
|
||||
"63f36455cc": "Reconnect",
|
||||
"59b553e2aa": "Disconnect",
|
||||
"2d3e4f5a6b": "Check connection",
|
||||
"3c4d5e6f7a": "Manage host…",
|
||||
"6e7f8a9b0c": "Remove host…"
|
||||
}
|
||||
},
|
||||
"shared": {
|
||||
|
||||
Reference in New Issue
Block a user