diff --git a/libs/i18n/locales/en/translation.json b/libs/i18n/locales/en/translation.json index 7c3db06d0..7ffbad1e0 100644 --- a/libs/i18n/locales/en/translation.json +++ b/libs/i18n/locales/en/translation.json @@ -210,6 +210,9 @@ "View catalog": "View catalog", "Edit catalog": "Edit catalog", "Create catalog": "Create catalog", + "Catalog created": "Catalog created", + "Catalog created successfully": "Catalog created successfully", + "\"{{catalogName}}\" has been created and is ready to use. You can select it from the list of available catalogs.": "\"{{catalogName}}\" has been created and is ready to use. You can select it from the list of available catalogs.", "Short description": "Short description", "Icon": "Icon", "Provider": "Provider", diff --git a/libs/ui-components/src/components/Catalog/AddCatalogItemWizard/CreateCatalogModal.tsx b/libs/ui-components/src/components/Catalog/AddCatalogItemWizard/CreateCatalogModal.tsx index 01349f320..ed356e3a5 100644 --- a/libs/ui-components/src/components/Catalog/AddCatalogItemWizard/CreateCatalogModal.tsx +++ b/libs/ui-components/src/components/Catalog/AddCatalogItemWizard/CreateCatalogModal.tsx @@ -2,6 +2,9 @@ import * as React from 'react'; import { Alert, Button, + EmptyState, + EmptyStateBody, + EmptyStateStatus, FormGroup, Modal, ModalBody, @@ -38,6 +41,7 @@ const CreateCatalogModal = ({ onClose, onSuccess, catalog }: CreateCatalogModalP const { t } = useTranslation(); const { post, patch } = useFetch(); const [error, setError] = React.useState(); + const [createdCatalog, setCreatedCatalog] = React.useState(); const isEdit = !!catalog; const isReadOnly = !!catalog?.metadata?.owner; @@ -97,7 +101,7 @@ const CreateCatalogModal = ({ onClose, onSuccess, catalog }: CreateCatalogModalP } } else { const result = await post('catalogs', getCatalogResource(values)); - onSuccess(result); + setCreatedCatalog(result); } } catch (e) { setError(e); @@ -106,68 +110,91 @@ const CreateCatalogModal = ({ onClose, onSuccess, catalog }: CreateCatalogModalP > {({ isSubmitting, isValid, submitForm, dirty }) => ( <> - + - - - - - - - - - - - - - - - - + + {t( + '"{{catalogName}}" has been created and is ready to use. You can select it from the list of available catalogs.', + { + catalogName: createdCatalog.spec.displayName || createdCatalog.metadata.name, + }, + )} + + + ) : ( + + - - + + + + + + + + + + + + + + + + + )} - - {!!error && ( + {createdCatalog ? ( + + ) : ( + + {!!error && ( + + + + )} - - - )} - - - {!isReadOnly && ( + + {!isReadOnly && ( + + + + )} - - )} - - - - - - + + + + )} )}