diff --git a/components/InstallStepper/CloudAccountContent.tsx b/components/InstallStepper/CloudAccountContent.tsx new file mode 100644 index 0000000..18b6d74 --- /dev/null +++ b/components/InstallStepper/CloudAccountContent.tsx @@ -0,0 +1,52 @@ +import { + Accordion, + AccordionHeader, + AccordionBody, +} from "@material-tailwind/react"; +import { + AWSInstallerFormFields, + AzureInstallerFormFields, + StepOneAWS, + StepOneAzure, + Card, +} from "@/components"; + +export const CloudAccountContent = ({ + app = { cloud_platform: "aws" }, + open = false, + onClick = () => {}, + searchParams = {}, + regions = [], +}) => ( + + {app.cloud_platform === "aws" && ( + <> + AWS IAM Role + + + + + + + + )} + + {app?.cloud_platform === "azure" && ( + <> + Azure Account + + + + + + + + )} + +); diff --git a/components/InstallStepper/CompanyContent.tsx b/components/InstallStepper/CompanyContent.tsx new file mode 100644 index 0000000..57b26ae --- /dev/null +++ b/components/InstallStepper/CompanyContent.tsx @@ -0,0 +1,34 @@ +import { + Accordion, + AccordionHeader, + AccordionBody, + Card, +} from "@material-tailwind/react"; + +export const CompanyContent = ({ + open = false, + onClick = () => {}, + searchParams = {}, +}) => ( + + Company Info + + +
+ +
+
+
+
+); diff --git a/components/InstallStepper/ErrorAlert.tsx b/components/InstallStepper/ErrorAlert.tsx new file mode 100644 index 0000000..8956e65 --- /dev/null +++ b/components/InstallStepper/ErrorAlert.tsx @@ -0,0 +1,7 @@ +import { Alert } from "@material-tailwind/react"; + +export const ErrorAlert = ({ children }) => ( +
+ {children} +
+); diff --git a/components/InstallStepper/GroupContent.tsx b/components/InstallStepper/GroupContent.tsx new file mode 100644 index 0000000..fbd9fcd --- /dev/null +++ b/components/InstallStepper/GroupContent.tsx @@ -0,0 +1,25 @@ +import { + Accordion, + AccordionHeader, + AccordionBody, +} from "@material-tailwind/react"; +import { InputFields, Card } from "@/components"; + +export const GroupContent = ({ + group = { display_name: "" }, + idx = 0, + activeStep = 0, + setActiveStep = (idx = 0) => {}, + searchParams = {}, +}) => ( + + setActiveStep(idx + 2)}> + {group.display_name} + + + + + + + +); diff --git a/components/InstallStepper/InstallButton.tsx b/components/InstallStepper/InstallButton.tsx new file mode 100644 index 0000000..e4cd491 --- /dev/null +++ b/components/InstallStepper/InstallButton.tsx @@ -0,0 +1,19 @@ +import { Button } from "@material-tailwind/react"; + +export const InstallButton = ({ install }) => { + const loading = install.status === "provisioning"; + + let label = "Create Install"; + if (install.id.length > 0) label = "Update Install"; + if (loading) label = "Provisioning"; + + return ( + + ); +}; diff --git a/components/InstallStepper/InstallStatusContent.tsx b/components/InstallStepper/InstallStatusContent.tsx new file mode 100644 index 0000000..bb0abb2 --- /dev/null +++ b/components/InstallStepper/InstallStatusContent.tsx @@ -0,0 +1,48 @@ +import { + Accordion, + AccordionHeader, + AccordionBody, +} from "@material-tailwind/react"; +import showdown from "showdown"; +import { InstallStatus } from "./InstallStatus"; +import { StatusIcon } from "@/components"; +import { InstallButton } from "./InstallButton"; + +const markdown = new showdown.Converter(); + +export const InstallStatusContent = ({ + open = false, + onClick = () => {}, + install = { + status: "", + status_description: "", + }, + post_install_markdown = "", +}) => ( + + + + Install Status {" "} + + {install.status_description} + + + + +
+
+
+
+ +
+ + +
+
+ + +); diff --git a/components/InstallStepper/NavArrows.tsx b/components/InstallStepper/NavArrows.tsx new file mode 100644 index 0000000..446f03b --- /dev/null +++ b/components/InstallStepper/NavArrows.tsx @@ -0,0 +1,51 @@ +import { IconButton } from "@material-tailwind/react"; + +export const NavArrows = ({ + handlePrev = () => {}, + isFirstStep = false, + handleNext = () => {}, + isLastStep = () => {}, +}) => ( +
+ + + + + + + + + + +
+); diff --git a/components/InstallStepper/index.tsx b/components/InstallStepper/index.tsx index a815659..3f218e3 100644 --- a/components/InstallStepper/index.tsx +++ b/components/InstallStepper/index.tsx @@ -1,29 +1,14 @@ "use client"; import React, { useEffect, useRef } from "react"; -import { - Stepper, - Step, - Button, - IconButton, - Accordion, - AccordionHeader, - AccordionBody, - Alert, -} from "@material-tailwind/react"; -import { - AWSInstallerFormFields, - InputFields, - AzureInstallerFormFields, - StepOneAWS, - StepOneAzure, - StatusIcon, - Card, -} from "@/components"; -import { InstallStatus } from "./InstallStatus"; -import showdown from "showdown"; +import { Stepper, Step } from "@material-tailwind/react"; -const markdown = new showdown.Converter(); +import { NavArrows } from "./NavArrows"; +import { CompanyContent } from "./CompanyContent"; +import { CloudAccountContent } from "./CloudAccountContent"; +import { GroupContent } from "./GroupContent"; +import { InstallStatusContent } from "./InstallStatusContent"; +import { ErrorAlert } from "./ErrorAlert"; const InstallStepper = ({ app, @@ -134,16 +119,7 @@ const InstallStepper = ({ const input_groups = app.input_config.input_groups || []; const stepContent = input_groups.map((group, idx) => ( - - setActiveStep(idx + 2)}> - {group.display_name} - - - - - - - + )); const steps = input_groups.map((group, idx) => ( @@ -153,11 +129,7 @@ const InstallStepper = ({ )); const errorAlert = - error.error !== "" ? ( -
- {error.description} -
- ) : null; + error.error !== "" ? {error.description} : null; return (
@@ -177,142 +149,35 @@ const InstallStepper = ({ -
- - - - - - - - - - -
+
- - setActiveStep(0)}> - Company Info - - - -
- -
-
-
-
- - - {app?.cloud_platform === "aws" && ( - <> - setActiveStep(1)}> - AWS IAM Role - - - - - - - - - )} - - {app?.cloud_platform === "azure" && ( - <> - setActiveStep(1)}> - Azure Account - - - - - - - - - )} - + setActiveStep(0)} + /> + + setActiveStep(1)} + searchParams={searchParams} + regions={regions} + /> {...stepContent} - - setActiveStep(steps.length + 2)}> - - Install Status {" "} - - {install.status_description} - - - - -
-
-
-
- -
- - -
-
- - + setActiveStep(steps.length + 2)} + install={install} + post_install_markdown={installer.metadata.post_install_markdown} + /> {errorAlert} @@ -320,22 +185,4 @@ const InstallStepper = ({ ); }; -const InstallButton = ({ install }) => { - const loading = install.status === "provisioning"; - - let label = "Create Install"; - if (install.id.length > 0) label = "Update Install"; - if (loading) label = "Provisioning"; - - return ( - - ); -}; - export default InstallStepper;