1
0
Fork 0
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:
Anthony Lapenna 2017-04-12 20:47:22 +01:00 committed by GitHub
parent 8e8b0578b2
commit f15cf3e8be
38 changed files with 277 additions and 728 deletions

View 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;
}]);