Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: format the schedules page with treefmt

This commit is contained in:
iris 2026-10-04 17:37:31 +02:00 • committed by mara
commit 207b089498
4 changed files with 14 additions and 8 deletions

View file

@ -92,7 +92,8 @@ export function ScheduleForm({
? amountNum * UNIT_SECONDS[unit] ? amountNum * UNIT_SECONDS[unit]
: null; : null;
const startUnix = fromLocalInput(start); const startUnix = fromLocalInput(start);
const cadenceValid = startUnix !== null && (!repeat || intervalSeconds !== null); const cadenceValid =
startUnix !== null && (!repeat || intervalSeconds !== null);
const picked: MultiselectFilterState = { values: agents, negate: false }; const picked: MultiselectFilterState = { values: agents, negate: false };
const toggleAgent = (a: string) => const toggleAgent = (a: string) =>
@ -260,7 +261,10 @@ export function ScheduleForm({
</p> </p>
) : null} ) : null}
{error ? ( {error ? (
<ApiErrorPanel context="failed to save the schedule" problem={error} /> <ApiErrorPanel
context="failed to save the schedule"
problem={error}
/>
) : null} ) : null}
<div class="ui-schedule-form-actions"> <div class="ui-schedule-form-actions">
<Button onClick={onCancel}>cancel</Button> <Button onClick={onCancel}>cancel</Button>

View file

@ -72,7 +72,10 @@ export function upcomingFires(
count: number, count: number,
): number[] { ): number[] {
if (intervalSeconds === null) return anchorUnix > nowUnix ? [anchorUnix] : []; if (intervalSeconds === null) return anchorUnix > nowUnix ? [anchorUnix] : [];
const first = Math.max(0, Math.ceil((nowUnix - anchorUnix) / intervalSeconds)); const first = Math.max(
0,
Math.ceil((nowUnix - anchorUnix) / intervalSeconds),
);
return Array.from( return Array.from(
{ length: count }, { length: count },
(_, i) => anchorUnix + (first + i) * intervalSeconds, (_, i) => anchorUnix + (first + i) * intervalSeconds,

View file

@ -186,10 +186,7 @@ export function SchedulesPage() {
} }
> >
{error ? ( {error ? (
<ApiErrorPanel <ApiErrorPanel context="failed to load the schedules" problem={error} />
context="failed to load the schedules"
problem={error}
/>
) : null} ) : null}
{actionError ? ( {actionError ? (
<ApiErrorPanel <ApiErrorPanel

View file

@ -55,6 +55,8 @@ export function RelativeTime({
const ageSeconds = (now - epochMs) / 1000; const ageSeconds = (now - epochMs) / 1000;
return ( return (
<>{upcoming && ageSeconds < 0 ? fmtUntil(-ageSeconds) : fmtAgo(ageSeconds)}</> <>
{upcoming && ageSeconds < 0 ? fmtUntil(-ageSeconds) : fmtAgo(ageSeconds)}
</>
); );
} }