swarm-ui: shared Hint, ActionRow, Toolbar, EmptyState, ExternalLink and ExpandableCard replace per-page copies
Hint, ActionRow, Toolbar, EmptyState and ExternalLink replace the muted text, button row, refresh bar, empty line and _blank anchor that each page restyled under its own class. ExpandableCard (with a loading twin) holds the builds and recent-runs cards, which had identical head and body CSS. The create form's raw checkbox becomes CheckboxField. The components page shows each new piece.
This commit is contained in:
parent
b74b5e77e4
commit
8a2e5203ad
1 changed files with 689 additions and 427 deletions
|
|
@ -7,6 +7,7 @@ import { useState } from "preact/hooks";
|
|||
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
|
||||
import { Badge, type BadgeTone } from "@hive/shared/badge.js";
|
||||
import { Button } from "../ui/button/Button.js";
|
||||
import { ExternalLink } from "../ui/external-link/ExternalLink.js";
|
||||
import { LazyDisclosure } from "../ui/disclosure/LazyDisclosure.js";
|
||||
import { RelativeTime } from "../ui/relative-time/RelativeTime.js";
|
||||
import {
|
||||
|
|
@ -16,6 +17,7 @@ import {
|
|||
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 { Toolbar } from "../ui/toolbar/Toolbar.js";
|
||||
import { activeSinceMs, alertKey, listedAlerts, type Alert } from "./alerts.js";
|
||||
|
||||
const STATE_TONE: Record<string, BadgeTone> = {
|
||||
|
|
@ -90,10 +92,10 @@ function AlertsBody() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<div class="ui-alerts-bar">
|
||||
<a href={GRAFANA_ALERTS_URL} target="_blank" rel="noopener noreferrer">
|
||||
<Toolbar>
|
||||
<ExternalLink href={GRAFANA_ALERTS_URL}>
|
||||
Grafana's alert list
|
||||
</a>
|
||||
</ExternalLink>
|
||||
{showAll || hidden > 0 ? (
|
||||
<Button onClick={() => setShowAll(!showAll)}>
|
||||
{showAll ? "only firing" : `show ${hidden} more`}
|
||||
|
|
@ -105,7 +107,7 @@ function AlertsBody() {
|
|||
onChange={setIntervalMs}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
</div>
|
||||
</Toolbar>
|
||||
{error ? (
|
||||
<ApiErrorPanel
|
||||
context="failed to load Grafana's alerts"
|
||||
|
|
|
|||
Loading…
Reference in a new issue