Skip to content

Commit

Permalink
Added success alert for custom entity attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jul 7, 2022
1 parent 5d5dc4d commit 7684867
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/public/assets/schema/attribute/attribute.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"title": "label.entity-attribute-help",
"description": "tooltip.entity-attribute-help",
"type": "string",
"minLength": 1,
"minLength": 0,
"maxLength": 255
}
},
Expand Down
9 changes: 7 additions & 2 deletions ui/src/app/metadata/new/NewAttribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useMetadataAttribute } from '../hooks/api';
import {CustomAttributeDefinition} from '../domain/attribute/CustomAttributeDefinition';
import MetadataSchema from '../hoc/MetadataSchema';
import { MetadataForm } from '../hoc/MetadataFormContext';
import { createNotificationAction, useNotificationDispatcher } from '../../notifications/hoc/Notifications';
import { createNotificationAction, NotificationTypes, useNotificationDispatcher } from '../../notifications/hoc/Notifications';

export function NewAttribute() {
const history = useHistory();
Expand All @@ -25,11 +25,16 @@ export function NewAttribute() {
const [blocking, setBlocking] = React.useState(false);

async function save(metadata) {
let toast;
const resp = await post(``, definition.parser(metadata));
if (response.ok) {
toast = createNotificationAction(`Added attribute successfully.`, NotificationTypes.SUCCESS);
gotoDetail({ refresh: true });
} else {
dispatch(createNotificationAction(`${resp.errorCode}: Unable to create attribute ... ${resp.errorMessage}`, 'danger', 5000));
toast = createNotificationAction(`${resp.errorCode}: Unable to create attribute ... ${resp.errorMessage}`, 'danger', 5000);
}
if (toast) {
dispatch(toast);
}
};

Expand Down

0 comments on commit 7684867

Please sign in to comment.