Skip to content

Commit 2152a89

Browse files
committed
Back out "chore: convert last few routes (#2719)"
This backs out commit a3566bd.
1 parent 7410850 commit 2152a89

File tree

16 files changed

+70
-103
lines changed

16 files changed

+70
-103
lines changed

app/pages/project/vpcs/VpcPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ import { VpcDocsPopover } from './VpcsPage'
2727
const vpcView = ({ project, vpc }: PP.Vpc) =>
2828
apiq('vpcView', { path: { vpc }, query: { project } })
2929

30-
export async function clientLoader({ params }: LoaderFunctionArgs) {
30+
VpcPage.loader = async ({ params }: LoaderFunctionArgs) => {
3131
await queryClient.prefetchQuery(vpcView(getVpcSelector(params)))
3232
return null
3333
}
3434

35-
export default function VpcPage() {
35+
export function VpcPage() {
3636
const navigate = useNavigate()
3737
const vpcSelector = useVpcSelector()
3838
const { project, vpc: vpcName } = vpcSelector

app/pages/project/vpcs/VpcRoutersTab.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ const colHelper = createColumnHelper<VpcRouter>()
3535

3636
const vpcRouterList = (query: PP.Vpc) => getListQFn('vpcRouterList', { query })
3737

38-
export async function clientLoader({ params }: LoaderFunctionArgs) {
38+
export async function loader({ params }: LoaderFunctionArgs) {
3939
const { project, vpc } = getVpcSelector(params)
4040
await queryClient.prefetchQuery(vpcRouterList({ project, vpc }).optionsFn())
4141
return null
4242
}
4343

44-
export const handle = { crumb: 'Routers' }
45-
46-
export default function VpcRoutersTab() {
44+
Component.displayName = 'VpcRoutersTab'
45+
export function Component() {
4746
const vpcSelector = useVpcSelector()
4847
const navigate = useNavigate()
4948
const { project, vpc } = vpcSelector

app/pages/project/vpcs/VpcsPage.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { Networking16Icon, Networking24Icon } from '@oxide/design-system/icons/r
1515

1616
import { DocsPopover } from '~/components/DocsPopover'
1717
import { HL } from '~/components/HL'
18-
import { makeCrumb } from '~/hooks/use-crumbs'
1918
import { getProjectSelector, useProjectSelector } from '~/hooks/use-params'
2019
import { useQuickActions } from '~/hooks/use-quick-actions'
2120
import { confirmDelete } from '~/stores/confirm-delete'
@@ -66,15 +65,13 @@ const colHelper = createColumnHelper<Vpc>()
6665

6766
// just as in the vpcList call for the quick actions menu, include limit to make
6867
// sure it matches the call in the QueryTable
69-
export async function clientLoader({ params }: LoaderFunctionArgs) {
68+
VpcsPage.loader = async ({ params }: LoaderFunctionArgs) => {
7069
const { project } = getProjectSelector(params)
7170
await queryClient.prefetchQuery(vpcList(project).optionsFn())
7271
return null
7372
}
7473

75-
export const handle = makeCrumb('VPCs', (p) => pb.vpcs(getProjectSelector(p)))
76-
77-
export default function VpcsPage() {
74+
export function VpcsPage() {
7875
const { project } = useProjectSelector()
7976
const navigate = useNavigate()
8077

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ const EmptyState = () => (
5151

5252
const imageList = getListQFn('imageList', {})
5353

54-
export async function clientLoader() {
54+
export async function loader() {
5555
await queryClient.prefetchQuery(imageList.optionsFn())
5656
return null
5757
}
5858

59-
export const handle = { crumb: 'Images' }
60-
6159
const colHelper = createColumnHelper<Image>()
6260
const staticCols = [
6361
colHelper.accessor('name', {
@@ -68,7 +66,8 @@ const staticCols = [
6866
colHelper.accessor('timeCreated', Columns.timeCreated),
6967
]
7068

71-
export default function SiloImagesPage() {
69+
Component.displayName = 'SiloImagesPage'
70+
export function Component() {
7271
const [showModal, setShowModal] = useState(false)
7372
const [demoteImage, setDemoteImage] = useState<Image | null>(null)
7473

app/pages/system/inventory/DisksTab.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ const EmptyState = () => (
4040

4141
const diskList = getListQFn('physicalDiskList', {})
4242

43-
export async function clientLoader() {
43+
export async function loader() {
4444
await queryClient.prefetchQuery(diskList.optionsFn())
4545
return null
4646
}
4747

48-
export const handle = { crumb: 'Disks' }
49-
5048
const colHelper = createColumnHelper<PhysicalDisk>()
5149
const staticCols = [
5250
colHelper.accessor('id', {}),
@@ -71,7 +69,8 @@ const staticCols = [
7169
}),
7270
]
7371

74-
export default function DisksTab() {
72+
Component.displayName = 'DisksTab'
73+
export function Component() {
7574
const emptyState = <EmptyState />
7675
const { table } = useQueryTable({ query: diskList, columns: staticCols, emptyState })
7776
return table

app/pages/system/inventory/InventoryPage.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@ import { Servers16Icon, Servers24Icon } from '@oxide/design-system/icons/react'
1111

1212
import { DocsPopover } from '~/components/DocsPopover'
1313
import { RouteTabs, Tab } from '~/components/RouteTabs'
14-
import { makeCrumb } from '~/hooks/use-crumbs'
1514
import { PageHeader, PageTitle } from '~/ui/lib/PageHeader'
1615
import { docLinks } from '~/util/links'
1716
import { pb } from '~/util/path-builder'
1817

1918
const rackList = getListQFn('rackList', {})
2019

21-
export async function clientLoader() {
20+
InventoryPage.loader = async () => {
2221
await queryClient.prefetchQuery(rackList.optionsFn())
2322
return null
2423
}
2524

26-
export const handle = makeCrumb('Inventory', pb.sledInventory())
27-
28-
export default function InventoryPage() {
25+
export function InventoryPage() {
2926
const { data: racks } = usePrefetchedQuery(rackList.optionsFn())
3027
const rack = racks?.items[0]
3128

app/pages/system/inventory/SledsTab.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ const STATE_BADGE_COLORS: Record<SledState, BadgeColor> = {
3030

3131
const sledList = getListQFn('sledList', {})
3232

33-
export async function clientLoader() {
33+
export async function loader() {
3434
await queryClient.prefetchQuery(sledList.optionsFn())
3535
return null
3636
}
3737

38-
export const handle = { crumb: 'Sleds' }
39-
4038
const colHelper = createColumnHelper<Sled>()
4139
const staticCols = [
4240
colHelper.accessor('id', {
@@ -90,7 +88,8 @@ const staticCols = [
9088
}),
9189
]
9290

93-
export default function SledsTab() {
91+
Component.displayName = 'SledsTab'
92+
export function Component() {
9493
const emptyState = <EmptyMessage icon={<Servers24Icon />} title="No sleds found" />
9594
const { table } = useQueryTable({ query: sledList, columns: staticCols, emptyState })
9695
return table

app/pages/system/inventory/sled/SledInstancesTab.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ const EmptyState = () => {
3333
)
3434
}
3535

36-
export async function clientLoader({ params }: LoaderFunctionArgs) {
36+
export async function loader({ params }: LoaderFunctionArgs) {
3737
const { sledId } = requireSledParams(params)
3838
await queryClient.prefetchQuery(sledInstanceList(sledId).optionsFn())
3939
return null
4040
}
4141

42-
export const handle = { crumb: 'Instances' }
43-
4442
// passing in empty function because we still want the copy ID button
4543
const makeActions = (): MenuAction[] => []
4644

@@ -71,7 +69,8 @@ const staticCols = [
7169
colHelper.accessor('timeCreated', Columns.timeCreated),
7270
]
7371

74-
export default function SledInstancesTab() {
72+
Component.displayName = 'SledInstancesTab'
73+
export function Component() {
7574
const { sledId } = useSledParams()
7675
const columns = useColsWithActions(staticCols, makeActions)
7776
const { table } = useQueryTable({

app/pages/system/inventory/sled/SledPage.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,21 @@ import { apiQueryClient, usePrefetchedApiQuery } from '@oxide/api'
1212
import { Servers24Icon } from '@oxide/design-system/icons/react'
1313

1414
import { RouteTabs, Tab } from '~/components/RouteTabs'
15-
import { makeCrumb } from '~/hooks/use-crumbs'
1615
import { requireSledParams, useSledParams } from '~/hooks/use-params'
1716
import { PageHeader, PageTitle } from '~/ui/lib/PageHeader'
1817
import { PropertiesTable } from '~/ui/lib/PropertiesTable'
19-
import { truncate } from '~/ui/lib/Truncate'
2018
import { pb } from '~/util/path-builder'
2119

22-
export async function clientLoader({ params }: LoaderFunctionArgs) {
20+
export async function loader({ params }: LoaderFunctionArgs) {
2321
const { sledId } = requireSledParams(params)
2422
await apiQueryClient.prefetchQuery('sledView', {
2523
path: { sledId },
2624
})
2725
return null
2826
}
29-
export const handle = makeCrumb(
30-
(p) => truncate(p.sledId!, 12, 'middle'),
31-
(p) => pb.sled({ sledId: p.sledId! })
32-
)
3327

34-
export default function SledPage() {
28+
Component.displayName = 'SledPage'
29+
export function Component() {
3530
const { sledId } = useSledParams()
3631
const { data: sled } = usePrefetchedApiQuery('sledView', { path: { sledId } })
3732

0 commit comments

Comments
 (0)