swarm-ui: the hives card and the alerts table show placeholder rows under their own header while they load
TableSkeleton is the twin of Table: the same columns, so the same header cells, with a placeholder shape in each cell of three blank rows and no sort or filter, which have nothing to work on yet. The hives card and the alerts table use it in place of their "loading…" text.
This commit is contained in:
parent
33c230665b
commit
e149ff3315
3 changed files with 54 additions and 3 deletions
|
|
@ -15,6 +15,7 @@ import {
|
|||
} from "../ui/refresh-interval/RefreshInterval.js";
|
||||
import { fetchJson, usePolled } from "../ui/polled/usePolled.js";
|
||||
import { Table, type TableColumn } from "../ui/table/Table.js";
|
||||
import { TableSkeleton } from "../ui/table/TableSkeleton.js";
|
||||
import { activeSinceMs, alertKey, listedAlerts, type Alert } from "./alerts.js";
|
||||
|
||||
const STATE_TONE: Record<string, BadgeTone> = {
|
||||
|
|
@ -111,7 +112,9 @@ function AlertsBody() {
|
|||
problem={error}
|
||||
/>
|
||||
) : null}
|
||||
{!error && alerts === null ? <p>loading…</p> : null}
|
||||
{!error && alerts === null ? (
|
||||
<TableSkeleton columns={COLUMNS} label="the alerts" />
|
||||
) : null}
|
||||
{listed && listed.length === 0 ? (
|
||||
<p>{showAll ? "no alerts." : "nothing is alerting."}</p>
|
||||
) : null}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import {
|
|||
} from "../ui/refresh-interval/RefreshInterval.js";
|
||||
import { SplitView } from "../ui/split-view/SplitView.js";
|
||||
import { Table, type TableColumn } from "../ui/table/Table.js";
|
||||
import { TableSkeleton } from "../ui/table/TableSkeleton.js";
|
||||
import { TextField } from "../ui/text-field/TextField.js";
|
||||
import { TextAreaField } from "../ui/text-area-field/TextAreaField.js";
|
||||
import {
|
||||
|
|
@ -491,6 +492,9 @@ export function ComponentsPage() {
|
|||
<AgentListSkeleton count={2} />
|
||||
</SkeletonRegion>
|
||||
</Sample>
|
||||
<Sample label="table placeholder">
|
||||
<TableSkeleton columns={TABLE_COLUMNS} label="the rows" />
|
||||
</Sample>
|
||||
</Section>
|
||||
|
||||
<Section title="MultiselectFilter">
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
} from "../../ui/refresh-interval/RefreshInterval.js";
|
||||
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
||||
import { Table, type TableColumn } from "../../ui/table/Table.js";
|
||||
import { TableSkeleton } from "../../ui/table/TableSkeleton.js";
|
||||
import { domainCell } from "../hive-domain.js";
|
||||
|
||||
type Freshness = "fresh" | "stale" | "never_reported" | "unknown";
|
||||
|
|
@ -142,7 +143,9 @@ function HiveRoster() {
|
|||
problem={error}
|
||||
/>
|
||||
) : null}
|
||||
{!error && hives === null ? <p>loading…</p> : null}
|
||||
{!error && hives === null ? (
|
||||
<TableSkeleton columns={COLUMNS} label="the hives" />
|
||||
) : null}
|
||||
{hives ? (
|
||||
<Table
|
||||
columns={COLUMNS}
|
||||
|
|
|
|||
Loading…
Reference in a new issue