swarm-ui link-account forms: keep the sent name, drop secrets, one word for forge
The success line of both link forms read the live text field, so editing the name after a link changed the sentence. The result now carries the name that was sent. The matrix form held the typed token and password after a failed submit, and kept them across a switch of credential mode. It now drops them when the request ends and when the mode changes. The linked-accounts list and the delete dialog said forgejo where the link menu and forms say forge; they now say forge.
This commit is contained in:
parent
8f8217100b
commit
ef156d9d23
6 changed files with 52 additions and 18 deletions
|
|
@ -14,6 +14,7 @@ import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
|
|||
import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
|
||||
import { Badge } from "@hive/shared/badge.js";
|
||||
import { ConfirmDialog } from "../../ui/confirm-dialog/ConfirmDialog.js";
|
||||
import { accountKindLabel } from "./account-kind.js";
|
||||
import "./LinkedAccounts.css";
|
||||
|
||||
type AccountKind = "matrix" | "forgejo" | "github";
|
||||
|
|
@ -123,7 +124,7 @@ export function LinkedAccounts({
|
|||
{deleteTarget ? (
|
||||
<>
|
||||
<p>
|
||||
Delete the {deleteTarget.kind} account{" "}
|
||||
Delete the {accountKindLabel(deleteTarget.kind)} account{" "}
|
||||
<strong>{deleteTarget.name}</strong>
|
||||
{deleteTarget.host ? (
|
||||
<>
|
||||
|
|
@ -173,7 +174,7 @@ export function LinkedAccounts({
|
|||
<ul class="ui-linked-accounts">
|
||||
{accounts.map((a) => (
|
||||
<li key={`${a.kind}/${a.name}`}>
|
||||
<Badge label={a.kind} value={a.name} />
|
||||
<Badge label={accountKindLabel(a.kind)} value={a.name} />
|
||||
<span class="ui-linked-accounts-host">{a.host ?? "—"}</span>
|
||||
{a.reserved ? (
|
||||
<Badge
|
||||
|
|
@ -184,7 +185,7 @@ export function LinkedAccounts({
|
|||
<Badge
|
||||
variant="quiet"
|
||||
value="delete"
|
||||
title={`delete the ${a.kind} account ${a.name}`}
|
||||
title={`delete the ${accountKindLabel(a.kind)} account ${a.name}`}
|
||||
onClick={() => openDelete(a)}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
// What the operator calls an account kind. The wire value for a forge
|
||||
// account is "forgejo", but the link menu and form say "forge", so the list
|
||||
// and the delete dialog say it too.
|
||||
export function accountKindLabel(kind: string): string {
|
||||
return kind === "forgejo" ? "forge" : kind;
|
||||
}
|
||||
Loading…
Reference in a new issue