-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix type errors and adjust sample table height flex
- Loading branch information
1 parent
3131ecb
commit e8937fd
Showing
13 changed files
with
129 additions
and
142 deletions.
There are no files selected for viewing
29 changes: 12 additions & 17 deletions
29
web/src/components/forms/components/combined-error-message.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,44 @@ | ||
import { FC } from 'react'; | ||
import { FieldErrors } from 'react-hook-form'; | ||
|
||
type CombinedErrorMessageProps = { | ||
errors: FieldErrors<any>; | ||
formType: string; | ||
}; | ||
|
||
export const CombinedErrorMessage = (props: CombinedErrorMessageProps) => { | ||
const { errors, formType } = props; | ||
|
||
export const CombinedErrorMessage: FC<CombinedErrorMessageProps> = ({ errors, formType }) => { | ||
if (formType === 'schema') { | ||
const nameError = errors.name?.message; | ||
let msg = null; | ||
|
||
if (nameError == 'empty') { | ||
if (nameError === 'empty') { | ||
msg = 'Schema Name must not be empty.'; | ||
} else if (nameError == 'invalid') { | ||
} else if (nameError === 'invalid') { | ||
msg = "Schema Name must contain only alphanumeric characters, '.', '-', or '_'."; | ||
} | ||
|
||
if (nameError) { | ||
return <p className="text-danger text-xs pt-1 mb-0">{msg}</p>; | ||
} | ||
return null; | ||
} else if (formType === 'project') { | ||
const nameError = errors.project_name?.message; | ||
const nameError = errors.project_name?.message || errors.name?.message; | ||
const tagError = errors.tag?.message; | ||
let msg = null; | ||
|
||
if (nameError == 'empty' && !tagError) { | ||
if (nameError === 'empty' && !tagError) { | ||
msg = 'Project Name must not be empty.'; | ||
} else if (nameError == 'invalid' && !tagError) { | ||
} else if (nameError === 'invalid' && !tagError) { | ||
msg = "Project Name must contain only alphanumeric characters, '-', or '_'."; | ||
} else if (nameError == 'empty' && tagError == 'invalid') { | ||
} else if (nameError === 'empty' && tagError === 'invalid') { | ||
msg = "Project Name must not be empty and Tag must contain only alphanumeric characters, '-', or '_'."; | ||
} else if (nameError == 'invalid' && tagError == 'invalid') { | ||
} else if (nameError === 'invalid' && tagError === 'invalid') { | ||
msg = "Project Name and Tag must contain only alphanumeric characters, '-', or '_'."; | ||
} else if (!nameError && tagError == 'invalid') { | ||
} else if (!nameError && tagError === 'invalid') { | ||
msg = "Project Tag must contain only alphanumeric characters, '-', or '_'."; | ||
} | ||
|
||
if (nameError || tagError) { | ||
return <p className="text-danger text-xs pt-1 mb-0">{msg}</p>; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
|
||
return <span />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.