fmtAgo, fmtUntil and durationLabel move to @hive/shared/time.js. The swarm UI's util.ts is deleted and its importers (RelativeTime, ReviewRuns, BuildsPage) read the shared module directly. The dashboard's own copies are gone: its fmtAgeSecs (a third phrasing, used for two status lines) becomes the shared fmtAgo, and the dashboard util.js lost fmtAgo, fmtElapsed, epochSec and truncate, which nothing called. asyncBtn and the bulk action buttons mark themselves busy with markBusy: a spinner node before the label and aria-busy, in place of replacing the button's innerHTML with a string (and the label, so the button changed width and lost its name). The el() helper loses its html attribute.
13 lines
615 B
JavaScript
13 lines
615 B
JavaScript
// Dashboard render helper: `paintAtomic`, the atomic-swap render the tab modules
|
|
// use. Pure: no DOM or module state captured, so any tab module can import it
|
|
// without ordering concerns. Relative times and durations are
|
|
// `@hive/shared/time.js`.
|
|
|
|
// Atomic-swap render: build into an off-DOM DocumentFragment, then commit
|
|
// with a single `replaceChildren`. Avoids an intermediate empty-state
|
|
// flash on poll cycles even when the builder allocates a lot of nodes.
|
|
export function paintAtomic(liveRoot, build) {
|
|
const buf = document.createDocumentFragment();
|
|
build(buf);
|
|
liveRoot.replaceChildren(buf);
|
|
}
|