From 417c47fb28f9635bfc66d9409fea57bd4ff366ef Mon Sep 17 00:00:00 2001 From: Zakk Date: Sun, 27 Sep 2026 22:55:33 +1000 Subject: [PATCH] fix(policies): stop blaming TCP support when Test all is unavailable canProbe is false when the backend offers no TCP probe, when its probe limits are too small for the group, when the group has no members, or when the group takes no TCP probe. The disabled button's tip and the untested help both said the group does not support TCP probes, which is wrong in the first three cases. Both now say only that Test all is not available for this group, in all three languages. --- e2e/policies.spec.ts | 17 +++++++++++++++++ src/features/policies/messages.ts | 12 ++++++------ src/features/policies/view.ts | 3 ++- src/i18n/locales/en.ts | 4 ++-- src/i18n/locales/zh-CN.ts | 4 ++-- src/i18n/locales/zh-TW.ts | 4 ++-- 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/e2e/policies.spec.ts b/e2e/policies.spec.ts index 7ce22317..4b8a5c4f 100644 --- a/e2e/policies.spec.ts +++ b/e2e/policies.spec.ts @@ -135,3 +135,20 @@ test('a group check URL is edited in its dialog, refused inline when unsafe', as ]); expect(patches[0].headers()['if-match']).toBe('"40"'); }); + +test('a disabled Test all does not blame TCP support when the probe limits rule it out', async ({page}) => { + const {capabilities} = await mockBackend(page); + // The group takes TCP probes; the backend's job limit is what rules Test all out. + capabilities.resources.probes.limits!.max_members_per_job = 0; + await page.goto('/#/policies'); + const probe = page.getByRole('region', {name: 'resilient', exact: true}).getByRole('button', {name: 'Test all', exact: true}); + await expect(probe).toBeDisabled(); + // The disabled button's wrapper is its focus stop; reaching it by keyboard opens the tip at once, where a hover + // waits out the delay and closes if the card moves under the pointer. + const stop = probe.locator('xpath=..'); + await stop.focus(); + await page.keyboard.press('Shift+Tab'); + await page.keyboard.press('Tab'); + await expect(stop).toBeFocused(); + await expect(page.getByRole('tooltip')).toHaveText('Test all is not available for this group'); +}); diff --git a/src/features/policies/messages.ts b/src/features/policies/messages.ts index 1ffcfd69..de793299 100644 --- a/src/features/policies/messages.ts +++ b/src/features/policies/messages.ts @@ -88,7 +88,7 @@ export const messages = defineMessages({ 'policy.members': '{n} 個成員', 'policy.membersDown': '{n} 個成員,{down} 個無法使用', 'policy.loading': '正在載入 {id}…', - 'policy.noProbe': '此群組不支援 TCP 探測', + 'policy.noProbe': '此群組無法使用「測試全部」', 'policy.probing': '測試中…', 'policy.probeAll': '測試全部', 'policy.healthy': '{n} 個可用', @@ -96,7 +96,7 @@ export const messages = defineMessages({ 'policy.untested': '{n} 個未測試', 'policy.untestedHelp': '這些成員的狀態尚未確定。', 'policy.untestedProbe': '可使用「測試全部」重新測試。', - 'policy.untestedNoProbe': '此群組不支援 TCP 探測。', + 'policy.untestedNoProbe': '此群組無法使用「測試全部」。', 'policy.network': '為 {name} 選擇網路', 'policy.both': '兩者', 'policy.updated': '{name} 組態已寫入並重載', @@ -234,7 +234,7 @@ export const messages = defineMessages({ 'policy.members': '{n} 个成员', 'policy.membersDown': '{n} 个成员,{down} 个不可用', 'policy.loading': '正在加载 {id}…', - 'policy.noProbe': '此组不支持 TCP 探测', + 'policy.noProbe': '此组无法使用“测试全部”', 'policy.probing': '测试中…', 'policy.probeAll': '测试全部', 'policy.healthy': '{n} 个可用', @@ -242,7 +242,7 @@ export const messages = defineMessages({ 'policy.untested': '{n} 个未测试', 'policy.untestedHelp': '这些成员的状态尚未确定。', 'policy.untestedProbe': '可使用“测试全部”重新测试。', - 'policy.untestedNoProbe': '此组不支持 TCP 探测。', + 'policy.untestedNoProbe': '此组无法使用“测试全部”。', 'policy.network': '为 {name} 选择网络', 'policy.both': '两者', 'policy.updated': '{name} 配置已写入并重载', @@ -384,7 +384,7 @@ export const messages = defineMessages({ }, 'policy.membersDown': {one: '{n} member, {down} unavailable', other: '{n} members, {down} unavailable'}, 'policy.loading': 'Loading {id}…', - 'policy.noProbe': 'This group does not support TCP probes', + 'policy.noProbe': 'Test all is not available for this group', 'policy.probing': 'Testing…', 'policy.probeAll': 'Test all', 'policy.healthy': '{n} available', @@ -392,7 +392,7 @@ export const messages = defineMessages({ 'policy.untested': '{n} untested', 'policy.untestedHelp': 'The state of these members is not known yet.', 'policy.untestedProbe': 'Use Test all to test them again.', - 'policy.untestedNoProbe': 'This group does not support TCP probes.', + 'policy.untestedNoProbe': 'Test all is not available for this group.', 'policy.network': 'Select network for {name}', 'policy.both': 'Both', 'policy.updated': 'Configuration for {name} written and reloaded', diff --git a/src/features/policies/view.ts b/src/features/policies/view.ts index 46e8a601..500f945a 100644 --- a/src/features/policies/view.ts +++ b/src/features/policies/view.ts @@ -192,7 +192,8 @@ export function nodeGridView( }; } -// Why members are untested, and whether Test all can settle it: a group that takes no probe cannot. +// Why members are untested, and whether Test all can settle it: it cannot when the backend offers no TCP probe within +// its limits, or the group has no members or takes no TCP probe. export function untestedHelp(untested: string | null, canProbe: boolean, t: Translator): Help | null { return untested ? {title: untested, text: [t('policy.untestedHelp'), t(canProbe ? 'policy.untestedProbe' : 'policy.untestedNoProbe')]} : null; } diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 0780d0bd..0c82717a 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -728,7 +728,7 @@ export const messages = { 'policy.members': {one: '{n} member', other: '{n} members'}, 'policy.membersDown': {one: '{n} member, {down} unavailable', other: '{n} members, {down} unavailable'}, 'policy.loading': 'Loading {id}…', - 'policy.noProbe': 'This group does not support TCP probes', + 'policy.noProbe': 'Test all is not available for this group', 'policy.probing': 'Testing…', 'policy.probeAll': 'Test all', 'policy.healthy': '{n} available', @@ -736,7 +736,7 @@ export const messages = { 'policy.untested': '{n} untested', 'policy.untestedHelp': 'The state of these members is not known yet.', 'policy.untestedProbe': 'Use Test all to test them again.', - 'policy.untestedNoProbe': 'This group does not support TCP probes.', + 'policy.untestedNoProbe': 'Test all is not available for this group.', 'policy.network': 'Select network for {name}', 'policy.both': 'Both', 'policy.updated': 'Configuration for {name} written and reloaded', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 80384bef..1bb0b7c2 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -704,7 +704,7 @@ export const messages = { 'policy.members': '{n} 个成员', 'policy.membersDown': '{n} 个成员,{down} 个不可用', 'policy.loading': '正在加载 {id}…', - 'policy.noProbe': '此组不支持 TCP 探测', + 'policy.noProbe': '此组无法使用“测试全部”', 'policy.probing': '测试中…', 'policy.probeAll': '测试全部', 'policy.healthy': '{n} 个可用', @@ -712,7 +712,7 @@ export const messages = { 'policy.untested': '{n} 个未测试', 'policy.untestedHelp': '这些成员的状态尚未确定。', 'policy.untestedProbe': '可使用“测试全部”重新测试。', - 'policy.untestedNoProbe': '此组不支持 TCP 探测。', + 'policy.untestedNoProbe': '此组无法使用“测试全部”。', 'policy.network': '为 {name} 选择网络', 'policy.both': '两者', 'policy.updated': '{name} 配置已写入并重载', diff --git a/src/i18n/locales/zh-TW.ts b/src/i18n/locales/zh-TW.ts index af4dd0d5..5f52d771 100644 --- a/src/i18n/locales/zh-TW.ts +++ b/src/i18n/locales/zh-TW.ts @@ -703,7 +703,7 @@ export const messages = { 'policy.members': '{n} 個成員', 'policy.membersDown': '{n} 個成員,{down} 個無法使用', 'policy.loading': '正在載入 {id}…', - 'policy.noProbe': '此群組不支援 TCP 探測', + 'policy.noProbe': '此群組無法使用「測試全部」', 'policy.probing': '測試中…', 'policy.probeAll': '測試全部', 'policy.healthy': '{n} 個可用', @@ -711,7 +711,7 @@ export const messages = { 'policy.untested': '{n} 個未測試', 'policy.untestedHelp': '這些成員的狀態尚未確定。', 'policy.untestedProbe': '可使用「測試全部」重新測試。', - 'policy.untestedNoProbe': '此群組不支援 TCP 探測。', + 'policy.untestedNoProbe': '此群組無法使用「測試全部」。', 'policy.network': '為 {name} 選擇網路', 'policy.both': '兩者', 'policy.updated': '{name} 組態已寫入並重載',