Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/pages/ProjectsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import {
import { Folder24Icon } from '@oxide/design-system/icons/react'

import { confirmDelete } from '~/stores/confirm-delete'
import { DateCell } from '~/table/cells/DateCell'
import { makeLinkCell } from '~/table/cells/LinkCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { buttonStyle } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand Down Expand Up @@ -51,11 +51,8 @@ const staticCols = [
colHelper.accessor('name', {
cell: makeLinkCell((project) => pb.instances({ project })),
}),
colHelper.accessor('description', {}),
colHelper.accessor('timeCreated', {
header: 'created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('description', Columns.description),
colHelper.accessor('timeCreated', Columns.timeCreated),
]

export function ProjectsPage() {
Expand Down Expand Up @@ -119,6 +116,7 @@ export function ProjectsPage() {
)

const columns = useColsWithActions(staticCols, makeActions)

return (
<>
<PageHeader>
Expand Down
10 changes: 3 additions & 7 deletions app/pages/project/disks/DisksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import { Storage24Icon } from '@oxide/design-system/icons/react'
import { DiskStatusBadge } from '~/components/StatusBadge'
import { getProjectSelector, useProjectSelector, useToast } from '~/hooks'
import { confirmDelete } from '~/stores/confirm-delete'
import { DateCell } from '~/table/cells/DateCell'
import { InstanceLinkCell } from '~/table/cells/InstanceLinkCell'
import { SizeCell } from '~/table/cells/SizeCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { buttonStyle } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand Down Expand Up @@ -83,15 +82,12 @@ const staticCols = [
cell: (info) => <InstanceLinkCell instanceId={info.getValue()} />,
}
),
colHelper.accessor('size', { cell: (info) => <SizeCell value={info.getValue()} /> }),
colHelper.accessor('size', Columns.size),
colHelper.accessor('state.state', {
header: 'Status',
cell: (info) => <DiskStatusBadge status={info.getValue()} />,
}),
colHelper.accessor('timeCreated', {
header: 'Created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', Columns.timeCreated),
]

export function DisksPage() {
Expand Down
3 changes: 2 additions & 1 deletion app/pages/project/floating-ips/FloatingIpsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { confirmDelete } from '~/stores/confirm-delete'
import { addToast } from '~/stores/toast'
import { InstanceLinkCell } from '~/table/cells/InstanceLinkCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
import { Listbox } from '~/ui/lib/Listbox'
Expand Down Expand Up @@ -64,7 +65,7 @@ FloatingIpsPage.loader = async ({ params }: LoaderFunctionArgs) => {
const colHelper = createColumnHelper<FloatingIp>()
const staticCols = [
colHelper.accessor('name', {}),
colHelper.accessor('description', {}),
colHelper.accessor('description', Columns.description),
colHelper.accessor('ip', {}),
colHelper.accessor('instanceId', {
cell: (info) => <InstanceLinkCell instanceId={info.getValue()} />,
Expand Down
19 changes: 6 additions & 13 deletions app/pages/project/images/ImagesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import { Images24Icon } from '@oxide/design-system/icons/react'

import { getProjectSelector, useProjectSelector, useToast } from '~/hooks'
import { confirmDelete } from '~/stores/confirm-delete'
import { DateCell } from '~/table/cells/DateCell'
import { makeLinkCell } from '~/table/cells/LinkCell'
import { SizeCell } from '~/table/cells/SizeCell'
import { getActionsCol, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { buttonStyle } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand All @@ -37,7 +36,7 @@ const EmptyState = () => (
/>
)

const columnHelper = createColumnHelper<Image>()
const colHelper = createColumnHelper<Image>()

ImagesPage.loader = async ({ params }: LoaderFunctionArgs) => {
const { project } = getProjectSelector(params)
Expand Down Expand Up @@ -85,18 +84,12 @@ export function ImagesPage() {

const columns = useMemo(() => {
return [
columnHelper.accessor('name', {
colHelper.accessor('name', {
cell: makeLinkCell((image) => pb.projectImageEdit({ ...projectSelector, image })),
}),
columnHelper.accessor('description', {}),
columnHelper.accessor('size', {
header: 'size',
cell: (info) => <SizeCell value={info.getValue()} />,
}),
columnHelper.accessor('timeCreated', {
header: 'created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('description', Columns.description),
colHelper.accessor('size', Columns.size),
colHelper.accessor('timeCreated', Columns.timeCreated),
getActionsCol(makeActions),
]
}, [projectSelector, makeActions])
Expand Down
7 changes: 2 additions & 5 deletions app/pages/project/instances/InstancesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import {
import { Instances24Icon, Refresh16Icon } from '@oxide/design-system/icons/react'

import { getProjectSelector, useProjectSelector, useQuickActions } from '~/hooks'
import { DateCell } from '~/table/cells/DateCell'
import { InstanceResourceCell } from '~/table/cells/InstanceResourceCell'
import { InstanceStatusCell } from '~/table/cells/InstanceStatusCell'
import { makeLinkCell } from '~/table/cells/LinkCell'
import { getActionsCol } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { Button, buttonStyle } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand Down Expand Up @@ -110,10 +110,7 @@ export function InstancesPage() {
}
),
colHelper.accessor('hostname', {}),
colHelper.accessor('timeCreated', {
header: 'created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', Columns.timeCreated),
getActionsCol(makeActions),
],
[projectSelector, makeActions]
Expand Down
3 changes: 2 additions & 1 deletion app/pages/project/instances/instance/tabs/NetworkingTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { confirmDelete } from '~/stores/confirm-delete'
import { SkeletonCell } from '~/table/cells/EmptyCell'
import { LinkCell } from '~/table/cells/LinkCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { Badge } from '~/ui/lib/Badge'
import { Button } from '~/ui/lib/Button'
Expand Down Expand Up @@ -97,7 +98,7 @@ const staticCols = [
</>
),
}),
colHelper.accessor('description', {}),
colHelper.accessor('description', Columns.description),
colHelper.accessor('ip', {}),
colHelper.accessor('vpcId', {
header: 'vpc',
Expand Down
12 changes: 3 additions & 9 deletions app/pages/project/instances/instance/tabs/StorageTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ import { AttachDiskSideModalForm } from '~/forms/disk-attach'
import { CreateDiskSideModalForm } from '~/forms/disk-create'
import { getInstanceSelector, useInstanceSelector } from '~/hooks'
import { addToast } from '~/stores/toast'
import { DateCell } from '~/table/cells/DateCell'
import { SizeCell } from '~/table/cells/SizeCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { Button } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand All @@ -55,17 +54,12 @@ StorageTab.loader = async ({ params }: LoaderFunctionArgs) => {
const colHelper = createColumnHelper<Disk>()
const staticCols = [
colHelper.accessor('name', {}),
colHelper.accessor('size', {
cell: (info) => <SizeCell value={info.getValue()} />,
}),
colHelper.accessor('size', Columns.size),
colHelper.accessor((row) => row.state.state, {
header: 'status',
cell: (info) => <DiskStatusBadge status={info.getValue()} />,
}),
colHelper.accessor('timeCreated', {
header: 'created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', Columns.timeCreated),
]

const attachableStates = fancifyStates(instanceCan.attachDisk.states)
Expand Down
12 changes: 4 additions & 8 deletions app/pages/project/snapshots/SnapshotsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ import { Snapshots24Icon } from '@oxide/design-system/icons/react'
import { SnapshotStatusBadge } from '~/components/StatusBadge'
import { getProjectSelector, useProjectSelector } from '~/hooks'
import { confirmDelete } from '~/stores/confirm-delete'
import { DateCell } from '~/table/cells/DateCell'
import { SkeletonCell } from '~/table/cells/EmptyCell'
import { SizeCell } from '~/table/cells/SizeCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { Badge } from '~/ui/lib/Badge'
import { buttonStyle } from '~/ui/lib/Button'
Expand Down Expand Up @@ -84,19 +83,16 @@ SnapshotsPage.loader = async ({ params }: LoaderFunctionArgs) => {
const colHelper = createColumnHelper<Snapshot>()
const staticCols = [
colHelper.accessor('name', {}),
colHelper.accessor('description', {}),
colHelper.accessor('description', Columns.description),
colHelper.accessor('diskId', {
header: 'disk',
cell: (info) => <DiskNameFromId value={info.getValue()} />,
}),
colHelper.accessor('state', {
cell: (info) => <SnapshotStatusBadge status={info.getValue()} />,
}),
colHelper.accessor('size', { cell: (info) => <SizeCell value={info.getValue()} /> }),
colHelper.accessor('timeCreated', {
header: 'created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('size', Columns.size),
colHelper.accessor('timeCreated', Columns.timeCreated),
]

export function SnapshotsPage() {
Expand Down
7 changes: 2 additions & 5 deletions app/pages/project/vpcs/VpcPage/tabs/VpcFirewallRulesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { CreateFirewallRuleForm } from '~/forms/firewall-rules-create'
import { EditFirewallRuleForm } from '~/forms/firewall-rules-edit'
import { useVpcSelector } from '~/hooks'
import { confirmDelete } from '~/stores/confirm-delete'
import { DateCell } from '~/table/cells/DateCell'
import { EnabledCell } from '~/table/cells/EnabledCell'
import { FirewallFilterCell } from '~/table/cells/FirewallFilterCell'
import { ButtonCell } from '~/table/cells/LinkCell'
import { TypeValueCell } from '~/table/cells/TypeValueCell'
import { getActionsCol } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { Table } from '~/table/Table'
import { Button } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand Down Expand Up @@ -66,10 +66,7 @@ const staticColumns = [
header: 'Status',
cell: (info) => <EnabledCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', {
header: 'Created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', Columns.timeCreated),
]

export const VpcFirewallRulesTab = () => {
Expand Down
7 changes: 2 additions & 5 deletions app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { CreateSubnetForm } from '~/forms/subnet-create'
import { EditSubnetForm } from '~/forms/subnet-edit'
import { useVpcSelector } from '~/hooks'
import { confirmDelete } from '~/stores/confirm-delete'
import { DateCell } from '~/table/cells/DateCell'
import { TwoLineCell } from '~/table/cells/TwoLineCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { Button } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand All @@ -28,10 +28,7 @@ const staticCols = [
header: 'IP Block',
cell: (info) => <TwoLineCell value={[...info.getValue()]} />,
}),
colHelper.accessor('timeCreated', {
header: 'created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', Columns.timeCreated),
]

export const VpcSubnetsTab = () => {
Expand Down
9 changes: 3 additions & 6 deletions app/pages/project/vpcs/VpcsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import { Networking24Icon } from '@oxide/design-system/icons/react'

import { getProjectSelector, useProjectSelector, useQuickActions } from '~/hooks'
import { confirmDelete } from '~/stores/confirm-delete'
import { DateCell } from '~/table/cells/DateCell'
import { makeLinkCell } from '~/table/cells/LinkCell'
import { getActionsCol, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { buttonStyle } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand Down Expand Up @@ -106,11 +106,8 @@ export function VpcsPage() {
cell: makeLinkCell((vpc) => pb.vpc({ project, vpc })),
}),
colHelper.accessor('dnsName', { header: 'DNS name' }),
colHelper.accessor('description', {}),
colHelper.accessor('timeCreated', {
header: 'created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('description', Columns.description),
colHelper.accessor('timeCreated', Columns.timeCreated),
getActionsCol(makeActions),
],
[project, makeActions]
Expand Down
9 changes: 3 additions & 6 deletions app/pages/settings/SSHKeysPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { apiQueryClient, useApiMutation, useApiQueryClient, type SshKey } from '
import { Key16Icon, Key24Icon } from '@oxide/design-system/icons/react'

import { confirmDelete } from '~/stores/confirm-delete'
import { DateCell } from '~/table/cells/DateCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { buttonStyle } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand All @@ -30,11 +30,8 @@ SSHKeysPage.loader = async () => {
const colHelper = createColumnHelper<SshKey>()
const staticCols = [
colHelper.accessor('name', {}),
colHelper.accessor('description', {}),
colHelper.accessor('timeModified', {
header: 'Last updated',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('description', Columns.description),
colHelper.accessor('timeModified', Columns.timeModified),
]

export function SSHKeysPage() {
Expand Down
12 changes: 4 additions & 8 deletions app/pages/system/SiloImagesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ import { ListboxField } from '~/components/form/fields/ListboxField'
import { useForm, useToast } from '~/hooks'
import { confirmDelete } from '~/stores/confirm-delete'
import { addToast } from '~/stores/toast'
import { DateCell } from '~/table/cells/DateCell'
import { makeLinkCell } from '~/table/cells/LinkCell'
import { SizeCell } from '~/table/cells/SizeCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { Button } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
Expand Down Expand Up @@ -57,12 +56,9 @@ const staticCols = [
colHelper.accessor('name', {
cell: makeLinkCell((image) => pb.siloImageEdit({ image })),
}),
colHelper.accessor('description', {}),
colHelper.accessor('size', { cell: (info) => <SizeCell value={info.getValue()} /> }),
colHelper.accessor('timeCreated', {
header: 'Created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('description', Columns.description),
colHelper.accessor('size', Columns.size),
colHelper.accessor('timeCreated', Columns.timeCreated),
]

export function SiloImagesPage() {
Expand Down
12 changes: 3 additions & 9 deletions app/pages/system/inventory/sled/SledInstancesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { Instances24Icon } from '@oxide/design-system/icons/react'

import { InstanceStatusBadge } from '~/components/StatusBadge'
import { requireSledParams, useSledParams } from '~/hooks'
import { DateCell } from '~/table/cells/DateCell'
import { InstanceResourceCell } from '~/table/cells/InstanceResourceCell'
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
import { pick } from '~/util/object'
Expand Down Expand Up @@ -64,14 +64,8 @@ const staticCols = [
header: 'specs',
cell: (info) => <InstanceResourceCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', {
header: 'created',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('timeModified', {
header: 'modified',
cell: (info) => <DateCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', Columns.timeCreated),
colHelper.accessor('timeModified', Columns.timeModified),
]

export function SledInstancesTab() {
Expand Down
Loading