mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-09 21:14:22 +00:00
feat(ui): complete Registry provider onboarding for Private Cloud (#12494)
Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com>
This commit is contained in:
co-authored by
alejandrobailo
parent
974f4251dd
commit
2198ba2d84
@@ -251,7 +251,7 @@ export function getColumnProviders(
|
||||
entityId={provider.attributes.uid}
|
||||
nameAction={
|
||||
provider.attributes.is_dynamic ? (
|
||||
<Badge variant="info">Custom</Badge>
|
||||
<Badge variant="info">Registry</Badge>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
vi.mock("@/actions/providers/registry-provider", () => ({
|
||||
addRegistryProvider: vi.fn(),
|
||||
}));
|
||||
vi.mock("@/actions/registry/registry", () => ({
|
||||
getInstalledRegistryProviderOptions: vi
|
||||
.fn()
|
||||
.mockResolvedValue({ status: "access_denied" }),
|
||||
}));
|
||||
vi.mock("@/actions/providers/provider-schemas", () => ({
|
||||
getProviderSchemas: vi.fn(),
|
||||
}));
|
||||
vi.mock("@/actions/providers/dynamic-provider-credentials", () => ({
|
||||
saveDynamicProviderCredentials: vi.fn(),
|
||||
}));
|
||||
import { Row } from "@tanstack/react-table";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
@@ -327,7 +341,7 @@ describe("DataTableRowActions", () => {
|
||||
expect(screen.queryByText("Update Credentials")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("allows rename/delete and operational actions for a dynamic provider but hides credential management", async () => {
|
||||
it("allows credential editing and operational actions for a dynamic provider", 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();
|
||||
@@ -354,9 +368,9 @@ describe("DataTableRowActions", () => {
|
||||
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)
|
||||
// Existing dynamic accounts use the same wizard with schema-based credentials.
|
||||
expect(screen.queryByText("Add Credentials")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Update Credentials")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("Update Credentials")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("navigates to the provider-filtered scan jobs from View Scan Jobs", async () => {
|
||||
|
||||
@@ -52,7 +52,6 @@ import {
|
||||
OrgFlowType,
|
||||
} from "@/types/organizations";
|
||||
import { PROVIDER_WIZARD_MODE } from "@/types/provider-wizard";
|
||||
import { isConfigurableProvider } from "@/types/providers";
|
||||
import {
|
||||
isProvidersOrganizationRow,
|
||||
PROVIDERS_GROUP_KIND,
|
||||
@@ -355,8 +354,7 @@ export function DataTableRowActions({
|
||||
const provider = isOrganizationRow ? null : rowData;
|
||||
const providerId = provider?.id ?? "";
|
||||
const providerType = provider?.attributes.provider ?? "";
|
||||
// Only predefined providers can manage credentials from the UI
|
||||
const canManageCredentials = isConfigurableProvider(providerType);
|
||||
const canManageCredentials = Boolean(providerType);
|
||||
const providerUid = provider?.attributes.uid ?? "";
|
||||
const providerAlias = provider?.attributes.alias ?? null;
|
||||
const providerSecretId = provider?.relationships.secret.data?.id ?? null;
|
||||
|
||||
Reference in New Issue
Block a user