mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 00:25:50 +00:00
Move all integration queries/mutations to hooks
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
export {
|
export {
|
||||||
|
useAuthorizeIntegration,
|
||||||
useDeleteIntegrationAuth,
|
useDeleteIntegrationAuth,
|
||||||
useGetIntegrationAuthApps,
|
useGetIntegrationAuthApps,
|
||||||
useGetIntegrationAuthBitBucketWorkspaces,
|
useGetIntegrationAuthBitBucketWorkspaces,
|
||||||
@@ -7,4 +8,6 @@ export {
|
|||||||
useGetIntegrationAuthRailwayEnvironments,
|
useGetIntegrationAuthRailwayEnvironments,
|
||||||
useGetIntegrationAuthRailwayServices,
|
useGetIntegrationAuthRailwayServices,
|
||||||
useGetIntegrationAuthTeams,
|
useGetIntegrationAuthTeams,
|
||||||
useGetIntegrationAuthVercelBranches} from "./queries";
|
useGetIntegrationAuthVercelBranches,
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "./queries";
|
||||||
|
|||||||
@@ -312,6 +312,69 @@ export const useGetIntegrationAuthNorthflankSecretGroups = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useAuthorizeIntegration = () => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: async ({
|
||||||
|
workspaceId,
|
||||||
|
code,
|
||||||
|
integration
|
||||||
|
}: {
|
||||||
|
workspaceId: string;
|
||||||
|
code: string;
|
||||||
|
integration: string;
|
||||||
|
}) => {
|
||||||
|
const { data: { integrationAuth } } = await apiRequest.post("/api/v1/integration-auth/oauth-token", {
|
||||||
|
workspaceId,
|
||||||
|
code,
|
||||||
|
integration
|
||||||
|
});
|
||||||
|
|
||||||
|
return integrationAuth;
|
||||||
|
},
|
||||||
|
onSuccess: (res) => {
|
||||||
|
queryClient.invalidateQueries(workspaceKeys.getWorkspaceAuthorization(res.workspace));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useSaveIntegrationAccessToken = () => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: async ({
|
||||||
|
workspaceId,
|
||||||
|
integration,
|
||||||
|
accessId,
|
||||||
|
accessToken,
|
||||||
|
url,
|
||||||
|
namespace
|
||||||
|
}: {
|
||||||
|
workspaceId: string | null;
|
||||||
|
integration: string | undefined;
|
||||||
|
accessId: string | null;
|
||||||
|
accessToken: string;
|
||||||
|
url: string | null;
|
||||||
|
namespace: string | null;
|
||||||
|
}) => {
|
||||||
|
const { data: { integrationAuth } } = await apiRequest.post("/api/v1/integration-auth/access-token", {
|
||||||
|
workspaceId,
|
||||||
|
integration,
|
||||||
|
accessId,
|
||||||
|
accessToken,
|
||||||
|
url,
|
||||||
|
namespace
|
||||||
|
});
|
||||||
|
|
||||||
|
return integrationAuth;
|
||||||
|
},
|
||||||
|
onSuccess: (res) => {
|
||||||
|
queryClient.invalidateQueries(workspaceKeys.getWorkspaceAuthorization(res.workspace));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const useDeleteIntegrationAuth = () => {
|
export const useDeleteIntegrationAuth = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
export { useDeleteIntegration,useGetCloudIntegrations } from "./queries";
|
export {
|
||||||
|
useCreateIntegration,
|
||||||
|
useDeleteIntegration,
|
||||||
|
useGetCloudIntegrations
|
||||||
|
} from "./queries";
|
||||||
|
|||||||
@@ -23,6 +23,63 @@ export const useGetCloudIntegrations = () =>
|
|||||||
queryFn: () => fetchIntegrations()
|
queryFn: () => fetchIntegrations()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const useCreateIntegration = () => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: async ({
|
||||||
|
integrationAuthId,
|
||||||
|
isActive,
|
||||||
|
app,
|
||||||
|
appId,
|
||||||
|
sourceEnvironment,
|
||||||
|
targetEnvironment,
|
||||||
|
targetEnvironmentId,
|
||||||
|
targetService,
|
||||||
|
targetServiceId,
|
||||||
|
owner,
|
||||||
|
path,
|
||||||
|
region,
|
||||||
|
secretPath
|
||||||
|
}: {
|
||||||
|
integrationAuthId: string;
|
||||||
|
isActive: boolean;
|
||||||
|
secretPath: string;
|
||||||
|
app: string | null;
|
||||||
|
appId: string | null;
|
||||||
|
sourceEnvironment: string;
|
||||||
|
targetEnvironment: string | null;
|
||||||
|
targetEnvironmentId: string | null;
|
||||||
|
targetService: string | null;
|
||||||
|
targetServiceId: string | null;
|
||||||
|
owner: string | null;
|
||||||
|
path: string | null;
|
||||||
|
region: string | null;
|
||||||
|
}) => {
|
||||||
|
const { data: { integration } } = await apiRequest.post("/api/v1/integration", {
|
||||||
|
integrationAuthId,
|
||||||
|
isActive,
|
||||||
|
app,
|
||||||
|
appId,
|
||||||
|
sourceEnvironment,
|
||||||
|
targetEnvironment,
|
||||||
|
targetEnvironmentId,
|
||||||
|
targetService,
|
||||||
|
targetServiceId,
|
||||||
|
owner,
|
||||||
|
path,
|
||||||
|
region,
|
||||||
|
secretPath
|
||||||
|
});
|
||||||
|
|
||||||
|
return integration;
|
||||||
|
},
|
||||||
|
onSuccess: (res) => {
|
||||||
|
queryClient.invalidateQueries(workspaceKeys.getWorkspaceIntegrations(res.workspace));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const useDeleteIntegration = () => {
|
export const useDeleteIntegration = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
integrationId: string;
|
|
||||||
key: { encryptedKey: any; nonce: any };
|
|
||||||
secrets: {
|
|
||||||
ciphertextKey: any;
|
|
||||||
ivKey: any;
|
|
||||||
tagKey: any;
|
|
||||||
hashKey: any;
|
|
||||||
ciphertextValue: any;
|
|
||||||
ivValue: any;
|
|
||||||
tagValue: any;
|
|
||||||
hashValue: any;
|
|
||||||
type: string;
|
|
||||||
}[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const changeHerokuConfigVars = ({ integrationId, key, secrets }: Props) =>
|
|
||||||
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}/sync`, {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
key,
|
|
||||||
secrets
|
|
||||||
})
|
|
||||||
}).then(async (res) => {
|
|
||||||
if (res && res.status === 200) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
console.log("Failed to sync secrets to Heroku");
|
|
||||||
return undefined;
|
|
||||||
});
|
|
||||||
|
|
||||||
export default changeHerokuConfigVars;
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
workspaceId: string;
|
|
||||||
code: string;
|
|
||||||
integration: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This is the first step of the change password process (pake)
|
|
||||||
* @param {object} obj
|
|
||||||
* @param {object} obj.workspaceId - project id for which we want to authorize the integration
|
|
||||||
* @param {object} obj.code
|
|
||||||
* @param {object} obj.integration - integration which a user is trying to turn on
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const AuthorizeIntegration = ({ workspaceId, code, integration }: Props) =>
|
|
||||||
SecurityClient.fetchCall("/api/v1/integration-auth/oauth-token", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
workspaceId,
|
|
||||||
code,
|
|
||||||
integration
|
|
||||||
})
|
|
||||||
}).then(async (res) => {
|
|
||||||
if (res && res.status === 200) {
|
|
||||||
return (await res.json()).integrationAuth;
|
|
||||||
}
|
|
||||||
console.log("Failed to authorize the integration");
|
|
||||||
return undefined;
|
|
||||||
});
|
|
||||||
|
|
||||||
export default AuthorizeIntegration;
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
integrationAuthId: string;
|
|
||||||
isActive: boolean;
|
|
||||||
secretPath: string;
|
|
||||||
app: string | null;
|
|
||||||
appId: string | null;
|
|
||||||
sourceEnvironment: string;
|
|
||||||
targetEnvironment: string | null;
|
|
||||||
targetEnvironmentId: string | null;
|
|
||||||
targetService: string | null;
|
|
||||||
targetServiceId: string | null;
|
|
||||||
owner: string | null;
|
|
||||||
path: string | null;
|
|
||||||
region: string | null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This route creates a new integration based on the integration authorization with id [integrationAuthId]
|
|
||||||
* @param {Object} obj
|
|
||||||
* @param {String} obj.accessToken - id of integration authorization for which to create the integration
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const createIntegration = ({
|
|
||||||
integrationAuthId,
|
|
||||||
isActive,
|
|
||||||
app,
|
|
||||||
appId,
|
|
||||||
sourceEnvironment,
|
|
||||||
targetEnvironment,
|
|
||||||
targetEnvironmentId,
|
|
||||||
targetService,
|
|
||||||
targetServiceId,
|
|
||||||
owner,
|
|
||||||
path,
|
|
||||||
region,
|
|
||||||
secretPath,
|
|
||||||
}: Props) =>
|
|
||||||
SecurityClient.fetchCall("/api/v1/integration", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
integrationAuthId,
|
|
||||||
isActive,
|
|
||||||
app,
|
|
||||||
appId,
|
|
||||||
sourceEnvironment,
|
|
||||||
targetEnvironment,
|
|
||||||
targetEnvironmentId,
|
|
||||||
targetService,
|
|
||||||
targetServiceId,
|
|
||||||
owner,
|
|
||||||
path,
|
|
||||||
region,
|
|
||||||
secretPath,
|
|
||||||
})
|
|
||||||
}).then(async (res) => {
|
|
||||||
if (res && res.status === 200) {
|
|
||||||
return (await res.json()).integration;
|
|
||||||
}
|
|
||||||
console.log("Failed to create integration");
|
|
||||||
return undefined;
|
|
||||||
});
|
|
||||||
|
|
||||||
export default createIntegration;
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
workspaceId: string | null;
|
|
||||||
integration: string | undefined;
|
|
||||||
accessId: string | null;
|
|
||||||
accessToken: string;
|
|
||||||
url: string | null;
|
|
||||||
namespace: string | null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This route creates a new integration authorization for integration [integration]
|
|
||||||
* that requires the user to input their access token manually (e.g. Render). It
|
|
||||||
* saves access token [accessToken] under that integration for workspace with id
|
|
||||||
* [workspaceId].
|
|
||||||
* @param {Object} obj
|
|
||||||
* @param {String} obj.workspaceId - id of workspace to authorize integration for
|
|
||||||
* @param {String} obj.integration - integration
|
|
||||||
* @param {String} obj.accessToken - access token to save
|
|
||||||
* @param {String} obj.url - URL of the Vault instance
|
|
||||||
* @param {String} obj.namespace - Vault-specific namespace param
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const saveIntegrationAccessToken = ({
|
|
||||||
workspaceId,
|
|
||||||
integration,
|
|
||||||
accessId,
|
|
||||||
accessToken,
|
|
||||||
url,
|
|
||||||
namespace
|
|
||||||
}: Props) =>
|
|
||||||
SecurityClient.fetchCall("/api/v1/integration-auth/access-token", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
workspaceId,
|
|
||||||
integration,
|
|
||||||
accessId,
|
|
||||||
accessToken,
|
|
||||||
url,
|
|
||||||
namespace
|
|
||||||
})
|
|
||||||
}).then(async (res) => {
|
|
||||||
if (res && res.status === 200) {
|
|
||||||
return (await res.json()).integrationAuth;
|
|
||||||
}
|
|
||||||
console.log("Failed to save integration access details");
|
|
||||||
return undefined;
|
|
||||||
});
|
|
||||||
|
|
||||||
export default saveIntegrationAccessToken;
|
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function AWSParameterStoreAuthorizeIntegrationPage() {
|
export default function AWSParameterStoreAuthorizeIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const [accessKey, setAccessKey] = useState("");
|
const [accessKey, setAccessKey] = useState("");
|
||||||
@@ -30,7 +35,7 @@ export default function AWSParameterStoreAuthorizeIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "aws-parameter-store",
|
integration: "aws-parameter-store",
|
||||||
accessId: accessKey,
|
accessId: accessKey,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -13,7 +17,6 @@ import {
|
|||||||
} from "../../../components/v2";
|
} from "../../../components/v2";
|
||||||
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
const awsRegions = [
|
const awsRegions = [
|
||||||
{ name: "US East (Ohio)", slug: "us-east-2" },
|
{ name: "US East (Ohio)", slug: "us-east-2" },
|
||||||
@@ -49,6 +52,7 @@ const awsRegions = [
|
|||||||
|
|
||||||
export default function AWSParameterStoreCreateIntegrationPage() {
|
export default function AWSParameterStoreCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -90,7 +94,7 @@ export default function AWSParameterStoreCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: null,
|
app: null,
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import { useSaveIntegrationAccessToken } from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function AWSSecretManagerCreateIntegrationPage() {
|
export default function AWSSecretManagerCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const [accessKey, setAccessKey] = useState("");
|
const [accessKey, setAccessKey] = useState("");
|
||||||
@@ -30,7 +33,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "aws-secret-manager",
|
integration: "aws-secret-manager",
|
||||||
accessId: accessKey,
|
accessId: accessKey,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -13,7 +17,6 @@ import {
|
|||||||
} from "../../../components/v2";
|
} from "../../../components/v2";
|
||||||
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
const awsRegions = [
|
const awsRegions = [
|
||||||
{ name: "US East (Ohio)", slug: "us-east-2" },
|
{ name: "US East (Ohio)", slug: "us-east-2" },
|
||||||
@@ -49,6 +52,7 @@ const awsRegions = [
|
|||||||
|
|
||||||
export default function AWSSecretManagerCreateIntegrationPage() {
|
export default function AWSSecretManagerCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -89,7 +93,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetSecretName.trim(),
|
app: targetSecretName.trim(),
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -13,10 +17,10 @@ import {
|
|||||||
} from "../../../components/v2";
|
} from "../../../components/v2";
|
||||||
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function AzureKeyVaultCreateIntegrationPage() {
|
export default function AzureKeyVaultCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -52,7 +56,7 @@ export default function AzureKeyVaultCreateIntegrationPage() {
|
|||||||
if (!integrationAuth?._id) return;
|
if (!integrationAuth?._id) return;
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: vaultBaseUrl,
|
app: vaultBaseUrl,
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ import { useEffect } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
import AuthorizeIntegration from "../../../api/integrations/authorizeIntegration";
|
import {
|
||||||
|
useAuthorizeIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
export default function AzureKeyVaultOAuth2CallbackPage() {
|
export default function AzureKeyVaultOAuth2CallbackPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useAuthorizeIntegration();
|
||||||
|
|
||||||
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -16,7 +19,7 @@ export default function AzureKeyVaultOAuth2CallbackPage() {
|
|||||||
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
||||||
localStorage.removeItem("latestCSRFToken");
|
localStorage.removeItem("latestCSRFToken");
|
||||||
|
|
||||||
const integrationAuth = await AuthorizeIntegration({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id") as string,
|
workspaceId: localStorage.getItem("projectData.id") as string,
|
||||||
code: code as string,
|
code: code as string,
|
||||||
integration: "azure-key-vault"
|
integration: "azure-key-vault"
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -17,10 +21,10 @@ import {
|
|||||||
useGetIntegrationAuthById,
|
useGetIntegrationAuthById,
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function BitBucketCreateIntegrationPage() {
|
export default function BitBucketCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const [targetAppId, setTargetAppId] = useState("");
|
const [targetAppId, setTargetAppId] = useState("");
|
||||||
const [targetEnvironmentId, setTargetEnvironmentId] = useState("");
|
const [targetEnvironmentId, setTargetEnvironmentId] = useState("");
|
||||||
@@ -79,7 +83,7 @@ export default function BitBucketCreateIntegrationPage() {
|
|||||||
|
|
||||||
if (!targetApp || !targetApp.appId || !targetEnvironment) return;
|
if (!targetApp || !targetApp.appId || !targetEnvironment) return;
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp.name,
|
app: targetApp.name,
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ import { useEffect } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
import AuthorizeIntegration from "../../../api/integrations/authorizeIntegration";
|
import {
|
||||||
|
useAuthorizeIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
export default function BitBucketOAuth2CallbackPage() {
|
export default function BitBucketOAuth2CallbackPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useAuthorizeIntegration();
|
||||||
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -15,7 +18,7 @@ export default function BitBucketOAuth2CallbackPage() {
|
|||||||
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
||||||
localStorage.removeItem("latestCSRFToken");
|
localStorage.removeItem("latestCSRFToken");
|
||||||
|
|
||||||
const integrationAuth = await AuthorizeIntegration({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id") as string,
|
workspaceId: localStorage.getItem("projectData.id") as string,
|
||||||
code: code as string,
|
code: code as string,
|
||||||
integration: "bitbucket"
|
integration: "bitbucket"
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function ChecklyCreateIntegrationPage() {
|
export default function ChecklyCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [accessToken, setAccessToken] = useState("");
|
const [accessToken, setAccessToken] = useState("");
|
||||||
const [accessTokenErrorText, setAccessTokenErrorText] = useState("");
|
const [accessTokenErrorText, setAccessTokenErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "checkly",
|
integration: "checkly",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
|||||||
@@ -11,16 +11,19 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
SelectItem
|
SelectItem
|
||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useGetIntegrationAuthApps,
|
useGetIntegrationAuthApps,
|
||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function ChecklyCreateIntegrationPage() {
|
export default function ChecklyCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -62,7 +65,7 @@ export default function ChecklyCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function CircleCICreateIntegrationPage() {
|
export default function CircleCICreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function CircleCICreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "circleci",
|
integration: "circleci",
|
||||||
accessToken: apiKey,
|
accessToken: apiKey,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function CircleCICreateIntegrationPage() {
|
export default function CircleCICreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -58,7 +62,7 @@ export default function CircleCICreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function Cloud66CreateIntegrationPage() {
|
export default function Cloud66CreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function Cloud66CreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "cloud-66",
|
integration: "cloud-66",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById,
|
useGetIntegrationAuthById,
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function Cloud66CreateIntegrationPage() {
|
export default function Cloud66CreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ export default function Cloud66CreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button,Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button,Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function CloudflarePagesIntegrationPage() {
|
export default function CloudflarePagesIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [accessKey, setAccessKey] = useState("");
|
const [accessKey, setAccessKey] = useState("");
|
||||||
const [accessKeyErrorText, setAccessKeyErrorText] = useState("");
|
const [accessKeyErrorText, setAccessKeyErrorText] = useState("");
|
||||||
const [accountId, setAccountId] = useState("");
|
const [accountId, setAccountId] = useState("");
|
||||||
@@ -24,7 +29,7 @@ export default function CloudflarePagesIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "cloudflare-pages",
|
integration: "cloudflare-pages",
|
||||||
accessId: accountId,
|
accessId: accountId,
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ import { useEffect,useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
, useGetWorkspaceById } from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Select, SelectItem } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Select, SelectItem } from "../../../components/v2";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api";
|
|
||||||
import { useGetIntegrationAuthApps, useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
import { useGetIntegrationAuthApps, useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
const cloudflareEnvironments = [
|
const cloudflareEnvironments = [
|
||||||
{ name: "Production", slug: "production" },
|
{ name: "Production", slug: "production" },
|
||||||
@@ -14,6 +16,7 @@ const cloudflareEnvironments = [
|
|||||||
|
|
||||||
export default function CloudflarePagesIntegrationPage() {
|
export default function CloudflarePagesIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
|
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
|
||||||
@@ -54,7 +57,7 @@ export default function CloudflarePagesIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function CodefreshCreateIntegrationPage() {
|
export default function CodefreshCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function CodefreshCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "codefresh",
|
integration: "codefresh",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function CodefreshCreateIntegrationPage() {
|
export default function CodefreshCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ export default function CodefreshCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function DigitalOceanAppPlatformCreateIntegrationPage() {
|
export default function DigitalOceanAppPlatformCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function DigitalOceanAppPlatformCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "digital-ocean-app-platform",
|
integration: "digital-ocean-app-platform",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function DigitalOceanAppPlatformCreateIntegrationPage() {
|
export default function DigitalOceanAppPlatformCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ export default function DigitalOceanAppPlatformCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function FlyioCreateIntegrationPage() {
|
export default function FlyioCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [accessToken, setAccessToken] = useState("");
|
const [accessToken, setAccessToken] = useState("");
|
||||||
const [accessTokenErrorText, setAccessTokenErrorText] = useState("");
|
const [accessTokenErrorText, setAccessTokenErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function FlyioCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "flyio",
|
integration: "flyio",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function FlyioCreateIntegrationPage() {
|
export default function FlyioCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -59,7 +63,7 @@ export default function FlyioCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function GitHubCreateIntegrationPage() {
|
export default function GitHubCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -63,7 +67,7 @@ export default function GitHubCreateIntegrationPage() {
|
|||||||
|
|
||||||
if (!targetApp || !targetApp.owner) return;
|
if (!targetApp || !targetApp.owner) return;
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp.name,
|
app: targetApp.name,
|
||||||
|
|||||||
@@ -2,10 +2,14 @@ import { useEffect } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
import AuthorizeIntegration from "../../../api/integrations/authorizeIntegration";
|
import {
|
||||||
|
useAuthorizeIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
export default function GitHubOAuth2CallbackPage() {
|
export default function GitHubOAuth2CallbackPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useAuthorizeIntegration();
|
||||||
|
|
||||||
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -15,7 +19,7 @@ export default function GitHubOAuth2CallbackPage() {
|
|||||||
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
||||||
localStorage.removeItem("latestCSRFToken");
|
localStorage.removeItem("latestCSRFToken");
|
||||||
|
|
||||||
const integrationAuth = await AuthorizeIntegration({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id") as string,
|
workspaceId: localStorage.getItem("projectData.id") as string,
|
||||||
code: code as string,
|
code: code as string,
|
||||||
integration: "github"
|
integration: "github"
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -17,7 +21,6 @@ import {
|
|||||||
useGetIntegrationAuthTeams
|
useGetIntegrationAuthTeams
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
const gitLabEntities = [
|
const gitLabEntities = [
|
||||||
{ name: "Individual", value: "individual" },
|
{ name: "Individual", value: "individual" },
|
||||||
@@ -26,6 +29,7 @@ const gitLabEntities = [
|
|||||||
|
|
||||||
export default function GitLabCreateIntegrationPage() {
|
export default function GitLabCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -87,7 +91,7 @@ export default function GitLabCreateIntegrationPage() {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
if (!integrationAuth?._id) return;
|
if (!integrationAuth?._id) return;
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app:
|
app:
|
||||||
|
|||||||
@@ -2,10 +2,14 @@ import { useEffect } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
import AuthorizeIntegration from "../../../api/integrations/authorizeIntegration";
|
import {
|
||||||
|
useAuthorizeIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
export default function GitLabOAuth2CallbackPage() {
|
export default function GitLabOAuth2CallbackPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useAuthorizeIntegration();
|
||||||
|
|
||||||
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -14,7 +18,7 @@ export default function GitLabOAuth2CallbackPage() {
|
|||||||
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
||||||
localStorage.removeItem("latestCSRFToken");
|
localStorage.removeItem("latestCSRFToken");
|
||||||
|
|
||||||
const integrationAuth = await AuthorizeIntegration({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id") as string,
|
workspaceId: localStorage.getItem("projectData.id") as string,
|
||||||
code: code as string,
|
code: code as string,
|
||||||
integration: "gitlab"
|
integration: "gitlab"
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function HashiCorpVaultAuthorizeIntegrationPage() {
|
export default function HashiCorpVaultAuthorizeIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [vaultURL, setVaultURL] = useState("");
|
const [vaultURL, setVaultURL] = useState("");
|
||||||
const [vaultURLErrorText, setVaultURLErrorText] = useState("");
|
const [vaultURLErrorText, setVaultURLErrorText] = useState("");
|
||||||
@@ -57,7 +61,7 @@ export default function HashiCorpVaultAuthorizeIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "hashicorp-vault",
|
integration: "hashicorp-vault",
|
||||||
accessId: vaultRoleID,
|
accessId: vaultRoleID,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -13,10 +17,10 @@ import {
|
|||||||
} from "../../../components/v2";
|
} from "../../../components/v2";
|
||||||
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function HashiCorpVaultCreateIntegrationPage() {
|
export default function HashiCorpVaultCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ export default function HashiCorpVaultCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: vaultEnginePath,
|
app: vaultEnginePath,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function HerokuCreateIntegrationPage() {
|
export default function HerokuCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ export default function HerokuCreateIntegrationPage() {
|
|||||||
|
|
||||||
if (!integrationAuth?._id) return;
|
if (!integrationAuth?._id) return;
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ import { useEffect } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
import AuthorizeIntegration from "../../../api/integrations/authorizeIntegration";
|
import {
|
||||||
|
useAuthorizeIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
export default function HerokuOAuth2CallbackPage() {
|
export default function HerokuOAuth2CallbackPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useAuthorizeIntegration();
|
||||||
|
|
||||||
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -15,7 +18,7 @@ export default function HerokuOAuth2CallbackPage() {
|
|||||||
// validate state
|
// validate state
|
||||||
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
||||||
localStorage.removeItem("latestCSRFToken");
|
localStorage.removeItem("latestCSRFToken");
|
||||||
const integrationAuth = await AuthorizeIntegration({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id") as string,
|
workspaceId: localStorage.getItem("projectData.id") as string,
|
||||||
code: code as string,
|
code: code as string,
|
||||||
integration: "heroku"
|
integration: "heroku"
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function LaravelForgeCreateIntegrationPage() {
|
export default function LaravelForgeCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [serverId, setServerId] = useState("");
|
const [serverId, setServerId] = useState("");
|
||||||
@@ -29,7 +34,7 @@ export default function LaravelForgeCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "laravel-forge",
|
integration: "laravel-forge",
|
||||||
accessId: serverId,
|
accessId: serverId,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function LaravelForgeCreateIntegrationPage() {
|
export default function LaravelForgeCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ export default function LaravelForgeCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,7 +20,6 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
const netlifyEnvironments = [
|
const netlifyEnvironments = [
|
||||||
{ name: "Local development", slug: "dev" },
|
{ name: "Local development", slug: "dev" },
|
||||||
@@ -27,6 +30,7 @@ const netlifyEnvironments = [
|
|||||||
|
|
||||||
export default function NetlifyCreateIntegrationPage() {
|
export default function NetlifyCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -65,7 +69,7 @@ export default function NetlifyCreateIntegrationPage() {
|
|||||||
|
|
||||||
if (!integrationAuth?._id) return;
|
if (!integrationAuth?._id) return;
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ import { useEffect } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
import AuthorizeIntegration from "../../../api/integrations/authorizeIntegration";
|
import {
|
||||||
|
useAuthorizeIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
export default function NetlifyOAuth2CallbackPage() {
|
export default function NetlifyOAuth2CallbackPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useAuthorizeIntegration();
|
||||||
|
|
||||||
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -16,7 +19,7 @@ export default function NetlifyOAuth2CallbackPage() {
|
|||||||
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
||||||
localStorage.removeItem("latestCSRFToken");
|
localStorage.removeItem("latestCSRFToken");
|
||||||
|
|
||||||
const integrationAuth = await AuthorizeIntegration({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id") as string,
|
workspaceId: localStorage.getItem("projectData.id") as string,
|
||||||
code: code as string,
|
code: code as string,
|
||||||
integration: "netlify"
|
integration: "netlify"
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function NorthflankCreateIntegrationPage() {
|
export default function NorthflankCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function NorthflankCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "northflank",
|
integration: "northflank",
|
||||||
accessToken: apiKey,
|
accessToken: apiKey,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -17,10 +21,10 @@ import {
|
|||||||
useGetIntegrationAuthNorthflankSecretGroups
|
useGetIntegrationAuthNorthflankSecretGroups
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function NorthflankCreateIntegrationPage() {
|
export default function NorthflankCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
||||||
const [secretPath, setSecretPath] = useState("/");
|
const [secretPath, setSecretPath] = useState("/");
|
||||||
@@ -78,7 +82,7 @@ export default function NorthflankCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: integrationAuthApps?.find(
|
app: integrationAuthApps?.find(
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function RailwayAuthorizeIntegrationPage() {
|
export default function RailwayAuthorizeIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function RailwayAuthorizeIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "railway",
|
integration: "railway",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -18,10 +22,10 @@ import {
|
|||||||
useGetIntegrationAuthRailwayServices
|
useGetIntegrationAuthRailwayServices
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function RailwayCreateIntegrationPage() {
|
export default function RailwayCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const [targetAppId, setTargetAppId] = useState("");
|
const [targetAppId, setTargetAppId] = useState("");
|
||||||
const [targetEnvironmentId, setTargetEnvironmentId] = useState("");
|
const [targetEnvironmentId, setTargetEnvironmentId] = useState("");
|
||||||
@@ -96,7 +100,7 @@ export default function RailwayCreateIntegrationPage() {
|
|||||||
(service) => service.serviceId === targetServiceId
|
(service) => service.serviceId === targetServiceId
|
||||||
);
|
);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp.name,
|
app: targetApp.name,
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import { useSaveIntegrationAccessToken} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function RenderCreateIntegrationPage() {
|
export default function RenderCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +23,7 @@ export default function RenderCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "render",
|
integration: "render",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function RenderCreateIntegrationPage() {
|
export default function RenderCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ export default function RenderCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function SupabaseCreateIntegrationPage() {
|
export default function SupabaseCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function SupabaseCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "supabase",
|
integration: "supabase",
|
||||||
accessToken: apiKey,
|
accessToken: apiKey,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function SupabaseCreateIntegrationPage() {
|
export default function SupabaseCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ export default function SupabaseCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function TeamCityCreateIntegrationPage() {
|
export default function TeamCityCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [serverUrl, setServerUrl] = useState("");
|
const [serverUrl, setServerUrl] = useState("");
|
||||||
@@ -29,7 +34,7 @@ export default function TeamCityCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "teamcity",
|
integration: "teamcity",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function TeamCityCreateIntegrationPage() {
|
export default function TeamCityCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ export default function TeamCityCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function TerraformCloudCreateIntegrationPage() {
|
export default function TerraformCloudCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [workspacesId, setWorkSpacesId] = useState("");
|
const [workspacesId, setWorkSpacesId] = useState("");
|
||||||
@@ -29,7 +34,7 @@ export default function TerraformCloudCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "terraform-cloud",
|
integration: "terraform-cloud",
|
||||||
accessId: workspacesId,
|
accessId: workspacesId,
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import { useCreateIntegration } from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,7 +18,6 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
const variableTypes = [
|
const variableTypes = [
|
||||||
{ name: "env" },
|
{ name: "env" },
|
||||||
@@ -25,6 +26,7 @@ const variableTypes = [
|
|||||||
|
|
||||||
export default function TerraformCloudCreateIntegrationPage() {
|
export default function TerraformCloudCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -70,7 +72,7 @@ export default function TerraformCloudCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
export default function TravisCICreateIntegrationPage() {
|
export default function TravisCICreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -20,7 +25,7 @@ export default function TravisCICreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "travisci",
|
integration: "travisci",
|
||||||
accessToken: apiKey,
|
accessToken: apiKey,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function TravisCICreateIntegrationPage() {
|
export default function TravisCICreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ export default function TravisCICreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -17,7 +21,6 @@ import {
|
|||||||
useGetIntegrationAuthVercelBranches
|
useGetIntegrationAuthVercelBranches
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
const vercelEnvironments = [
|
const vercelEnvironments = [
|
||||||
{ name: "Development", slug: "development" },
|
{ name: "Development", slug: "development" },
|
||||||
@@ -27,6 +30,7 @@ const vercelEnvironments = [
|
|||||||
|
|
||||||
export default function VercelCreateIntegrationPage() {
|
export default function VercelCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
|
||||||
const [secretPath, setSecretPath] = useState("/");
|
const [secretPath, setSecretPath] = useState("/");
|
||||||
@@ -81,7 +85,7 @@ export default function VercelCreateIntegrationPage() {
|
|||||||
|
|
||||||
const path = targetEnvironment === "preview" && targetBranch !== "" ? targetBranch : null;
|
const path = targetEnvironment === "preview" && targetBranch !== "" ? targetBranch : null;
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp.name,
|
app: targetApp.name,
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ import { useEffect } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
import AuthorizeIntegration from "../../../api/integrations/authorizeIntegration";
|
import {
|
||||||
|
useAuthorizeIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
export default function VercelOAuth2CallbackPage() {
|
export default function VercelOAuth2CallbackPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useAuthorizeIntegration();
|
||||||
|
|
||||||
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -15,8 +18,8 @@ export default function VercelOAuth2CallbackPage() {
|
|||||||
// validate state
|
// validate state
|
||||||
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
if (state !== localStorage.getItem("latestCSRFToken")) return;
|
||||||
localStorage.removeItem("latestCSRFToken");
|
localStorage.removeItem("latestCSRFToken");
|
||||||
|
|
||||||
const integrationAuth = await AuthorizeIntegration({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id") as string,
|
workspaceId: localStorage.getItem("projectData.id") as string,
|
||||||
code: code as string,
|
code: code as string,
|
||||||
integration: "vercel"
|
integration: "vercel"
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useSaveIntegrationAccessToken
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
|
||||||
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
|
|
||||||
|
|
||||||
|
|
||||||
export default function WindmillCreateIntegrationPage() {
|
export default function WindmillCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -21,7 +26,7 @@ export default function WindmillCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "windmill",
|
integration: "windmill",
|
||||||
accessToken: apiKey,
|
accessToken: apiKey,
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
|
|
||||||
|
import {
|
||||||
|
useCreateIntegration
|
||||||
|
} from "@app/hooks/api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -16,10 +20,10 @@ import {
|
|||||||
useGetIntegrationAuthById
|
useGetIntegrationAuthById
|
||||||
} from "../../../hooks/api/integrationAuth";
|
} from "../../../hooks/api/integrationAuth";
|
||||||
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
||||||
import createIntegration from "../../api/integrations/createIntegration";
|
|
||||||
|
|
||||||
export default function WindmillCreateIntegrationPage() {
|
export default function WindmillCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { mutateAsync } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ export default function WindmillCreateIntegrationPage() {
|
|||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
await createIntegration({
|
await mutateAsync({
|
||||||
integrationAuthId: integrationAuth?._id,
|
integrationAuthId: integrationAuth?._id,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
app: targetApp,
|
app: targetApp,
|
||||||
|
|||||||
Reference in New Issue
Block a user