swarm-ui: the refresh picker shows a spinner in place of its clock while its page is fetching
usePolled reports when a request is in flight (through a new onBusy of the poller) and holds it on for at least 0.4 seconds, so a quick answer still reads as a refresh. The picker swaps its clock for the spinner, in the same box so its width stays, and the spinner stands still where motion is off. Every page with a picker passes it; a page with several polled requests shows it while any of them runs. The Jobs page fetches through shared components and has none yet.
This commit is contained in:
parent
89bbeb9757
commit
47c447409b
1 changed files with 296 additions and 23 deletions
|
|
@ -64,6 +64,7 @@ function SchedulesBody() {
|
|||
const {
|
||||
data: schedules,
|
||||
error,
|
||||
refreshing: schedulesRefreshing,
|
||||
refresh,
|
||||
} = usePolled(intervalMs, (signal) =>
|
||||
fetchJson<Schedule[]>("/api/schedules", signal),
|
||||
|
|
@ -72,7 +73,11 @@ function SchedulesBody() {
|
|||
// lists, polled on the same cadence so an agent created after this page
|
||||
// opened shows up. A failed load does not block the page, the cards do not
|
||||
// need it; the form says the list could not load.
|
||||
const { data: roster, error: rosterError } = usePolled(intervalMs, (signal) =>
|
||||
const {
|
||||
data: roster,
|
||||
error: rosterError,
|
||||
refreshing: rosterRefreshing,
|
||||
} = usePolled(intervalMs, (signal) =>
|
||||
fetchJson<AgentRow[]>("/api/agents/status", signal),
|
||||
);
|
||||
const agentNames = useMemo(() => agentNamesFrom(roster), [roster]);
|
||||
|
|
@ -159,6 +164,7 @@ function SchedulesBody() {
|
|||
id="schedules-refresh"
|
||||
value={intervalMs}
|
||||
onChange={setIntervalMs}
|
||||
refreshing={schedulesRefreshing || rosterRefreshing}
|
||||
/>
|
||||
</div>
|
||||
{error ? (
|
||||
|
|
|
|||
Loading…
Reference in a new issue