fix(web): serialize credential key actions

This commit is contained in:
2026-09-24 19:28:44 +09:00
parent 0537894768
commit 92fe0ab9b6
2 changed files with 10 additions and 2 deletions
@@ -730,9 +730,9 @@
{isPending(`copy-${credential.credential_id}`) ? 'Loading…' : copiedCredentialId === credential.credential_id ? 'Copied' : 'Copy public key'}
</button>
{#if credential.credential_id !== workspaceDefaultCredentialId}
<button id={`rotate-credential-${credential.credential_id}`} type="button" class="secondary" disabled={credentialEditorPending() || isPending(`delete-${credential.credential_id}`)} onclick={() => void openCredentialRotation(credential)}>Rotate</button>
<button id={`rotate-credential-${credential.credential_id}`} type="button" class="secondary" disabled={credentialEditorPending() || isPending(`copy-${credential.credential_id}`) || isPending(`delete-${credential.credential_id}`)} onclick={() => void openCredentialRotation(credential)}>Rotate</button>
{#if credential.referenced_repositories.length === 0}
<button type="button" class="danger" disabled={isPending(`delete-${credential.credential_id}`) || isPending(`rotate-${credential.credential_id}`)} onclick={() => void deleteCredential(credential)}>Delete</button>
<button type="button" class="danger" disabled={isPending(`delete-${credential.credential_id}`) || isPending(`copy-${credential.credential_id}`) || isPending(`rotate-${credential.credential_id}`)} onclick={() => void deleteCredential(credential)}>Delete</button>
{/if}
{/if}
</div>
@@ -240,6 +240,14 @@ test("keeps a deferred row failure on that row while unrelated actions remain en
name: "Add pinned key",
}) as HTMLButtonElement).disabled,
).toBe(false);
const rotate = within(row).getByRole("button", { name: "Rotate" });
const remove = within(row).getByRole("button", { name: "Delete" });
expect((rotate as HTMLButtonElement).disabled).toBe(true);
expect((remove as HTMLButtonElement).disabled).toBe(true);
await fireEvent.click(rotate);
await fireEvent.click(remove);
expect(screen.queryByRole("heading", { name: "Rotate Deploy key" }))
.toBeNull();
await fireEvent.click(within(row).getByRole("button", { name: "Loading…" }));
expect(fetchMock).toHaveBeenCalledTimes(1);