34663ec5f9bd8846e66960c8db4f17c18d266400
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
34663ec5f9 |
fix(client): dashboard review pass - correctness, redundancy, comments
Code review of the dashboard branch. Four correctness bugs, one shared
helper, and the comment density brought down.
Correctness:
- CurrentlyDownCard: downSince() broke its backwards walk only on
`status === true`, so a check with an undefined status kept the run
going and reported a downtime reaching back to the start of the
retained window. Break on `status !== false` instead, matching what
the doc comment already claimed.
- RankingCards: the lowest-uptime card barred the uptime percentage
itself, so the worst monitor drew the shortest bar - a chart that read
as "best uptime" directly against its own title and sort order. Bar
the shortfall instead.
- useCardTransitions: the FLIP rAF and its nested 260ms timeout were
never cancelled. Navigating away mid-animation wrote styles to
unmounted nodes, and a second move while the first was settling had
its inversion wiped by the earlier timeout, so the card jumped rather
than travelled. Handles are now tracked and cancelled on unmount and
at the start of each move.
- BreakdownCard: the bar scale took buckets[0].total, silently assuming
the caller sorted descending. Compute the max instead - both callers
do sort today, but nothing in the signature said they had to.
Redundancy:
- "newest check is the last element of recentChecks" was implemented
twice with its own copy of the explanation. Now one `latestCheck`
helper in checks.ts. RankingCards averages over all checks, which is
a different operation, and is left alone.
- DEFAULT_CARD_IDS is `readonly` and copied into state rather than
assigned by reference.
Comments and conventions:
- 283 comment lines down to ~220. Design rationale ("two lines rather
than one wide row", "the header controls stay invisible until...")
is gone; comments recording non-obvious API facts - recentChecks is
oldest-first, snake_case here but camelCase there, credential fields
must not reach the DOM - are kept and shortened.
- DashboardCard: display/flexDirection/height hoisted out of sx to
native props (frontend rule 1). A stale comment claiming a "34px
control height" is corrected; the codebase settled on 32.
Gates: tsc clean, build passes, format-check clean, lint unchanged from
develop (12 errors, all pre-existing in untouched files).
|
||
|
|
dad32bc475 |
fix(client): translate the dashboard, drop redundant font sizes, reword the header
Three fixes from an audit of the dashboard against docs/coding-conventions.md.
Translations. The dashboard shipped English-only: all 18 other locales
had an empty pages.dashboard block, so every non-English user saw raw key
paths like pages.dashboard.cards.monitorStatus.title. All 18 are now
seeded, reusing each locale's own existing vocabulary for uptime,
incidents, checks and so on so the dashboard reads consistently with the
rest of that translation. Verified: all 91 keys the code uses resolve in
all 19 locales, with no interpolation placeholder mismatches.
Rule 3. Thirty-one fontSize={typographyLevels.m} props removed. The
conventions doc is explicit that 13px is the body default and the prop
should be dropped entirely; setting it to the token was my error while
fixing an earlier font-size complaint. Only the two xxl figures keep an
explicit size, which is correct. Nine now-dead typographyLevels imports
went with them.
Header description. "What is wrong right now, across every monitor type."
was a negative sentence fragment; every other page uses a full sentence
describing what the page gives you and why it helps. Reworded to match.
Rules 1, 2, 4, 5 and the i18n rule already passed and needed no change.
Claude-Session: https://claude.ai/code/session_01AbYLvwpEaZFXktHVcqrFRd
|
||
|
|
e4718b814f |
refactor(client): uniform card widths, shared primitives, clearer titles
Four widths (4/6/8/12) put four different card sizes on one page, and the 4-vs-6 difference read as inconsistency rather than intent. There are now two: every card is half-width and pairs down the page, and only Monitor status is full-width because it lays six counts across a single row. Currently down is half-width too. Seven columns would crush the monitor name there, so its rows are now two lines — name and downtime lead, with type, status code and the sparkline in a quieter line beneath. No information is lost. This collapses the layout logic: two halves fill a row exactly and a full card fills its own, so nothing is ever stretched to close a gap. The only remaining decision is a lone trailing half, promoted to full so the page does not end ragged. Verified across the catalogue, the non-admin subset, the defaults and single-card cases: no mid-page gaps anywhere. Componentization — there was real duplication: - StatLine was defined twice and MetricLine was a third copy of the same thing. All three are now CardStatLine. - A label + value + bar row appeared five times across the breakdown and ranking cards. It is now CardMeterRow. - Monitors by type and by group were the same card over different keys, so they share a BreakdownCard shell. Between them they drop from 232 lines to 83. Titles, checked against what each card actually renders: - Checks on schedule -> Check queue. It reports queue jobs and workers, not the checks themselves. - Maintenance -> Maintenance windows, Team -> Team members. Bare nouns read as navigation rather than as what the card reports. - The picker no longer borrows the sidebar's group labels. The Logs page hosts logs, queue and diagnostics tabs, so "Logs" misdescribed the three cards under it; that group is now "System". Checkmate server keeps its name — it does report on the server process. Picker buttons: Reset to defaults moves to the left, away from Done, since a destructive action should not sit next to the one people reach for by reflex. Done becomes the primary contained button. Dialog gains an optional cancelSx to allow that placement. Claude-Session: https://claude.ai/code/session_01AbYLvwpEaZFXktHVcqrFRd |
||
|
|
c46ead515b |
fix(client): dashboard hover controls, card widths and font sizes
Reorder controls stayed visible after a click. The reveal used `:focus-within`, and clicking a button leaves it focused, so that card's controls stayed pinned open long after the pointer left — Failed checks being wherever focus happened to land. Now `:has(:focus-visible)`, which matches keyboard focus only, so a mouse click no longer pins them. Widths: Currently down was full-width and Recent incidents 8-wide, both with more whitespace than content. Currently down carries six columns per row so it is the densest card, but it does not need all twelve; it is now 8. Recent incidents carries four and is now 4, as are Recent errors. Declaring a narrower width is not enough on its own: a card left alone in a row gets stretched to fill it, so Currently down at 8 still rendered at 12 while it was the only card in its row. Registry and default order are now sequenced so widths pair into full rows — 8 beside 4, 6 beside 6 — which is what actually makes the narrow cards render narrow. Verified across the full catalogue, the non-admin subset and the defaults: every mid-page row fills exactly 12 with no gaps. Fonts: every secondary line used typographyLevels.s, which is 11px — body2, a de-emphasis size. The theme's body1 is 13px, so all 24 uses are now typographyLevels.m. Nothing in a card renders below body size any more; only the large figures differ, at xxl. Claude-Session: https://claude.ai/code/session_01AbYLvwpEaZFXktHVcqrFRd |
||
|
|
49af07009d |
feat(client): reorder cards on hover, and tidy dashboard styling
Adds move-up / move-down controls to each card, revealed on hover or when something inside the card takes focus, so a settled dashboard stays quiet but the controls are still reachable by keyboard. The controls reach the card header through context rather than a prop, so none of the 17 card components has to know its own position — the grid owns ordering. Positions resolve against the *visible* order, not the stored array: a non-admin never sees the admin cards, so moving a card past one of them would otherwise appear to do nothing. Hidden cards keep their stored positions. Styling fixes: - 'Reset to defaults' no longer renders as the prominent green contained button. It is a destructive secondary action, so it moves to the quiet outlined slot beside the close action. The dialog now has no confirm button at all, since every change applies immediately and there is nothing to confirm. - Icons go through the shared Icon component at the codebase's usual 16px instead of ad-hoc 14px with a one-off stroke width, and the header spinner matches at 16px. - Named the remaining magic numbers — header height, bar thickness, sparkline and column widths, status tile width, control sizes — so they read as decisions rather than arbitrary pixels. There is no size-token scale in the theme (LAYOUT is spacing only) and peer components hardcode their own dimensions, so module constants match the house pattern rather than inventing a scale. - Centralised the two poll rates instead of repeating 30000 and 60000 across cards, and hoisted a stray sx flexShrink onto the component. Claude-Session: https://claude.ai/code/session_01AbYLvwpEaZFXktHVcqrFRd |
||
|
|
23b00401ca |
fix(client): correct recentChecks ordering on the dashboard
recentChecks is oldest-first, not newest-first. The server appends each snapshot with `$push … $slice: -N` (monitor.repository.mongo.ts:218) and returns it unreversed, and every existing consumer reads recentChecks[length - 1] as the latest. I had it backwards, which broke three things: - downSince() walked from index 0 and broke on the first element. For any monitor that was up before it failed — the normal case — the very first check is an "up", so the loop exited immediately and the downtime duration never rendered at all. - The sparkline reversed already-ascending data, drawing every trend line mirrored: climbing latency appeared to be improving. - The status code read index 0, the oldest retained check, so a monitor that served 200s before failing showed a green 200 beside a red dot. Also from review: - Drop `initializing` from the "Currently down" ranking. On a fresh install every new monitor starts there, so the card opened red claiming a fleet-wide outage. It means "not checked yet", not "broken". - Add the maintenance count to Monitor status. The summary reports it and the server counts it; omitting it left the tiles summing to less than totalMonitors with nothing explaining the gap. - Link the status tiles to plain /uptime. The monitors list never reads query params, so ?status= was silently dropped and the link lied. - Render the status code as plain text instead of StatusCodeLabel, whose Tooltip put a focusable element inside the row's link where no keyboard user could reach it. - Stop sending `limit`: findByTeamIdWithStats derives its page size from rowsPerPage alone and never reads it, so it only implied a truncation that was not in effect. - Persist a deliberately emptied dashboard instead of resetting it to the defaults on reload. - Pass isStale on every card. The prop and its dimming were implemented but never wired, so background refetches gave no feedback. Claude-Session: https://claude.ai/code/session_01AbYLvwpEaZFXktHVcqrFRd |
||
|
|
c58087c787 |
feat(client): add the main dashboard page
Adds /dashboard, a cross-type overview answering "is anything wrong, and where" — the question no single-type page can answer today. /uptime shows uptime monitors, /infrastructure shows hardware, /incidents shows history; nothing joined them. Layout is a 12-column grid. Each card type declares a minimum width (4, 6, 8 or 12) in the registry; the grid stretches the last card of a short row to fill the remainder, capped at 8 so one card never balloons across a near-empty row. Declared width is never a user setting. grid-auto-flow: dense was tried and does not help — no card is small enough to backfill the gaps that occur in practice. Six cards ship as the default set: Monitor status the five fleet counts, server-computed Currently down the centrepiece: everything wrong now, worst first Failed checks failure rate over the last day Recent incidents latest five, with the open count Monitors by type composition, flagging types with something down Checkmate server the only card that works with zero monitors (admin) Cards 1-3 and 5 ride a single /monitors/team/with-checks call shared through context, so adding a monitor-derived card costs no extra request. Notes on the data: - Ordering in "Currently down" is down -> breached -> initializing, tied on longest downtime. That is ordering derived from existing fields, not a new severity scale — Checkmate has none, and inventing one would be a product decision dressed as a design choice. - The healthy state is deliberately quiet: one line, not a wall of green. - Failed checks ships the day range only. dateRange=week returns figures identical to day, so a range selector would silently lie. - Admin-only cards are hidden rather than disabled, and are filtered out of the selection entirely for non-admins. Card selection persists to localStorage, validated on read so a card removed in a later release cannot break the page. The picker and the remaining catalogue cards are not built yet. The Containers card from the spec is deliberately absent: it needs containerSummary on the check snapshot, which arrives with the Docker monitoring work. cards.ts records where it slots in. Claude-Session: https://claude.ai/code/session_01AbYLvwpEaZFXktHVcqrFRd |