ui(pool): pick an account's users from its own Edit

Each account row in the Account pool card has a pencil: tick the users
whose sessions run on it (one moves off any other account, unticking sends
one back to the balancer). PUT /api/accounts/:name/users saves the set in one
transaction, audits each change and switches a Claude login into each added
user's home at once. The card-level switch button and pinned list are gone.
This commit is contained in:
2026-10-19 10:45:54 +07:00
parent 776ad6466f
commit c042adc51b
11 changed files with 305 additions and 232 deletions
+11 -7
View File
@@ -1061,15 +1061,19 @@ export const api = {
method: "POST",
body: JSON.stringify({ ...body, currentPassword }),
}),
/** PUT /api/accounts/pins — admin: switch a user to one account (`null` = automatic), password again. */
pin: (tool: PoolTool, userId: number, account: string | null, currentPassword: string) =>
/** PUT /api/accounts/:name/users — admin: exactly these users run on this account. */
setUsers: (tool: PoolTool, name: string, userIds: number[], currentPassword: string) =>
request<{
pin: { userId: number; username: string; account: string | null };
/** What happened now: a Claude login goes into the user's home at once. */
switched: "switched" | "kept" | "own-login" | "expired" | "next-session" | null;
}>("/accounts/pins", {
/** Users moved onto it; `switched`: what happened now (a Claude login goes into their home). */
added: {
userId: number;
username: string;
switched: "switched" | "kept" | "own-login" | "expired" | "next-session";
}[];
removed: { userId: number; username: string }[];
}>(`/accounts/${encodeURIComponent(name)}/users`, {
method: "PUT",
body: JSON.stringify({ tool, userId, account, currentPassword }),
body: JSON.stringify({ tool, userIds, currentPassword }),
}),
/** DELETE /api/accounts/:name — admin, with their OWN password again. */
remove: (tool: PoolTool, name: string, currentPassword: string) =>