From d9a90756362d51e3f83dbfc00b60693b2ad18d2d Mon Sep 17 00:00:00 2001 From: CodingOnStar Date: Thu, 10 Sep 2026 18:36:10 +0800 Subject: [PATCH] fix(web): match IP Policy Used by chips to Figma Move Used by into the edit dialog body as a labeled field of app chips with icon, name, and an external-link arrow. --- .../ip-policies-page/__tests__/index.spec.tsx | 10 +++------ .../ip-policies-page/policy-dialog.tsx | 22 +++++++++---------- .../ip-policies-page/referenced-apps.tsx | 16 ++++++++------ web/i18n/ar-TN/common.json | 1 + web/i18n/de-DE/common.json | 1 + web/i18n/en-US/common.json | 1 + web/i18n/es-ES/common.json | 1 + web/i18n/fa-IR/common.json | 1 + web/i18n/fr-FR/common.json | 1 + web/i18n/hi-IN/common.json | 1 + web/i18n/id-ID/common.json | 1 + web/i18n/it-IT/common.json | 1 + web/i18n/ja-JP/common.json | 1 + web/i18n/ko-KR/common.json | 1 + web/i18n/lo-LA/common.json | 1 + web/i18n/nl-NL/common.json | 1 + web/i18n/pl-PL/common.json | 1 + web/i18n/pt-BR/common.json | 1 + web/i18n/ro-RO/common.json | 1 + web/i18n/ru-RU/common.json | 1 + web/i18n/sl-SI/common.json | 1 + web/i18n/th-TH/common.json | 1 + web/i18n/tr-TR/common.json | 1 + web/i18n/uk-UA/common.json | 1 + web/i18n/vi-VN/common.json | 1 + web/i18n/zh-Hans/common.json | 1 + web/i18n/zh-Hant/common.json | 1 + 27 files changed, 46 insertions(+), 26 deletions(-) diff --git a/web/app/components/header/account-setting/ip-policies-page/__tests__/index.spec.tsx b/web/app/components/header/account-setting/ip-policies-page/__tests__/index.spec.tsx index a06dfc8f307..1582334b77f 100644 --- a/web/app/components/header/account-setting/ip-policies-page/__tests__/index.spec.tsx +++ b/web/app/components/header/account-setting/ip-policies-page/__tests__/index.spec.tsx @@ -25,8 +25,7 @@ const translations = vi.hoisted(() => ({ 'settings.ipPolicyDeleteBoundDescription': '{{name}} is applied to {{count}} apps. Deleting it turns off IP restriction for those apps, so they can be reached from any IP. Other app permissions stay the same.', 'settings.ipPolicyDeleteConfirm': 'Delete “{{name}}”?', - 'settings.ipPolicyEditUsedBy': - 'This policy is used by {{count}} apps. Saving updates the allowlist for all of them.', + 'settings.ipPolicyUsedByLabel': 'Used by', 'settings.ipPolicyDialogDescription': 'Specify which IP addresses or ranges can access your apps.', 'settings.ipPolicyEditTitle': 'Edit IP Policy', @@ -159,15 +158,12 @@ describe('IpPoliciesPage', () => { ) await user.click(screen.getByRole('button', { name: 'Edit' })) - expect( - screen.getByText( - 'This policy is used by 2 apps. Saving updates the allowlist for all of them.', - ), - ).toBeInTheDocument() + expect(screen.getByText('Used by')).toBeInTheDocument() expect(screen.getByRole('link', { name: 'Support Bot' })).toHaveAttribute( 'href', '/app/app-a/overview', ) + expect(screen.getByRole('link', { name: 'Support Bot' })).toHaveAttribute('target', '_blank') }) it('lets the user delete a referenced policy after confirming the impact', async () => { diff --git a/web/app/components/header/account-setting/ip-policies-page/policy-dialog.tsx b/web/app/components/header/account-setting/ip-policies-page/policy-dialog.tsx index 7252f3afd65..ab794d9cfb0 100644 --- a/web/app/components/header/account-setting/ip-policies-page/policy-dialog.tsx +++ b/web/app/components/header/account-setting/ip-policies-page/policy-dialog.tsx @@ -80,17 +80,6 @@ export function IpPolicyDialog({ {t(($) => $['settings.ipPolicyDialogDescription'], { ns: 'common' })} - {mode === 'edit' && usedByCount > 0 && ( -
-

- {t(($) => $['settings.ipPolicyEditUsedBy'], { - ns: 'common', - count: usedByCount, - })} -

- -
- )}
{ event.preventDefault() if (!canSubmit) return @@ -128,6 +117,15 @@ export function IpPolicyDialog({ + {mode === 'edit' && usedByCount > 0 && ( + + + {t(($) => $['settings.ipPolicyUsedByLabel'], { ns: 'common' })} + + + + )} +