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**
|
||||
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.
|
||||
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
|
||||
harness isn't running, or isn't connected to the swarm queue, the box shows an
|
||||
error and the agent gets nothing.
|
||||
|
|
|
|||
|
|
@ -131,9 +131,10 @@ export function ClaudeLoginDialog({
|
|||
<Button
|
||||
variant="primary"
|
||||
type="submit"
|
||||
busy={step.step === "submitting"}
|
||||
disabled={step.step === "submitting"}
|
||||
>
|
||||
{step.step === "submitting" ? "logging in…" : "log in"}
|
||||
log in
|
||||
</Button>
|
||||
</FormStack>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -262,11 +262,12 @@ function InstructionsForm({ agent }: { agent: string }) {
|
|||
) : null}
|
||||
<ActionRow class="ui-agent-instructions-actions">
|
||||
<Button
|
||||
busy={busy}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={busy || !dirty || theirs !== null}
|
||||
>
|
||||
{busy ? "saving…" : "save"}
|
||||
save
|
||||
</Button>
|
||||
<Button
|
||||
disabled={busy || !dirty}
|
||||
|
|
|
|||
|
|
@ -244,8 +244,13 @@ function LimitsForm({
|
|||
<ApiErrorPanel context="the caps were not saved" problem={problem} />
|
||||
) : null}
|
||||
<ActionRow>
|
||||
<Button variant="primary" type="submit" disabled={busy || empty}>
|
||||
{busy ? "saving…" : "save"}
|
||||
<Button
|
||||
busy={busy}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={busy || empty}
|
||||
>
|
||||
save
|
||||
</Button>
|
||||
<Button
|
||||
disabled={busy || !capped}
|
||||
|
|
|
|||
|
|
@ -383,11 +383,12 @@ export function AgentRepos({ agent, g }: { agent: string; g: GrantState }) {
|
|||
onInput={setTyped}
|
||||
/>
|
||||
<Button
|
||||
busy={busy}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={busy || parsed === null || parsed === stored}
|
||||
>
|
||||
{busy ? "saving…" : "save"}
|
||||
save
|
||||
</Button>
|
||||
</form>
|
||||
{saveError ? (
|
||||
|
|
|
|||
|
|
@ -262,11 +262,12 @@ function Connections({ agent, on }: { agent: string; on: boolean }) {
|
|||
) : null}
|
||||
<ActionRow>
|
||||
<Button
|
||||
busy={busy}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={busy || list === null || !complete}
|
||||
>
|
||||
{busy ? "saving…" : replacing ? "replace" : "add"}
|
||||
{replacing ? "replace" : "add"}
|
||||
</Button>
|
||||
</ActionRow>
|
||||
</FormStack>
|
||||
|
|
|
|||
|
|
@ -263,11 +263,12 @@ export function AddForm({
|
|||
) : null}
|
||||
<ActionRow>
|
||||
<Button
|
||||
busy={busy}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={busy || domain.trim() === ""}
|
||||
>
|
||||
{busy ? "adding…" : "add"}
|
||||
add
|
||||
</Button>
|
||||
</ActionRow>
|
||||
</FormStack>
|
||||
|
|
|
|||
|
|
@ -598,6 +598,7 @@ export function CreateAgentForm({
|
|||
)}
|
||||
{step === "summary" ? (
|
||||
<Button
|
||||
busy={result.status === "submitting"}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={
|
||||
|
|
@ -607,7 +608,7 @@ export function CreateAgentForm({
|
|||
createProblem !== null ? "create-agent-hint" : undefined
|
||||
}
|
||||
>
|
||||
{result.status === "submitting" ? "creating…" : "create"}
|
||||
create
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -76,8 +76,13 @@ export function LinkApiKeyForm({
|
|||
Stored in the swarm secret store and never shown again; a save
|
||||
replaces the stored key. The agent loads it at its next restart.
|
||||
</Hint>
|
||||
<Button variant="primary" type="submit" disabled={submitting}>
|
||||
{submitting ? "saving…" : "save"}
|
||||
<Button
|
||||
busy={submitting}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={submitting}
|
||||
>
|
||||
save
|
||||
</Button>
|
||||
</FormStack>
|
||||
<FormResult
|
||||
|
|
|
|||
|
|
@ -226,11 +226,12 @@ export function LinkBackendEnvForm({
|
|||
/>
|
||||
<ActionRow>
|
||||
<Button
|
||||
busy={configRun.submitting}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={configRun.submitting || !loaded}
|
||||
>
|
||||
{configRun.submitting ? "saving…" : "save"}
|
||||
save
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
|
|
@ -284,11 +285,12 @@ export function LinkBackendEnvForm({
|
|||
</Hint>
|
||||
<ActionRow>
|
||||
<Button
|
||||
busy={secretsRun.submitting}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={secretsRun.submitting || secrets.trim() === ""}
|
||||
>
|
||||
{secretsRun.submitting ? "saving…" : "save"}
|
||||
save
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
|
|
|
|||
|
|
@ -134,8 +134,13 @@ export function LinkForgeAccountForm({
|
|||
required
|
||||
onInput={setToken}
|
||||
/>
|
||||
<Button variant="primary" type="submit" disabled={submitting}>
|
||||
{submitting ? "linking…" : "link account"}
|
||||
<Button
|
||||
busy={submitting}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={submitting}
|
||||
>
|
||||
link account
|
||||
</Button>
|
||||
</FormStack>
|
||||
<FormResult
|
||||
|
|
|
|||
|
|
@ -69,8 +69,13 @@ export function LinkGithubAccountForm({
|
|||
required
|
||||
onInput={setToken}
|
||||
/>
|
||||
<Button variant="primary" type="submit" disabled={submitting}>
|
||||
{submitting ? "linking…" : "link account"}
|
||||
<Button
|
||||
busy={submitting}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={submitting}
|
||||
>
|
||||
link account
|
||||
</Button>
|
||||
</FormStack>
|
||||
<FormResult
|
||||
|
|
|
|||
|
|
@ -227,8 +227,13 @@ export function LinkMatrixAccountForm({
|
|||
required={mode === "password"}
|
||||
onInput={setHomeserver}
|
||||
/>
|
||||
<Button variant="primary" type="submit" disabled={submitting}>
|
||||
{submitting ? "linking…" : "link account"}
|
||||
<Button
|
||||
busy={submitting}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={submitting}
|
||||
>
|
||||
link account
|
||||
</Button>
|
||||
</FormStack>
|
||||
<FormResult
|
||||
|
|
|
|||
|
|
@ -213,8 +213,13 @@ export function BroadcastComposer() {
|
|||
onInput={setBody}
|
||||
/>
|
||||
<div class="ui-broadcast-send">
|
||||
<Button variant="primary" type="submit" disabled={!canSend}>
|
||||
{sending ? "sending…" : sendLabel(targets.length)}
|
||||
<Button
|
||||
busy={sending}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={!canSend}
|
||||
>
|
||||
{sendLabel(targets.length)}
|
||||
</Button>
|
||||
{overCap && (
|
||||
<span class="ui-broadcast-cap" role="status">
|
||||
|
|
|
|||
|
|
@ -110,11 +110,12 @@ export function ClassifierKey({ runtime }: { runtime: Runtime }) {
|
|||
) : null}
|
||||
<ActionRow>
|
||||
<Button
|
||||
busy={saving}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={saving || problem !== null}
|
||||
>
|
||||
{saving ? "saving…" : "save key"}
|
||||
save key
|
||||
</Button>
|
||||
{justSaved ? (
|
||||
<Hint as="span" role="status">
|
||||
|
|
|
|||
|
|
@ -261,11 +261,12 @@ export function ClassifierSettings() {
|
|||
) : null}
|
||||
<ActionRow>
|
||||
<Button
|
||||
busy={saving}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={saving || problem !== null || !changed(draft, saved)}
|
||||
>
|
||||
{saving ? "saving…" : "save"}
|
||||
save
|
||||
</Button>
|
||||
{justSaved ? (
|
||||
<Hint as="span" role="status">
|
||||
|
|
|
|||
|
|
@ -399,9 +399,10 @@ export function ReviewTryOut() {
|
|||
/>
|
||||
<Button
|
||||
onClick={askLoadRules}
|
||||
busy={loadingRules}
|
||||
disabled={loadingRules || running || repoProblem(repo) !== null}
|
||||
>
|
||||
{loadingRules ? "loading…" : "load the repo's rules"}
|
||||
load the repo's rules
|
||||
</Button>
|
||||
</FieldGrid>
|
||||
{repoChoicesError ? (
|
||||
|
|
@ -452,19 +453,21 @@ export function ReviewTryOut() {
|
|||
add a classification
|
||||
</Button>
|
||||
<Button
|
||||
busy={running}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={running || problem !== null}
|
||||
describedBy={problem !== null ? HINT_ID : undefined}
|
||||
>
|
||||
{running ? "running…" : "run"}
|
||||
run
|
||||
</Button>
|
||||
<Button
|
||||
busy={opening}
|
||||
onClick={() => void askPushBranch()}
|
||||
disabled={opening || openPrProblem !== null}
|
||||
describedBy={openPrProblem !== null ? HINT_ID : undefined}
|
||||
>
|
||||
{opening ? "pushing…" : "push a branch for a PR"}
|
||||
push a branch for a PR
|
||||
</Button>
|
||||
</ActionRow>
|
||||
{capProblem !== null ? (
|
||||
|
|
|
|||
|
|
@ -275,11 +275,12 @@ export function ScheduleForm({
|
|||
<ActionRow align="end" class="ui-schedule-form-actions">
|
||||
<Button onClick={onCancel}>cancel</Button>
|
||||
<Button
|
||||
busy={saving}
|
||||
variant="primary"
|
||||
type="submit"
|
||||
disabled={saving || !cadenceValid || agents.length === 0}
|
||||
>
|
||||
{saving ? "saving…" : original ? "save" : "create"}
|
||||
{original ? "save" : "create"}
|
||||
</Button>
|
||||
</ActionRow>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in a new issue