fix(alert): alert creation detailed response

pull/3657/head
Oori 2018-06-13 10:36:13 +03:00
parent 187fca793f
commit 89c4ba784e
2 changed files with 7 additions and 7 deletions

View File

@ -52,10 +52,10 @@ class KapacitorRule extends Component {
createRule(kapacitor, newRule)
.then(() => {
router.push(pathname || `/sources/${source.id}/alert-rules`)
notify(notifyAlertRuleCreated())
notify(notifyAlertRuleCreated(newRule.name))
})
.catch(() => {
notify(notifyAlertRuleCreateFailed())
.catch(e => {
notify(notifyAlertRuleCreateFailed(newRule.name, e.data.message))
})
}

View File

@ -490,14 +490,14 @@ export const notifyViewerUnauthorizedToSetTempVars = () => ({
// Rule Builder Notifications
// ----------------------------------------------------------------------------
export const notifyAlertRuleCreated = () => ({
export const notifyAlertRuleCreated = ruleName => ({
...defaultSuccessNotification,
message: 'Alert Rule created successfully.',
message: `${ruleName} created successfully.`,
})
export const notifyAlertRuleCreateFailed = () => ({
export const notifyAlertRuleCreateFailed = (ruleName, errorMessage) => ({
...defaultErrorNotification,
message: 'Alert Rule could not be created.',
message: `There was a problem creating ${ruleName}: ${errorMessage}`,
})
export const notifyAlertRuleUpdated = ruleName => ({