swarm-ui: show a spinner on a busy submit button instead of swapping its label
Twenty save, link, create, send, run, load and log-in buttons changed their label to "saving…" or similar while a request ran, so the button changed width under the cursor. They now use Button's busy prop like the message box and the broadcast dialog do: a spinner covers the label, which keeps its space. No behaviour change; the buttons are disabled while busy as before.
This commit is contained in:
parent
79f2d4bd4d
commit
5dfff854d5
18 changed files with 72 additions and 27 deletions
|
|
@ -641,7 +641,8 @@ tab, follow a link in the app, or press the browser's back button. Choose
|
||||||
Under an agent's terminal, in the preview and in its own tab, is a **message**
|
Under an agent's terminal, in the preview and in its own tab, is a **message**
|
||||||
box, with the agent's name as its placeholder. **send** hands the text to the agent's
|
box, with the agent's name as its placeholder. **send** hands the text to the agent's
|
||||||
harness, and the agent takes it as an inbox message from your authelia username.
|
harness, and the agent takes it as an inbox message from your authelia username.
|
||||||
While the request is pending, a spinner replaces the button's label. When it
|
While the request is pending, a spinner replaces the button's label, as it does on
|
||||||
|
every save, link and create button, and the button keeps its width. When it
|
||||||
ends, the box empties: the harness was listening and holds the message. If the
|
ends, the box empties: the harness was listening and holds the message. If the
|
||||||
harness isn't running, or isn't connected to the swarm queue, the box shows an
|
harness isn't running, or isn't connected to the swarm queue, the box shows an
|
||||||
error and the agent gets nothing.
|
error and the agent gets nothing.
|
||||||
|
|
|
||||||
|
|
@ -131,9 +131,10 @@ export function ClaudeLoginDialog({
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
busy={step.step === "submitting"}
|
||||||
disabled={step.step === "submitting"}
|
disabled={step.step === "submitting"}
|
||||||
>
|
>
|
||||||
{step.step === "submitting" ? "logging in…" : "log in"}
|
log in
|
||||||
</Button>
|
</Button>
|
||||||
</FormStack>
|
</FormStack>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -262,11 +262,12 @@ function InstructionsForm({ agent }: { agent: string }) {
|
||||||
) : null}
|
) : null}
|
||||||
<ActionRow class="ui-agent-instructions-actions">
|
<ActionRow class="ui-agent-instructions-actions">
|
||||||
<Button
|
<Button
|
||||||
|
busy={busy}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={busy || !dirty || theirs !== null}
|
disabled={busy || !dirty || theirs !== null}
|
||||||
>
|
>
|
||||||
{busy ? "saving…" : "save"}
|
save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={busy || !dirty}
|
disabled={busy || !dirty}
|
||||||
|
|
|
||||||
|
|
@ -244,8 +244,13 @@ function LimitsForm({
|
||||||
<ApiErrorPanel context="the caps were not saved" problem={problem} />
|
<ApiErrorPanel context="the caps were not saved" problem={problem} />
|
||||||
) : null}
|
) : null}
|
||||||
<ActionRow>
|
<ActionRow>
|
||||||
<Button variant="primary" type="submit" disabled={busy || empty}>
|
<Button
|
||||||
{busy ? "saving…" : "save"}
|
busy={busy}
|
||||||
|
variant="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={busy || empty}
|
||||||
|
>
|
||||||
|
save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={busy || !capped}
|
disabled={busy || !capped}
|
||||||
|
|
|
||||||
|
|
@ -383,11 +383,12 @@ export function AgentRepos({ agent, g }: { agent: string; g: GrantState }) {
|
||||||
onInput={setTyped}
|
onInput={setTyped}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
busy={busy}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={busy || parsed === null || parsed === stored}
|
disabled={busy || parsed === null || parsed === stored}
|
||||||
>
|
>
|
||||||
{busy ? "saving…" : "save"}
|
save
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
{saveError ? (
|
{saveError ? (
|
||||||
|
|
|
||||||
|
|
@ -262,11 +262,12 @@ function Connections({ agent, on }: { agent: string; on: boolean }) {
|
||||||
) : null}
|
) : null}
|
||||||
<ActionRow>
|
<ActionRow>
|
||||||
<Button
|
<Button
|
||||||
|
busy={busy}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={busy || list === null || !complete}
|
disabled={busy || list === null || !complete}
|
||||||
>
|
>
|
||||||
{busy ? "saving…" : replacing ? "replace" : "add"}
|
{replacing ? "replace" : "add"}
|
||||||
</Button>
|
</Button>
|
||||||
</ActionRow>
|
</ActionRow>
|
||||||
</FormStack>
|
</FormStack>
|
||||||
|
|
|
||||||
|
|
@ -263,11 +263,12 @@ export function AddForm({
|
||||||
) : null}
|
) : null}
|
||||||
<ActionRow>
|
<ActionRow>
|
||||||
<Button
|
<Button
|
||||||
|
busy={busy}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={busy || domain.trim() === ""}
|
disabled={busy || domain.trim() === ""}
|
||||||
>
|
>
|
||||||
{busy ? "adding…" : "add"}
|
add
|
||||||
</Button>
|
</Button>
|
||||||
</ActionRow>
|
</ActionRow>
|
||||||
</FormStack>
|
</FormStack>
|
||||||
|
|
|
||||||
|
|
@ -598,6 +598,7 @@ export function CreateAgentForm({
|
||||||
)}
|
)}
|
||||||
{step === "summary" ? (
|
{step === "summary" ? (
|
||||||
<Button
|
<Button
|
||||||
|
busy={result.status === "submitting"}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={
|
disabled={
|
||||||
|
|
@ -607,7 +608,7 @@ export function CreateAgentForm({
|
||||||
createProblem !== null ? "create-agent-hint" : undefined
|
createProblem !== null ? "create-agent-hint" : undefined
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{result.status === "submitting" ? "creating…" : "create"}
|
create
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,13 @@ export function LinkApiKeyForm({
|
||||||
Stored in the swarm secret store and never shown again; a save
|
Stored in the swarm secret store and never shown again; a save
|
||||||
replaces the stored key. The agent loads it at its next restart.
|
replaces the stored key. The agent loads it at its next restart.
|
||||||
</Hint>
|
</Hint>
|
||||||
<Button variant="primary" type="submit" disabled={submitting}>
|
<Button
|
||||||
{submitting ? "saving…" : "save"}
|
busy={submitting}
|
||||||
|
variant="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={submitting}
|
||||||
|
>
|
||||||
|
save
|
||||||
</Button>
|
</Button>
|
||||||
</FormStack>
|
</FormStack>
|
||||||
<FormResult
|
<FormResult
|
||||||
|
|
|
||||||
|
|
@ -226,11 +226,12 @@ export function LinkBackendEnvForm({
|
||||||
/>
|
/>
|
||||||
<ActionRow>
|
<ActionRow>
|
||||||
<Button
|
<Button
|
||||||
|
busy={configRun.submitting}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={configRun.submitting || !loaded}
|
disabled={configRun.submitting || !loaded}
|
||||||
>
|
>
|
||||||
{configRun.submitting ? "saving…" : "save"}
|
save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
@ -284,11 +285,12 @@ export function LinkBackendEnvForm({
|
||||||
</Hint>
|
</Hint>
|
||||||
<ActionRow>
|
<ActionRow>
|
||||||
<Button
|
<Button
|
||||||
|
busy={secretsRun.submitting}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={secretsRun.submitting || secrets.trim() === ""}
|
disabled={secretsRun.submitting || secrets.trim() === ""}
|
||||||
>
|
>
|
||||||
{secretsRun.submitting ? "saving…" : "save"}
|
save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,13 @@ export function LinkForgeAccountForm({
|
||||||
required
|
required
|
||||||
onInput={setToken}
|
onInput={setToken}
|
||||||
/>
|
/>
|
||||||
<Button variant="primary" type="submit" disabled={submitting}>
|
<Button
|
||||||
{submitting ? "linking…" : "link account"}
|
busy={submitting}
|
||||||
|
variant="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={submitting}
|
||||||
|
>
|
||||||
|
link account
|
||||||
</Button>
|
</Button>
|
||||||
</FormStack>
|
</FormStack>
|
||||||
<FormResult
|
<FormResult
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,13 @@ export function LinkGithubAccountForm({
|
||||||
required
|
required
|
||||||
onInput={setToken}
|
onInput={setToken}
|
||||||
/>
|
/>
|
||||||
<Button variant="primary" type="submit" disabled={submitting}>
|
<Button
|
||||||
{submitting ? "linking…" : "link account"}
|
busy={submitting}
|
||||||
|
variant="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={submitting}
|
||||||
|
>
|
||||||
|
link account
|
||||||
</Button>
|
</Button>
|
||||||
</FormStack>
|
</FormStack>
|
||||||
<FormResult
|
<FormResult
|
||||||
|
|
|
||||||
|
|
@ -227,8 +227,13 @@ export function LinkMatrixAccountForm({
|
||||||
required={mode === "password"}
|
required={mode === "password"}
|
||||||
onInput={setHomeserver}
|
onInput={setHomeserver}
|
||||||
/>
|
/>
|
||||||
<Button variant="primary" type="submit" disabled={submitting}>
|
<Button
|
||||||
{submitting ? "linking…" : "link account"}
|
busy={submitting}
|
||||||
|
variant="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={submitting}
|
||||||
|
>
|
||||||
|
link account
|
||||||
</Button>
|
</Button>
|
||||||
</FormStack>
|
</FormStack>
|
||||||
<FormResult
|
<FormResult
|
||||||
|
|
|
||||||
|
|
@ -213,8 +213,13 @@ export function BroadcastComposer() {
|
||||||
onInput={setBody}
|
onInput={setBody}
|
||||||
/>
|
/>
|
||||||
<div class="ui-broadcast-send">
|
<div class="ui-broadcast-send">
|
||||||
<Button variant="primary" type="submit" disabled={!canSend}>
|
<Button
|
||||||
{sending ? "sending…" : sendLabel(targets.length)}
|
busy={sending}
|
||||||
|
variant="primary"
|
||||||
|
type="submit"
|
||||||
|
disabled={!canSend}
|
||||||
|
>
|
||||||
|
{sendLabel(targets.length)}
|
||||||
</Button>
|
</Button>
|
||||||
{overCap && (
|
{overCap && (
|
||||||
<span class="ui-broadcast-cap" role="status">
|
<span class="ui-broadcast-cap" role="status">
|
||||||
|
|
|
||||||
|
|
@ -110,11 +110,12 @@ export function ClassifierKey({ runtime }: { runtime: Runtime }) {
|
||||||
) : null}
|
) : null}
|
||||||
<ActionRow>
|
<ActionRow>
|
||||||
<Button
|
<Button
|
||||||
|
busy={saving}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={saving || problem !== null}
|
disabled={saving || problem !== null}
|
||||||
>
|
>
|
||||||
{saving ? "saving…" : "save key"}
|
save key
|
||||||
</Button>
|
</Button>
|
||||||
{justSaved ? (
|
{justSaved ? (
|
||||||
<Hint as="span" role="status">
|
<Hint as="span" role="status">
|
||||||
|
|
|
||||||
|
|
@ -261,11 +261,12 @@ export function ClassifierSettings() {
|
||||||
) : null}
|
) : null}
|
||||||
<ActionRow>
|
<ActionRow>
|
||||||
<Button
|
<Button
|
||||||
|
busy={saving}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={saving || problem !== null || !changed(draft, saved)}
|
disabled={saving || problem !== null || !changed(draft, saved)}
|
||||||
>
|
>
|
||||||
{saving ? "saving…" : "save"}
|
save
|
||||||
</Button>
|
</Button>
|
||||||
{justSaved ? (
|
{justSaved ? (
|
||||||
<Hint as="span" role="status">
|
<Hint as="span" role="status">
|
||||||
|
|
|
||||||
|
|
@ -399,9 +399,10 @@ export function ReviewTryOut() {
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
onClick={askLoadRules}
|
onClick={askLoadRules}
|
||||||
|
busy={loadingRules}
|
||||||
disabled={loadingRules || running || repoProblem(repo) !== null}
|
disabled={loadingRules || running || repoProblem(repo) !== null}
|
||||||
>
|
>
|
||||||
{loadingRules ? "loading…" : "load the repo's rules"}
|
load the repo's rules
|
||||||
</Button>
|
</Button>
|
||||||
</FieldGrid>
|
</FieldGrid>
|
||||||
{repoChoicesError ? (
|
{repoChoicesError ? (
|
||||||
|
|
@ -452,19 +453,21 @@ export function ReviewTryOut() {
|
||||||
add a classification
|
add a classification
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
busy={running}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={running || problem !== null}
|
disabled={running || problem !== null}
|
||||||
describedBy={problem !== null ? HINT_ID : undefined}
|
describedBy={problem !== null ? HINT_ID : undefined}
|
||||||
>
|
>
|
||||||
{running ? "running…" : "run"}
|
run
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
busy={opening}
|
||||||
onClick={() => void askPushBranch()}
|
onClick={() => void askPushBranch()}
|
||||||
disabled={opening || openPrProblem !== null}
|
disabled={opening || openPrProblem !== null}
|
||||||
describedBy={openPrProblem !== null ? HINT_ID : undefined}
|
describedBy={openPrProblem !== null ? HINT_ID : undefined}
|
||||||
>
|
>
|
||||||
{opening ? "pushing…" : "push a branch for a PR"}
|
push a branch for a PR
|
||||||
</Button>
|
</Button>
|
||||||
</ActionRow>
|
</ActionRow>
|
||||||
{capProblem !== null ? (
|
{capProblem !== null ? (
|
||||||
|
|
|
||||||
|
|
@ -275,11 +275,12 @@ export function ScheduleForm({
|
||||||
<ActionRow align="end" class="ui-schedule-form-actions">
|
<ActionRow align="end" class="ui-schedule-form-actions">
|
||||||
<Button onClick={onCancel}>cancel</Button>
|
<Button onClick={onCancel}>cancel</Button>
|
||||||
<Button
|
<Button
|
||||||
|
busy={saving}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={saving || !cadenceValid || agents.length === 0}
|
disabled={saving || !cadenceValid || agents.length === 0}
|
||||||
>
|
>
|
||||||
{saving ? "saving…" : original ? "save" : "create"}
|
{original ? "save" : "create"}
|
||||||
</Button>
|
</Button>
|
||||||
</ActionRow>
|
</ActionRow>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue