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
2 changes: 1 addition & 1 deletion app/pages/system/UtilizationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const UsageCell = ({
allocated: number
unit?: string
}) => (
<div className="text-secondary flex flex-col">
<div className="text-secondary flex flex-col tabular-nums">
<div>
<span className="text-raise">{provisioned}</span> /
</div>
Expand Down
14 changes: 9 additions & 5 deletions app/pages/system/inventory/SledsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { TableEmptyBox } from '~/ui/lib/Table'
import { Truncate } from '~/ui/lib/Truncate'
import { ALL_ISH } from '~/util/consts'
import { pb } from '~/util/path-builder'
import { formatSlot } from '~/util/str'

import { ProvisionPolicyBadge, SledKindBadge, SledStateBadge } from './sled/SledBadges'

Expand All @@ -35,11 +36,14 @@ export const handle = { crumb: 'Sleds' }
const colHelper = createColumnHelper<Sled>()
const staticCols = [
colHelper.accessor('slot', {
cell: (info) => (
<div className="w-[2.5ch] text-right tabular-nums">
{info.getValue() ?? <EmptyCell />}
</div>
),
cell: (info) => {
const slot = info.getValue()
return slot == null ? (
<EmptyCell />
) : (
<span className="tabular-nums">{formatSlot(slot)}</span>
)
},
}),
colHelper.accessor('id', {
cell: (info) => (
Expand Down
7 changes: 6 additions & 1 deletion app/pages/system/inventory/sled/SledPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { PropertiesTable } from '~/ui/lib/PropertiesTable'
import { truncate } from '~/ui/lib/Truncate'
import { pb } from '~/util/path-builder'
import type * as PP from '~/util/path-params'
import { formatSlot } from '~/util/str'

import type { Route } from './+types/SledPage'
import { ProvisionPolicyBadge, SledKindBadge, SledStateBadge } from './SledBadges'
Expand Down Expand Up @@ -73,7 +74,11 @@ export default function SledPage() {
bytes={sled.usablePhysicalRam}
/>
<PropertiesTable.Row label="slot">
<span className="text-default">{sled.slot ?? <EmptyCell />}</span>
{sled.slot == null ? (
<EmptyCell />
) : (
<span className="text-default tabular-nums">{formatSlot(sled.slot)}</span>
)}
</PropertiesTable.Row>
<PropertiesTable.DateRow label="Created" date={sled.timeCreated} />
</PropertiesTable>
Expand Down
Binary file removed app/ui/assets/fonts/SuisseIntl-Light-WebS.woff
Binary file not shown.
Binary file removed app/ui/assets/fonts/SuisseIntl-Light-WebS.woff2
Binary file not shown.
Binary file added app/ui/assets/fonts/SuisseIntl-Light.woff2
Binary file not shown.
Binary file removed app/ui/assets/fonts/SuisseIntl-Medium-WebS.woff
Binary file not shown.
Binary file removed app/ui/assets/fonts/SuisseIntl-Medium-WebS.woff2
Binary file not shown.
Binary file added app/ui/assets/fonts/SuisseIntl-Medium.woff2
Binary file not shown.
Binary file removed app/ui/assets/fonts/SuisseIntl-Regular-WebS.woff
Binary file not shown.
Binary file removed app/ui/assets/fonts/SuisseIntl-Regular-WebS.woff2
Binary file not shown.
Binary file added app/ui/assets/fonts/SuisseIntl-Regular.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 4 additions & 12 deletions app/ui/styles/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,28 @@
/* Source: https://www.swisstypefaces.com/fonts/suisse/ */
@font-face {
font-family: 'SuisseIntl';
src:
url('../assets/fonts/SuisseIntl-Light-WebS.woff2') format('woff2'),
url('../assets/fonts/SuisseIntl-Light-WebS.woff') format('woff');
src: url('../assets/fonts/SuisseIntl-Light.woff2') format('woff2');
font-weight: 300;
font-style: normal;
}

@font-face {
font-family: 'SuisseIntl';
src:
url('../assets/fonts/SuisseIntl-Regular-WebS.woff2') format('woff2'),
url('../assets/fonts/SuisseIntl-Regular-WebS.woff') format('woff');
src: url('../assets/fonts/SuisseIntl-Regular.woff2') format('woff2');
font-weight: 400;
font-style: normal;
}

@font-face {
font-family: 'SuisseIntl';
src:
url('../assets/fonts/SuisseIntl-RegularItalic-WebS.woff2') format('woff2'),
url('../assets/fonts/SuisseIntl-RegularItalic-WebS.woff') format('woff');
src: url('../assets/fonts/SuisseIntl-RegularItalic.woff2') format('woff2');
font-weight: 400;
font-style: italic;
}

@font-face {
font-family: 'SuisseIntl';
src:
url('../assets/fonts/SuisseIntl-Medium-WebS.woff2') format('woff2'),
url('../assets/fonts/SuisseIntl-Medium-WebS.woff') format('woff');
src: url('../assets/fonts/SuisseIntl-Medium.woff2') format('woff2');
font-weight: 500;
font-style: normal;
}
3 changes: 3 additions & 0 deletions app/util/str.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import React, { type ReactElement, type ReactNode } from 'react'

export const capitalize = (s: string) => s && s.charAt(0).toUpperCase() + s.slice(1)

/** Zero-pad sled slot so 1- and 2-digit slots align (a rack has at most 32 slots) */
export const formatSlot = (slot: number) => String(slot).padStart(2, '0')

export const pluralize = (s: string, n: number) => `${s}${n === 1 ? '' : 's'}`

export const camelCase = (s: string) =>
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/inventory.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('Sled inventory page', async ({ page }) => {
// grouping, hence the slightly weird column names
await expectRowVisible(sledsTable, {
id: expect.stringContaining(sleds[0].id),
slot: '0',
slot: '00',
'serial number': sleds[0].baseboard.serial,
Kind: 'In service',
'Provision policy': 'Provisionable',
Expand Down Expand Up @@ -55,14 +55,14 @@ test('Sled inventory page', async ({ page }) => {

// rows are in slot order, with the sled without a slot last
const slotCells = sledsTable.locator('tbody tr td:first-child')
await expect(slotCells).toHaveText(['0', '2', '15', '—'])
await expect(slotCells).toHaveText(['00', '02', '15', '—'])

// Visit the sled detail page of the slot 0 sled
await sledsTable.getByRole('link', { name: sleds[0].id }).click()

await expectVisible(page, ['role=heading[name*="Sled"]'])
await expect(page.getByText('serialBRM02222869')).toBeVisible()
await expect(page.getByText('slot0')).toBeVisible()
await expect(page.getByText('slot00')).toBeVisible()

const instancesTab = page.getByRole('tab', { name: 'Instances' })
await expect(instancesTab).toBeVisible()
Expand Down
Loading