swarm-ui: show agent panel read failures as text and keep loaded data
Inference, resource caps and linked accounts showed a failed read as a badge with the reason in a hover title, which keyboard and touch users cannot read. They now use ApiErrorPanel, and a list that already loaded stays on screen under a failed refetch.
This commit is contained in:
parent
ac0bed47e9
commit
e727774dc8
1 changed files with 38 additions and 29 deletions
|
|
@ -114,19 +114,18 @@ export function AgentLimits({ agent }: { agent: string }) {
|
|||
};
|
||||
}, [agent, reload]);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Badge
|
||||
tone="negative"
|
||||
value="resource caps unavailable"
|
||||
title={error.detail ?? "reading the resource caps failed"}
|
||||
/>
|
||||
);
|
||||
// Shown as text, not a hover title. Caps already loaded stay under a
|
||||
// failed refetch, so a save that worked is not hidden by a read that did not.
|
||||
const errorPanel = error ? (
|
||||
<ApiErrorPanel context="reading the resource caps failed" problem={error} />
|
||||
) : null;
|
||||
if (caps === null) {
|
||||
return errorPanel ?? <span class="ui-agent-limits-muted">…</span>;
|
||||
}
|
||||
if (caps === null) return <span class="ui-agent-limits-muted">…</span>;
|
||||
|
||||
return (
|
||||
<div class="ui-agent-limits">
|
||||
{errorPanel}
|
||||
<ul class="ui-agent-limits-list">
|
||||
<li>
|
||||
<Badge label="cpu quota" value={caps.cpu_quota ?? HIVE_DECIDES} />
|
||||
|
|
|
|||
Loading…
Reference in a new issue