mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* fix(runtime): show Re-pair required for revoked servers and re-pair in place A server that revokes this computer's pairing token was labeled "Update required" because auth refusals and protocol mismatches shared one blocked state. Carry the blocked reason locally, label revoked hosts "Re-pair required", and add a Re-pair action (sidebar host menu + Settings server row) that verifies a new pairing link reaches the same server before replacing the saved pairing. * fix(sidebar): stop host header menu clicks from toggling or dragging the row * fix(sidebar): vertically center host header label and menu button
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import type { SshConnectionStatus } from './ssh-types'
|
|
import type { RuntimeHostBlockedReason } from './runtime-host-status'
|
|
|
|
export type ExecutionHostHealth =
|
|
| 'local'
|
|
| 'available'
|
|
| 'connecting'
|
|
| 'blocked'
|
|
| 'disconnected'
|
|
| 'error'
|
|
|
|
/** An SSH host's health; a target with no lifecycle state has never connected. */
|
|
export function getSshConnectionHealth(
|
|
status: SshConnectionStatus | undefined
|
|
): ExecutionHostHealth {
|
|
switch (status) {
|
|
case 'connected':
|
|
return 'available'
|
|
case 'connecting':
|
|
case 'deploying-relay':
|
|
case 'reconnecting':
|
|
return 'connecting'
|
|
case 'auth-failed':
|
|
case 'error':
|
|
case 'reconnection-failed':
|
|
return 'error'
|
|
case 'disconnected':
|
|
case undefined:
|
|
return 'disconnected'
|
|
}
|
|
}
|
|
|
|
export function getExecutionHostHealthLabel(
|
|
health: ExecutionHostHealth,
|
|
blockedReason?: RuntimeHostBlockedReason
|
|
): string {
|
|
switch (health) {
|
|
case 'local':
|
|
return 'Local'
|
|
case 'available':
|
|
return 'Connected'
|
|
case 'connecting':
|
|
return 'Connecting'
|
|
case 'blocked':
|
|
return blockedReason === 'access-revoked' ? 'Re-pair needed' : 'Update needed'
|
|
case 'disconnected':
|
|
return 'Disconnected'
|
|
case 'error':
|
|
return 'Needs attention'
|
|
}
|
|
}
|