Skip to content

Commit

Permalink
Improve metadata toast
Browse files Browse the repository at this point in the history
  • Loading branch information
novakzaballa committed Jun 5, 2024
1 parent a26faf1 commit f15418e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions frontend/web/components/ErrorMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class ErrorMessage extends PureComponent {
}`
const error =
this.props.error?.data?.metadata?.find((item) =>
// eslint-disable-next-line no-prototype-builtins
item.hasOwnProperty('non_field_errors'),
)?.non_field_errors[0] ||
this.props.error?.data ||
Expand Down
8 changes: 6 additions & 2 deletions frontend/web/components/metadata/AddMetadataToEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,12 @@ const AddMetadataToEntity: FC<AddMetadataToEntityType> = ({
project: parseInt(`${projectId}`),
},
id: entityId,
}).then(() => {
toast('Environment Metadata Updated')
}).then((res) => {
if (res?.error) {
toast(res?.error?.data.metadata[0], 'danger')
} else {
toast('Environment Metadata Updated')
}
})
}}
>
Expand Down
3 changes: 2 additions & 1 deletion frontend/web/components/metadata/MetadataPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ const MetadataPage: FC<MetadataPageType> = ({ organisationId, projectId }) => {
</div>
),
destructive: true,
onYes: () => deleteMetadata({ id }),
onYes: () =>
deleteMetadata({ id }).then(() => toast('Metadata Field Deleted')),
title: 'Delete Metadata Field',
yesText: 'Confirm',
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/pages/EnvironmentSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import CreateWebhookModal from 'components/modals/CreateWebhook'
import ConfirmRemoveWebhook from 'components/modals/ConfirmRemoveWebhook'
import ConfirmToggleEnvFeature from 'components/modals/ConfirmToggleEnvFeature'
import EditPermissions from 'components/EditPermissions'
import ServerSideSDKKeys from 'components/ServerSideSDKKeys'
import Tabs from 'components/base/forms/Tabs'
import TabItem from 'components/base/forms/TabItem'
import JSONReference from 'components/JSONReference'
Expand All @@ -25,6 +24,7 @@ import { enableFeatureVersioning } from 'common/services/useEnableFeatureVersion
import AddMetadataToEntity from 'components/metadata/AddMetadataToEntity'
import { getSupportedContentType } from 'common/services/useSupportedContentType'
import EnvironmentVersioningListener from 'components/EnvironmentVersioningListener'
import MetadataTitle from 'components/metadata/MetadataTitle'

const showDisabledFlagOptions = [
{ label: 'Inherit from Project', value: null },
Expand Down

0 comments on commit f15418e

Please sign in to comment.