swarm ui: the status age helpers live in status-fields.ts
StatusMessage.tsx and statusMessage.ts differ only by case, which the esbuild step in the nix build can't read on a case-insensitive builder.
This commit is contained in:
parent
0547081138
commit
818d41eef3
3 changed files with 2 additions and 2 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
// agent with no message shows a dash and no age.
|
// agent with no message shows a dash and no age.
|
||||||
import type { AgentStatusSnapshot } from "../AgentTypes.js";
|
import type { AgentStatusSnapshot } from "../AgentTypes.js";
|
||||||
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
||||||
import { statusSetAtMs, statusText } from "./statusMessage.js";
|
import { statusSetAtMs, statusText } from "./status-fields.js";
|
||||||
|
|
||||||
export function StatusMessage({
|
export function StatusMessage({
|
||||||
snapshot,
|
snapshot,
|
||||||
|
|
|
||||||
20
frontend/packages/swarm-ui/src/agent/detail/status-fields.ts
Normal file
20
frontend/packages/swarm-ui/src/agent/detail/status-fields.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
// The agent's status message and when it set it, for the card and its detail.
|
||||||
|
// Kept out of the component so `npm test` runs it.
|
||||||
|
import type { AgentStatusSnapshot } from "../AgentTypes.js";
|
||||||
|
|
||||||
|
/** When the message was set, in ms since the epoch, or null when the agent has
|
||||||
|
* set none or the time is not known. The wire carries seconds. */
|
||||||
|
export function statusSetAtMs(
|
||||||
|
snapshot: AgentStatusSnapshot | null,
|
||||||
|
): number | null {
|
||||||
|
const at = snapshot?.status_set_at;
|
||||||
|
return typeof at === "number" && Number.isFinite(at) && at > 0
|
||||||
|
? at * 1000
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The message, or a dash when there is none. */
|
||||||
|
export function statusText(snapshot: AgentStatusSnapshot | null): string {
|
||||||
|
const text = snapshot?.status_text;
|
||||||
|
return text === null || text === undefined || text === "" ? "—" : text;
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ import { test } from "node:test";
|
||||||
import {
|
import {
|
||||||
statusSetAtMs,
|
statusSetAtMs,
|
||||||
statusText,
|
statusText,
|
||||||
} from "../src/agent/detail/statusMessage.ts";
|
} from "../src/agent/detail/status-fields.ts";
|
||||||
|
|
||||||
const snap = (status_text, status_set_at) => ({
|
const snap = (status_text, status_set_at) => ({
|
||||||
status_text,
|
status_text,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue