From db24c4267ece99e9ffee4770514e8e7f324d7955 Mon Sep 17 00:00:00 2001 From: Justin Rhee Date: Thu, 21 Sep 2023 16:10:42 -0400 Subject: [PATCH] comm --- .../app-dashboard/create-app/CreateApp.tsx | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/dashboard/src/main/home/app-dashboard/create-app/CreateApp.tsx b/dashboard/src/main/home/app-dashboard/create-app/CreateApp.tsx index cb88238d8d..82e2e33558 100644 --- a/dashboard/src/main/home/app-dashboard/create-app/CreateApp.tsx +++ b/dashboard/src/main/home/app-dashboard/create-app/CreateApp.tsx @@ -338,31 +338,41 @@ const CreateApp: React.FC = ({ history }) => { useEffect(() => { // set step to 1 if name is filled out - if (name) { + if (name.value) { setStep((prev) => Math.max(prev, 1)); + } else { + setStep(0); } // set step to 2 if source is filled out if (source?.type && source.type === "github") { if (source.git_repo_name && source.git_branch) { - setStep((prev) => Math.max(prev, 5)); + setStep((prev) => Math.max(prev, 2)); } } - // set step to 3 if source is filled out + // set step to 2 if source is filled out if (source?.type && source.type === "docker-registry") { if (image && image.tag) { - setStep((prev) => Math.max(prev, 5)); + setStep((prev) => Math.max(prev, 2)); } } }, [ - name, + name.value, source?.type, source?.git_repo_name, source?.git_branch, image?.tag, ]); + useEffect(() => { + if (services?.length > 0) { + setStep((prev) => Math.max(prev, 5)); + } else { + setStep((prev) => Math.min(prev, 2)); + }; + }, [services]); + // todo(ianedwards): it's a bit odd that the button error can be set to either a string or JSX, // need to look into refactoring that where possible and then improve this error handling const submitBtnStatus = useMemo(() => { @@ -494,6 +504,7 @@ const CreateApp: React.FC = ({ history }) => {