Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App v2 UI cleanup #3629

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions dashboard/src/main/home/app-dashboard/create-app/CreateApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,31 +340,41 @@ const CreateApp: React.FC<CreateAppProps> = ({ 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(() => {
Expand Down Expand Up @@ -500,6 +510,7 @@ const CreateApp: React.FC<CreateAppProps> = ({ history }) => {
<ControlledInput
placeholder="ex: academic-sophon"
type="text"
width="300px"
error={errors.app?.name?.message}
disabled={name.readOnly}
disabledTooltip={
Expand Down