Select mode picks agents from the list: the select button in the filter card, a press on an agent's icon, or a long press on a card starts it. In it a card toggles a tick instead of opening its details, and the card's own controls stop answering. A bar at the foot of the list has select all shown, clear, broadcast and done; Escape leaves the mode. Broadcast opens a dialog with the picked agents and a message box, sending through the existing broadcast endpoint; the composer's send and result parts are now shared with the swarm page's broadcast card. A full send shows a toast and ends select mode; a partial one keeps the result with a retry for the agents that failed.
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
// <SendResults> — what a broadcast came back with: how many agents got it, one
|
|
// line per agent, and a way to select just the ones that failed for a retry.
|
|
import { AgentIcon } from "../../agent/AgentIcon.js";
|
|
import { failedAgents, type BroadcastResult } from "./broadcast-types.js";
|
|
import "./BroadcastComposer.css";
|
|
|
|
export function SendResults({
|
|
results,
|
|
onRetry,
|
|
}: {
|
|
results: BroadcastResult[];
|
|
onRetry: (results: BroadcastResult[]) => void;
|
|
}) {
|
|
const failed = failedAgents(results);
|
|
const sent = results.length - failed.length;
|
|
return (
|
|
<section class="ui-broadcast-results" aria-label="send result">
|
|
<p class="ui-broadcast-summary">
|
|
sent to {sent} of {results.length}
|
|
{failed.length > 0 && (
|
|
<button
|
|
type="button"
|
|
class="ui-broadcast-link"
|
|
onClick={() => onRetry(results)}
|
|
>
|
|
select the {failed.length} that failed
|
|
</button>
|
|
)}
|
|
</p>
|
|
<ul class="ui-broadcast-outcomes">
|
|
{results.map((r) => (
|
|
<li
|
|
key={r.agent}
|
|
class={r.sent ? "ui-broadcast-ok" : "ui-broadcast-fail"}
|
|
>
|
|
<AgentIcon name={r.agent} small />
|
|
<span class="ui-broadcast-outcome-name">{r.agent}</span>
|
|
<span>
|
|
{r.sent
|
|
? "✓ sent"
|
|
: `✗ not sent${r.reason ? `: ${r.reason}` : ""}`}
|
|
</span>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</section>
|
|
);
|
|
}
|