Skip to content

Commit 7712765

Browse files
authored
Rename "status" columns to more correct "state" (#2395)
rename status to state everywhere it's appropriate
1 parent 342aa04 commit 7712765

File tree

12 files changed

+46
-52
lines changed

12 files changed

+46
-52
lines changed

app/components/StatusBadge.tsx app/components/StateBadge.tsx

+9-15
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ const INSTANCE_COLORS: Record<InstanceState, Pick<BadgeProps, 'color' | 'variant
2222
destroyed: { color: 'neutral', variant: 'solid' },
2323
}
2424

25-
export const InstanceStatusBadge = (props: {
26-
status: InstanceState
27-
className?: string
28-
}) => (
29-
<Badge {...INSTANCE_COLORS[props.status]} className={props.className}>
30-
{props.status}
25+
export const InstanceStateBadge = (props: { state: InstanceState; className?: string }) => (
26+
<Badge {...INSTANCE_COLORS[props.state]} className={props.className}>
27+
{props.state}
3128
</Badge>
3229
)
3330

@@ -48,9 +45,9 @@ const DISK_COLORS: Record<DiskStateStr, Pick<BadgeProps, 'color' | 'variant'>> =
4845
finalizing: { color: 'blue', variant: 'solid' },
4946
}
5047

51-
export const DiskStatusBadge = (props: { status: DiskStateStr; className?: string }) => (
52-
<Badge {...DISK_COLORS[props.status]} className={props.className}>
53-
{props.status}
48+
export const DiskStateBadge = (props: { state: DiskStateStr; className?: string }) => (
49+
<Badge {...DISK_COLORS[props.state]} className={props.className}>
50+
{props.state}
5451
</Badge>
5552
)
5653

@@ -61,11 +58,8 @@ const SNAPSHOT_COLORS: Record<SnapshotState, BadgeColor> = {
6158
ready: 'default',
6259
}
6360

64-
export const SnapshotStatusBadge = (props: {
65-
status: SnapshotState
66-
className?: string
67-
}) => (
68-
<Badge color={SNAPSHOT_COLORS[props.status]} className={props.className}>
69-
{props.status}
61+
export const SnapshotStateBadge = (props: { state: SnapshotState; className?: string }) => (
62+
<Badge color={SNAPSHOT_COLORS[props.state]} className={props.className}>
63+
{props.state}
7064
</Badge>
7165
)

app/pages/project/disks/DisksPage.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import { Storage16Icon, Storage24Icon } from '@oxide/design-system/icons/react'
2121

2222
import { DocsPopover } from '~/components/DocsPopover'
23-
import { DiskStatusBadge } from '~/components/StatusBadge'
23+
import { DiskStateBadge } from '~/components/StateBadge'
2424
import { getProjectSelector, useProjectSelector } from '~/hooks'
2525
import { confirmDelete } from '~/stores/confirm-delete'
2626
import { addToast } from '~/stores/toast'
@@ -87,8 +87,8 @@ const staticCols = [
8787
),
8888
colHelper.accessor('size', Columns.size),
8989
colHelper.accessor('state.state', {
90-
header: 'Status',
91-
cell: (info) => <DiskStatusBadge status={info.getValue()} />,
90+
header: 'state',
91+
cell: (info) => <DiskStateBadge state={info.getValue()} />,
9292
}),
9393
colHelper.accessor('timeCreated', Columns.timeCreated),
9494
]

app/pages/project/instances/InstancesPage.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { instanceTransitioning } from '~/api/util'
1717
import { InstanceDocsPopover } from '~/components/InstanceDocsPopover'
1818
import { RefreshButton } from '~/components/RefreshButton'
1919
import { getProjectSelector, useProjectSelector, useQuickActions } from '~/hooks'
20-
import { InstanceStatusCell } from '~/table/cells/InstanceStatusCell'
20+
import { InstanceStateCell } from '~/table/cells/InstanceStateCell'
2121
import { makeLinkCell } from '~/table/cells/LinkCell'
2222
import { getActionsCol } from '~/table/columns/action-col'
2323
import { Columns } from '~/table/columns/common'
@@ -176,8 +176,8 @@ export function InstancesPage() {
176176
colHelper.accessor(
177177
(i) => ({ runState: i.runState, timeRunStateUpdated: i.timeRunStateUpdated }),
178178
{
179-
header: 'status',
180-
cell: (info) => <InstanceStatusCell value={info.getValue()} />,
179+
header: 'state',
180+
cell: (info) => <InstanceStateCell value={info.getValue()} />,
181181
}
182182
),
183183
colHelper.accessor('timeCreated', Columns.timeCreated),

app/pages/project/instances/instance/InstancePage.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { InstanceDocsPopover } from '~/components/InstanceDocsPopover'
2323
import { MoreActionsMenu } from '~/components/MoreActionsMenu'
2424
import { RefreshButton } from '~/components/RefreshButton'
2525
import { RouteTabs, Tab } from '~/components/RouteTabs'
26-
import { InstanceStatusBadge } from '~/components/StatusBadge'
26+
import { InstanceStateBadge } from '~/components/StateBadge'
2727
import { getInstanceSelector, useInstanceSelector } from '~/hooks'
2828
import { EmptyCell } from '~/table/cells/EmptyCell'
2929
import { DateTime } from '~/ui/lib/DateTime'
@@ -167,11 +167,11 @@ export function InstancePage() {
167167
<span className="text-secondary">{memory.value}</span>
168168
<span className="ml-1 text-quaternary"> {memory.unit}</span>
169169
</PropertiesTable.Row>
170-
<PropertiesTable.Row label="status">
170+
<PropertiesTable.Row label="state">
171171
<div className="flex">
172-
<InstanceStatusBadge status={instance.runState} />
172+
<InstanceStateBadge state={instance.runState} />
173173
{polling && (
174-
<Tooltip content="Auto-refreshing while status changes" delay={150}>
174+
<Tooltip content="Auto-refreshing while state changes" delay={150}>
175175
<button type="button">
176176
<Spinner className="ml-2" />
177177
</button>

app/pages/project/instances/instance/SerialConsolePage.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
import { PrevArrow12Icon } from '@oxide/design-system/icons/react'
2020

2121
import { EquivalentCliCommand } from '~/components/EquivalentCliCommand'
22-
import { InstanceStatusBadge } from '~/components/StatusBadge'
22+
import { InstanceStateBadge } from '~/components/StateBadge'
2323
import { getInstanceSelector, useInstanceSelector } from '~/hooks/use-params'
2424
import { Badge, type BadgeColor } from '~/ui/lib/Badge'
2525
import { Spinner } from '~/ui/lib/Spinner'
@@ -219,7 +219,7 @@ const CannotConnect = ({ instance }: { instance: Instance }) => (
219219
<SerialSkeleton animate={isStarting(instance)}>
220220
<p className="flex items-center justify-center text-sans-xl">
221221
<span>The instance is </span>
222-
<InstanceStatusBadge className="ml-1.5" status={instance.runState} />
222+
<InstanceStateBadge className="ml-1.5" state={instance.runState} />
223223
</p>
224224
<p className="mt-2 text-balance text-center text-secondary">
225225
{isStarting(instance)

app/pages/project/instances/instance/tabs/StorageTab.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from '@oxide/api'
2222
import { Storage24Icon } from '@oxide/design-system/icons/react'
2323

24-
import { DiskStatusBadge } from '~/components/StatusBadge'
24+
import { DiskStateBadge } from '~/components/StateBadge'
2525
import { AttachDiskSideModalForm } from '~/forms/disk-attach'
2626
import { CreateDiskSideModalForm } from '~/forms/disk-create'
2727
import { getInstanceSelector, useInstanceSelector } from '~/hooks'
@@ -56,8 +56,8 @@ const staticCols = [
5656
colHelper.accessor('name', { header: 'Disk' }),
5757
colHelper.accessor('size', Columns.size),
5858
colHelper.accessor((row) => row.state.state, {
59-
header: 'status',
60-
cell: (info) => <DiskStatusBadge status={info.getValue()} />,
59+
header: 'state',
60+
cell: (info) => <DiskStateBadge state={info.getValue()} />,
6161
}),
6262
colHelper.accessor('timeCreated', Columns.timeCreated),
6363
]

app/pages/project/snapshots/SnapshotsPage.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
import { Snapshots16Icon, Snapshots24Icon } from '@oxide/design-system/icons/react'
2020

2121
import { DocsPopover } from '~/components/DocsPopover'
22-
import { SnapshotStatusBadge } from '~/components/StatusBadge'
22+
import { SnapshotStateBadge } from '~/components/StateBadge'
2323
import { getProjectSelector, useProjectSelector } from '~/hooks'
2424
import { confirmDelete } from '~/stores/confirm-delete'
2525
import { SkeletonCell } from '~/table/cells/EmptyCell'
@@ -91,7 +91,7 @@ const staticCols = [
9191
cell: (info) => <DiskNameFromId value={info.getValue()} />,
9292
}),
9393
colHelper.accessor('state', {
94-
cell: (info) => <SnapshotStatusBadge status={info.getValue()} />,
94+
cell: (info) => <SnapshotStateBadge state={info.getValue()} />,
9595
}),
9696
colHelper.accessor('size', Columns.size),
9797
colHelper.accessor('timeCreated', Columns.timeCreated),

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as R from 'remeda'
1212
import { apiQueryClient, type SledInstance } from '@oxide/api'
1313
import { Instances24Icon } from '@oxide/design-system/icons/react'
1414

15-
import { InstanceStatusBadge } from '~/components/StatusBadge'
15+
import { InstanceStateBadge } from '~/components/StateBadge'
1616
import { requireSledParams, useSledParams } from '~/hooks'
1717
import { InstanceResourceCell } from '~/table/cells/InstanceResourceCell'
1818
import { useColsWithActions, type MenuAction } from '~/table/columns/action-col'
@@ -59,8 +59,8 @@ const staticCols = [
5959
// we don't show run state last update time like on project instances because
6060
// it's not in this response
6161
colHelper.accessor('state', {
62-
header: 'status',
63-
cell: (info) => <InstanceStatusBadge status={info.getValue()} />,
62+
header: 'State',
63+
cell: (info) => <InstanceStateBadge state={info.getValue()} />,
6464
}),
6565
colHelper.accessor((i) => R.pick(i, ['memory', 'ncpus']), {
6666
header: 'specs',

app/table/cells/InstanceStatusCell.tsx app/table/cells/InstanceStateCell.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
*/
88
import type { Instance } from '@oxide/api'
99

10-
import { InstanceStatusBadge } from '~/components/StatusBadge'
10+
import { InstanceStateBadge } from '~/components/StateBadge'
1111
import { TimeAgo } from '~/components/TimeAgo'
1212

1313
type Props = { value: Pick<Instance, 'runState' | 'timeRunStateUpdated'> }
1414

15-
export const InstanceStatusCell = ({ value }: Props) => {
15+
export const InstanceStateCell = ({ value }: Props) => {
1616
return (
1717
<div className="flex items-center gap-1.5">
18-
<InstanceStatusBadge status={value.runState} />
18+
<InstanceStateBadge state={value.runState} />
1919
<TimeAgo tooltipText="Run state updated" datetime={value.timeRunStateUpdated} />
2020
</div>
2121
)

test/e2e/disks.e2e.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ test('List disks and snapshot', async ({ page }) => {
1818
'Attached to': 'db1',
1919
name: 'disk-1',
2020
size: '2 GiB',
21-
Status: 'attached',
21+
state: 'attached',
2222
})
2323
await expectRowVisible(table, {
2424
'Attached to': '',
2525
name: 'disk-3',
2626
size: '6 GiB',
27-
Status: 'detached',
27+
state: 'detached',
2828
})
2929

3030
await clickRowAction(page, 'disk-1 db1', 'Snapshot')

test/e2e/instance.e2e.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test('can stop and delete a running instance', async ({ page }) => {
2929
const table = page.getByRole('table')
3030
await expectRowVisible(table, {
3131
name: 'db1',
32-
status: expect.stringContaining('running'),
32+
state: expect.stringContaining('running'),
3333
})
3434
const row = page.getByRole('row', { name: 'db1', exact: false })
3535

@@ -42,11 +42,11 @@ test('can stop and delete a running instance', async ({ page }) => {
4242
// polling makes it go stopping and then stopped
4343
await expectRowVisible(table, {
4444
name: 'db1',
45-
status: expect.stringContaining('stopping'),
45+
state: expect.stringContaining('stopping'),
4646
})
4747
await expectRowVisible(table, {
4848
name: 'db1',
49-
status: expect.stringContaining('stopped'),
49+
state: expect.stringContaining('stopped'),
5050
})
5151

5252
// now delete
@@ -62,29 +62,29 @@ test('can stop a starting instance, then start it again', async ({ page }) => {
6262
const table = page.getByRole('table')
6363
await expectRowVisible(table, {
6464
name: 'not-there-yet',
65-
status: expect.stringContaining('starting'),
65+
state: expect.stringContaining('starting'),
6666
})
6767

6868
await clickRowAction(page, 'not-there-yet', 'Stop')
6969
await page.getByRole('button', { name: 'Confirm' }).click()
7070

7171
await expectRowVisible(table, {
7272
name: 'not-there-yet',
73-
status: expect.stringContaining('stopping'),
73+
state: expect.stringContaining('stopping'),
7474
})
7575
await expectRowVisible(table, {
7676
name: 'not-there-yet',
77-
status: expect.stringContaining('stopped'),
77+
state: expect.stringContaining('stopped'),
7878
})
7979

8080
await clickRowAction(page, 'not-there-yet', 'Start')
8181
await expectRowVisible(table, {
8282
name: 'not-there-yet',
83-
status: expect.stringContaining('starting'),
83+
state: expect.stringContaining('starting'),
8484
})
8585
await expectRowVisible(table, {
8686
name: 'not-there-yet',
87-
status: expect.stringContaining('running'),
87+
state: expect.stringContaining('running'),
8888
})
8989
})
9090

@@ -108,18 +108,18 @@ test('instance table', async ({ page }) => {
108108
name: 'db1',
109109
CPU: '2 vCPU',
110110
Memory: '4 GiB',
111-
status: expect.stringMatching(/^running\d+s$/),
111+
state: expect.stringMatching(/^running\d+s$/),
112112
})
113113
await expectRowVisible(table, {
114114
name: 'you-fail',
115115
CPU: '4 vCPU',
116116
Memory: '6 GiB',
117-
status: expect.stringMatching(/^failed\d+s$/),
117+
state: expect.stringMatching(/^failed\d+s$/),
118118
})
119119
await expectRowVisible(table, {
120120
name: 'not-there-yet',
121121
CPU: '2 vCPU',
122122
Memory: '8 GiB',
123-
status: expect.stringMatching(/^starting\d+s$/),
123+
state: expect.stringMatching(/^starting\d+s$/),
124124
})
125125
})

test/e2e/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export async function stopInstance(page: Page) {
112112
await page.getByRole('button', { name: 'Confirm' }).click()
113113
await closeToast(page)
114114
// don't need to manually refresh because of polling
115-
await expect(page.getByText('statusstopped')).toBeVisible()
115+
await expect(page.getByText('statestopped')).toBeVisible()
116116
}
117117

118118
/**

0 commit comments

Comments
 (0)