Skip to content

Commit 240c48a

Browse files
authored
fix: update network isolation labels (#580)
1 parent 407edd8 commit 240c48a

File tree

2 files changed

+38
-16
lines changed

2 files changed

+38
-16
lines changed

renderer/src/features/registry-servers/components/__tests__/form-run-from-registry.test.tsx

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ describe('FormRunFromRegistry', () => {
152152
await userEvent.click(networkTab)
153153
expect(networkTab).toHaveAttribute('aria-selected', 'true')
154154
expect(configTab).toHaveAttribute('aria-selected', 'false')
155-
const switchLabel = screen.getByLabelText('Network isolation')
155+
const switchLabel = screen.getByLabelText(
156+
'Enable outbound network filtering'
157+
)
156158
expect(switchLabel).toBeInTheDocument()
157159
expect(switchLabel).toHaveAttribute('role', 'switch')
158160
expect(switchLabel).toHaveAttribute('aria-checked', 'false')
@@ -788,7 +790,9 @@ describe('FormRunFromRegistry', () => {
788790
await userEvent.click(networkTab)
789791

790792
// Enable the switch
791-
const switchLabel = screen.getByLabelText('Network isolation')
793+
const switchLabel = screen.getByLabelText(
794+
'Enable outbound network filtering'
795+
)
792796
await userEvent.click(switchLabel)
793797

794798
// The alert should appear
@@ -818,7 +822,9 @@ describe('FormRunFromRegistry', () => {
818822
})
819823
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
820824
await userEvent.click(networkTab)
821-
const switchLabel = screen.getByLabelText('Network isolation')
825+
const switchLabel = screen.getByLabelText(
826+
'Enable outbound network filtering'
827+
)
822828
await userEvent.click(switchLabel)
823829

824830
// By default, all are empty, so alert should show
@@ -885,7 +891,9 @@ describe('FormRunFromRegistry', () => {
885891
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
886892
await userEvent.click(networkTab)
887893
// Enable network isolation
888-
const switchLabel = screen.getByLabelText('Network isolation')
894+
const switchLabel = screen.getByLabelText(
895+
'Enable outbound network filtering'
896+
)
889897
await userEvent.click(switchLabel)
890898
// Add ports
891899
const addPortButton = screen.getByRole('button', { name: 'Add a port' })
@@ -941,7 +949,9 @@ describe('FormRunFromRegistry', () => {
941949
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
942950
await userEvent.click(networkTab)
943951
// Enable network isolation
944-
const switchLabel = screen.getByLabelText('Network isolation')
952+
const switchLabel = screen.getByLabelText(
953+
'Enable outbound network filtering'
954+
)
945955
await userEvent.click(switchLabel)
946956
// Do not add any ports
947957
// Submit
@@ -986,12 +996,14 @@ describe('Allowed Hosts field', () => {
986996
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
987997
await userEvent.click(networkTab)
988998
// Enable network isolation
989-
const switchLabel = screen.getByLabelText('Network isolation')
999+
const switchLabel = screen.getByLabelText(
1000+
'Enable outbound network filtering'
1001+
)
9901002
await userEvent.click(switchLabel)
9911003
// Add a host so the input and label are rendered
9921004
await userEvent.click(screen.getByRole('button', { name: /add a host/i }))
9931005
// Allowed Hosts field should be present
994-
expect(screen.getByLabelText('Allowed Hosts')).toBeInTheDocument()
1006+
expect(screen.getByLabelText('Allowed hosts')).toBeInTheDocument()
9951007
// Add host button should be present
9961008
expect(
9971009
screen.getByRole('button', { name: /add a host/i })
@@ -1015,7 +1027,9 @@ describe('Allowed Hosts field', () => {
10151027
})
10161028
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
10171029
await userEvent.click(networkTab)
1018-
const switchLabel = screen.getByLabelText('Network isolation')
1030+
const switchLabel = screen.getByLabelText(
1031+
'Enable outbound network filtering'
1032+
)
10191033
await userEvent.click(switchLabel)
10201034
// Add a host
10211035
const addHostButton = screen.getByRole('button', { name: /add a host/i })
@@ -1053,7 +1067,9 @@ describe('Allowed Hosts field', () => {
10531067
})
10541068
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
10551069
await userEvent.click(networkTab)
1056-
const switchLabel = screen.getByLabelText('Network isolation')
1070+
const switchLabel = screen.getByLabelText(
1071+
'Enable outbound network filtering'
1072+
)
10571073
await userEvent.click(switchLabel)
10581074
const addHostButton = screen.getByRole('button', { name: /add a host/i })
10591075
await userEvent.click(addHostButton)
@@ -1122,7 +1138,9 @@ describe('Allowed Hosts field', () => {
11221138
)
11231139
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
11241140
await userEvent.click(networkTab)
1125-
const switchLabel = screen.getByLabelText('Network isolation')
1141+
const switchLabel = screen.getByLabelText(
1142+
'Enable outbound network filtering'
1143+
)
11261144
await userEvent.click(switchLabel)
11271145
const addHostButton = screen.getByRole('button', { name: /add a host/i })
11281146
await userEvent.click(addHostButton)
@@ -1166,7 +1184,9 @@ describe('Allowed Hosts field', () => {
11661184
})
11671185
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
11681186
await userEvent.click(networkTab)
1169-
const switchLabel = screen.getByLabelText('Network isolation')
1187+
const switchLabel = screen.getByLabelText(
1188+
'Enable outbound network filtering'
1189+
)
11701190
await userEvent.click(switchLabel)
11711191
// Should be empty by default
11721192
expect(screen.queryByLabelText('Host 1')).not.toBeInTheDocument()
@@ -1206,7 +1226,9 @@ describe('Network Isolation Tab Activation', () => {
12061226
// Enable network isolation and add an invalid host
12071227
const networkTab = screen.getByRole('tab', { name: /network isolation/i })
12081228
await userEvent.click(networkTab)
1209-
const switchLabel = screen.getByLabelText('Network isolation')
1229+
const switchLabel = screen.getByLabelText(
1230+
'Enable outbound network filtering'
1231+
)
12101232
await userEvent.click(switchLabel)
12111233
// Add a host and enter an invalid value
12121234
const addHostBtn = screen.getByRole('button', { name: /add a host/i })

renderer/src/features/registry-servers/components/form-run-from-registry/network-isolation-tab-content.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export function NetworkIsolationTabContent({
2727
<div className="mb-4 flex items-center gap-4 rounded-md border px-3 py-4">
2828
<Switch
2929
id="network-isolation-switch"
30-
aria-label="Network isolation"
30+
aria-label="Enable outbound network filtering"
3131
checked={!!networkField.value}
3232
onCheckedChange={networkField.onChange}
3333
/>
3434
<Label htmlFor="network-isolation-switch">
35-
Network isolation
35+
Enable outbound network filtering
3636
</Label>
3737
</div>
3838
{networkField.value && (
@@ -54,7 +54,7 @@ export function NetworkIsolationTabContent({
5454
/*
5555
// @ts-expect-error no time to fix this */
5656
name="allowedHosts"
57-
label="Allowed Hosts"
57+
label="Allowed hosts"
5858
inputLabelPrefix="Host"
5959
addButtonText="Add a host"
6060
control={form.control}
@@ -70,7 +70,7 @@ export function NetworkIsolationTabContent({
7070
/*
7171
// @ts-expect-error no time to fix this */
7272
name={'allowedPorts'}
73-
label="Allowed Ports"
73+
label="Allowed ports"
7474
control={form.control}
7575
inputLabelPrefix="Port"
7676
addButtonText="Add a port"

0 commit comments

Comments
 (0)