diff --git a/src/assets/service-account.mp4 b/src/assets/service-account.mp4 deleted file mode 100644 index 99054667..00000000 Binary files a/src/assets/service-account.mp4 and /dev/null differ diff --git a/src/components/Setup/Step3ProjectOwner.tsx b/src/components/Setup/Step2ProjectOwner.tsx similarity index 99% rename from src/components/Setup/Step3ProjectOwner.tsx rename to src/components/Setup/Step2ProjectOwner.tsx index bd3b5670..c03d6764 100644 --- a/src/components/Setup/Step3ProjectOwner.tsx +++ b/src/components/Setup/Step2ProjectOwner.tsx @@ -13,7 +13,7 @@ import { rowyRun } from "@src/utils/rowyRun"; import { runRoutes } from "@src/constants/runRoutes"; import CopyIcon from "@src/assets/icons/Copy"; -export default function Step3ProjectOwner({ +export default function Step2ProjectOwner({ rowyRunUrl, completion, setCompletion, diff --git a/src/components/Setup/Step2ServiceAccount.tsx b/src/components/Setup/Step2ServiceAccount.tsx deleted file mode 100644 index 3e193e84..00000000 --- a/src/components/Setup/Step2ServiceAccount.tsx +++ /dev/null @@ -1,174 +0,0 @@ -import { useState, useEffect } from "react"; -import { ISetupStepBodyProps } from "@src/pages/Setup"; - -import { Typography, Link, Stack } from "@mui/material"; -import LoadingButton from "@mui/lab/LoadingButton"; -import InlineOpenInNewIcon from "@src/components/InlineOpenInNewIcon"; - -import SetupItem from "./SetupItem"; - -import { name } from "@root/package.json"; -import { useAppContext } from "@src/contexts/AppContext"; -import { rowyRun } from "@src/utils/rowyRun"; -import { runRoutes } from "@src/constants/runRoutes"; -import { WIKI_LINKS } from "@src/constants/externalLinks"; -import screenRecording from "@src/assets/service-account.mp4"; - -export default function Step2ServiceAccount({ - rowyRunUrl, - completion, - setCompletion, -}: ISetupStepBodyProps) { - const [hasAllRoles, setHasAllRoles] = useState(completion.serviceAccount); - // const [roles, setRoles] = useState>({}); - const [verificationStatus, setVerificationStatus] = useState< - "IDLE" | "LOADING" | "FAIL" - >("IDLE"); - - const { projectId } = useAppContext(); - const [region, setRegion] = useState(""); - useEffect(() => { - fetch(rowyRunUrl + runRoutes.region.path, { - method: runRoutes.region.method, - }) - .then((res) => res.json()) - .then((data) => setRegion(data.region)) - .catch((e) => console.error(e)); - }, []); - - const verifyRoles = async () => { - setVerificationStatus("LOADING"); - try { - const result = await checkServiceAccount(rowyRunUrl); - // setRoles(result); - if (result.hasAllRoles) { - setVerificationStatus("IDLE"); - setHasAllRoles(true); - setCompletion((c) => ({ ...c, serviceAccount: true })); - } else { - setVerificationStatus("FAIL"); - setHasAllRoles(false); - } - } catch (e) { - console.error(e); - setVerificationStatus("FAIL"); - } - }; - - return ( - <> - - {name} Run uses a{" "} - - service account - {" "} - to access your project. It operates exclusively on your GCP project, so - we never have access to any of your data.{" "} - - Learn more - - - - - - {!hasAllRoles && ( - <> - - - - - Set up service account - - - - Verify - - - - {verificationStatus === "FAIL" && ( - - Some roles are missing. Also make sure your Firebase project has - Firestore and Authentication enabled.{" "} - - Setup guide - - - - )} - - - Follow the steps in the screen recording below: - - - - - ); -} - -export const checkServiceAccount = async ( - serviceUrl: string, - signal?: AbortSignal -) => { - try { - const res = await rowyRun({ - serviceUrl, - route: runRoutes.serviceAccountAccess, - signal, - }); - - return { - ...res, - hasAllRoles: Object.values(res).reduce( - (acc, value) => acc && value, - true - ) as boolean, - }; - } catch (e: any) { - console.error(e); - return false; - } -}; diff --git a/src/components/Setup/Step4Rules.tsx b/src/components/Setup/Step3Rules.tsx similarity index 99% rename from src/components/Setup/Step4Rules.tsx rename to src/components/Setup/Step3Rules.tsx index 14666220..621efd37 100644 --- a/src/components/Setup/Step4Rules.tsx +++ b/src/components/Setup/Step3Rules.tsx @@ -30,7 +30,7 @@ import { rowyRun } from "@src/utils/rowyRun"; import { runRoutes } from "@src/constants/runRoutes"; // import { useConfirmation } from "@src/components/ConfirmationDialog"; -export default function Step4Rules({ +export default function Step3Rules({ rowyRunUrl, completion, setCompletion, diff --git a/src/components/Setup/Step5Migrate.tsx b/src/components/Setup/Step4Migrate.tsx similarity index 98% rename from src/components/Setup/Step5Migrate.tsx rename to src/components/Setup/Step4Migrate.tsx index 64488109..676a553d 100644 --- a/src/components/Setup/Step5Migrate.tsx +++ b/src/components/Setup/Step4Migrate.tsx @@ -12,7 +12,7 @@ import { CONFIG } from "@src/config/dbPaths"; import { rowyRun } from "@src/utils/rowyRun"; import { runRoutes } from "@src/constants/runRoutes"; -export default function Step5Migrate({ +export default function Step4Migrate({ rowyRunUrl, completion, setCompletion, diff --git a/src/pages/Setup.tsx b/src/pages/Setup.tsx index f9789223..a5a19754 100644 --- a/src/pages/Setup.tsx +++ b/src/pages/Setup.tsx @@ -31,12 +31,11 @@ import { SlideTransition } from "@src/components/Modal/SlideTransition"; import Step0Welcome from "@src/components/Setup/Step0Welcome"; import Step1RowyRun, { checkRowyRun } from "@src/components/Setup/Step1RowyRun"; // prettier-ignore -import Step2ServiceAccount, { checkServiceAccount } from "@src/components/Setup/Step2ServiceAccount"; // prettier-ignore -import Step3ProjectOwner, { checkProjectOwner } from "@src/components/Setup/Step3ProjectOwner"; -import Step4Rules, { checkRules } from "@src/components/Setup/Step4Rules"; -import Step5Migrate, { checkMigrate } from "@src/components/Setup/Step5Migrate"; -import Step6Finish from "@src/components/Setup/Step6Finish"; +import Step2ProjectOwner, { checkProjectOwner } from "@src/components/Setup/Step2ProjectOwner"; +import Step3Rules, { checkRules } from "@src/components/Setup/Step3Rules"; +import Step4Migrate, { checkMigrate } from "@src/components/Setup/Step4Migrate"; +import Step5Finish from "@src/components/Setup/Step6Finish"; import { name } from "@root/package.json"; import routes from "@src/constants/routes"; @@ -77,9 +76,6 @@ const checkAllSteps = async ( if (rowyRunValidation.isLatestVersion) completion.rowyRun = true; const promises = [ - checkServiceAccount(rowyRunUrl, signal).then((serviceAccount) => { - if (serviceAccount.hasAllRoles) completion.serviceAccount = true; - }), checkProjectOwner(rowyRunUrl, currentUser, userRoles, signal).then( (projectOwner) => { if (projectOwner) completion.projectOwner = true; @@ -182,30 +178,24 @@ export default function SetupPage() { title: `Set up ${name} Run`, body: , }, - { - id: "serviceAccount", - shortTitle: `Service account`, - title: `Set up service account`, - body: , - }, { id: "projectOwner", shortTitle: `Project owner`, title: `Set up project owner`, - body: , + body: , }, { id: "rules", shortTitle: `Rules`, title: `Set up Firestore Rules`, - body: , + body: , }, completion.migrate !== undefined ? { id: "migrate", shortTitle: `Migrate`, title: `Migrate to ${name} (optional)`, - body: , + body: , } : ({} as ISetupStep), { @@ -213,7 +203,7 @@ export default function SetupPage() { layout: "centered" as "centered", shortTitle: `Finish`, title: `You’re all set up!`, - body: , + body: , actions: (