['error', 'warning', 'success', 'info']
// deprecated-types
['notice']
Available in all application-controllers
error "This is an error message"
warning "This is a warning message"
success "This is a success message"
info "This is an info message"
# deprecated!!! will use success type
notice "This is n notice message"
error "This is an error message", link: { text: 'action', href: 'https://theforeman.org' }
warning "This is a warning message", link: { text: 'action', href: 'https://theforeman.org' }
success "This is a success message", link: { text: 'action', href: 'https://theforeman.org' }
info "This is an info message", link: { text: 'action', href: 'https://theforeman.org' }
// getting the API object in the browser
window.tfm.toastNotifications
Clear all the toast notifications from the view
window.tfm.toastNotifications.clear();
Creates a toast notification
window.tfm.toastNotifications.notify({
message: 'This is an error message',
type: 'error',
})
window.tfm.toastNotifications.notify({
message: 'This is a warning message',
type: 'warning',
})
window.tfm.toastNotifications.notify({
message: 'This is a success message',
type: 'success',
})
window.tfm.toastNotifications.notify({
message: 'This is an info message',
type: 'info',
})
window.tfm.toastNotifications.notify({
message: 'This is an error message',
type: 'error',
sticky: false,
})
window.tfm.toastNotifications.notify({
message: 'This is a warning message',
type: 'warning',
sticky: false,
})
window.tfm.toastNotifications.notify({
message: 'This is a success message',
type: 'success',
sticky: true,
})
window.tfm.toastNotifications.notify({
message: 'This is an info message',
type: 'info',
sticky: true,
})
window.tfm.toastNotifications.notify({
message: 'This is an error message',
type: 'error',
link: { children: 'Click to fix!', href: 'https://theforeman.org' }
})
window.tfm.toastNotifications.notify({
message: 'This is a warning message',
type: 'warning',
link: { children: 'Read more', href: 'https://theforeman.org' }
})
window.tfm.toastNotifications.notify({
message: 'This is a success message',
type: 'success',
link: { children: 'Undo', href: 'https://theforeman.org' }
})
window.tfm.toastNotifications.notify({
message: 'This is an info message',
type: 'info',
link: { children: 'Redo', href: 'https://theforeman.org' }
})