mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 21:51:56 +00:00
misc: addressed review comments
This commit is contained in:
@@ -138,3 +138,8 @@ export type TOctopusDeployVariableSetScopeValues = {
|
||||
Name: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
export enum CircleCiScope {
|
||||
Context = "context",
|
||||
Project = "project"
|
||||
}
|
||||
|
||||
@@ -22,17 +22,18 @@ import { SecretPathInput } from "@app/components/v2/SecretPathInput";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useCreateIntegration } from "@app/hooks/api";
|
||||
import { useGetIntegrationAuthCircleCIOrganizations } from "@app/hooks/api/integrationAuth";
|
||||
import { CircleCiScope } from "@app/hooks/api/integrationAuth/types";
|
||||
|
||||
const formSchema = z.discriminatedUnion("scope", [
|
||||
z.object({
|
||||
scope: z.literal("context"),
|
||||
scope: z.literal(CircleCiScope.Context),
|
||||
secretPath: z.string().default("/"),
|
||||
sourceEnvironment: z.object({ name: z.string(), slug: z.string() }),
|
||||
targetOrg: z.object({ name: z.string().min(1), slug: z.string().min(1) }),
|
||||
targetContext: z.object({ name: z.string().min(1), id: z.string().min(1) })
|
||||
}),
|
||||
z.object({
|
||||
scope: z.literal("project"),
|
||||
scope: z.literal(CircleCiScope.Project),
|
||||
secretPath: z.string().default("/"),
|
||||
sourceEnvironment: z.object({ name: z.string(), slug: z.string() }),
|
||||
targetOrg: z.object({ name: z.string().min(1), slug: z.string().min(1) }),
|
||||
@@ -69,7 +70,7 @@ export default function CircleCICreateIntegrationPage() {
|
||||
|
||||
const onSubmit = async (data: TFormData) => {
|
||||
try {
|
||||
if (data.scope === "context") {
|
||||
if (data.scope === CircleCiScope.Context) {
|
||||
await mutateAsync({
|
||||
scope: data.scope,
|
||||
integrationAuthId,
|
||||
@@ -231,13 +232,13 @@ export default function CircleCICreateIntegrationPage() {
|
||||
}}
|
||||
className="w-full border border-mineshaft-500"
|
||||
>
|
||||
<SelectItem value="project">Project</SelectItem>
|
||||
<SelectItem value="context">Context</SelectItem>
|
||||
<SelectItem value={CircleCiScope.Project}>Project</SelectItem>
|
||||
<SelectItem value={CircleCiScope.Context}>Context</SelectItem>
|
||||
</Select>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
{selectedScope === "context" && selectedOrganizationEntry && (
|
||||
{selectedScope === CircleCiScope.Context && selectedOrganizationEntry && (
|
||||
<Controller
|
||||
control={control}
|
||||
name="targetContext"
|
||||
@@ -264,7 +265,7 @@ export default function CircleCICreateIntegrationPage() {
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
{selectedScope === "project" && selectedOrganizationEntry && (
|
||||
{selectedScope === CircleCiScope.Project && selectedOrganizationEntry && (
|
||||
<Controller
|
||||
control={control}
|
||||
name="targetProject"
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
import { integrationSlugNameMapping } from "public/data/frequentConstants";
|
||||
|
||||
import { FormLabel } from "@app/components/v2";
|
||||
import { CircleCiScope } from "@app/hooks/api/integrationAuth/types";
|
||||
import { IntegrationMappingBehavior, TIntegrationWithEnv } from "@app/hooks/api/integrations/types";
|
||||
|
||||
type Props = {
|
||||
@@ -46,7 +47,7 @@ export const IntegrationConnectionSection = ({ integration }: Props) => {
|
||||
case "qovery":
|
||||
return integration.scope;
|
||||
case "circleci":
|
||||
if (integration.scope === "context") {
|
||||
if (integration.scope === CircleCiScope.Context) {
|
||||
return "Context";
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { FormLabel } from "@app/components/v2";
|
||||
import { CircleCiScope } from "@app/hooks/api/integrationAuth/types";
|
||||
import { IntegrationMappingBehavior, TIntegration } from "@app/hooks/api/integrations/types";
|
||||
|
||||
type Props = {
|
||||
@@ -53,7 +54,7 @@ export const IntegrationDetails = ({ integration }: Props) => {
|
||||
label={
|
||||
(integration.integration === "qovery" && integration?.scope) ||
|
||||
(integration.integration === "circleci" &&
|
||||
(integration.scope === "context" ? "Context" : "Project")) ||
|
||||
(integration.scope === CircleCiScope.Context ? "Context" : "Project")) ||
|
||||
(integration.integration === "bitbucket" && "Repository") ||
|
||||
(integration.integration === "octopus-deploy" && "Project") ||
|
||||
(integration.integration === "aws-secret-manager" && "Secret") ||
|
||||
|
||||
Reference in New Issue
Block a user