swarm ui: the create form picks an archetype from tiles with their icons
An archetype's meta gets an optional icon, the SVG text (at most 16 KiB), which the controller checks, stores and serves on GET /api/archetypes. The built-in archetypes read theirs from nix/archetypes/icons. The create form shows each archetype as a tile with its icon and name, laid out like the broadcast screen's agent tiles, in place of the dropdown, and draws the SVG through an img data URL.
This commit is contained in:
parent
f8beca4e6a
commit
53224d877e
1 changed files with 240 additions and 16 deletions
|
|
@ -63,6 +63,7 @@ import {
|
|||
requestArchetype,
|
||||
type ArchetypeList,
|
||||
} from "./CreateAgentArchetype.js";
|
||||
import { ArchetypePicker } from "./ArchetypePicker.js";
|
||||
import {
|
||||
agentsMdAfterPick,
|
||||
agentsMdBody,
|
||||
|
|
@ -377,19 +378,12 @@ export function CreateAgentForm({
|
|||
/>
|
||||
{archetypes && archetypes.archetypes.length > 0 && (
|
||||
<>
|
||||
<SelectField
|
||||
<ArchetypePicker
|
||||
id="agent-archetype"
|
||||
label="archetype"
|
||||
archetypes={archetypes.archetypes}
|
||||
value={archetype}
|
||||
onChange={pickArchetype}
|
||||
disabled={!catalogue}
|
||||
options={[
|
||||
{ value: "", label: "none" },
|
||||
...archetypes.archetypes.map((a) => ({
|
||||
value: archetypeKey(a),
|
||||
label: a.name,
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
{picked && (
|
||||
<p class="create-agent-archetype-description">
|
||||
|
|
|
|||
Loading…
Reference in a new issue