Skip to content

Commit

Permalink
Fixed error response when updating group
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Oct 25, 2021
1 parent 006b7fb commit cc9cd4b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 13 additions & 1 deletion ui/src/app/admin/container/MetadataActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { DeleteConfirmation } from '../../core/components/DeleteConfirmation';
import { useMetadataActivator, useMetadataEntity } from '../../metadata/hooks/api';

import { NotificationContext, createNotificationAction } from '../../notifications/hoc/Notifications';
import { NotificationContext, createNotificationAction, NotificationTypes } from '../../notifications/hoc/Notifications';

export function MetadataActions ({type, children}) {

Expand All @@ -21,6 +21,12 @@ export function MetadataActions ({type, children}) {
`Metadata ${type} has been ${enabled ? 'enabled' : 'disabled'}.`
));
cb();
} else {
const { errorCode, errorMessage, cause } = activator?.response?.data;
dispatch(createNotificationAction(
`${errorCode}: ${errorMessage} ${cause ? `-${cause}` : ''}`,
NotificationTypes.ERROR
));
}
}

Expand All @@ -31,6 +37,12 @@ export function MetadataActions ({type, children}) {
`Metadata ${type} has been deleted.`
));
cb();
} else {
const { errorCode, errorMessage, cause } = activator?.response?.data;
dispatch(createNotificationAction(
`${errorCode}: ${errorMessage} ${cause ? `-${cause}` : ''}`,
NotificationTypes.ERROR
));
}
}

Expand Down
8 changes: 7 additions & 1 deletion ui/src/app/dashboard/view/SourcesTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SourceList from '../../metadata/domain/source/component/SourceList';
import { useMetadataEntities, useMetadataEntity } from '../../metadata/hooks/api';
import { Search } from '../component/Search';

import { NotificationContext, createNotificationAction } from '../../notifications/hoc/Notifications';
import { NotificationContext, createNotificationAction, NotificationTypes } from '../../notifications/hoc/Notifications';

const searchProps = ['serviceProviderName', 'entityId', 'createdBy'];

Expand Down Expand Up @@ -42,6 +42,12 @@ export function SourcesTab () {
if (updater.response.ok) {
dispatch(createNotificationAction(`Updated group successfully.`));
loadSources();
} else {
const { errorCode, errorMessage, cause } = updater?.response?.data;
dispatch(createNotificationAction(
`${errorCode}: ${errorMessage} ${cause ? `-${cause}` : ''}`,
NotificationTypes.ERROR
));
}
}

Expand Down

0 comments on commit cc9cd4b

Please sign in to comment.