Watch
0
0
Fork
You've already forked hyperhive
0

Compare commits

..
3 changed files with 8 additions and 30 deletions

View file

@ -432,11 +432,6 @@ as optional `limits` and `inference` objects, the same shapes the two `PUT`
routes take. The controller checks them with the `PUT` rules before it queues
anything, so a bad value gets a refusal with its reason and creates no agent.
The dialog loads the hive list and the permission list when it opens. If either
load fails, the dialog shows the reason in an error panel above the fields, and
the hive picker or the permissions area reads `could not load hives` or
`could not load permissions` in place of `loading…`.
It stores them ahead of the job graph, before it declares the agent, so they
are in place before the agent first runs. If the creation then fails, the
controller puts back what it replaced. Each agent name keys its settings and

View file

@ -309,9 +309,7 @@ export function CreateAgentForm({
disabled={!hivesReady}
placeholder={
!hives
? hivesError
? "could not load hives"
: "loading…"
? "loading…"
: hives.length === 0
? "no hives configured"
: "select a hive"
@ -342,8 +340,8 @@ export function CreateAgentForm({
)}
</>
)}
<FormField label="permissions" labelId="agent-permissions-label">
<div role="group" aria-labelledby="agent-permissions-label">
<FormField label="permissions" htmlFor="agent-permissions">
<div id="agent-permissions">
{catalogue ? (
<MultiselectFilterOptions
options={catalogue.all}
@ -351,9 +349,7 @@ export function CreateAgentForm({
onToggle={(v) => setSelected((s) => togglePermission(s, v))}
/>
) : (
<span>
{catalogueError ? "could not load permissions" : "loading…"}
</span>
<span>loading…</span>
)}
</div>
</FormField>

View file

@ -4,36 +4,23 @@
// don't each reinvent the label/spacing chrome; a bare labelled `<div>`
// wrapper has no independent identity worth a `/components` entry of
// its own.
//
// A control a `<label for>` can name (input, select, textarea) passes
// `htmlFor`. A group of controls (a checkbox set) has no single element to
// point at: it passes `labelId` instead and puts `role="group"` with
// `aria-labelledby` on the group.
import type { ComponentChildren } from "preact";
import "./FormField.css";
export function FormField({
label,
htmlFor,
labelId,
children,
}: {
label: string;
htmlFor?: string;
labelId?: string;
htmlFor: string;
children: ComponentChildren;
}) {
return (
<div class="ui-form-field">
{htmlFor !== undefined ? (
<label class="ui-form-field-label" for={htmlFor}>
{label}
</label>
) : (
<span class="ui-form-field-label" id={labelId}>
{label}
</span>
)}
<label class="ui-form-field-label" for={htmlFor}>
{label}
</label>
{children}
</div>
);