From 7d8c64d35b7381577cfc04802d5f40d4643a7b24 Mon Sep 17 00:00:00 2001 From: "Pablo Fernandez Guerra (PFE)" <148432447+pfe-nazaries@users.noreply.github.com> Date: Thu, 16 Jul 2026 11:50:35 +0200 Subject: [PATCH] fix(ui): allow rename and delete for dynamic providers (#11957) Co-authored-by: Pablo F.G --- .../dynamic-provider-alias-delete.changed.md | 1 + .../table/data-table-row-actions.test.tsx | 15 ++++---- .../table/data-table-row-actions.tsx | 36 +++++++++---------- 3 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 ui/changelog.d/dynamic-provider-alias-delete.changed.md diff --git a/ui/changelog.d/dynamic-provider-alias-delete.changed.md b/ui/changelog.d/dynamic-provider-alias-delete.changed.md new file mode 100644 index 0000000000..75adeeeffb --- /dev/null +++ b/ui/changelog.d/dynamic-provider-alias-delete.changed.md @@ -0,0 +1 @@ +Dynamic providers can now be renamed and deleted from the Providers table diff --git a/ui/components/providers/table/data-table-row-actions.test.tsx b/ui/components/providers/table/data-table-row-actions.test.tsx index 851b599bc7..0a0a774b50 100644 --- a/ui/components/providers/table/data-table-row-actions.test.tsx +++ b/ui/components/providers/table/data-table-row-actions.test.tsx @@ -303,7 +303,7 @@ describe("DataTableRowActions", () => { expect(screen.queryByText("Update Credentials")).not.toBeInTheDocument(); }); - it("blocks provider-account actions (alias/credentials/delete) for a dynamic provider but keeps operational actions", async () => { + it("allows rename/delete and operational actions for a dynamic provider but hides credential management", async () => { // Given a dynamic provider outside the configurable set, with the advanced // schedule capability enabled (so Edit Scan Schedule can show). const user = userEvent.setup(); @@ -323,15 +323,16 @@ describe("DataTableRowActions", () => { // When await user.click(screen.getByRole("button")); - // Then — provider-account CRUD is suppressed (can't add/edit/delete it) - expect(screen.queryByText("Edit Provider Alias")).not.toBeInTheDocument(); - expect(screen.queryByText("Add Credentials")).not.toBeInTheDocument(); - expect(screen.queryByText("Update Credentials")).not.toBeInTheDocument(); - expect(screen.queryByText("Delete Provider")).not.toBeInTheDocument(); - // ...but operational actions the provider exists for stay available + // Then — rename and delete are backend-generic, so they stay available + expect(screen.getByText("Edit Provider Alias")).toBeInTheDocument(); + expect(screen.getByText("Delete Provider")).toBeInTheDocument(); + // ...operational actions stay available too expect(screen.getByText("Test Connection")).toBeInTheDocument(); expect(screen.getByText("View Scan Jobs")).toBeInTheDocument(); expect(screen.getByText("Edit Scan Schedule")).toBeInTheDocument(); + // ...but credential management is hidden (no bespoke wizard for dynamic types) + expect(screen.queryByText("Add Credentials")).not.toBeInTheDocument(); + expect(screen.queryByText("Update Credentials")).not.toBeInTheDocument(); }); it("navigates to the provider-filtered scan jobs from View Scan Jobs", async () => { diff --git a/ui/components/providers/table/data-table-row-actions.tsx b/ui/components/providers/table/data-table-row-actions.tsx index 5c3b00d36b..c43631f754 100644 --- a/ui/components/providers/table/data-table-row-actions.tsx +++ b/ui/components/providers/table/data-table-row-actions.tsx @@ -310,8 +310,8 @@ export function DataTableRowActions({ const provider = isOrganizationRow ? null : rowData; const providerId = provider?.id ?? ""; const providerType = provider?.attributes.provider ?? ""; - // Only predefined providers can be managed from the UI - const canManageProvider = isConfigurableProvider(providerType); + // Only predefined providers can manage credentials from the UI + const canManageCredentials = isConfigurableProvider(providerType); const providerUid = provider?.attributes.uid ?? ""; const providerAlias = provider?.attributes.alias ?? null; const providerSecretId = provider?.relationships.secret.data?.id ?? null; @@ -590,13 +590,11 @@ export function DataTableRowActions({ )}
- {canManageProvider && ( - } - label="Edit Provider Alias" - onSelect={() => setIsEditOpen(true)} - /> - )} + } + label="Edit Provider Alias" + onSelect={() => setIsEditOpen(true)} + /> } label="View Scan Jobs" @@ -634,7 +632,7 @@ export function DataTableRowActions({ disabled /> )} - {canManageProvider && ( + {canManageCredentials && ( } label={hasSecret ? "Update Credentials" : "Add Credentials"} @@ -661,16 +659,14 @@ export function DataTableRowActions({ }} disabled={!hasSecret || loading} /> - {canManageProvider && ( - - } - label="Delete Provider" - destructive - onSelect={() => setIsDeleteOpen(true)} - /> - - )} + + } + label="Delete Provider" + destructive + onSelect={() => setIsDeleteOpen(true)} + /> +