diff --git a/clients/ui/frontend/src/app/pages/modelCatalogSettings/components/YamlSection.tsx b/clients/ui/frontend/src/app/pages/modelCatalogSettings/components/YamlSection.tsx index d7cabcdf00..9e51a037cb 100644 --- a/clients/ui/frontend/src/app/pages/modelCatalogSettings/components/YamlSection.tsx +++ b/clients/ui/frontend/src/app/pages/modelCatalogSettings/components/YamlSection.tsx @@ -11,6 +11,7 @@ import { } from '@patternfly/react-core'; import { OpenDrawerRightIcon } from '@patternfly/react-icons'; import { UpdateObjectAtPropAndValue } from 'mod-arch-shared'; +import { useThemeContext } from 'mod-arch-kubeflow'; import FormFieldset from '~/app/pages/modelRegistry/screens/components/FormFieldset'; import FormSection from '~/app/pages/modelRegistry/components/pf-overrides/FormSection'; import { ManageSourceFormData } from '~/app/pages/modelCatalogSettings/useManageSourceData'; @@ -33,6 +34,7 @@ const YamlSection: React.FC = ({ setData, onToggleExpectedFormatDrawer, }) => { + const { isMUITheme } = useThemeContext(); const [isYamlTouched, setIsYamlTouched] = React.useState(false); const [filename, setFilename] = React.useState(''); const isYamlContentValid = validateYamlContent(formData.yamlContent); @@ -83,6 +85,60 @@ const YamlSection: React.FC = ({ ); + const expectedFormatButton = onToggleExpectedFormatDrawer ? ( + + ) : null; + + const descriptionTextNode = ( + + + {HELP_TEXT.YAML} + + + ); + + const hasError = isYamlTouched && !isYamlContentValid; + const helperTextNode = hasError ? ( + + + + {VALIDATION_MESSAGES.YAML_CONTENT_REQUIRED} + + + + ) : undefined; + + if (isMUITheme) { + return ( + + {expectedFormatButton && ( + + {expectedFormatButton} + + )} + {descriptionTextNode} + + + + {helperTextNode} + + ); + } + return ( = ({ alignItems={{ default: 'alignItemsCenter' }} > {FORM_LABELS.YAML_CONTENT} - {onToggleExpectedFormatDrawer && ( - - - - )} + {expectedFormatButton && {expectedFormatButton}} } isRequired fieldId="yaml-content" > - - - {HELP_TEXT.YAML} - - - {isYamlTouched && !isYamlContentValid && ( - - - - {VALIDATION_MESSAGES.YAML_CONTENT_REQUIRED} - - - - )} + {descriptionTextNode} + {helperTextNode} );