From d9abe671afaf1a5e3969d7c39047ace5460f8bf6 Mon Sep 17 00:00:00 2001 From: Tuan Dang Date: Thu, 31 Aug 2023 15:22:26 +0100 Subject: [PATCH] Start GCP SM integration update --- .../gcp-secret-manager/authorize.tsx | 96 +++++++++++++++++++ .../IntegrationPage.utils.tsx | 3 +- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 frontend/src/pages/integrations/gcp-secret-manager/authorize.tsx diff --git a/frontend/src/pages/integrations/gcp-secret-manager/authorize.tsx b/frontend/src/pages/integrations/gcp-secret-manager/authorize.tsx new file mode 100644 index 000000000..f63b5a7dd --- /dev/null +++ b/frontend/src/pages/integrations/gcp-secret-manager/authorize.tsx @@ -0,0 +1,96 @@ +import { useState } from "react"; +import { useRouter } from "next/router"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faGoogle } from "@fortawesome/free-brands-svg-icons"; + +import { + useSaveIntegrationAccessToken +} from "@app/hooks/api"; + +import { Button, Card, CardTitle, FormControl, Input, TextArea } from "../../../components/v2"; + +export default function GCPSecretManagerAuthorizeIntegrationPage() { + const router = useRouter(); + const { mutateAsync } = useSaveIntegrationAccessToken(); + + const [accessToken, setAccessToken] = useState(""); + const [accessTokenErrorText, setAccessTokenErrorText] = useState(""); + const [isLoading, setIsLoading] = useState(false); + + const handleButtonClick = async () => { + try { + setAccessTokenErrorText(""); + if (accessToken.length === 0) { + setAccessTokenErrorText("Access token cannot be blank"); + return; + } + + console.log("setAccessTokenErrorText"); + console.log("accessToken: ", accessToken); + + // setIsLoading(true); + + // const integrationAuth = await mutateAsync({ + // workspaceId: localStorage.getItem("projectData.id"), + // integration: "flyio", + // accessId: null, + // accessToken, + // url: null, + // namespace: null + // }); + + // setIsLoading(false); + + // router.push(`/integrations/flyio/create?integrationAuthId=${integrationAuth._id}`); + } catch (err) { + console.error(err); + } + }; + + return ( +
+ + GCP Secret Manager Integration + +
+
+ or +
+
+ +