icons for the swarm's own forge accounts, and a default agent icon
The builder, ci-metrics and review-classifier forge accounts get an avatar: an icon each in a hexagonal frame, the hyperhive logo when one is missing. The controller sets them with a short-lived write:user token it mints for the account, since only an account can set its own avatar. An agent with no icon of its own shows a default agent icon in the swarm UI, a robot head in a round frame, instead of the dimmed hyperhive mark.
This commit is contained in:
parent
51479d9fe8
commit
91cf4d2ae1
2 changed files with 389 additions and 8 deletions
|
|
@ -20,6 +20,10 @@
|
|||
filter: grayscale(1);
|
||||
opacity: 0.4;
|
||||
}
|
||||
/* The default agent icon: dimmed, but in its colour. */
|
||||
.ui-agent-icon-default {
|
||||
opacity: 0.6;
|
||||
}
|
||||
/* Beside a line of text, inside a badge. */
|
||||
.ui-agent-icon-small {
|
||||
width: 1.3em;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
// <AgentIcon> — the agent's icon from swarm-controller's
|
||||
// `GET /api/agents/{name}/icon`, the same square and fallback as the hive
|
||||
// dashboard's container row: an agent with no icon (404) or an unreachable
|
||||
// controller shows the dimmed hyperhive mark instead of a broken image.
|
||||
// `GET /api/agents/{name}/icon`: an agent with no icon (404) or an unreachable
|
||||
// controller shows the default agent icon, dimmed, instead of a broken image.
|
||||
// It is a robot head in a round frame, so it is not mistaken for a swarm
|
||||
// service, whose icons sit in a hexagon.
|
||||
// Always an `<img>`: the body is an agent-authored SVG, and only an image load
|
||||
// keeps its script from running.
|
||||
import { useState } from "preact/hooks";
|
||||
|
|
@ -21,14 +22,14 @@ export function AgentIcon({
|
|||
class={
|
||||
"ui-agent-icon" +
|
||||
(small ? " ui-agent-icon-small" : "") +
|
||||
(fallback ? " ui-agent-icon-none" : "")
|
||||
(fallback ? " ui-agent-icon-default" : "")
|
||||
}
|
||||
>
|
||||
<img
|
||||
alt=""
|
||||
src={
|
||||
fallback
|
||||
? "/favicon.svg"
|
||||
? "/agent-default.svg"
|
||||
: `/api/agents/${encodeURIComponent(name)}/icon`
|
||||
}
|
||||
onError={() => setFallback(true)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue