Skip to content

Commit

Permalink
fix(hostd): alerts list not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Jan 9, 2025
1 parent e1a49ed commit 2fda955
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-dogs-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': patch
---

Fixed an issue where the list of alerts was not showing.
5 changes: 5 additions & 0 deletions .changeset/strange-ravens-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': patch
---

Fixed an issue where AlertDialog was using the incorrect dataset loaded state.
10 changes: 10 additions & 0 deletions apps/hostd-e2e/src/fixtures/navigate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@ export const navigateToContracts = step(
).toBeVisible()
}
)

export const openAlertsDialog = step(
'open alerts dialog',
async (page: Page) => {
await page.getByTestId('sidenav').getByLabel('Alerts').click()
const dialog = page.getByRole('dialog')
await expect(dialog.getByText('Alerts')).toBeVisible()
return dialog
}
)
5 changes: 4 additions & 1 deletion apps/hostd-e2e/src/specs/volumes.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test'
import { navigateToVolumes } from '../fixtures/navigate'
import { navigateToVolumes, openAlertsDialog } from '../fixtures/navigate'
import {
createVolume,
deleteVolume,
Expand Down Expand Up @@ -31,6 +31,9 @@ test('can create and delete a volume', async ({ page }) => {
const name = 'my-new-volume'
await navigateToVolumes({ page })
await createVolume(page, name, dirPath)
const dialog = await openAlertsDialog(page)
await expect(dialog.getByText('Volume initialized')).toBeVisible()
await dialog.getByLabel('close').click()
await deleteVolume(page, name, dirPath)
})

Expand Down
5 changes: 2 additions & 3 deletions libs/design-system/src/app/AlertsDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export function AlertsDialog({
alerts.data?.filter((a) => (filter ? a.severity === filter : true)) || [],
[alerts.data, filter]
)

// Sort keys by dataFieldOrder, then alphabetically
// Sort keys by dataFieldOrder, then alphabetically.
const getOrderedKeys = useCallback(
(obj: Record<string, unknown>) => {
const orderedKeys = Object.keys(obj).sort((a, b) => {
Expand Down Expand Up @@ -164,7 +163,7 @@ export function AlertsDialog({
</div>
)}
{loadingState === 'loading' && <EntityListSkeleton />}
{!loadingState && (
{loadingState === 'loaded' && (
<div className="flex flex-col">
{dataset.length ? (
dataset.map((a) => (
Expand Down

0 comments on commit 2fda955

Please sign in to comment.