Skip to content

Commit

Permalink
Add success toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
jen-huang committed Apr 29, 2020
1 parent 67e7f16 commit c7a99e8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,23 @@ export const CreateDatasourcePage: React.FunctionComponent = () => {
const { error } = await saveDatasource();
if (!error) {
history.push(`${AGENT_CONFIG_DETAILS_PATH}${agentConfig ? agentConfig.id : configId}`);
notifications.toasts.addSuccess({
title: i18n.translate('xpack.ingestManager.createDatasource.addedNotificationTitle', {
defaultMessage: `Successfully added '{datasourceName}'`,
values: {
datasourceName: datasource.name,
},
}),
text:
agentCount && agentConfig
? i18n.translate('xpack.ingestManager.createDatasource.addedNotificationMessage', {
defaultMessage: `Fleet will deploy updates to all agents that use the '{agentConfigName}' configuration`,
values: {
agentConfigName: agentConfig.name,
},
})
: undefined,
});
} else {
notifications.toasts.addError(error, {
title: 'Error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,23 @@ export const EditDatasourcePage: React.FunctionComponent = () => {
const { error } = await saveDatasource();
if (!error) {
history.push(`${AGENT_CONFIG_DETAILS_PATH}${configId}`);
notifications.toasts.addSuccess({
title: i18n.translate('xpack.ingestManager.editDatasource.updatedNotificationTitle', {
defaultMessage: `Successfully updated '{datasourceName}'`,
values: {
datasourceName: datasource.name,
},
}),
text:
agentCount && agentConfig
? i18n.translate('xpack.ingestManager.editDatasource.updatedNotificationMessage', {
defaultMessage: `Fleet will deploy updates to all agents that use the '{agentConfigName}' configuration`,
values: {
agentConfigName: agentConfig.name,
},
})
: undefined,
});
} else {
notifications.toasts.addError(error, {
title: 'Error',
Expand Down

0 comments on commit c7a99e8

Please sign in to comment.