Skip to content

Commit a5af899

Browse files
authored
Get rid of single tab on IP pools (#2154)
* get rid of single tab on IP pools * comment is obsolete
1 parent 73263a4 commit a5af899

File tree

6 files changed

+20
-43
lines changed

6 files changed

+20
-43
lines changed

app/layouts/SystemLayout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function SystemLayout() {
6666
{ value: 'Silos', path: pb.silos() },
6767
{ value: 'Utilization', path: pb.systemUtilization() },
6868
{ value: 'Inventory', path: pb.inventory() },
69-
{ value: 'Networking', path: pb.ipPools() },
69+
{ value: 'IP Pools', path: pb.ipPools() },
7070
]
7171
// filter out the entry for the path we're currently on
7272
.filter((i) => i.path !== pathname)
@@ -112,7 +112,7 @@ export function SystemLayout() {
112112
<Storage16Icon /> Inventory
113113
</NavLinkItem>
114114
<NavLinkItem to={pb.ipPools()}>
115-
<Networking16Icon /> Networking
115+
<Networking16Icon /> IP Pools
116116
</NavLinkItem>
117117
</Sidebar.Nav>
118118
</Sidebar>

app/pages/system/networking/IpPoolsTab.tsx renamed to app/pages/system/networking/IpPoolsPage.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import { Columns } from '~/table/columns/common'
2929
import { useQueryTable } from '~/table/QueryTable'
3030
import { buttonStyle } from '~/ui/lib/Button'
3131
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
32+
import { PageHeader, PageTitle } from '~/ui/lib/PageHeader'
33+
import { TableActions } from '~/ui/lib/Table'
3234
import { pb } from '~/util/path-builder'
3335

3436
const EmptyState = () => (
@@ -60,12 +62,12 @@ const staticColumns = [
6062
colHelper.accessor('timeCreated', Columns.timeCreated),
6163
]
6264

63-
IpPoolsTab.loader = async function () {
65+
IpPoolsPage.loader = async function () {
6466
await apiQueryClient.prefetchQuery('ipPoolList', { query: { limit: 25 } })
6567
return null
6668
}
6769

68-
export function IpPoolsTab() {
70+
export function IpPoolsPage() {
6971
const navigate = useNavigate()
7072
const { Table } = useQueryTable('ipPoolList', {})
7173
const { data: pools } = usePrefetchedApiQuery('ipPoolList', { query: { limit: 25 } })
@@ -119,11 +121,14 @@ export function IpPoolsTab() {
119121

120122
return (
121123
<>
122-
<div className="mb-3 flex justify-end space-x-2">
124+
<PageHeader>
125+
<PageTitle icon={<Networking24Icon />}>IP Pools</PageTitle>
126+
</PageHeader>
127+
<TableActions>
123128
<Link to={pb.ipPoolsNew()} className={buttonStyle({ size: 'sm' })}>
124129
New IP Pool
125130
</Link>
126-
</div>
131+
</TableActions>
127132
<Table columns={columns} emptyState={<EmptyState />} />
128133
<Outlet />
129134
</>

app/pages/system/networking/NetworkingPage.tsx

-25
This file was deleted.

app/routes.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ import { SledInstancesTab } from './pages/system/inventory/sled/SledInstancesTab
7171
import { SledPage } from './pages/system/inventory/sled/SledPage'
7272
import { SledsTab } from './pages/system/inventory/SledsTab'
7373
import { IpPoolPage } from './pages/system/networking/IpPoolPage'
74-
import { IpPoolsTab } from './pages/system/networking/IpPoolsTab'
75-
import { NetworkingPage } from './pages/system/networking/NetworkingPage'
74+
import { IpPoolsPage } from './pages/system/networking/IpPoolsPage'
7675
import { SiloImagesPage } from './pages/system/SiloImagesPage'
7776
import { SiloPage } from './pages/system/silos/SiloPage'
7877
import { SilosPage } from './pages/system/silos/SilosPage'
@@ -178,10 +177,11 @@ export const routes = createRoutesFromElements(
178177
</Route>
179178
<Route path="health" element={null} handle={{ crumb: 'Health' }} />
180179
<Route path="update" element={null} handle={{ crumb: 'Update' }} />
181-
<Route path="networking" element={<NetworkingPage />}>
180+
<Route path="networking">
181+
<Route index element={<Navigate to="ip-pools" replace />} />
182182
<Route
183-
element={<IpPoolsTab />}
184-
loader={IpPoolsTab.loader}
183+
element={<IpPoolsPage />}
184+
loader={IpPoolsPage.loader}
185185
handle={{ crumb: 'IP pools' }}
186186
>
187187
<Route path="ip-pools" element={null} />

app/util/path-builder.ts

-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ export const pb = {
8383
systemUtilization: () => '/system/utilization',
8484
systemHealth: () => '/system/health',
8585

86-
// there is only one tab on networking and it's IP pools, so we just treat
87-
// that as the networking route for now
8886
ipPools: () => '/system/networking/ip-pools',
8987
ipPoolsNew: () => '/system/networking/ip-pools-new',
9088
ipPool: (params: IpPool) => `${pb.ipPools()}/${params.pool}`,

test/e2e/ip-pools.e2e.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ test('IP pool list', async ({ page }) => {
1515

1616
await expect(page).toHaveTitle('IP pools / Oxide Console')
1717

18-
await expect(page.getByRole('heading', { name: 'Networking' })).toBeVisible()
19-
await expect(page.getByRole('tab', { name: 'IP pools' })).toBeVisible()
18+
await expect(page.getByRole('heading', { name: 'IP Pools' })).toBeVisible()
2019

2120
const table = page.getByRole('table')
2221

@@ -199,7 +198,7 @@ test('IP range validation and add', async ({ page }) => {
199198
await expect(page.getByText('Capacity32')).toBeVisible()
200199

201200
// go back to the pool and verify the utilization column changed
202-
await page.getByRole('link', { name: 'Networking' }).click()
201+
await page.getByRole('link', { name: 'IP Pools' }).click()
203202
await expectRowVisible(table, {
204203
name: 'ip-pool-2',
205204
Utilization: 'v4' + '0 / 1' + 'v6' + '0 / 32',
@@ -233,7 +232,7 @@ test('remove range', async ({ page }) => {
233232
await expect(page.getByText('Capacity21')).toBeVisible()
234233

235234
// go back to the pool and verify the utilization column changed
236-
await page.getByRole('link', { name: 'Networking' }).click()
235+
await page.getByRole('link', { name: 'IP Pools' }).click()
237236
await expectRowVisible(table, {
238237
name: 'ip-pool-1',
239238
Utilization: '6 / 21',
@@ -256,7 +255,7 @@ test('deleting floating IP decrements utilization', async ({ page }) => {
256255
// now go back and it's 5. wow
257256
await page.getByLabel('Switch between system and silo').click()
258257
await page.getByRole('menuitem', { name: 'System' }).click()
259-
await page.getByRole('link', { name: 'Networking' }).click()
258+
await page.getByRole('link', { name: 'IP Pools' }).click()
260259
await expectRowVisible(table, { name: 'ip-pool-1', Utilization: '5 / 24' })
261260
})
262261

0 commit comments

Comments
 (0)