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
|
|
@ -156,21 +156,26 @@ export function LinkedAccounts({
|
|||
</ConfirmDialog>
|
||||
);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Badge
|
||||
tone="negative"
|
||||
value="accounts unavailable"
|
||||
title={error.detail ?? "listing linked accounts failed"}
|
||||
/>
|
||||
);
|
||||
// Shown as text, not a hover title. A list already loaded stays under a
|
||||
// failed refetch, so a link or delete that worked is not hidden by a read
|
||||
// that did not.
|
||||
const errorPanel = error ? (
|
||||
<ApiErrorPanel context="listing linked accounts failed" problem={error} />
|
||||
) : null;
|
||||
if (accounts === null) {
|
||||
return errorPanel ?? <span class="ui-linked-accounts-muted">…</span>;
|
||||
}
|
||||
if (accounts === null) return <span class="ui-linked-accounts-muted">…</span>;
|
||||
if (accounts.length === 0) {
|
||||
return <span class="ui-linked-accounts-muted">none linked</span>;
|
||||
return (
|
||||
<>
|
||||
{errorPanel}
|
||||
<span class="ui-linked-accounts-muted">none linked</span>
|
||||
</>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{errorPanel}
|
||||
<ul class="ui-linked-accounts">
|
||||
{accounts.map((a) => (
|
||||
<li key={`${a.kind}/${a.name}`}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue