-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(providers): refactor workflow providers v2 (#6001)
- Loading branch information
Showing
17 changed files
with
754 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 13 additions & 18 deletions
31
ui/app/(prowler)/providers/(set-up-provider)/add-credentials/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,30 @@ | ||
import { redirect } from "next/navigation"; | ||
import React from "react"; | ||
|
||
import { | ||
ViaCredentialsForm, | ||
ViaRoleForm, | ||
} from "@/components/providers/workflow/forms"; | ||
import { SelectViaAWS } from "@/components/providers/workflow/forms/select-via-aws/select-via-aws"; | ||
|
||
interface Props { | ||
searchParams: { type: string; id: string; via?: string }; | ||
} | ||
|
||
export default function AddCredentialsPage({ searchParams }: Props) { | ||
if ( | ||
!searchParams.type || | ||
!searchParams.id || | ||
(searchParams.type === "aws" && !searchParams.via) | ||
) { | ||
redirect("/providers/connect-account"); | ||
} | ||
|
||
const useCredentialsForm = | ||
(searchParams.type === "aws" && searchParams.via === "credentials") || | ||
(searchParams.type !== "aws" && !searchParams.via); | ||
|
||
const useRoleForm = | ||
searchParams.type === "aws" && searchParams.via === "role"; | ||
|
||
return ( | ||
<> | ||
{useCredentialsForm && <ViaCredentialsForm searchParams={searchParams} />} | ||
{useRoleForm && <ViaRoleForm searchParams={searchParams} />} | ||
{searchParams.type === "aws" && !searchParams.via && ( | ||
<SelectViaAWS initialVia={searchParams.via} /> | ||
)} | ||
|
||
{((searchParams.type === "aws" && searchParams.via === "credentials") || | ||
searchParams.type !== "aws") && ( | ||
<ViaCredentialsForm searchParams={searchParams} /> | ||
)} | ||
|
||
{searchParams.type === "aws" && searchParams.via === "role" && ( | ||
<ViaRoleForm searchParams={searchParams} /> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
ui/app/(prowler)/providers/(set-up-provider)/update-credentials/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
|
||
import { | ||
UpdateViaCredentialsForm, | ||
UpdateViaRoleForm, | ||
} from "@/components/providers/workflow/forms"; | ||
import { SelectViaAWS } from "@/components/providers/workflow/forms/select-via-aws/select-via-aws"; | ||
|
||
interface Props { | ||
searchParams: { type: string; id: string; via?: string }; | ||
} | ||
|
||
export default function UpdateCredentialsPage({ searchParams }: Props) { | ||
return ( | ||
<> | ||
{searchParams.type === "aws" && !searchParams.via && ( | ||
<SelectViaAWS initialVia={searchParams.via} /> | ||
)} | ||
|
||
{((searchParams.type === "aws" && searchParams.via === "credentials") || | ||
searchParams.type !== "aws") && ( | ||
<UpdateViaCredentialsForm searchParams={searchParams} /> | ||
)} | ||
|
||
{searchParams.type === "aws" && searchParams.via === "role" && ( | ||
<UpdateViaRoleForm searchParams={searchParams} /> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.