Add eslint rule and fix as many issues as possible

This commit is contained in:
Khoa Le
2023-06-19 23:42:04 -04:00
parent e9eacc445d
commit 9d33e4756b
689 changed files with 9446 additions and 21821 deletions
+6 -6
View File
@@ -1,6 +1,6 @@
import Head from 'next/head';
import Image from 'next/image';
import Link from 'next/link';
import Head from "next/head";
import Image from "next/image";
import Link from "next/link";
export default function Custom404() {
return (
@@ -12,14 +12,14 @@ export default function Custom404() {
<div className='flex flex-col items-center justify-center text-gray-200 h-screen w-screen'>
<p className='text-4xl mt-32'>Oops, something went wrong</p>
<p className='mt-2 mb-1 text-lg'>
Think this is a mistake? Email{' '}
Think this is a mistake? Email{" "}
<a
className='text-primary underline underline-offset-4'
href='mailto:[email protected]'
>
team@infisical.com
</a>{' '}
and we`ll fix it!{' '}
</a>{" "}
and we`ll fix it!{" "}
</p>
<Link
href='/dashboard'
+22 -22
View File
@@ -4,36 +4,36 @@
/* eslint-disable react/jsx-props-no-spreading */
// @ts-nocheck
import { useEffect } from 'react';
import { AppProps } from 'next/app';
import { useRouter } from 'next/router';
import { config } from '@fortawesome/fontawesome-svg-core';
import { QueryClientProvider } from '@tanstack/react-query';
import { useEffect } from "react";
import { AppProps } from "next/app";
import { useRouter } from "next/router";
import { config } from "@fortawesome/fontawesome-svg-core";
import { QueryClientProvider } from "@tanstack/react-query";
import NotificationProvider from '@app/components/context/Notifications/NotificationProvider';
import { IntercomProvider } from '@app/components/utilities/intercom/intercomProvider';
import Telemetry from '@app/components/utilities/telemetry/Telemetry';
import { TooltipProvider } from '@app/components/v2';
import { publicPaths } from '@app/const';
import NotificationProvider from "@app/components/context/Notifications/NotificationProvider";
import { IntercomProvider } from "@app/components/utilities/intercom/intercomProvider";
import Telemetry from "@app/components/utilities/telemetry/Telemetry";
import { TooltipProvider } from "@app/components/v2";
import { publicPaths } from "@app/const";
import {
AuthProvider,
OrgProvider,
SubscriptionProvider,
UserProvider,
WorkspaceProvider
} from '@app/context';
import { AppLayout } from '@app/layouts';
import { queryClient } from '@app/reactQuery';
} from "@app/context";
import { AppLayout } from "@app/layouts";
import { queryClient } from "@app/reactQuery";
import '@fortawesome/fontawesome-svg-core/styles.css';
import '../styles/globals.css';
import "@fortawesome/fontawesome-svg-core/styles.css";
import "../styles/globals.css";
import '@app/i18n';
import "@app/i18n";
config.autoAddCss = false;
type NextAppProp = AppProps & {
Component: AppProps['Component'] & { requireAuth: boolean };
Component: AppProps["Component"] & { requireAuth: boolean };
};
const App = ({ Component, pageProps, ...appProps }: NextAppProp): JSX.Element => {
@@ -45,21 +45,21 @@ const App = ({ Component, pageProps, ...appProps }: NextAppProp): JSX.Element =>
const handleRouteChange = () => {
// (window).Intercom('update');
if (typeof window !== 'undefined') {
telemetry.capture('$pageview');
if (typeof window !== "undefined") {
telemetry.capture("$pageview");
}
};
router.events.on('routeChangeComplete', handleRouteChange);
router.events.on("routeChangeComplete", handleRouteChange);
return () => {
router.events.off('routeChangeComplete', handleRouteChange);
router.events.off("routeChangeComplete", handleRouteChange);
};
}, [router.events]);
// If it's one of these routes, don't add the layout (e.g., these routes are external)
if (
publicPaths.includes(`/${appProps.router.pathname.split('/')[1]}`) ||
publicPaths.includes(`/${appProps.router.pathname.split("/")[1]}`) ||
!Component.requireAuth
) {
return (
+23 -23
View File
@@ -1,18 +1,18 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Head from 'next/head';
import { useRouter } from 'next/router';
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import Head from "next/head";
import { useRouter } from "next/router";
import Button from '@app/components/basic/buttons/Button';
import EventFilter from '@app/components/basic/EventFilter';
import NavHeader from '@app/components/navigation/NavHeader';
import { UpgradePlanModal } from '@app/components/v2';
import { useSubscription } from '@app/context';
import ActivitySideBar from '@app/ee/components/ActivitySideBar';
import { usePopUp } from '@app/hooks/usePopUp';
import Button from "@app/components/basic/buttons/Button";
import EventFilter from "@app/components/basic/EventFilter";
import NavHeader from "@app/components/navigation/NavHeader";
import { UpgradePlanModal } from "@app/components/v2";
import { useSubscription } from "@app/context";
import ActivitySideBar from "@app/ee/components/ActivitySideBar";
import { usePopUp } from "@app/hooks/usePopUp";
import getProjectLogs from '../../ee/api/secrets/GetProjectLogs';
import ActivityTable from '../../ee/components/ActivityTable';
import getProjectLogs from "../../ee/api/secrets/GetProjectLogs";
import ActivityTable from "../../ee/components/ActivityTable";
interface LogData {
_id: string;
@@ -63,7 +63,7 @@ interface LogDataPoint {
*/
export default function Activity() {
const router = useRouter();
const [eventChosen, setEventChosen] = useState('');
const [eventChosen, setEventChosen] = useState("");
const [logsData, setLogsData] = useState<LogDataPoint[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [currentOffset, setCurrentOffset] = useState(0);
@@ -72,7 +72,7 @@ export default function Activity() {
const { t } = useTranslation();
const { subscription } = useSubscription();
const { popUp, handlePopUpOpen, handlePopUpClose } = usePopUp([
'upgradePlan'
"upgradePlan"
] as const);
// this use effect updates the data in case of a new filter being added
@@ -84,7 +84,7 @@ export default function Activity() {
workspaceId: String(router.query.id),
offset: 0,
limit: currentLimit,
userId: '',
userId: "",
actionNames: eventChosen
});
@@ -117,7 +117,7 @@ export default function Activity() {
workspaceId: String(router.query.id),
offset: currentOffset,
limit: currentLimit,
userId: '',
userId: "",
actionNames: eventChosen
});
setLogsData(
@@ -145,7 +145,7 @@ export default function Activity() {
const loadMoreLogs = () => {
if (subscription?.auditLogs === false) {
handlePopUpOpen('upgradePlan');
handlePopUpOpen("upgradePlan");
} else {
setCurrentOffset(currentOffset + currentLimit);
}
@@ -164,9 +164,9 @@ export default function Activity() {
)}
<div className="flex flex-col justify-between items-start mx-4 mt-6 mb-4 text-xl max-w-5xl px-2">
<div className="flex flex-row justify-start items-center text-3xl">
<p className="font-semibold mr-4 text-bunker-100">{t('activity.title')}</p>
<p className="font-semibold mr-4 text-bunker-100">{t("activity.title")}</p>
</div>
<p className="mr-4 text-base text-gray-400">{t('activity.subtitle')}</p>
<p className="mr-4 text-base text-gray-400">{t("activity.subtitle")}</p>
</div>
<div className="px-6 h-8 mt-2">
<EventFilter selected={eventChosen} select={setEventChosen} />
@@ -175,8 +175,8 @@ export default function Activity() {
<div className="flex justify-center w-full mb-6">
<div className="items-center w-60">
<Button
text={String(t('common.view-more'))}
textDisabled={String(t('common.end-of-history'))}
text={String(t("common.view-more"))}
textDisabled={String(t("common.end-of-history"))}
active={logsData.length % 10 === 0}
onButtonPressed={loadMoreLogs}
size="md"
@@ -186,7 +186,7 @@ export default function Activity() {
</div>
<UpgradePlanModal
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={() => handlePopUpClose('upgradePlan')}
onOpenChange={() => handlePopUpClose("upgradePlan")}
text="You can see more logs if you switch to Infisical's Business/Professional Plan."
/>
</div>
+5 -5
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
name: string;
@@ -13,10 +13,10 @@ interface Props {
* @returns
*/
const addAPIKey = ({ name, expiresIn }: Props) =>
SecurityClient.fetchCall('/api/v2/api-key/', {
method: 'POST',
SecurityClient.fetchCall("/api/v2/api-key/", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
name,
@@ -26,7 +26,7 @@ const addAPIKey = ({ name, expiresIn }: Props) =>
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to add API key');
console.log("Failed to add API key");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
apiKeyId: string;
@@ -12,15 +12,15 @@ interface Props {
*/
const deleteAPIKey = ({ apiKeyId }: Props) =>
SecurityClient.fetchCall(`/api/v2/api-key/${apiKeyId}`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to delete API key');
console.log("Failed to delete API key");
return undefined;
});
+5 -5
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route gets API keys for the user
@@ -6,16 +6,16 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
* @returns
*/
const getAPIKeys = () =>
SecurityClient.fetchCall('/api/v2/api-key', {
method: 'GET',
SecurityClient.fetchCall("/api/v2/api-key", {
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).apiKeyData;
}
console.log('Failed to get API keys');
console.log("Failed to get API keys");
return undefined;
});
@@ -28,7 +28,7 @@ const changePassword2 = async ({
salt,
verifier
}: Props) => {
const { data } = await apiRequest.post('/api/v1/password/change-password', {
const { data } = await apiRequest.post("/api/v1/password/change-password", {
clientProof,
protectedKey,
protectedKeyIV,
+4 -4
View File
@@ -1,14 +1,14 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function is used to check if the user is authenticated.
* To do that, we get their tokens from cookies, and verify if they are good.
*/
const checkAuth = async () =>
SecurityClient.fetchCall('/api/v1/auth/checkAuth', {
method: 'POST',
SecurityClient.fetchCall("/api/v1/auth/checkAuth", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then((res) => res);
@@ -10,10 +10,10 @@ interface Props {
* @param {string} obj.code
* @returns
*/
const checkEmailVerificationCode = ({ email, code }: Props) => fetch('/api/v1/signup/email/verify', {
method: 'POST',
const checkEmailVerificationCode = ({ email, code }: Props) => fetch("/api/v1/signup/email/verify", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
email,
@@ -55,7 +55,7 @@ const completeAccountInformationSignup = async ({
providerAuthToken,
attributionSource
}: Props) => {
const { data } = await apiRequest.post('/api/v3/signup/complete-account/signup', {
const { data } = await apiRequest.post("/api/v3/signup/complete-account/signup", {
email,
firstName,
lastName,
@@ -49,7 +49,7 @@ const completeAccountInformationSignupInvite = async ({
salt,
verifier
}: Props) => {
const { data } = await apiRequest.post('/api/v2/signup/complete-account/invite', {
const { data } = await apiRequest.post("/api/v2/signup/complete-account/invite", {
email,
firstName,
lastName,
@@ -12,10 +12,10 @@ interface Props {
* @returns
*/
const EmailVerifyOnPasswordReset = async ({ email, code }: Props) => {
const response = await fetch('/api/v1/password/email/password-reset-verify', {
method: 'POST',
const response = await fetch("/api/v1/password/email/password-reset-verify", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
email,
@@ -27,7 +27,7 @@ const EmailVerifyOnPasswordReset = async ({ email, code }: Props) => {
}
throw new Error(
'Something went wrong during email verification on password reset.'
"Something went wrong during email verification on password reset."
);
};
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
encryptedPrivateKey: string;
@@ -28,10 +28,10 @@ const issueBackupPrivateKey = ({
verifier,
clientProof
}: Props) =>
SecurityClient.fetchCall('/api/v1/password/backup-private-key', {
method: 'POST',
SecurityClient.fetchCall("/api/v1/password/backup-private-key", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
clientProof,
@@ -43,7 +43,7 @@ const issueBackupPrivateKey = ({
})
}).then((res) => {
if (res?.status !== 200) {
console.log('Failed to issue the backup key');
console.log("Failed to issue the backup key");
}
return res;
});
+5 -5
View File
@@ -22,13 +22,13 @@ const login2 = async (loginDetails: {
clientProof: string;
providerAuthToken?: string;
}) => {
const response = await fetch('/api/v3/auth/login2', {
method: 'POST',
const response = await fetch("/api/v3/auth/login2", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify(loginDetails),
credentials: 'include'
credentials: "include"
});
// need precise error handling about the status code
if (response.status === 200) {
@@ -36,7 +36,7 @@ const login2 = async (loginDetails: {
return data;
}
throw new Error('Password verification failed');
throw new Error("Password verification failed");
};
export default login2;
+17 -17
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route logs the user out. Note: the user should authorized to do this.
@@ -6,33 +6,33 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const logout = async () => {
try {
const res = await SecurityClient.fetchCall('/api/v1/auth/logout', {
method: 'POST',
const res = await SecurityClient.fetchCall("/api/v1/auth/logout", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
credentials: 'include'
credentials: "include"
});
if (res?.status === 200) {
SecurityClient.setToken('');
SecurityClient.setToken("");
// Delete the cookie by not setting a value; Alternatively clear the local storage
localStorage.removeItem('protectedKey');
localStorage.removeItem('protectedKeyIV');
localStorage.removeItem('protectedKeyTag');
localStorage.removeItem('publicKey');
localStorage.removeItem('encryptedPrivateKey');
localStorage.removeItem('iv');
localStorage.removeItem('tag');
localStorage.removeItem('PRIVATE_KEY');
localStorage.removeItem('orgData.id');
localStorage.removeItem('projectData.id');
localStorage.removeItem("protectedKey");
localStorage.removeItem("protectedKeyIV");
localStorage.removeItem("protectedKeyTag");
localStorage.removeItem("publicKey");
localStorage.removeItem("encryptedPrivateKey");
localStorage.removeItem("iv");
localStorage.removeItem("tag");
localStorage.removeItem("PRIVATE_KEY");
localStorage.removeItem("orgData.id");
localStorage.removeItem("projectData.id");
return res;
}
} catch (error) {
console.log('Error logging out', error);
console.log("Error logging out", error);
}
return undefined;
+5 -5
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
clientPublicKey: string;
@@ -10,10 +10,10 @@ interface Props {
* @returns
*/
const SRP1 = ({ clientPublicKey }: Props) =>
SecurityClient.fetchCall('/api/v1/password/srp1', {
method: 'POST',
SecurityClient.fetchCall("/api/v1/password/srp1", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
clientPublicKey
@@ -22,7 +22,7 @@ const SRP1 = ({ clientPublicKey }: Props) =>
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to do the first step of SRP');
console.log("Failed to do the first step of SRP");
return undefined;
});
@@ -10,10 +10,10 @@ interface Props {
* @returns
*/
const SendEmailOnPasswordReset = async ({ email }: Props) => {
const response = await fetch('/api/v1/password/email/password-reset', {
method: 'POST',
const response = await fetch("/api/v1/password/email/password-reset", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
email
@@ -26,7 +26,7 @@ const SendEmailOnPasswordReset = async ({ email }: Props) => {
}
throw new Error(
'Something went wrong while sending the email verification for password reset.'
"Something went wrong while sending the email verification for password reset."
);
};
@@ -3,10 +3,10 @@
* @param {*} email
*/
const sendVerificationEmail = (email: string) => {
fetch('/api/v1/signup/email/signup', {
method: 'POST',
fetch("/api/v1/signup/email/signup", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
email
+5 -5
View File
@@ -1,15 +1,15 @@
const token = async () =>
fetch('/api/v1/auth/token', {
method: 'POST',
fetch("/api/v1/auth/token", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
credentials: 'include'
credentials: "include"
}).then(async (res) => {
if (res.status === 200) {
return (await res.json()).token;
}
console.log('Getting a new token failed');
console.log("Getting a new token failed");
return undefined;
});
@@ -12,10 +12,10 @@ interface Props {
* @param {string} obj.code - code that a user received to the abovementioned email
* @returns
*/
const verifySignupInvite = ({ email, organizationId, code }: Props) => fetch('/api/v1/invite-org/verify', {
method: 'POST',
const verifySignupInvite = ({ email, organizationId, code }: Props) => fetch("/api/v1/invite-org/verify", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
email,
@@ -8,15 +8,15 @@ const getBackupEncryptedPrivateKey = ({
verificationToken
}: {
verificationToken: string;
}) => fetch('/api/v1/password/backup-private-key', {
method: 'GET',
}) => fetch("/api/v1/password/backup-private-key", {
method: "GET",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
Authorization: `Bearer ${ verificationToken}`
}
}).then(async (res) => {
if (res?.status !== 200) {
console.log('Failed to get the backup key');
console.log("Failed to get the backup key");
}
return (await res?.json())?.backupPrivateKey;
});
@@ -1,7 +1,7 @@
const publicKeyInfisical = () => fetch('/api/v1/key/publicKey/infisical', {
method: 'GET',
const publicKeyInfisical = () => fetch("/api/v1/key/publicKey/infisical", {
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
});
@@ -31,10 +31,10 @@ const resetPasswordOnAccountRecovery = ({
salt,
verifier,
verificationToken,
}: Props) => fetch('/api/v1/password/password-reset', {
method: 'POST',
}: Props) => fetch("/api/v1/password/password-reset", {
method: "POST",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
Authorization: `Bearer ${verificationToken}`
},
body: JSON.stringify({
@@ -49,7 +49,7 @@ const resetPasswordOnAccountRecovery = ({
})
}).then(async (res) => {
if (res?.status !== 200) {
console.log('Failed to get the backup key');
console.log("Failed to get the backup key");
}
return res;
});
@@ -14,7 +14,7 @@ const verifyMfaToken = async ({
email: string;
mfaToken: string;
}) => {
const { data } = await apiRequest.post('/api/v2/auth/mfa/verify', {
const { data } = await apiRequest.post("/api/v2/auth/mfa/verify", {
email,
mfaToken
});
+4 -4
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
workspaceId: string;
@@ -12,15 +12,15 @@ interface Props {
*/
const getBot = async ({ workspaceId }: Props) =>
SecurityClient.fetchCall(`/api/v1/bot/${workspaceId}`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).bot;
}
console.log('Failed to get bot for project');
console.log("Failed to get bot for project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface BotKey {
encryptedKey: string;
@@ -23,9 +23,9 @@ interface Props {
*/
const setBotActiveStatus = async ({ botId, isActive, botKey }: Props) =>
SecurityClient.fetchCall(`/api/v1/bot/${botId}/active`, {
method: 'PATCH',
method: "PATCH",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
isActive,
@@ -35,7 +35,7 @@ const setBotActiveStatus = async ({ botId, isActive, botKey }: Props) =>
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to get bot for project');
console.log("Failed to get bot for project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
type NewEnvironmentInfo = {
environmentSlug: string;
@@ -12,16 +12,16 @@ type NewEnvironmentInfo = {
*/
const createEnvironment = (workspaceId: string, newEnv: NewEnvironmentInfo) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify(newEnv)
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to create environment');
console.log("Failed to create environment");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route deletes a specified env.
* @param {*} workspaceId
@@ -6,16 +6,16 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const deleteEnvironment = (workspaceId: string, environmentSlug: string) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({ environmentSlug })
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to delete environment');
console.log("Failed to delete environment");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
type EnvironmentInfo = {
oldEnvironmentSlug: string;
@@ -13,16 +13,16 @@ type EnvironmentInfo = {
*/
const updateEnvironment = (workspaceId: string, env: EnvironmentInfo) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
method: 'PUT',
method: "PUT",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify(env)
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to update environment');
console.log("Failed to update environment");
return undefined;
});
+6 -6
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface EncryptedSecretProps {
id: string;
@@ -13,7 +13,7 @@ interface EncryptedSecretProps {
secretValueCiphertext: string;
secretValueIV: string;
secretValueTag: string;
type: 'personal' | 'shared';
type: "personal" | "shared";
}
/**
@@ -33,10 +33,10 @@ const addSecrets = async ({
env: string;
workspaceId: string;
}) =>
SecurityClient.fetchCall('/api/v2/secrets', {
method: 'POST',
SecurityClient.fetchCall("/api/v2/secrets", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
environment: env,
@@ -47,7 +47,7 @@ const addSecrets = async ({
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to add certain project secrets');
console.log("Failed to add certain project secrets");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function deletes certain secrets from a certain project
@@ -6,10 +6,10 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
* @returns
*/
const deleteSecrets = async ({ secretIds }: { secretIds: string[] }) =>
SecurityClient.fetchCall('/api/v2/secrets', {
method: 'DELETE',
SecurityClient.fetchCall("/api/v2/secrets", {
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
secretIds
@@ -18,7 +18,7 @@ const deleteSecrets = async ({ secretIds }: { secretIds: string[] }) =>
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to delete certain project secrets');
console.log("Failed to delete certain project secrets");
return undefined;
});
+4 -4
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function fetches the encrypted secrets for a certain project
@@ -13,16 +13,16 @@ const getSecrets = async (workspaceId: string, env: string) =>
workspaceId
})}`,
{
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}
).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).secrets;
}
console.log('Failed to get project secrets');
console.log("Failed to get project secrets");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface EncryptedSecretProps {
id: string;
@@ -13,7 +13,7 @@ interface EncryptedSecretProps {
secretValueCiphertext: string;
secretValueIV: string;
secretValueTag: string;
type: 'personal' | 'shared';
type: "personal" | "shared";
}
/**
@@ -23,10 +23,10 @@ interface EncryptedSecretProps {
* @returns
*/
const updateSecrets = async ({ secrets }: { secrets: EncryptedSecretProps[] }) =>
SecurityClient.fetchCall('/api/v2/secrets', {
method: 'PATCH',
SecurityClient.fetchCall("/api/v2/secrets", {
method: "PATCH",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
secrets
@@ -35,7 +35,7 @@ const updateSecrets = async ({ secrets }: { secrets: EncryptedSecretProps[] }) =
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to update certain project secrets');
console.log("Failed to update certain project secrets");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
workspaceId: string;
@@ -18,21 +18,21 @@ interface Props {
*/
const uploadSecrets = async ({ workspaceId, secrets, keys, environment }: Props) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/secrets`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
secrets,
keys,
environment,
channel: 'web'
channel: "web"
})
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to push secrets');
console.log("Failed to push secrets");
return undefined;
});
+1 -1
View File
@@ -26,7 +26,7 @@ const batchSecrets = async ({
environment: string;
requests: RequestType[];
}) => {
const { data } = await apiRequest.post('/api/v2/secrets/batch', {
const { data } = await apiRequest.post("/api/v2/secrets/batch", {
workspaceId,
environment,
requests
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
integrationId: string;
@@ -18,9 +18,9 @@ interface Props {
const changeHerokuConfigVars = ({ integrationId, key, secrets }: Props) =>
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}/sync`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
key,
@@ -30,7 +30,7 @@ const changeHerokuConfigVars = ({ integrationId, key, secrets }: Props) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to sync secrets to Heroku');
console.log("Failed to sync secrets to Heroku");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
integrationId: string;
@@ -11,9 +11,9 @@ interface Props {
*/
const deleteIntegration = ({ integrationId }: Props) =>
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
integrationAuthId: string;
@@ -11,15 +11,15 @@ interface Props {
*/
const deleteIntegrationAuth = ({ integrationAuthId }: Props) =>
SecurityClient.fetchCall(`/api/v1/integration-auth/${integrationAuthId}`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).integrationAuth;
}
console.log('Failed to delete an integration authorization');
console.log("Failed to delete an integration authorization");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
integrationAuthId: string;
@@ -6,15 +6,15 @@ interface Props {
const getIntegrationApps = ({ integrationAuthId }: Props) =>
SecurityClient.fetchCall(`/api/v1/integration-auth/${integrationAuthId}/apps`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).apps;
}
console.log('Failed to get available apps for an integration');
console.log("Failed to get available apps for an integration");
return undefined;
});
@@ -1,16 +1,16 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
const getIntegrationOptions = () =>
SecurityClient.fetchCall('/api/v1/integration-auth/integration-options', {
method: 'GET',
SecurityClient.fetchCall("/api/v1/integration-auth/integration-options", {
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).integrationOptions;
}
console.log('Failed to get (cloud) integration options');
console.log("Failed to get (cloud) integration options");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
integrationId: string;
@@ -13,9 +13,9 @@ interface Props {
*/
const startIntegration = ({ integrationId, appName, environment }: Props) =>
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
method: 'PATCH',
method: "PATCH",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
update: {
@@ -28,7 +28,7 @@ const startIntegration = ({ integrationId, appName, environment }: Props) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to start an integration');
console.log("Failed to start an integration");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
workspaceId: string;
@@ -14,10 +14,10 @@ interface Props {
* @returns
*/
const AuthorizeIntegration = ({ workspaceId, code, integration }: Props) =>
SecurityClient.fetchCall('/api/v1/integration-auth/oauth-token', {
method: 'POST',
SecurityClient.fetchCall("/api/v1/integration-auth/oauth-token", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
workspaceId,
@@ -28,7 +28,7 @@ const AuthorizeIntegration = ({ workspaceId, code, integration }: Props) =>
if (res && res.status === 200) {
return (await res.json()).integrationAuth;
}
console.log('Failed to authorize the integration');
console.log("Failed to authorize the integration");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
integrationAuthId: string;
@@ -36,10 +36,10 @@ const createIntegration = ({
region,
secretPath
}: Props) =>
SecurityClient.fetchCall('/api/v1/integration', {
method: 'POST',
SecurityClient.fetchCall("/api/v1/integration", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
integrationAuthId,
@@ -60,7 +60,7 @@ const createIntegration = ({
if (res && res.status === 200) {
return (await res.json()).integration;
}
console.log('Failed to create integration');
console.log("Failed to create integration");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
workspaceId: string;
@@ -11,15 +11,15 @@ interface Props {
*/
const getWorkspaceAuthorizations = ({ workspaceId }: Props) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/authorizations`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).authorizations;
}
console.log('Failed to get project authorizations');
console.log("Failed to get project authorizations");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
workspaceId: string;
@@ -11,15 +11,15 @@ interface Props {
*/
const getWorkspaceIntegrations = ({ workspaceId }: Props) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/integrations`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).integrations;
}
console.log('Failed to get the project integrations');
console.log("Failed to get the project integrations");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
workspaceId: string | null;
@@ -29,10 +29,10 @@ const saveIntegrationAccessToken = ({
url,
namespace
}: Props) =>
SecurityClient.fetchCall(`/api/v1/integration-auth/access-token`, {
method: 'POST',
SecurityClient.fetchCall("/api/v1/integration-auth/access-token", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
workspaceId,
@@ -46,7 +46,7 @@ const saveIntegrationAccessToken = ({
if (res && res.status === 200) {
return (await res.json()).integrationAuth;
}
console.log('Failed to save integration access details');
console.log("Failed to save integration access details");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route starts the integration after teh default one if gonna set up.
@@ -32,9 +32,9 @@ const updateIntegration = ({
owner: string | null;
}) =>
SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
method: 'PATCH',
method: "PATCH",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
app,
@@ -48,7 +48,7 @@ const updateIntegration = ({
if (res && res.status === 200) {
return (await res.json()).integration;
}
console.log('Failed to start an integration');
console.log("Failed to start an integration");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get info about a certain org
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getOrganization = ({ orgId }: { orgId: string }) =>
SecurityClient.fetchCall(`/api/v1/organization/${orgId}`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).organization;
}
console.log('Failed to get org info');
console.log("Failed to get org info");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get all the project memebrships of users in an org.
@@ -9,15 +9,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
const getOrganizationProjectMemberships = (req: { orgId: string }) =>
SecurityClient.fetchCall(`/api/v1/organization/${req.orgId}/workspace-memberships`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to get project memberships for users in an org');
console.log("Failed to get project memberships for users in an org");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get all the users in an org.
@@ -10,15 +10,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
// TODO: this file is not used anywhere
const getOrganizationProjects = (req: { orgId: string }) =>
SecurityClient.fetchCall(`/api/organization/${req.orgId}/workspaces`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).workspaces;
}
console.log('Failed to get projects for an org');
console.log("Failed to get projects for an org");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get the current subscription of an org.
@@ -8,15 +8,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getOrganizationSubscriptions = (req: { orgId: string }) =>
SecurityClient.fetchCall(`/api/v1/organization/${req.orgId}/subscriptions`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).subscriptions;
}
console.log('Failed to get org subscriptions');
console.log("Failed to get org subscriptions");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get all the projects of a certain user in an org.
@@ -8,15 +8,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getOrganizationUserProjects = (req: { orgId: string }) =>
SecurityClient.fetchCall(`/api/v1/organization/${req.orgId}/my-workspaces`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).workspaces;
}
console.log('Failed to get projects of a user in an org');
console.log("Failed to get projects of a user in an org");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
export interface IMembershipOrg {
_id: string;
@@ -11,8 +11,8 @@ export interface IMembershipOrg {
};
inviteEmail: string;
organization: string;
role: 'owner' | 'admin' | 'member';
status: 'invited' | 'accepted';
role: "owner" | "admin" | "member";
status: "invited" | "accepted";
deniedPermissions: any[];
}
/**
@@ -23,15 +23,15 @@ export interface IMembershipOrg {
*/
const getOrganizationUsers = ({ orgId }: { orgId: string }): Promise<IMembershipOrg[]> =>
SecurityClient.fetchCall(`/api/v1/organization/${orgId}/users`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).users;
}
console.log('Failed to get org users');
console.log("Failed to get org users");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route redirects the user to the right stripe billing page.
@@ -8,16 +8,16 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const StripeRedirect = ({ orgId }: { orgId: string }) =>
SecurityClient.fetchCall(`/api/v1/organization/${orgId}/customer-portal-session`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
window.location.href = (await res.json()).url;
return;
}
console.log('Failed to redirect to Stripe');
console.log("Failed to redirect to Stripe");
});
export default StripeRedirect;
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route add an incident contact email to a certain organization
@@ -7,9 +7,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const addIncidentContact = (organizationId: string, email: string) =>
SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
email
@@ -18,7 +18,7 @@ const addIncidentContact = (organizationId: string, email: string) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to add an incident contact');
console.log("Failed to add an incident contact");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function sends an email invite to a user to join an org
@@ -7,10 +7,10 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
* @returns
*/
const addUserToOrg = (email: string, orgId: string) =>
SecurityClient.fetchCall('/api/v1/invite-org/signup', {
method: 'POST',
SecurityClient.fetchCall("/api/v1/invite-org/signup", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
inviteeEmail: email,
@@ -20,7 +20,7 @@ const addUserToOrg = (email: string, orgId: string) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to add a user to an org');
console.log("Failed to add a user to an org");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function change the access of a user in a certain organization
@@ -9,9 +9,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const changeUserRoleInOrganization = (organizationId: string, membershipId: string, role: string) =>
SecurityClient.fetchCall(`/api/v2/organizations/${organizationId}/memberships/${membershipId}`, {
method: 'PATCH',
method: "PATCH",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
role
@@ -20,7 +20,7 @@ const changeUserRoleInOrganization = (organizationId: string, membershipId: stri
if (res && res.status === 200) {
return res;
}
console.log('Failed to change the user role in an org');
console.log("Failed to change the user role in an org");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route deletes an incident Contact from a certain organization
@@ -7,9 +7,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const deleteIncidentContact = (organizationId: string, email: string) =>
SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
email
@@ -18,7 +18,7 @@ const deleteIncidentContact = (organizationId: string, email: string) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to delete an incident contact');
console.log("Failed to delete an incident contact");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function removes a certain member from a certain organization
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const deleteUserFromOrganization = (membershipId: string) =>
SecurityClient.fetchCall(`/api/v1/membership-org/${membershipId}`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to delete a user from an org');
console.log("Failed to delete a user from an org");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
export interface IIncidentContactOrg {
_id: string;
@@ -12,15 +12,15 @@ export interface IIncidentContactOrg {
*/
const getIncidentContacts = (organizationId: string): Promise<IIncidentContactOrg[]> =>
SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).incidentContactsOrg;
}
console.log('Failed to get incident contacts');
console.log("Failed to get incident contacts");
return undefined;
});
@@ -1,20 +1,20 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get the all the orgs of a certain user.
* @returns
*/
const getOrganizations = () =>
SecurityClient.fetchCall('/api/v1/organization', {
method: 'GET',
SecurityClient.fetchCall("/api/v1/organization", {
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).organizations;
}
console.log('Failed to get orgs of a user');
console.log("Failed to get orgs of a user");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us rename a certain org.
@@ -8,9 +8,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const renameOrg = (orgId: string, newOrgName: string) =>
SecurityClient.fetchCall(`/api/v1/organization/${orgId}/name`, {
method: 'PATCH',
method: "PATCH",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
name: newOrgName
@@ -19,7 +19,7 @@ const renameOrg = (orgId: string, newOrgName: string) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to rename an organization');
console.log("Failed to rename an organization");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
name: string;
@@ -31,10 +31,10 @@ const addServiceToken = ({
iv,
tag
}: Props) =>
SecurityClient.fetchCall('/api/v2/service-token/', {
method: 'POST',
SecurityClient.fetchCall("/api/v2/service-token/", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
name,
@@ -49,7 +49,7 @@ const addServiceToken = ({
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to add service tokens');
console.log("Failed to add service tokens");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
serviceTokenId: string;
@@ -12,15 +12,15 @@ interface Props {
*/
const deleteServiceToken = ({ serviceTokenId }: Props) =>
SecurityClient.fetchCall(`/api/v2/service-token/${serviceTokenId}`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to delete a service token');
console.log("Failed to delete a service token");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route gets service tokens for a specific user in a project
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getServiceTokens = ({ workspaceId }: { workspaceId: string }) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/service-token-data`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).serviceTokenData;
}
console.log('Failed to get service tokens');
console.log("Failed to get service tokens");
return undefined;
});
+5 -5
View File
@@ -1,19 +1,19 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route gets the information about a specific user.
*/
const getUser = () =>
SecurityClient.fetchCall('/api/v1/user', {
method: 'GET',
SecurityClient.fetchCall("/api/v1/user", {
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).user;
}
console.log('Failed to get user info');
console.log("Failed to get user info");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Props {
isMfaEnabled: boolean;
@@ -13,10 +13,10 @@ interface Props {
const updateMyMfaEnabled = async ({
isMfaEnabled
}: Props) =>
SecurityClient.fetchCall(`/api/v2/users/me/mfa`, {
method: 'PATCH',
SecurityClient.fetchCall("/api/v2/users/me/mfa", {
method: "PATCH",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
isMfaEnabled,
@@ -25,7 +25,7 @@ const updateMyMfaEnabled = async ({
if (res && res.status === 200) {
return (await res.json()).user;
}
console.log('Failed to update MFA status');
console.log("Failed to update MFA status");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route registers a certain action for a user
@@ -8,21 +8,21 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const checkUserAction = ({ action }: { action: string }) =>
SecurityClient.fetchCall(
`/api/v1/user-action` +
"/api/v1/user-action" +
`?${new URLSearchParams({
action
})}`,
{
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}
).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).userAction;
}
console.log('Failed to check a user action');
console.log("Failed to check a user action");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route registers a certain action for a user
@@ -6,10 +6,10 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
* @returns
*/
const registerUserAction = ({ action }: { action: string }) =>
SecurityClient.fetchCall('/api/v1/user-action', {
method: 'POST',
SecurityClient.fetchCall("/api/v1/user-action", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
action
@@ -18,7 +18,7 @@ const registerUserAction = ({ action }: { action: string }) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to register a user action');
console.log("Failed to register a user action");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function adds a user to a project
@@ -8,9 +8,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const addUserToWorkspace = (email: string, workspaceId: string) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/invite-signup`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
email
@@ -19,7 +19,7 @@ const addUserToWorkspace = (email: string, workspaceId: string) =>
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to add a user to project');
console.log("Failed to add a user to project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function change the access of a user in a certain workspace
@@ -8,9 +8,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const changeUserRoleInWorkspace = (membershipId: string, role: string) =>
SecurityClient.fetchCall(`/api/v1/membership/${membershipId}/change-role`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
role
@@ -19,7 +19,7 @@ const changeUserRoleInWorkspace = (membershipId: string, role: string) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to change the user role in a project');
console.log("Failed to change the user role in a project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route creates a new workspace for a user within a certain organization.
@@ -13,10 +13,10 @@ const createWorkspace = ({
workspaceName: string;
organizationId: string;
}) =>
SecurityClient.fetchCall('/api/v1/workspace', {
method: 'POST',
SecurityClient.fetchCall("/api/v1/workspace", {
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
workspaceName,
@@ -26,7 +26,7 @@ const createWorkspace = ({
if (res?.status === 200) {
return (await res.json()).workspace;
}
console.log('Failed to create a project');
console.log("Failed to create a project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function removes a certain member from a certain workspace
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const deleteUserFromWorkspace = (membershipId: string) =>
SecurityClient.fetchCall(`/api/v1/membership/${membershipId}`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to delete a user from a project');
console.log("Failed to delete a user from a project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route deletes a specified workspace.
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const deleteWorkspace = (workspaceId: string) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}`, {
method: 'DELETE',
method: "DELETE",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to delete a project');
console.log("Failed to delete a project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Workspace {
__v: number;
@@ -14,9 +14,9 @@ interface Workspace {
*/
const getAWorkspace = (workspaceID: string) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceID}`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
@@ -24,7 +24,7 @@ const getAWorkspace = (workspaceID: string) =>
return data.workspace;
}
throw new Error('Failed to get workspace');
throw new Error("Failed to get workspace");
});
export default getAWorkspace;
@@ -1,4 +1,4 @@
import { apiRequest } from '@app/config/request';
import { apiRequest } from "@app/config/request";
/**
* Get the latest key pairs from a certain workspace
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get the information of a certain project.
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getProjectInfo = ({ projectId }: { projectId: string }) =>
SecurityClient.fetchCall(`/api/v1/workspace/${projectId}`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).workspace;
}
console.log('Failed to get project info');
console.log("Failed to get project info");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get the environments that a certain user has acess to in a certain project
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getWorkspaceEnvironments = ({ workspaceId }: { workspaceId: string }) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).accessibleEnvironments;
}
console.log('Failed to get accessible environments');
console.log("Failed to get accessible environments");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get the public keys of everyone in your workspace.
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getWorkspaceKeys = ({ workspaceId }: { workspaceId: string }) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/keys`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).publicKeys;
}
console.log('Failed to get the public keys of everyone in the workspace');
console.log("Failed to get the public keys of everyone in the workspace");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get the tags for a certain project
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getWorkspaceTags = ({ workspaceId }: { workspaceId: string }) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/tags`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).workspaceTags;
}
console.log('Failed to get the tags available in a certain project');
console.log("Failed to get the tags available in a certain project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us get all the users in the workspace.
@@ -7,15 +7,15 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const getWorkspaceUsers = ({ workspaceId }: { workspaceId: string }) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/users`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).users;
}
console.log('Failed to get Project Users');
console.log("Failed to get Project Users");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface Workspace {
__v: number;
@@ -14,10 +14,10 @@ interface Workspace {
* @returns
*/
const getWorkspaces = () =>
SecurityClient.fetchCall('/api/v1/workspace', {
method: 'GET',
SecurityClient.fetchCall("/api/v1/workspace", {
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res?.status === 200) {
@@ -25,7 +25,7 @@ const getWorkspaces = () =>
return data.workspaces;
}
throw new Error('Failed to get projects');
throw new Error("Failed to get projects");
});
export default getWorkspaces;
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route lets us rename a certain workspace.
@@ -8,9 +8,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const renameWorkspace = (workspaceId: string, newWorkspaceName: string) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/name`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
name: newWorkspaceName
@@ -19,7 +19,7 @@ const renameWorkspace = (workspaceId: string, newWorkspaceName: string) =>
if (res && res.status === 200) {
return res;
}
console.log('Failed to rename a project');
console.log("Failed to rename a project");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This route uplods the keys in an encrypted format.
@@ -10,9 +10,9 @@ import SecurityClient from '@app/components/utilities/SecurityClient';
*/
const uploadKeys = (workspaceId: string, userId: string, encryptedKey: string, nonce: string) =>
SecurityClient.fetchCall(`/api/v1/key/${workspaceId}`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
key: {
@@ -25,7 +25,7 @@ const uploadKeys = (workspaceId: string, userId: string, encryptedKey: string, n
if (res && res.status === 200) {
return res;
}
console.log('Failed to upload keys for a new user');
console.log("Failed to upload keys for a new user");
return undefined;
});
+6 -6
View File
@@ -1,7 +1,7 @@
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import { useEffect } from "react";
import { useRouter } from "next/router";
import getWorkspaces from './api/workspace/getWorkspaces';
import getWorkspaces from "./api/workspace/getWorkspaces";
export default function DashboardRedirect() {
const router = useRouter();
@@ -14,15 +14,15 @@ export default function DashboardRedirect() {
(async () => {
let userWorkspace;
try {
if (localStorage.getItem('projectData.id')) {
router.push(`/dashboard/${ localStorage.getItem('projectData.id')}`);
if (localStorage.getItem("projectData.id")) {
router.push(`/dashboard/${ localStorage.getItem("projectData.id")}`);
} else {
const userWorkspaces = await getWorkspaces();
userWorkspace = userWorkspaces[0]._id;
router.push(`/dashboard/${ userWorkspace}`);
}
} catch (error) {
console.log('Error - Not logged in yet');
console.log("Error - Not logged in yet");
}
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
+8 -8
View File
@@ -1,9 +1,9 @@
import { useTranslation } from 'react-i18next';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { useTranslation } from "react-i18next";
import Head from "next/head";
import { useRouter } from "next/router";
import { DashboardPage } from '@app/views/DashboardPage';
import { DashboardEnvOverview } from '@app/views/DashboardPage/DashboardEnvOverview';
import { DashboardPage } from "@app/views/DashboardPage";
import { DashboardEnvOverview } from "@app/views/DashboardPage/DashboardEnvOverview";
const Dashboard = () => {
const { t } = useTranslation();
@@ -15,11 +15,11 @@ const Dashboard = () => {
return (
<>
<Head>
<title>{t('common.head-title', { title: t('dashboard.title') })}</title>
<title>{t("common.head-title", { title: t("dashboard.title") })}</title>
<link rel="icon" href="/infisical.ico" />
<meta property="og:image" content="/images/message.png" />
<meta property="og:title" content={String(t('dashboard.og-title'))} />
<meta name="og:description" content={String(t('dashboard.og-description'))} />
<meta property="og:title" content={String(t("dashboard.og-title"))} />
<meta name="og:description" content={String(t("dashboard.og-description"))} />
</Head>
<div className="h-full">
{isOverviewMode ? <DashboardEnvOverview /> : <DashboardPage envFromTop={queryEnv} />}
+2 -2
View File
@@ -1,5 +1,5 @@
import React from 'react';
import Head from 'next/head';
import React from "react";
import Head from "next/head";
export default function EmailNotFeriviedPage() {
return (
+44 -44
View File
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react';
import Head from 'next/head';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { faSlack } from '@fortawesome/free-brands-svg-icons';
import { useEffect, useState } from "react";
import Head from "next/head";
import Image from "next/image";
import { useRouter } from "next/router";
import { IconProp } from "@fortawesome/fontawesome-svg-core";
import { faSlack } from "@fortawesome/free-brands-svg-icons";
import {
faCheckCircle,
faHandPeace,
@@ -12,13 +12,13 @@ import {
faPlus,
faStar,
faUserPlus
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import onboardingCheck from '@app/components/utilities/checks/OnboardingCheck';
import { TabsObject } from '@app/components/v2/Tabs';
import onboardingCheck from "@app/components/utilities/checks/OnboardingCheck";
import { TabsObject } from "@app/components/v2/Tabs";
import registerUserAction from '../api/userActions/registerUserAction';
import registerUserAction from "../api/userActions/registerUserAction";
type ItemProps = {
text: string;
@@ -42,9 +42,9 @@ const learningItem = ({
if (link) {
return (
<a
target={`${link.includes('https') ? '_blank' : '_self'}`}
target={`${link.includes("https") ? "_blank" : "_self"}`}
rel="noopener noreferrer"
className={`w-full ${complete && 'opacity-30 duration-200 hover:opacity-100'}`}
className={`w-full ${complete && "opacity-30 duration-200 hover:opacity-100"}`}
href={link}
>
<div
@@ -52,7 +52,7 @@ const learningItem = ({
role="button"
tabIndex={0}
onClick={async () => {
if (userAction && userAction !== 'first_time_secrets_pushed') {
if (userAction && userAction !== "first_time_secrets_pushed") {
await registerUserAction({
action: userAction
});
@@ -73,9 +73,9 @@ const learningItem = ({
</div>
</div>
<div
className={`w-28 pr-4 text-right text-sm font-semibold ${complete && 'text-primary'}`}
className={`w-28 pr-4 text-right text-sm font-semibold ${complete && "text-primary"}`}
>
{complete ? 'Complete!' : `About ${time}`}
{complete ? "Complete!" : `About ${time}`}
</div>
{complete && <div className="absolute bottom-0 left-0 h-1 w-full bg-primary" />}
</div>
@@ -111,8 +111,8 @@ const learningItem = ({
<div className="mt-0.5 text-sm font-normal">{subText}</div>
</div>
</div>
<div className={`w-28 pr-4 text-right text-sm font-semibold ${complete && 'text-primary'}`}>
{complete ? 'Complete!' : `About ${time}`}
<div className={`w-28 pr-4 text-right text-sm font-semibold ${complete && "text-primary"}`}>
{complete ? "Complete!" : `About ${time}`}
</div>
{complete && <div className="absolute bottom-0 left-0 h-1 w-full bg-primary" />}
</div>
@@ -162,21 +162,21 @@ export default function Home() {
/>
</div>
{learningItem({
text: 'Get to know Infisical',
subText: '',
text: "Get to know Infisical",
subText: "",
complete: hasUserClickedIntro,
icon: faHandPeace,
time: '3 min',
userAction: 'intro_cta_clicked',
link: 'https://www.youtube.com/watch?v=3F7FNYX94zA'
time: "3 min",
userAction: "intro_cta_clicked",
link: "https://www.youtube.com/watch?v=3F7FNYX94zA"
})}
{learningItem({
text: 'Add your secrets',
subText: 'Click to see example secrets, and add your own.',
text: "Add your secrets",
subText: "Click to see example secrets, and add your own.",
complete: hasUserPushedSecrets,
icon: faPlus,
time: '2 min',
userAction: 'first_time_secrets_pushed',
time: "2 min",
userAction: "first_time_secrets_pushed",
link: `/dashboard/${router.query.id}`
})}
<div className="group relative mb-3 flex h-full w-full cursor-default flex-col items-center justify-between overflow-hidden rounded-md border border-mineshaft-600 bg-bunker-500 pl-2 pr-2 pt-4 pb-2 shadow-xl duration-200">
@@ -195,7 +195,7 @@ export default function Home() {
</div>
</div>
</div>
<div className={`w-28 pr-4 text-right text-sm font-semibold ${false && 'text-green'}`}>
<div className={`w-28 pr-4 text-right text-sm font-semibold ${false && "text-green"}`}>
About 2 min
</div>
</div>
@@ -203,38 +203,38 @@ export default function Home() {
{false && <div className="absolute bottom-0 left-0 h-1 w-full bg-green" />}
</div>
{learningItem({
text: 'Integrate Infisical with your infrastructure',
subText: 'Connect Infisical to various 3rd party services and platforms.',
text: "Integrate Infisical with your infrastructure",
subText: "Connect Infisical to various 3rd party services and platforms.",
complete: false,
icon: faPlug,
time: '15 min',
link: 'https://infisical.com/docs/integrations/overview'
time: "15 min",
link: "https://infisical.com/docs/integrations/overview"
})}
{learningItem({
text: 'Invite your teammates',
subText: '',
text: "Invite your teammates",
subText: "",
complete: usersInOrg,
icon: faUserPlus,
time: '2 min',
time: "2 min",
link: `/settings/org/${router.query.id}?invite`
})}
{learningItem({
text: 'Join Infisical Slack',
subText: 'Have any questions? Ask us!',
text: "Join Infisical Slack",
subText: "Have any questions? Ask us!",
complete: hasUserClickedSlack,
icon: faSlack,
time: '1 min',
userAction: 'slack_cta_clicked',
link: 'https://join.slack.com/t/infisical-users/shared_invite/zt-1wehzfnzn-1aMo5JcGENJiNAC2SD8Jlg'
time: "1 min",
userAction: "slack_cta_clicked",
link: "https://join.slack.com/t/infisical-users/shared_invite/zt-1wehzfnzn-1aMo5JcGENJiNAC2SD8Jlg"
})}
{learningItem({
text: 'Star Infisical on GitHub',
text: "Star Infisical on GitHub",
subText: "Like what we're doing? You know what to do! :)",
complete: hasUserStarred,
icon: faStar,
time: '1 min',
userAction: 'star_cta_clicked',
link: 'https://github.com/Infisical/infisical'
time: "1 min",
userAction: "star_cta_clicked",
link: "https://github.com/Infisical/infisical"
})}
</div>
</div>
+65 -65
View File
@@ -1,29 +1,29 @@
import crypto from 'crypto';
import crypto from "crypto";
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Head from 'next/head';
import { useRouter } from 'next/router';
import frameworkIntegrationOptions from 'public/json/frameworkIntegrations.json';
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import Head from "next/head";
import { useRouter } from "next/router";
import frameworkIntegrationOptions from "public/json/frameworkIntegrations.json";
import ActivateBotDialog from '@app/components/basic/dialog/ActivateBotDialog';
import CloudIntegrationSection from '@app/components/integrations/CloudIntegrationSection';
import FrameworkIntegrationSection from '@app/components/integrations/FrameworkIntegrationSection';
import IntegrationSection from '@app/components/integrations/IntegrationSection';
import NavHeader from '@app/components/navigation/NavHeader';
import ActivateBotDialog from "@app/components/basic/dialog/ActivateBotDialog";
import CloudIntegrationSection from "@app/components/integrations/CloudIntegrationSection";
import FrameworkIntegrationSection from "@app/components/integrations/FrameworkIntegrationSection";
import IntegrationSection from "@app/components/integrations/IntegrationSection";
import NavHeader from "@app/components/navigation/NavHeader";
import {
decryptAssymmetric,
encryptAssymmetric
} from '../../components/utilities/cryptography/crypto';
import getBot from '../api/bot/getBot';
import setBotActiveStatus from '../api/bot/setBotActiveStatus';
import deleteIntegration from '../api/integrations/DeleteIntegration';
import getIntegrationOptions from '../api/integrations/GetIntegrationOptions';
import getWorkspaceAuthorizations from '../api/integrations/getWorkspaceAuthorizations';
import getWorkspaceIntegrations from '../api/integrations/getWorkspaceIntegrations';
import getAWorkspace from '../api/workspace/getAWorkspace';
import getLatestFileKey from '../api/workspace/getLatestFileKey';
} from "../../components/utilities/cryptography/crypto";
import getBot from "../api/bot/getBot";
import setBotActiveStatus from "../api/bot/setBotActiveStatus";
import deleteIntegration from "../api/integrations/DeleteIntegration";
import getIntegrationOptions from "../api/integrations/GetIntegrationOptions";
import getWorkspaceAuthorizations from "../api/integrations/getWorkspaceAuthorizations";
import getWorkspaceIntegrations from "../api/integrations/getWorkspaceIntegrations";
import getAWorkspace from "../api/workspace/getAWorkspace";
import getLatestFileKey from "../api/workspace/getLatestFileKey";
interface IntegrationAuth {
_id: string;
@@ -125,10 +125,10 @@ export default function Integrations() {
if (bot) {
// case: there is a bot
const key = await getLatestFileKey({ workspaceId });
const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY");
if (!PRIVATE_KEY) {
throw new Error('Private Key missing');
throw new Error("Private Key missing");
}
const WORKSPACE_KEY = decryptAssymmetric({
@@ -167,64 +167,64 @@ export default function Integrations() {
const handleUnauthorizedIntegrationOptionPress = (integrationOption: IntegrationOption) => {
try {
// generate CSRF token for OAuth2 code-token exchange integrations
const state = crypto.randomBytes(16).toString('hex');
localStorage.setItem('latestCSRFToken', state);
const state = crypto.randomBytes(16).toString("hex");
localStorage.setItem("latestCSRFToken", state);
let link = '';
let link = "";
switch (integrationOption.slug) {
case 'azure-key-vault':
case "azure-key-vault":
link = `https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${integrationOption.clientId}&response_type=code&redirect_uri=${window.location.origin}/integrations/azure-key-vault/oauth2/callback&response_mode=query&scope=https://vault.azure.net/.default openid offline_access&state=${state}`;
break;
case 'aws-parameter-store':
case "aws-parameter-store":
link = `${window.location.origin}/integrations/aws-parameter-store/authorize`;
break;
case 'aws-secret-manager':
case "aws-secret-manager":
link = `${window.location.origin}/integrations/aws-secret-manager/authorize`;
break;
case 'heroku':
case "heroku":
link = `https://id.heroku.com/oauth/authorize?client_id=${integrationOption.clientId}&response_type=code&scope=write-protected&state=${state}`;
break;
case 'vercel':
case "vercel":
link = `https://vercel.com/integrations/${integrationOption.clientSlug}/new?state=${state}`;
break;
case 'netlify':
case "netlify":
link = `https://app.netlify.com/authorize?client_id=${integrationOption.clientId}&response_type=code&state=${state}&redirect_uri=${window.location.origin}/integrations/netlify/oauth2/callback`;
break;
case 'github':
case "github":
link = `https://github.com/login/oauth/authorize?client_id=${integrationOption.clientId}&response_type=code&scope=repo&redirect_uri=${window.location.origin}/integrations/github/oauth2/callback&state=${state}`;
break;
case 'gitlab':
case "gitlab":
link = `https://gitlab.com/oauth/authorize?client_id=${integrationOption.clientId}&redirect_uri=${window.location.origin}/integrations/gitlab/oauth2/callback&response_type=code&state=${state}`;
break;
case 'render':
case "render":
link = `${window.location.origin}/integrations/render/authorize`;
break;
case 'flyio':
case "flyio":
link = `${window.location.origin}/integrations/flyio/authorize`;
break;
case 'circleci':
case "circleci":
link = `${window.location.origin}/integrations/circleci/authorize`;
break;
case 'travisci':
case "travisci":
link = `${window.location.origin}/integrations/travisci/authorize`;
break;
case 'supabase':
case "supabase":
link = `${window.location.origin}/integrations/supabase/authorize`;
break;
case 'checkly':
case "checkly":
link = `${window.location.origin}/integrations/checkly/authorize`;
break;
case 'railway':
case "railway":
link = `${window.location.origin}/integrations/railway/authorize`;
break;
case 'hashicorp-vault':
case "hashicorp-vault":
link = `${window.location.origin}/integrations/hashicorp-vault/authorize`;
break;
default:
break;
}
if (link !== '') {
if (link !== "") {
window.location.assign(link);
}
} catch (err) {
@@ -234,61 +234,61 @@ export default function Integrations() {
const handleAuthorizedIntegrationOptionPress = (integrationAuth: IntegrationAuth) => {
try {
let link = '';
let link = "";
switch (integrationAuth.integration) {
case 'azure-key-vault':
case "azure-key-vault":
link = `${window.location.origin}/integrations/azure-key-vault/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'aws-parameter-store':
case "aws-parameter-store":
link = `${window.location.origin}/integrations/aws-parameter-store/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'aws-secret-manager':
case "aws-secret-manager":
link = `${window.location.origin}/integrations/aws-secret-manager/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'heroku':
case "heroku":
link = `${window.location.origin}/integrations/heroku/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'vercel':
case "vercel":
link = `${window.location.origin}/integrations/vercel/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'netlify':
case "netlify":
link = `${window.location.origin}/integrations/netlify/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'github':
case "github":
link = `${window.location.origin}/integrations/github/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'gitlab':
case "gitlab":
link = `${window.location.origin}/integrations/gitlab/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'render':
case "render":
link = `${window.location.origin}/integrations/render/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'flyio':
case "flyio":
link = `${window.location.origin}/integrations/flyio/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'circleci':
case "circleci":
link = `${window.location.origin}/integrations/circleci/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'travisci':
case "travisci":
link = `${window.location.origin}/integrations/travisci/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'supabase':
case "supabase":
link = `${window.location.origin}/integrations/supabase/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'checkly':
case "checkly":
link = `${window.location.origin}/integrations/checkly/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'railway':
case "railway":
link = `${window.location.origin}/integrations/railway/create?integrationAuthId=${integrationAuth._id}`;
break;
case 'hashicorp-vault':
case "hashicorp-vault":
link = `${window.location.origin}/integrations/hashicorp-vault/create?integrationAuthId=${integrationAuth._id}`;
break;
default:
break;
}
if (link !== '') {
if (link !== "") {
window.location.assign(link);
}
} catch (err) {
@@ -399,14 +399,14 @@ export default function Integrations() {
return (
<div className="flex max-h-full flex-col justify-between bg-bunker-800 text-white">
<Head>
<title>{t('common.head-title', { title: t('integrations.title') })}</title>
<title>{t("common.head-title", { title: t("integrations.title") })}</title>
<link rel="icon" href="/infisical.ico" />
<meta property="og:image" content="/images/message.png" />
<meta property="og:title" content="Manage your .env files in seconds" />
<meta name="og:description" content={t('integrations.description') as string} />
<meta name="og:description" content={t("integrations.description") as string} />
</Head>
<div className="no-scrollbar::-webkit-scrollbar h-screen max-h-[calc(100vh-10px)] w-full overflow-y-scroll pb-6 no-scrollbar">
<NavHeader pageName={t('integrations.title')} isProjectRelated />
<NavHeader pageName={t("integrations.title")} isProjectRelated />
<ActivateBotDialog
isOpen={isActivateBotDialogOpen}
closeModal={() => setIsActivateBotDialogOpen(false)}
@@ -439,8 +439,8 @@ export default function Integrations() {
) : (
<>
<div className="m-4 mt-7 flex max-w-5xl flex-col items-start justify-between px-2 text-xl">
<h1 className="text-3xl font-semibold">{t('integrations.cloud-integrations')}</h1>
<p className="text-base text-gray-400">{t('integrations.click-to-start')}</p>
<h1 className="text-3xl font-semibold">{t("integrations.cloud-integrations")}</h1>
<p className="text-base text-gray-400">{t("integrations.click-to-start")}</p>
</div>
<div className="mx-6 grid max-w-5xl grid-cols-4 grid-rows-2 gap-4">
{[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16].map(elem => <div key={elem} className="bg-mineshaft-800 border border-mineshaft-600 animate-pulse h-32 rounded-md"/>)}
@@ -1,46 +1,46 @@
import { useState } from 'react';
import { useRouter } from 'next/router';
import { useState } from "react";
import { useRouter } from "next/router";
import { Button, Card, CardTitle, FormControl, Input } from '../../../components/v2';
import saveIntegrationAccessToken from '../../api/integrations/saveIntegrationAccessToken';
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
export default function AWSParameterStoreAuthorizeIntegrationPage() {
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
const [accessKey, setAccessKey] = useState('');
const [accessKeyErrorText, setAccessKeyErrorText] = useState('');
const [accessSecretKey, setAccessSecretKey] = useState('');
const [accessSecretKeyErrorText, setAccessSecretKeyErrorText] = useState('');
const [accessKey, setAccessKey] = useState("");
const [accessKeyErrorText, setAccessKeyErrorText] = useState("");
const [accessSecretKey, setAccessSecretKey] = useState("");
const [accessSecretKeyErrorText, setAccessSecretKeyErrorText] = useState("");
const handleButtonClick = async () => {
try {
setAccessKeyErrorText('');
setAccessSecretKeyErrorText('');
setAccessKeyErrorText("");
setAccessSecretKeyErrorText("");
if (accessKey.length === 0) {
setAccessKeyErrorText('Access key cannot be blank');
setAccessKeyErrorText("Access key cannot be blank");
return;
}
if (accessSecretKey.length === 0) {
setAccessSecretKeyErrorText('Secret access key cannot be blank');
setAccessSecretKeyErrorText("Secret access key cannot be blank");
return;
}
setIsLoading(true);
const integrationAuth = await saveIntegrationAccessToken({
workspaceId: localStorage.getItem('projectData.id'),
integration: 'aws-parameter-store',
workspaceId: localStorage.getItem("projectData.id"),
integration: "aws-parameter-store",
accessId: accessKey,
accessToken: accessSecretKey,
url: null,
namespace: null
});
setAccessKey('');
setAccessSecretKey('');
setAccessKey("");
setAccessSecretKey("");
setIsLoading(false);
router.push(
@@ -58,7 +58,7 @@ export default function AWSParameterStoreAuthorizeIntegrationPage() {
<FormControl
label="Access Key ID"
errorText={accessKeyErrorText}
isError={accessKeyErrorText !== '' ?? false}
isError={accessKeyErrorText !== "" ?? false}
>
<Input
placeholder=""
@@ -69,7 +69,7 @@ export default function AWSParameterStoreAuthorizeIntegrationPage() {
<FormControl
label="Secret Access Key"
errorText={accessSecretKeyErrorText}
isError={accessSecretKeyErrorText !== '' ?? false}
isError={accessSecretKeyErrorText !== "" ?? false}
>
<Input
placeholder=""
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import queryString from 'query-string';
import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import queryString from "query-string";
import {
Button,
@@ -10,56 +10,56 @@ import {
Input,
Select,
SelectItem
} from '../../../components/v2';
import { useGetIntegrationAuthById } from '../../../hooks/api/integrationAuth';
import { useGetWorkspaceById } from '../../../hooks/api/workspace';
import createIntegration from '../../api/integrations/createIntegration';
} from "../../../components/v2";
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
import createIntegration from "../../api/integrations/createIntegration";
const awsRegions = [
{ name: 'US East (Ohio)', slug: 'us-east-2' },
{ name: 'US East (N. Virginia)', slug: 'us-east-1' },
{ name: 'US West (N. California)', slug: 'us-west-1' },
{ name: 'US West (Oregon)', slug: 'us-west-2' },
{ name: 'Africa (Cape Town)', slug: 'af-south-1' },
{ name: 'Asia Pacific (Hong Kong)', slug: 'ap-east-1' },
{ name: 'Asia Pacific (Hyderabad)', slug: 'ap-south-2' },
{ name: 'Asia Pacific (Jakarta)', slug: 'ap-southeast-3' },
{ name: 'Asia Pacific (Melbourne)', slug: 'ap-southeast-4' },
{ name: 'Asia Pacific (Mumbai)', slug: 'ap-south-1' },
{ name: 'Asia Pacific (Osaka)', slug: 'ap-northeast-3' },
{ name: 'Asia Pacific (Seoul)', slug: 'ap-northeast-2' },
{ name: 'Asia Pacific (Singapore)', slug: 'ap-southeast-1' },
{ name: 'Asia Pacific (Sydney)', slug: 'ap-southeast-2' },
{ name: 'Asia Pacific (Tokyo)', slug: 'ap-northeast-1' },
{ name: 'Canada (Central)', slug: 'ca-central-1' },
{ name: 'Europe (Frankfurt)', slug: 'eu-central-1' },
{ name: 'Europe (Ireland)', slug: 'eu-west-1' },
{ name: 'Europe (London)', slug: 'eu-west-2' },
{ name: 'Europe (Milan)', slug: 'eu-south-1' },
{ name: 'Europe (Paris)', slug: 'eu-west-3' },
{ name: 'Europe (Spain)', slug: 'eu-south-2' },
{ name: 'Europe (Stockholm)', slug: 'eu-north-1' },
{ name: 'Europe (Zurich)', slug: 'eu-central-2' },
{ name: 'Middle East (Bahrain)', slug: 'me-south-1' },
{ name: 'Middle East (UAE)', slug: 'me-central-1' },
{ name: 'South America (Sao Paulo)', slug: 'sa-east-1' },
{ name: 'AWS GovCloud (US-East)', slug: 'us-gov-east-1' },
{ name: 'AWS GovCloud (US-West)', slug: 'us-gov-west-1' }
{ name: "US East (Ohio)", slug: "us-east-2" },
{ name: "US East (N. Virginia)", slug: "us-east-1" },
{ name: "US West (N. California)", slug: "us-west-1" },
{ name: "US West (Oregon)", slug: "us-west-2" },
{ name: "Africa (Cape Town)", slug: "af-south-1" },
{ name: "Asia Pacific (Hong Kong)", slug: "ap-east-1" },
{ name: "Asia Pacific (Hyderabad)", slug: "ap-south-2" },
{ name: "Asia Pacific (Jakarta)", slug: "ap-southeast-3" },
{ name: "Asia Pacific (Melbourne)", slug: "ap-southeast-4" },
{ name: "Asia Pacific (Mumbai)", slug: "ap-south-1" },
{ name: "Asia Pacific (Osaka)", slug: "ap-northeast-3" },
{ name: "Asia Pacific (Seoul)", slug: "ap-northeast-2" },
{ name: "Asia Pacific (Singapore)", slug: "ap-southeast-1" },
{ name: "Asia Pacific (Sydney)", slug: "ap-southeast-2" },
{ name: "Asia Pacific (Tokyo)", slug: "ap-northeast-1" },
{ name: "Canada (Central)", slug: "ca-central-1" },
{ name: "Europe (Frankfurt)", slug: "eu-central-1" },
{ name: "Europe (Ireland)", slug: "eu-west-1" },
{ name: "Europe (London)", slug: "eu-west-2" },
{ name: "Europe (Milan)", slug: "eu-south-1" },
{ name: "Europe (Paris)", slug: "eu-west-3" },
{ name: "Europe (Spain)", slug: "eu-south-2" },
{ name: "Europe (Stockholm)", slug: "eu-north-1" },
{ name: "Europe (Zurich)", slug: "eu-central-2" },
{ name: "Middle East (Bahrain)", slug: "me-south-1" },
{ name: "Middle East (UAE)", slug: "me-central-1" },
{ name: "South America (Sao Paulo)", slug: "sa-east-1" },
{ name: "AWS GovCloud (US-East)", slug: "us-gov-east-1" },
{ name: "AWS GovCloud (US-West)", slug: "us-gov-west-1" }
];
export default function AWSParameterStoreCreateIntegrationPage() {
const router = useRouter();
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: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? '');
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
const [secretPath, setSecretPath] = useState('/');
const [selectedAWSRegion, setSelectedAWSRegion] = useState('');
const [path, setPath] = useState('');
const [pathErrorText, setPathErrorText] = useState('');
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
const [secretPath, setSecretPath] = useState("/");
const [selectedAWSRegion, setSelectedAWSRegion] = useState("");
const [path, setPath] = useState("");
const [pathErrorText, setPathErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
@@ -77,11 +77,11 @@ export default function AWSParameterStoreCreateIntegrationPage() {
const handleButtonClick = async () => {
try {
if (path !== '') {
if (path !== "") {
// case: path is not empty
if (!isValidAWSParameterStorePath(path)) {
// case: path is not valid for aws parameter store
setPathErrorText('Path must be a valid path for SSM like /project/env/');
setPathErrorText("Path must be a valid path for SSM like /project/env/");
return;
}
}
@@ -107,9 +107,9 @@ export default function AWSParameterStoreCreateIntegrationPage() {
});
setIsLoading(false);
setPathErrorText('');
setPathErrorText("");
router.push(`/integrations/${localStorage.getItem('projectData.id')}`);
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
} catch (err) {
console.error(err);
}
@@ -155,11 +155,11 @@ export default function AWSParameterStoreCreateIntegrationPage() {
))}
</Select>
</FormControl>
<FormControl label="Path" errorText={pathErrorText} isError={pathErrorText !== '' ?? false}>
<FormControl label="Path" errorText={pathErrorText} isError={pathErrorText !== "" ?? false}>
<Input
placeholder={`/${workspace.name
.toLowerCase()
.replace(/ /g, '-')}/${selectedSourceEnvironment}/`}
.replace(/ /g, "-")}/${selectedSourceEnvironment}/`}
value={path}
onChange={(e) => setPath(e.target.value)}
/>
@@ -1,46 +1,46 @@
import { useState } from 'react';
import { useRouter } from 'next/router';
import { useState } from "react";
import { useRouter } from "next/router";
import { Button, Card, CardTitle, FormControl, Input } from '../../../components/v2';
import saveIntegrationAccessToken from '../../api/integrations/saveIntegrationAccessToken';
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
export default function AWSSecretManagerCreateIntegrationPage() {
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
const [accessKey, setAccessKey] = useState('');
const [accessKeyErrorText, setAccessKeyErrorText] = useState('');
const [accessSecretKey, setAccessSecretKey] = useState('');
const [accessSecretKeyErrorText, setAccessSecretKeyErrorText] = useState('');
const [accessKey, setAccessKey] = useState("");
const [accessKeyErrorText, setAccessKeyErrorText] = useState("");
const [accessSecretKey, setAccessSecretKey] = useState("");
const [accessSecretKeyErrorText, setAccessSecretKeyErrorText] = useState("");
const handleButtonClick = async () => {
try {
setAccessKeyErrorText('');
setAccessSecretKeyErrorText('');
setAccessKeyErrorText("");
setAccessSecretKeyErrorText("");
if (accessKey.length === 0) {
setAccessKeyErrorText('Access key cannot be blank');
setAccessKeyErrorText("Access key cannot be blank");
return;
}
if (accessSecretKey.length === 0) {
setAccessSecretKeyErrorText('Secret access key cannot be blank');
setAccessSecretKeyErrorText("Secret access key cannot be blank");
return;
}
setIsLoading(true);
const integrationAuth = await saveIntegrationAccessToken({
workspaceId: localStorage.getItem('projectData.id'),
integration: 'aws-secret-manager',
workspaceId: localStorage.getItem("projectData.id"),
integration: "aws-secret-manager",
accessId: accessKey,
accessToken: accessSecretKey,
url: null,
namespace: null
});
setAccessKey('');
setAccessSecretKey('');
setAccessKey("");
setAccessSecretKey("");
setIsLoading(false);
router.push(
@@ -58,14 +58,14 @@ export default function AWSSecretManagerCreateIntegrationPage() {
<FormControl
label="Access Key ID"
errorText={accessKeyErrorText}
isError={accessKeyErrorText !== '' ?? false}
isError={accessKeyErrorText !== "" ?? false}
>
<Input placeholder="" value={accessKey} onChange={(e) => setAccessKey(e.target.value)} />
</FormControl>
<FormControl
label="Secret Access Key"
errorText={accessSecretKeyErrorText}
isError={accessSecretKeyErrorText !== '' ?? false}
isError={accessSecretKeyErrorText !== "" ?? false}
>
<Input
placeholder=""
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import queryString from 'query-string';
import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import queryString from "query-string";
import {
Button,
@@ -10,56 +10,56 @@ import {
Input,
Select,
SelectItem
} from '../../../components/v2';
import { useGetIntegrationAuthById } from '../../../hooks/api/integrationAuth';
import { useGetWorkspaceById } from '../../../hooks/api/workspace';
import createIntegration from '../../api/integrations/createIntegration';
} from "../../../components/v2";
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
import createIntegration from "../../api/integrations/createIntegration";
const awsRegions = [
{ name: 'US East (Ohio)', slug: 'us-east-2' },
{ name: 'US East (N. Virginia)', slug: 'us-east-1' },
{ name: 'US West (N. California)', slug: 'us-west-1' },
{ name: 'US West (Oregon)', slug: 'us-west-2' },
{ name: 'Africa (Cape Town)', slug: 'af-south-1' },
{ name: 'Asia Pacific (Hong Kong)', slug: 'ap-east-1' },
{ name: 'Asia Pacific (Hyderabad)', slug: 'ap-south-2' },
{ name: 'Asia Pacific (Jakarta)', slug: 'ap-southeast-3' },
{ name: 'Asia Pacific (Melbourne)', slug: 'ap-southeast-4' },
{ name: 'Asia Pacific (Mumbai)', slug: 'ap-south-1' },
{ name: 'Asia Pacific (Osaka)', slug: 'ap-northeast-3' },
{ name: 'Asia Pacific (Seoul)', slug: 'ap-northeast-2' },
{ name: 'Asia Pacific (Singapore)', slug: 'ap-southeast-1' },
{ name: 'Asia Pacific (Sydney)', slug: 'ap-southeast-2' },
{ name: 'Asia Pacific (Tokyo)', slug: 'ap-northeast-1' },
{ name: 'Canada (Central)', slug: 'ca-central-1' },
{ name: 'Europe (Frankfurt)', slug: 'eu-central-1' },
{ name: 'Europe (Ireland)', slug: 'eu-west-1' },
{ name: 'Europe (London)', slug: 'eu-west-2' },
{ name: 'Europe (Milan)', slug: 'eu-south-1' },
{ name: 'Europe (Paris)', slug: 'eu-west-3' },
{ name: 'Europe (Spain)', slug: 'eu-south-2' },
{ name: 'Europe (Stockholm)', slug: 'eu-north-1' },
{ name: 'Europe (Zurich)', slug: 'eu-central-2' },
{ name: 'Middle East (Bahrain)', slug: 'me-south-1' },
{ name: 'Middle East (UAE)', slug: 'me-central-1' },
{ name: 'South America (Sao Paulo)', slug: 'sa-east-1' },
{ name: 'AWS GovCloud (US-East)', slug: 'us-gov-east-1' },
{ name: 'AWS GovCloud (US-West)', slug: 'us-gov-west-1' }
{ name: "US East (Ohio)", slug: "us-east-2" },
{ name: "US East (N. Virginia)", slug: "us-east-1" },
{ name: "US West (N. California)", slug: "us-west-1" },
{ name: "US West (Oregon)", slug: "us-west-2" },
{ name: "Africa (Cape Town)", slug: "af-south-1" },
{ name: "Asia Pacific (Hong Kong)", slug: "ap-east-1" },
{ name: "Asia Pacific (Hyderabad)", slug: "ap-south-2" },
{ name: "Asia Pacific (Jakarta)", slug: "ap-southeast-3" },
{ name: "Asia Pacific (Melbourne)", slug: "ap-southeast-4" },
{ name: "Asia Pacific (Mumbai)", slug: "ap-south-1" },
{ name: "Asia Pacific (Osaka)", slug: "ap-northeast-3" },
{ name: "Asia Pacific (Seoul)", slug: "ap-northeast-2" },
{ name: "Asia Pacific (Singapore)", slug: "ap-southeast-1" },
{ name: "Asia Pacific (Sydney)", slug: "ap-southeast-2" },
{ name: "Asia Pacific (Tokyo)", slug: "ap-northeast-1" },
{ name: "Canada (Central)", slug: "ca-central-1" },
{ name: "Europe (Frankfurt)", slug: "eu-central-1" },
{ name: "Europe (Ireland)", slug: "eu-west-1" },
{ name: "Europe (London)", slug: "eu-west-2" },
{ name: "Europe (Milan)", slug: "eu-south-1" },
{ name: "Europe (Paris)", slug: "eu-west-3" },
{ name: "Europe (Spain)", slug: "eu-south-2" },
{ name: "Europe (Stockholm)", slug: "eu-north-1" },
{ name: "Europe (Zurich)", slug: "eu-central-2" },
{ name: "Middle East (Bahrain)", slug: "me-south-1" },
{ name: "Middle East (UAE)", slug: "me-central-1" },
{ name: "South America (Sao Paulo)", slug: "sa-east-1" },
{ name: "AWS GovCloud (US-East)", slug: "us-gov-east-1" },
{ name: "AWS GovCloud (US-West)", slug: "us-gov-west-1" }
];
export default function AWSSecretManagerCreateIntegrationPage() {
const router = useRouter();
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: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? '');
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
const [secretPath, setSecretPath] = useState('/');
const [selectedAWSRegion, setSelectedAWSRegion] = useState('');
const [targetSecretName, setTargetSecretName] = useState('');
const [targetSecretNameErrorText, setTargetSecretNameErrorText] = useState('');
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
const [secretPath, setSecretPath] = useState("/");
const [selectedAWSRegion, setSelectedAWSRegion] = useState("");
const [targetSecretName, setTargetSecretName] = useState("");
const [targetSecretNameErrorText, setTargetSecretNameErrorText] = useState("");
// const [path, setPath] = useState('');
// const [pathErrorText, setPathErrorText] = useState('');
@@ -80,8 +80,8 @@ export default function AWSSecretManagerCreateIntegrationPage() {
const handleButtonClick = async () => {
try {
if (targetSecretName.trim() === '') {
setTargetSecretName('Secret name cannot be blank');
if (targetSecretName.trim() === "") {
setTargetSecretName("Secret name cannot be blank");
return;
}
@@ -106,9 +106,9 @@ export default function AWSSecretManagerCreateIntegrationPage() {
});
setIsLoading(false);
setTargetSecretNameErrorText('');
setTargetSecretNameErrorText("");
router.push(`/integrations/${localStorage.getItem('projectData.id')}`);
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
} catch (err) {
console.error(err);
}
@@ -157,12 +157,12 @@ export default function AWSSecretManagerCreateIntegrationPage() {
<FormControl
label="AWS SM Secret Name"
errorText={targetSecretNameErrorText}
isError={targetSecretNameErrorText !== '' ?? false}
isError={targetSecretNameErrorText !== "" ?? false}
>
<Input
placeholder={`${workspace.name
.toLowerCase()
.replace(/ /g, '-')}/${selectedSourceEnvironment}`}
.replace(/ /g, "-")}/${selectedSourceEnvironment}`}
value={targetSecretName}
onChange={(e) => setTargetSecretName(e.target.value)}
/>
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import queryString from 'query-string';
import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import queryString from "query-string";
import {
Button,
@@ -10,24 +10,24 @@ import {
Input,
Select,
SelectItem
} from '../../../components/v2';
import { useGetIntegrationAuthById } from '../../../hooks/api/integrationAuth';
import { useGetWorkspaceById } from '../../../hooks/api/workspace';
import createIntegration from '../../api/integrations/createIntegration';
} from "../../../components/v2";
import { useGetIntegrationAuthById } from "../../../hooks/api/integrationAuth";
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
import createIntegration from "../../api/integrations/createIntegration";
export default function AzureKeyVaultCreateIntegrationPage() {
const router = useRouter();
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: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? '');
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
const [secretPath, setSecretPath] = useState('/');
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
const [secretPath, setSecretPath] = useState("/");
const [vaultBaseUrl, setVaultBaseUrl] = useState('');
const [vaultBaseUrlErrorText, setVaultBaseUrlErrorText] = useState('');
const [vaultBaseUrl, setVaultBaseUrl] = useState("");
const [vaultBaseUrlErrorText, setVaultBaseUrlErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
@@ -40,12 +40,12 @@ export default function AzureKeyVaultCreateIntegrationPage() {
const handleButtonClick = async () => {
try {
if (vaultBaseUrl.length === 0) {
setVaultBaseUrlErrorText('Vault URI cannot be blank');
setVaultBaseUrlErrorText("Vault URI cannot be blank");
return;
}
if (!vaultBaseUrl.startsWith('https://') || !vaultBaseUrl.endsWith('vault.azure.net')) {
setVaultBaseUrlErrorText('Vault URI must be like https://<vault_name>.vault.azure.net');
if (!vaultBaseUrl.startsWith("https://") || !vaultBaseUrl.endsWith("vault.azure.net")) {
setVaultBaseUrlErrorText("Vault URI must be like https://<vault_name>.vault.azure.net");
return;
}
@@ -69,7 +69,7 @@ export default function AzureKeyVaultCreateIntegrationPage() {
});
setIsLoading(false);
router.push(`/integrations/${localStorage.getItem('projectData.id')}`);
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
} catch (err) {
console.error(err);
}
@@ -105,7 +105,7 @@ export default function AzureKeyVaultCreateIntegrationPage() {
<FormControl
label="Vault URI"
errorText={vaultBaseUrlErrorText}
isError={vaultBaseUrlErrorText !== '' ?? false}
isError={vaultBaseUrlErrorText !== "" ?? false}
>
<Input
placeholder="https://example.vault.azure.net"
@@ -1,25 +1,25 @@
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import queryString from 'query-string';
import { useEffect } from "react";
import { useRouter } from "next/router";
import queryString from "query-string";
import AuthorizeIntegration from '../../../api/integrations/authorizeIntegration';
import AuthorizeIntegration from "../../../api/integrations/authorizeIntegration";
export default function AzureKeyVaultOAuth2CallbackPage() {
const router = useRouter();
const { code, state } = queryString.parse(router.asPath.split('?')[1]);
const { code, state } = queryString.parse(router.asPath.split("?")[1]);
useEffect(() => {
(async () => {
try {
// validate state
if (state !== localStorage.getItem('latestCSRFToken')) return;
localStorage.removeItem('latestCSRFToken');
if (state !== localStorage.getItem("latestCSRFToken")) return;
localStorage.removeItem("latestCSRFToken");
const integrationAuth = await AuthorizeIntegration({
workspaceId: localStorage.getItem('projectData.id') as string,
workspaceId: localStorage.getItem("projectData.id") as string,
code: code as string,
integration: 'azure-key-vault'
integration: "azure-key-vault"
});
router.push(
@@ -1,28 +1,28 @@
import { useState } from 'react';
import { useRouter } from 'next/router';
import { useState } from "react";
import { useRouter } from "next/router";
import { Button, Card, CardTitle, FormControl, Input } from '../../../components/v2';
import saveIntegrationAccessToken from '../../api/integrations/saveIntegrationAccessToken';
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
export default function ChecklyCreateIntegrationPage() {
const router = useRouter();
const [accessToken, setAccessToken] = useState('');
const [accessTokenErrorText, setAccessTokenErrorText] = useState('');
const [accessToken, setAccessToken] = useState("");
const [accessTokenErrorText, setAccessTokenErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
const handleButtonClick = async () => {
try {
setAccessTokenErrorText('');
setAccessTokenErrorText("");
if (accessToken.length === 0) {
setAccessTokenErrorText('Access token cannot be blank');
setAccessTokenErrorText("Access token cannot be blank");
return;
}
setIsLoading(true);
const integrationAuth = await saveIntegrationAccessToken({
workspaceId: localStorage.getItem('projectData.id'),
integration: 'checkly',
workspaceId: localStorage.getItem("projectData.id"),
integration: "checkly",
accessId: null,
accessToken,
url: null,
@@ -44,7 +44,7 @@ export default function ChecklyCreateIntegrationPage() {
<FormControl
label="Checkly API key"
errorText={accessTokenErrorText}
isError={accessTokenErrorText !== '' ?? false}
isError={accessTokenErrorText !== "" ?? false}
className="mx-6"
>
<Input
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import queryString from 'query-string';
import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import queryString from "query-string";
import {
Button,
@@ -10,30 +10,30 @@ import {
Input,
Select,
SelectItem
} from '../../../components/v2';
} from "../../../components/v2";
import {
useGetIntegrationAuthApps,
useGetIntegrationAuthById
} from '../../../hooks/api/integrationAuth';
import { useGetWorkspaceById } from '../../../hooks/api/workspace';
import createIntegration from '../../api/integrations/createIntegration';
} from "../../../hooks/api/integrationAuth";
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
import createIntegration from "../../api/integrations/createIntegration";
export default function ChecklyCreateIntegrationPage() {
const router = useRouter();
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: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? '');
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const { data: integrationAuthApps } = useGetIntegrationAuthApps({
integrationAuthId: (integrationAuthId as string) ?? ''
integrationAuthId: (integrationAuthId as string) ?? ""
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
const [secretPath, setSecretPath] = useState('/');
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
const [secretPath, setSecretPath] = useState("/");
const [targetApp, setTargetApp] = useState('');
const [targetAppId, setTargetAppId] = useState('');
const [targetApp, setTargetApp] = useState("");
const [targetAppId, setTargetAppId] = useState("");
const [isLoading, setIsLoading] = useState(false);
@@ -50,7 +50,7 @@ export default function ChecklyCreateIntegrationPage() {
setTargetApp(integrationAuthApps[0].name);
setTargetAppId(String(integrationAuthApps[0].appId));
} else {
setTargetApp('none');
setTargetApp("none");
}
}
}, [integrationAuthApps]);
@@ -79,7 +79,7 @@ export default function ChecklyCreateIntegrationPage() {
setIsLoading(false);
router.push(`/integrations/${localStorage.getItem('projectData.id')}`);
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
} catch (err) {
console.error(err);
}
@@ -1,28 +1,28 @@
import { useState } from 'react';
import { useRouter } from 'next/router';
import { useState } from "react";
import { useRouter } from "next/router";
import { Button, Card, CardTitle, FormControl, Input } from '../../../components/v2';
import saveIntegrationAccessToken from '../../api/integrations/saveIntegrationAccessToken';
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
export default function CircleCICreateIntegrationPage() {
const router = useRouter();
const [apiKey, setApiKey] = useState('');
const [apiKeyErrorText, setApiKeyErrorText] = useState('');
const [apiKey, setApiKey] = useState("");
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
const handleButtonClick = async () => {
try {
setApiKeyErrorText('');
setApiKeyErrorText("");
if (apiKey.length === 0) {
setApiKeyErrorText('API Key cannot be blank');
setApiKeyErrorText("API Key cannot be blank");
return;
}
setIsLoading(true);
const integrationAuth = await saveIntegrationAccessToken({
workspaceId: localStorage.getItem('projectData.id'),
integration: 'circleci',
workspaceId: localStorage.getItem("projectData.id"),
integration: "circleci",
accessToken: apiKey,
accessId: null,
url: null,
@@ -44,7 +44,7 @@ export default function CircleCICreateIntegrationPage() {
<FormControl
label="CircleCI API Token"
errorText={apiKeyErrorText}
isError={apiKeyErrorText !== '' ?? false}
isError={apiKeyErrorText !== "" ?? false}
>
<Input placeholder="" value={apiKey} onChange={(e) => setApiKey(e.target.value)} />
</FormControl>
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import queryString from 'query-string';
import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import queryString from "query-string";
import {
Button,
@@ -10,29 +10,29 @@ import {
Input,
Select,
SelectItem
} from '../../../components/v2';
} from "../../../components/v2";
import {
useGetIntegrationAuthApps,
useGetIntegrationAuthById
} from '../../../hooks/api/integrationAuth';
import { useGetWorkspaceById } from '../../../hooks/api/workspace';
import createIntegration from '../../api/integrations/createIntegration';
} from "../../../hooks/api/integrationAuth";
import { useGetWorkspaceById } from "../../../hooks/api/workspace";
import createIntegration from "../../api/integrations/createIntegration";
export default function CircleCICreateIntegrationPage() {
const router = useRouter();
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: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? '');
const { data: workspace } = useGetWorkspaceById(localStorage.getItem("projectData.id") ?? "");
const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? "");
const { data: integrationAuthApps } = useGetIntegrationAuthApps({
integrationAuthId: (integrationAuthId as string) ?? ''
integrationAuthId: (integrationAuthId as string) ?? ""
});
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState('');
const [secretPath, setSecretPath] = useState('/');
const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState("");
const [secretPath, setSecretPath] = useState("/");
const [targetApp, setTargetApp] = useState('');
const [targetApp, setTargetApp] = useState("");
const [isLoading, setIsLoading] = useState(false);
@@ -47,7 +47,7 @@ export default function CircleCICreateIntegrationPage() {
if (integrationAuthApps.length > 0) {
setTargetApp(integrationAuthApps[0]?.name);
} else {
setTargetApp('none');
setTargetApp("none");
}
}
}, [integrationAuthApps]);
@@ -78,7 +78,7 @@ export default function CircleCICreateIntegrationPage() {
setIsLoading(false);
router.push(`/integrations/${localStorage.getItem('projectData.id')}`);
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
} catch (err) {
console.error(err);
}
@@ -1,28 +1,28 @@
import { useState } from 'react';
import { useRouter } from 'next/router';
import { useState } from "react";
import { useRouter } from "next/router";
import { Button, Card, CardTitle, FormControl, Input } from '../../../components/v2';
import saveIntegrationAccessToken from '../../api/integrations/saveIntegrationAccessToken';
import { Button, Card, CardTitle, FormControl, Input } from "../../../components/v2";
import saveIntegrationAccessToken from "../../api/integrations/saveIntegrationAccessToken";
export default function FlyioCreateIntegrationPage() {
const router = useRouter();
const [accessToken, setAccessToken] = useState('');
const [accessTokenErrorText, setAccessTokenErrorText] = useState('');
const [accessToken, setAccessToken] = useState("");
const [accessTokenErrorText, setAccessTokenErrorText] = useState("");
const [isLoading, setIsLoading] = useState(false);
const handleButtonClick = async () => {
try {
setAccessTokenErrorText('');
setAccessTokenErrorText("");
if (accessToken.length === 0) {
setAccessTokenErrorText('Access token cannot be blank');
setAccessTokenErrorText("Access token cannot be blank");
return;
}
setIsLoading(true);
const integrationAuth = await saveIntegrationAccessToken({
workspaceId: localStorage.getItem('projectData.id'),
integration: 'flyio',
workspaceId: localStorage.getItem("projectData.id"),
integration: "flyio",
accessId: null,
accessToken,
url: null,
@@ -44,7 +44,7 @@ export default function FlyioCreateIntegrationPage() {
<FormControl
label="Fly.io Access Token"
errorText={accessTokenErrorText}
isError={accessTokenErrorText !== '' ?? false}
isError={accessTokenErrorText !== "" ?? false}
>
<Input
placeholder=""

Some files were not shown because too many files have changed in this diff Show More