mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 12:25:22 +02:00
feat(notifications): replace gritter with toastr (#793)
This commit is contained in:
parent
8e8b0578b2
commit
f15cf3e8be
38 changed files with 277 additions and 728 deletions
25
app/services/notifications.js
Normal file
25
app/services/notifications.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
angular.module('portainer.services')
|
||||
.factory('Notifications', ['$sanitize', function NotificationsFactory($sanitize) {
|
||||
'use strict';
|
||||
var service = {};
|
||||
|
||||
service.success = function(title, text) {
|
||||
toastr.success($sanitize(text), $sanitize(title));
|
||||
};
|
||||
|
||||
service.error = function(title, e, fallbackText) {
|
||||
var msg = fallbackText;
|
||||
if (e.data && e.data.message) {
|
||||
msg = e.data.message;
|
||||
} else if (e.message) {
|
||||
msg = e.message;
|
||||
} else if (e.data && e.data.length > 0 && e.data[0].message) {
|
||||
msg = e.data[0].message;
|
||||
} else if (e.msg) {
|
||||
msg = e.msg;
|
||||
}
|
||||
toastr.error($sanitize(msg), $sanitize(title), {timeOut: 6000});
|
||||
};
|
||||
|
||||
return service;
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue