@@ -58,13 +58,14 @@ function OtherForwardRow({ forward }: { forward: RuntimePortForward }): React.JS
const connections =
forward.openConnections === 0
? null
- : forward.openConnections === 1
- ? t('auto.components.right.sidebar.RuntimeForwardedPorts.oneConnection', '1 connection')
- : t(
- 'auto.components.right.sidebar.RuntimeForwardedPorts.manyConnections',
- '{{value0}} connections',
- { value0: forward.openConnections }
- )
+ : t(
+ 'auto.components.right.sidebar.RuntimeForwardedPorts.connectionCount',
+ '{{count}} connections',
+ {
+ count: forward.openConnections,
+ defaultValue_one: '{{count}} connection'
+ }
+ )
const detail = [address, connections].filter(Boolean).join(' · ')
return (
diff --git a/src/renderer/src/components/right-sidebar/runtime-port-forward-status.tsx b/src/renderer/src/components/right-sidebar/runtime-port-forward-status.tsx
index 58a7fd941ed..8909ce9c1cc 100644
--- a/src/renderer/src/components/right-sidebar/runtime-port-forward-status.tsx
+++ b/src/renderer/src/components/right-sidebar/runtime-port-forward-status.tsx
@@ -14,7 +14,8 @@ export type RuntimePortForwardRowState =
const FOCUS =
'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring'
-const ACTION = 'h-5 px-1 text-xs font-normal text-foreground'
+const ACTION =
+ 'h-5 px-1 text-2xs font-normal text-muted-foreground hover:text-foreground [&_svg]:size-3'
/** The line under a remote port: where it lands on this computer, or a control to forward it. */
export function RuntimePortForwardStatus({
@@ -46,11 +47,9 @@ export function RuntimePortForwardStatus({
)
: remapped
? t(
- 'auto.components.right.sidebar.RuntimePortForward.remappedInUse',
- '{{value0}} in use',
- {
- value0: remotePort
- }
+ 'auto.components.right.sidebar.RuntimePortForward.remappedInUseHere',
+ '({{value0}} in use here)',
+ { value0: remotePort }
)
: null
const localAddress = t(
@@ -95,11 +94,11 @@ export function RuntimePortForwardStatus({
{note ? (
- · {note}
+ {note}
) : null}
{offline && onReconnect ? (
diff --git a/src/renderer/src/components/right-sidebar/runtime-ports-empty-text.tsx b/src/renderer/src/components/right-sidebar/runtime-ports-empty-text.tsx
index 9c5427ed50e..7ac6d940809 100644
--- a/src/renderer/src/components/right-sidebar/runtime-ports-empty-text.tsx
+++ b/src/renderer/src/components/right-sidebar/runtime-ports-empty-text.tsx
@@ -31,7 +31,10 @@ export function RuntimePortsEmptyText(): React.JSX.Element {
className="rounded-sm text-foreground underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
onClick={() => openSettingsTarget({ pane: 'ports', repoId: null })}
>
- {t('auto.components.right.sidebar.PortsPanel.portsSettingsLink', 'Ports settings')}
+ {t(
+ 'auto.components.right.sidebar.PortsPanel.turnOnInSettings',
+ 'Turn on in Ports settings'
+ )}
>
)
diff --git a/src/renderer/src/components/right-sidebar/ssh-forwarded-ports-section.tsx b/src/renderer/src/components/right-sidebar/ssh-forwarded-ports-section.tsx
index 1fee94ef272..30a71573f19 100644
--- a/src/renderer/src/components/right-sidebar/ssh-forwarded-ports-section.tsx
+++ b/src/renderer/src/components/right-sidebar/ssh-forwarded-ports-section.tsx
@@ -43,10 +43,10 @@ export function SshForwardedPortsSection({
size={12}
className={cn('text-muted-foreground transition-transform', !collapsed && 'rotate-90')}
/>
-
+
{t('auto.components.right.sidebar.PortsPanel.ddbe58d74e', 'Forwarded')}
- {count > 0 && {count}}
+ {count > 0 && {count}}
)
})
+
+export const invalidRange = defineFixture({
+ width: 640,
+ render: () => ,
+ interact: async (frame) => {
+ const input = frame.querySelector('input[aria-label="Lowest port"]')
+ if (!input) {
+ return
+ }
+ const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set
+ setValue?.call(input, '70000')
+ input.dispatchEvent(new Event('input', { bubbles: true }))
+ input.focus()
+ input.blur()
+ await new Promise((resolve) => requestAnimationFrame(() => resolve(null)))
+ }
+})
diff --git a/src/renderer/src/components/settings/ports/PortsPane.tsx b/src/renderer/src/components/settings/ports/PortsPane.tsx
index 19703778a7a..2e7fa14bd13 100644
--- a/src/renderer/src/components/settings/ports/PortsPane.tsx
+++ b/src/renderer/src/components/settings/ports/PortsPane.tsx
@@ -89,6 +89,11 @@ export function PortsPane({ settings }: { settings: GlobalSettings }): React.JSX
[forwarding, updateSettings]
)
const off = !forwarding.autoForward
+ const needsAutoForward = t(
+ 'auto.components.settings.ports.needsAutoForward',
+ 'Turn on Auto-forward ports to change this.'
+ )
+ const rangeErrorId = useId()
const [rangeError, setRangeError] = useState(null)
const reportInvalid = useCallback(
(rejected: string | null) =>
@@ -109,8 +114,8 @@ export function PortsPane({ settings }: { settings: GlobalSettings }): React.JSX
update({ autoForward: !forwarding.autoForward })}
@@ -121,7 +126,8 @@ export function PortsPane({ settings }: { settings: GlobalSettings }): React.JSX
'auto.components.settings.ports.exclusiveDescription',
'If the port is taken here, skip it instead of remapping.'
)}
- checked={forwarding.exclusive}
+ // Off reads as off: a dependent switch that cannot act should not look on.
+ checked={forwarding.exclusive && !off}
onChange={() => update({ exclusive: !forwarding.exclusive })}
disabled={off}
/>
@@ -143,7 +149,7 @@ export function PortsPane({ settings }: { settings: GlobalSettings }): React.JSX
max={forwarding.rangeEnd}
disabled={off}
ariaLabel={t('auto.components.settings.ports.rangeStart', 'Lowest port')}
- describedBy={rangeHelpId}
+ describedBy={rangeError && !off ? `${rangeHelpId} ${rangeErrorId}` : rangeHelpId}
onCommit={(rangeStart) => update({ rangeStart })}
onInvalid={reportInvalid}
/>
@@ -154,17 +160,22 @@ export function PortsPane({ settings }: { settings: GlobalSettings }): React.JSX
max={65_535}
disabled={off}
ariaLabel={t('auto.components.settings.ports.rangeEnd', 'Highest port')}
- describedBy={rangeHelpId}
+ describedBy={rangeError && !off ? `${rangeHelpId} ${rangeErrorId}` : rangeHelpId}
onCommit={(rangeEnd) => update({ rangeEnd })}
onInvalid={reportInvalid}
/>
}
/>
- {rangeError ?
: null}
+ {rangeError && !off ? (
+
+
+
+ ) : null}
update({ notify: !forwarding.notify })}
disabled={off}
/>
diff --git a/src/renderer/src/i18n/en-runtime-required.json b/src/renderer/src/i18n/en-runtime-required.json
index 8e0d0f7bda3..a7339c5466d 100644
--- a/src/renderer/src/i18n/en-runtime-required.json
+++ b/src/renderer/src/i18n/en-runtime-required.json
@@ -408,6 +408,10 @@
"selectedCount_one": "{{count}} selected",
"selectedCount_other": "{{count}} selected"
},
+ "RuntimeForwardedPorts": {
+ "connectionCount_one": "{{count}} connection",
+ "connectionCount_other": "{{count}} connections"
+ },
"Search": {
"fileCount_one": "{{count}} file",
"fileCount_other": "{{count}} files",
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index df83f6def47..fee24d39e11 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -2159,10 +2159,11 @@
"runtimePortForwards": {
"desktopOnly": "Port forwarding needs the desktop app.",
"forwardedAnnouncement": "Forwarded :{{value0}} to localhost:{{value1}}",
- "busyInUse": "localhost:{{value0}} in use",
"updateHost": "Update Orca on this host",
- "listenFailedHere": "Could not listen on this computer",
- "hostNotReachable": "Host not reachable"
+ "hostNotReachable": "Host not reachable",
+ "failedAnnouncement": "Couldn't forward :{{value0}}. {{value1}}",
+ "busyInUseHere": "localhost:{{value0}} in use on this computer",
+ "listenFailedRetry": "Couldn't listen on this computer. Retry or pick another port"
}
},
"hooks": {
@@ -14064,7 +14065,6 @@
},
"ports": {
"autoForward": "Auto-forward ports",
- "autoForwardDescription": "Forward dev servers on remote hosts to localhost here.",
"exclusive": "Same port number only",
"exclusiveDescription": "If the port is taken here, skip it instead of remapping.",
"range": "Auto-forward port range",
@@ -14081,7 +14081,9 @@
"devServer": "dev server",
"descriptionSandboxes": "Forward dev servers in sandboxes and on remote hosts to this computer."
},
- "rangeInvalid": "\"{{value0}}\" isn't a usable port. Use a port from 1 to 65535, lowest first."
+ "rangeInvalid": "\"{{value0}}\" isn't a usable port. Use a port from 1 to 65535, lowest first.",
+ "needsAutoForward": "Turn on Auto-forward ports to change this.",
+ "autoForwardDescriptionSandboxes": "Forward dev servers in sandboxes and on remote hosts to this computer."
}
},
"right": {
@@ -14314,7 +14316,7 @@
"localPortRequiresPrivileges": "Port {{port}} requires elevated privileges. Use a local port ≥ 1024.",
"remoteEmpty": "No ports yet. Dev servers started here are forwarded to localhost.",
"remoteEmptyOff": "No ports yet. Auto-forward is off.",
- "portsSettingsLink": "Ports settings"
+ "turnOnInSettings": "Turn on in Ports settings"
},
"Search": {
"1abfb25a66": "Type to search in files",
@@ -15642,8 +15644,8 @@
"ssh": "SSH access",
"stopped": "stopped",
"stopLabel": "Stop forwarding port {{value0}}",
- "oneConnection": "1 connection",
- "manyConnections": "{{value0}} connections"
+ "connectionCount_one": "{{count}} connection",
+ "connectionCount_other": "{{count}} connections"
},
"RuntimePortForward": {
"pending": "Forwarding…",
@@ -15655,12 +15657,12 @@
"stopForwarding": "Stop forwarding",
"hostOfflineNote": "Host offline",
"notAnswering": "Nothing answering on :{{value0}} yet",
- "remappedInUse": "{{value0}} in use",
"forwardedToLabel": "Port {{value0}} is forwarded to {{value1}}. Open in browser",
"reconnect": "Reconnect",
"actionLabel": "{{value0}} for port {{value1}}",
"copyLocalUrl": "Copy local URL",
- "stopAndSkip": "Stop and don't auto-forward :{{value0}}"
+ "stopAndSkip": "Stop and don't auto-forward :{{value0}}",
+ "remappedInUseHere": "({{value0}} in use here)"
},
"CloudShare": {
"alreadyShared": "Already shared",
@@ -19989,8 +19991,8 @@
"forwarded": "Forwarded :{{value0}} to localhost:{{value1}}",
"remappedInUse": "{{value0}} · {{value1}} in use on this computer",
"many": "{{value0}} ports forwarded",
- "openPorts": "Open Ports",
- "busyInUse": "localhost:{{value0}} in use on this computer"
+ "busyInUse": "localhost:{{value0}} in use on this computer",
+ "openPortsPanel": "Open ports"
}
}
},
diff --git a/src/renderer/src/lib/runtime-port-forwards/runtime-port-forwards-store.ts b/src/renderer/src/lib/runtime-port-forwards/runtime-port-forwards-store.ts
index ad9ba4a16eb..3ef8ad9166f 100644
--- a/src/renderer/src/lib/runtime-port-forwards/runtime-port-forwards-store.ts
+++ b/src/renderer/src/lib/runtime-port-forwards/runtime-port-forwards-store.ts
@@ -67,7 +67,14 @@ export function runtimePortForwardingAvailable(): boolean {
return typeof bridge()?.openPortForward === 'function'
}
+let announcementRepeat = 0
+
function emit(next: ForwardState): void {
+ if (next.announcement && next.announcement === state.announcement.replace(/\u00a0+$/, '')) {
+ // Live regions only speak changed text; a trailing no-break space marks a repeat.
+ announcementRepeat = (announcementRepeat + 1) % 2
+ next = { ...next, announcement: next.announcement + '\u00a0'.repeat(announcementRepeat + 1) }
+ }
state = next
for (const listener of listeners) {
listener()
@@ -189,10 +196,17 @@ export async function openRuntimePortForward(
'Forwarded :{{value0}} to localhost:{{value1}}',
{ value0: request.remotePort, value1: result.forward.localPort }
)
- : `:${request.remotePort} ${runtimePortForwardFailureText({
- code: result.code,
- localPort: request.localPort ?? request.remotePort
- })}`
+ : translate(
+ 'auto.lib.runtimePortForwards.failedAnnouncement',
+ "Couldn't forward :{{value0}}. {{value1}}",
+ {
+ value0: request.remotePort,
+ value1: runtimePortForwardFailureText({
+ code: result.code,
+ localPort: request.localPort ?? request.remotePort
+ })
+ }
+ )
})
return result
}
@@ -219,16 +233,20 @@ export async function closeRuntimePortForward(
export function runtimePortForwardFailureText(failure: RuntimePortForwardFailure): string {
switch (failure.code) {
case 'port_busy':
- return translate('auto.lib.runtimePortForwards.busyInUse', 'localhost:{{value0}} in use', {
- value0: failure.localPort
- })
+ return translate(
+ 'auto.lib.runtimePortForwards.busyInUseHere',
+ 'localhost:{{value0}} in use on this computer',
+ {
+ value0: failure.localPort
+ }
+ )
case 'host_unsupported':
return translate('auto.lib.runtimePortForwards.updateHost', 'Update Orca on this host')
case 'invalid_request':
case 'listen_failed':
return translate(
- 'auto.lib.runtimePortForwards.listenFailedHere',
- 'Could not listen on this computer'
+ 'auto.lib.runtimePortForwards.listenFailedRetry',
+ "Couldn't listen on this computer. Retry or pick another port"
)
case 'tunnel_failed':
return translate('auto.lib.runtimePortForwards.hostNotReachable', 'Host not reachable')