diff --git a/app/app.js b/app/app.js
index cb55a4f2d..09c01cc21 100644
--- a/app/app.js
+++ b/app/app.js
@@ -73,6 +73,8 @@ angular.module('portainer', [
$urlRouterProvider.otherwise('/auth');
+ toastr.options.timeOut = 3000;
+
$uibTooltipProvider.setTriggers({
'mouseenter': 'mouseleave',
'click': 'click',
@@ -540,25 +542,8 @@ angular.module('portainer', [
}
}
});
-
- // The Docker API likes to return plaintext errors, this catches them and disp
- $httpProvider.interceptors.push(function() {
- return {
- 'response': function(response) {
- if (typeof(response.data) === 'string' &&
- (_.startsWith(response.data, 'Conflict.') || _.startsWith(response.data, 'conflict:'))) {
- $.gritter.add({
- title: 'Error',
- text: $('
').text(response.data).html(),
- time: 10000
- });
- }
- return response;
- }
- };
- });
}])
- .run(['$rootScope', '$state', 'Authentication', 'authManager', 'StateManager', 'EndpointProvider', 'Messages', 'Analytics', function ($rootScope, $state, Authentication, authManager, StateManager, EndpointProvider, Messages, Analytics) {
+ .run(['$rootScope', '$state', 'Authentication', 'authManager', 'StateManager', 'EndpointProvider', 'Notifications', 'Analytics', function ($rootScope, $state, Authentication, authManager, StateManager, EndpointProvider, Notifications, Analytics) {
EndpointProvider.initialize();
StateManager.initialize().then(function success(state) {
if (state.application.authentication) {
@@ -579,7 +564,7 @@ angular.module('portainer', [
});
}
}, function error(err) {
- Messages.error("Failure", err, 'Unable to retrieve application settings');
+ Notifications.error("Failure", err, 'Unable to retrieve application settings');
});
$rootScope.$state = $state;
diff --git a/app/components/auth/authController.js b/app/components/auth/authController.js
index f12ed3c53..39b64d5c4 100644
--- a/app/components/auth/authController.js
+++ b/app/components/auth/authController.js
@@ -1,6 +1,6 @@
angular.module('auth', [])
-.controller('AuthenticationController', ['$scope', '$state', '$stateParams', '$window', '$timeout', '$sanitize', 'Config', 'Authentication', 'Users', 'EndpointService', 'StateManager', 'EndpointProvider', 'Messages',
-function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Config, Authentication, Users, EndpointService, StateManager, EndpointProvider, Messages) {
+.controller('AuthenticationController', ['$scope', '$state', '$stateParams', '$window', '$timeout', '$sanitize', 'Config', 'Authentication', 'Users', 'EndpointService', 'StateManager', 'EndpointProvider', 'Notifications',
+function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Config, Authentication, Users, EndpointService, StateManager, EndpointProvider, Notifications) {
$scope.authData = {
username: 'admin',
@@ -26,14 +26,14 @@ function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Config, Au
.then(function success() {
$state.go('dashboard');
}, function error(err) {
- Messages.error("Failure", err, 'Unable to connect to the Docker endpoint');
+ Notifications.error("Failure", err, 'Unable to connect to the Docker endpoint');
});
}
else {
$state.go('endpointInit');
}
}, function error(err) {
- Messages.error("Failure", err, 'Unable to retrieve endpoints');
+ Notifications.error("Failure", err, 'Unable to retrieve endpoints');
});
} else {
Users.checkAdminUser({}, function () {},
@@ -41,7 +41,7 @@ function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Config, Au
if (e.status === 404) {
$scope.initPassword = true;
} else {
- Messages.error("Failure", e, 'Unable to verify administrator account existence');
+ Notifications.error("Failure", e, 'Unable to verify administrator account existence');
}
});
}
@@ -98,7 +98,7 @@ function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Config, Au
.then(function success() {
$state.go('dashboard');
}, function error(err) {
- Messages.error("Failure", err, 'Unable to connect to the Docker endpoint');
+ Notifications.error("Failure", err, 'Unable to connect to the Docker endpoint');
});
}
else if (data.length === 0 && userDetails.role === 1) {
diff --git a/app/components/container/containerController.js b/app/components/container/containerController.js
index 1a1b3fd37..2b6195f9f 100644
--- a/app/components/container/containerController.js
+++ b/app/components/container/containerController.js
@@ -1,6 +1,6 @@
angular.module('container', [])
-.controller('ContainerController', ['$scope', '$state','$stateParams', '$filter', 'Container', 'ContainerCommit', 'ImageHelper', 'Network', 'Messages', 'Pagination',
-function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, ImageHelper, Network, Messages, Pagination) {
+.controller('ContainerController', ['$scope', '$state','$stateParams', '$filter', 'Container', 'ContainerCommit', 'ImageHelper', 'Network', 'Notifications', 'Pagination',
+function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, ImageHelper, Network, Notifications, Pagination) {
$scope.activityTime = 0;
$scope.portBindings = [];
$scope.config = {
@@ -41,7 +41,7 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
$('#loadingViewSpinner').hide();
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to retrieve container info");
+ Notifications.error("Failure", e, "Unable to retrieve container info");
});
};
@@ -49,10 +49,10 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
$('#loadingViewSpinner').show();
Container.start({id: $scope.container.Id}, {}, function (d) {
update();
- Messages.send("Container started", $stateParams.id);
+ Notifications.success("Container started", $stateParams.id);
}, function (e) {
update();
- Messages.error("Failure", e, "Unable to start container");
+ Notifications.error("Failure", e, "Unable to start container");
});
};
@@ -60,10 +60,10 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
$('#loadingViewSpinner').show();
Container.stop({id: $stateParams.id}, function (d) {
update();
- Messages.send("Container stopped", $stateParams.id);
+ Notifications.success("Container stopped", $stateParams.id);
}, function (e) {
update();
- Messages.error("Failure", e, "Unable to stop container");
+ Notifications.error("Failure", e, "Unable to stop container");
});
};
@@ -71,10 +71,10 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
$('#loadingViewSpinner').show();
Container.kill({id: $stateParams.id}, function (d) {
update();
- Messages.send("Container killed", $stateParams.id);
+ Notifications.success("Container killed", $stateParams.id);
}, function (e) {
update();
- Messages.error("Failure", e, "Unable to kill container");
+ Notifications.error("Failure", e, "Unable to kill container");
});
};
@@ -86,11 +86,11 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
ContainerCommit.commit({id: $stateParams.id, tag: imageConfig.tag, repo: imageConfig.repo}, function (d) {
$('#createImageSpinner').hide();
update();
- Messages.send("Container commited", $stateParams.id);
+ Notifications.success("Container commited", $stateParams.id);
}, function (e) {
$('#createImageSpinner').hide();
update();
- Messages.error("Failure", e, "Unable to commit container");
+ Notifications.error("Failure", e, "Unable to commit container");
});
};
@@ -98,10 +98,10 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
$('#loadingViewSpinner').show();
Container.pause({id: $stateParams.id}, function (d) {
update();
- Messages.send("Container paused", $stateParams.id);
+ Notifications.success("Container paused", $stateParams.id);
}, function (e) {
update();
- Messages.error("Failure", e, "Unable to pause container");
+ Notifications.error("Failure", e, "Unable to pause container");
});
};
@@ -109,10 +109,10 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
$('#loadingViewSpinner').show();
Container.unpause({id: $stateParams.id}, function (d) {
update();
- Messages.send("Container unpaused", $stateParams.id);
+ Notifications.success("Container unpaused", $stateParams.id);
}, function (e) {
update();
- Messages.error("Failure", e, "Unable to unpause container");
+ Notifications.error("Failure", e, "Unable to unpause container");
});
};
@@ -121,15 +121,15 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
Container.remove({id: $stateParams.id}, function (d) {
if (d.message) {
$('#loadingViewSpinner').hide();
- Messages.send("Error", d.message);
+ Notifications.error("Failure", d, "Unable to remove container");
}
else {
$state.go('containers', {}, {reload: true});
- Messages.send("Container removed", $stateParams.id);
+ Notifications.success("Container removed", $stateParams.id);
}
}, function (e) {
update();
- Messages.error("Failure", e, "Unable to remove container");
+ Notifications.error("Failure", e, "Unable to remove container");
});
};
@@ -137,10 +137,10 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
$('#loadingViewSpinner').show();
Container.restart({id: $stateParams.id}, function (d) {
update();
- Messages.send("Container restarted", $stateParams.id);
+ Notifications.success("Container restarted", $stateParams.id);
}, function (e) {
update();
- Messages.error("Failure", e, "Unable to restart container");
+ Notifications.error("Failure", e, "Unable to restart container");
});
};
@@ -148,13 +148,13 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
Container.rename({id: $stateParams.id, 'name': $scope.container.newContainerName}, function (d) {
if (d.message) {
$scope.container.newContainerName = $scope.container.Name;
- Messages.error("Unable to rename container", {}, d.message);
+ Notifications.error("Unable to rename container", {}, d.message);
} else {
$scope.container.Name = $scope.container.newContainerName;
- Messages.send("Container successfully renamed", d.name);
+ Notifications.success("Container successfully renamed", d.name);
}
}, function (e) {
- Messages.error("Failure", e, 'Unable to rename container');
+ Notifications.error("Failure", e, 'Unable to rename container');
});
$scope.container.edit = false;
};
@@ -164,15 +164,15 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
Network.disconnect({id: networkId}, { Container: $stateParams.id, Force: false }, function (d) {
if (d.message) {
$('#loadingViewSpinner').hide();
- Messages.send("Error", {}, d.message);
+ Notifications.error("Error", d, "Unable to disconnect container from network");
} else {
$('#loadingViewSpinner').hide();
- Messages.send("Container left network", $stateParams.id);
+ Notifications.success("Container left network", $stateParams.id);
$state.go('container', {id: $stateParams.id}, {reload: true});
}
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to disconnect container from network");
+ Notifications.error("Failure", e, "Unable to disconnect container from network");
});
};
diff --git a/app/components/containerConsole/containerConsoleController.js b/app/components/containerConsole/containerConsoleController.js
index 4ef8cc3d6..9b731f9a7 100644
--- a/app/components/containerConsole/containerConsoleController.js
+++ b/app/components/containerConsole/containerConsoleController.js
@@ -1,6 +1,6 @@
angular.module('containerConsole', [])
-.controller('ContainerConsoleController', ['$scope', '$stateParams', 'Settings', 'Container', 'Image', 'Exec', '$timeout', 'EndpointProvider', 'Messages',
-function ($scope, $stateParams, Settings, Container, Image, Exec, $timeout, EndpointProvider, Messages) {
+.controller('ContainerConsoleController', ['$scope', '$stateParams', 'Settings', 'Container', 'Image', 'Exec', '$timeout', 'EndpointProvider', 'Notifications',
+function ($scope, $stateParams, Settings, Container, Image, Exec, $timeout, EndpointProvider, Notifications) {
$scope.state = {};
$scope.state.loaded = false;
$scope.state.connected = false;
@@ -17,7 +17,7 @@ function ($scope, $stateParams, Settings, Container, Image, Exec, $timeout, Endp
Container.get({id: $stateParams.id}, function(d) {
$scope.container = d;
if (d.message) {
- Messages.error("Error", d, 'Unable to retrieve container details');
+ Notifications.error("Error", d, 'Unable to retrieve container details');
$('#loadingViewSpinner').hide();
} else {
Image.get({id: d.Image}, function(imgData) {
@@ -26,12 +26,12 @@ function ($scope, $stateParams, Settings, Container, Image, Exec, $timeout, Endp
$scope.state.loaded = true;
$('#loadingViewSpinner').hide();
}, function (e) {
- Messages.error("Failure", e, 'Unable to retrieve image details');
+ Notifications.error("Failure", e, 'Unable to retrieve image details');
$('#loadingViewSpinner').hide();
});
}
}, function (e) {
- Messages.error("Failure", e, 'Unable to retrieve container details');
+ Notifications.error("Failure", e, 'Unable to retrieve container details');
$('#loadingViewSpinner').hide();
});
@@ -51,7 +51,7 @@ function ($scope, $stateParams, Settings, Container, Image, Exec, $timeout, Endp
Container.exec(execConfig, function(d) {
if (d.message) {
$('#loadConsoleSpinner').hide();
- Messages.error("Error", {}, d.message);
+ Notifications.error("Error", {}, d.message);
} else {
var execId = d.Id;
resizeTTY(execId, termHeight, termWidth);
@@ -65,7 +65,7 @@ function ($scope, $stateParams, Settings, Container, Image, Exec, $timeout, Endp
}
}, function (e) {
$('#loadConsoleSpinner').hide();
- Messages.error("Failure", e, 'Unable to start an exec instance');
+ Notifications.error("Failure", e, 'Unable to start an exec instance');
});
};
@@ -83,10 +83,10 @@ function ($scope, $stateParams, Settings, Container, Image, Exec, $timeout, Endp
$timeout(function() {
Exec.resize({id: execId, height: height, width: width}, function (d) {
if (d.message) {
- Messages.error('Error', {}, 'Unable to resize TTY');
+ Notifications.error('Error', {}, 'Unable to resize TTY');
}
}, function (e) {
- Messages.error("Failure", {}, 'Unable to resize TTY');
+ Notifications.error("Failure", {}, 'Unable to resize TTY');
});
}, 2000);
diff --git a/app/components/containerLogs/containerLogsController.js b/app/components/containerLogs/containerLogsController.js
index fbba46058..cf92fbb72 100644
--- a/app/components/containerLogs/containerLogsController.js
+++ b/app/components/containerLogs/containerLogsController.js
@@ -14,7 +14,7 @@ function ($scope, $stateParams, $anchorScroll, ContainerLogs, Container) {
$('#loadingViewSpinner').hide();
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to retrieve container info");
+ Notifications.error("Failure", e, "Unable to retrieve container info");
});
function getLogs() {
diff --git a/app/components/containers/containersController.js b/app/components/containers/containersController.js
index f88821698..ee1ccedf3 100644
--- a/app/components/containers/containersController.js
+++ b/app/components/containers/containersController.js
@@ -1,6 +1,6 @@
angular.module('containers', [])
- .controller('ContainersController', ['$q', '$scope', '$filter', 'Container', 'ContainerHelper', 'Info', 'Settings', 'Messages', 'Config', 'Pagination', 'EntityListService', 'ModalService', 'Authentication', 'ResourceControlService', 'UserService',
- function ($q, $scope, $filter, Container, ContainerHelper, Info, Settings, Messages, Config, Pagination, EntityListService, ModalService, Authentication, ResourceControlService, UserService) {
+ .controller('ContainersController', ['$q', '$scope', '$filter', 'Container', 'ContainerHelper', 'Info', 'Settings', 'Notifications', 'Config', 'Pagination', 'EntityListService', 'ModalService', 'Authentication', 'ResourceControlService', 'UserService',
+ function ($q, $scope, $filter, Container, ContainerHelper, Info, Settings, Notifications, Config, Pagination, EntityListService, ModalService, Authentication, ResourceControlService, UserService) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('containers');
$scope.state.displayAll = Settings.displayAll;
@@ -29,10 +29,10 @@ angular.module('containers', [])
})
.then(function success() {
delete container.Metadata.ResourceControl;
- Messages.send('Ownership changed to public', container.Id);
+ Notifications.success('Ownership changed to public', container.Id);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to change container ownership");
+ Notifications.error("Failure", err, "Unable to change container ownership");
});
}
@@ -90,7 +90,7 @@ angular.module('containers', [])
mapUsersToContainers(data);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to retrieve users");
+ Notifications.error("Failure", err, "Unable to retrieve users");
})
.finally(function final() {
$('#loadContainersSpinner').hide();
@@ -100,7 +100,7 @@ angular.module('containers', [])
}
}, function (e) {
$('#loadContainersSpinner').hide();
- Messages.error("Failure", e, "Unable to retrieve containers");
+ Notifications.error("Failure", e, "Unable to retrieve containers");
$scope.containers = [];
});
};
@@ -120,56 +120,56 @@ angular.module('containers', [])
counter = counter + 1;
if (action === Container.start) {
action({id: c.Id}, {}, function (d) {
- Messages.send("Container " + msg, c.Id);
+ Notifications.success("Container " + msg, c.Id);
complete();
}, function (e) {
- Messages.error("Failure", e, "Unable to start container");
+ Notifications.error("Failure", e, "Unable to start container");
complete();
});
}
else if (action === Container.remove) {
action({id: c.Id}, function (d) {
if (d.message) {
- Messages.send("Error", d.message);
+ Notifications.error("Error", d, "Unable to remove container");
}
else {
if (c.Metadata && c.Metadata.ResourceControl) {
ResourceControlService.removeContainerResourceControl(c.Metadata.ResourceControl.OwnerId, c.Id)
.then(function success() {
- Messages.send("Container " + msg, c.Id);
+ Notifications.success("Container " + msg, c.Id);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to remove container ownership");
+ Notifications.error("Failure", err, "Unable to remove container ownership");
});
} else {
- Messages.send("Container " + msg, c.Id);
+ Notifications.success("Container " + msg, c.Id);
}
}
complete();
}, function (e) {
- Messages.error("Failure", e, 'Unable to remove container');
+ Notifications.error("Failure", e, 'Unable to remove container');
complete();
});
}
else if (action === Container.pause) {
action({id: c.Id}, function (d) {
if (d.message) {
- Messages.send("Container is already paused", c.Id);
+ Notifications.success("Container is already paused", c.Id);
} else {
- Messages.send("Container " + msg, c.Id);
+ Notifications.success("Container " + msg, c.Id);
}
complete();
}, function (e) {
- Messages.error("Failure", e, 'Unable to pause container');
+ Notifications.error("Failure", e, 'Unable to pause container');
complete();
});
}
else {
action({id: c.Id}, function (d) {
- Messages.send("Container " + msg, c.Id);
+ Notifications.success("Container " + msg, c.Id);
complete();
}, function (e) {
- Messages.error("Failure", e, 'An error occured');
+ Notifications.error("Failure", e, 'An error occured');
complete();
});
diff --git a/app/components/createContainer/createContainerController.js b/app/components/createContainer/createContainerController.js
index 4b12fef07..f7b58efc6 100644
--- a/app/components/createContainer/createContainerController.js
+++ b/app/components/createContainer/createContainerController.js
@@ -1,8 +1,8 @@
// @@OLD_SERVICE_CONTROLLER: this service should be rewritten to use services.
// See app/components/templates/templatesController.js as a reference.
angular.module('createContainer', [])
-.controller('CreateContainerController', ['$scope', '$state', '$stateParams', '$filter', 'Config', 'Info', 'Container', 'ContainerHelper', 'Image', 'ImageHelper', 'Volume', 'Network', 'ResourceControlService', 'Authentication', 'Messages',
-function ($scope, $state, $stateParams, $filter, Config, Info, Container, ContainerHelper, Image, ImageHelper, Volume, Network, ResourceControlService, Authentication, Messages) {
+.controller('CreateContainerController', ['$scope', '$state', '$stateParams', '$filter', 'Config', 'Info', 'Container', 'ContainerHelper', 'Image', 'ImageHelper', 'Volume', 'Network', 'ResourceControlService', 'Authentication', 'Notifications',
+function ($scope, $state, $stateParams, $filter, Config, Info, Container, ContainerHelper, Image, ImageHelper, Volume, Network, ResourceControlService, Authentication, Notifications) {
$scope.formValues = {
Ownership: $scope.applicationState.application.authentication ? 'private' : '',
@@ -83,7 +83,7 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
Volume.query({}, function (d) {
$scope.availableVolumes = d.Volumes;
}, function (e) {
- Messages.error("Failure", e, "Unable to retrieve volumes");
+ Notifications.error("Failure", e, "Unable to retrieve volumes");
});
Network.query({}, function (d) {
@@ -105,7 +105,7 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
$scope.config.HostConfig.NetworkMode = 'nat';
}
}, function (e) {
- Messages.error("Failure", e, "Unable to retrieve networks");
+ Notifications.error("Failure", e, "Unable to retrieve networks");
});
Container.query({}, function (d) {
@@ -115,7 +115,7 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
}
$scope.runningContainers = containers;
}, function(e) {
- Messages.error("Failure", e, "Unable to retrieve running containers");
+ Notifications.error("Failure", e, "Unable to retrieve running containers");
});
});
@@ -123,15 +123,15 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
Container.start({id: containerID}, {}, function (cd) {
if (cd.message) {
$('#createContainerSpinner').hide();
- Messages.error('Error', {}, cd.message);
+ Notifications.error('Error', {}, cd.message);
} else {
$('#createContainerSpinner').hide();
- Messages.send('Container Started', containerID);
+ Notifications.success('Container Started', containerID);
$state.go('containers', {}, {reload: true});
}
}, function (e) {
$('#createContainerSpinner').hide();
- Messages.error("Failure", e, 'Unable to start container');
+ Notifications.error("Failure", e, 'Unable to start container');
});
}
@@ -139,7 +139,7 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
Container.create(config, function (d) {
if (d.message) {
$('#createContainerSpinner').hide();
- Messages.error('Error', {}, d.message);
+ Notifications.error('Error', {}, d.message);
} else {
if ($scope.formValues.Ownership === 'private') {
ResourceControlService.setContainerResourceControl(Authentication.getUserDetails().ID, d.Id)
@@ -148,7 +148,7 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
})
.catch(function error(err) {
$('#createContainerSpinner').hide();
- Messages.error("Failure", err, 'Unable to apply resource control on container');
+ Notifications.error("Failure", err, 'Unable to apply resource control on container');
});
} else {
startContainer(d.Id);
@@ -156,7 +156,7 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
}
}, function (e) {
$('#createContainerSpinner').hide();
- Messages.error("Failure", e, 'Unable to create container');
+ Notifications.error("Failure", e, 'Unable to create container');
});
}
@@ -165,7 +165,7 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
createContainer(config);
}, function (e) {
$('#createContainerSpinner').hide();
- Messages.error('Failure', e, 'Unable to pull image');
+ Notifications.error('Failure', e, 'Unable to pull image');
});
}
diff --git a/app/components/createNetwork/createNetworkController.js b/app/components/createNetwork/createNetworkController.js
index 79970cf76..14a8b2143 100644
--- a/app/components/createNetwork/createNetworkController.js
+++ b/app/components/createNetwork/createNetworkController.js
@@ -1,6 +1,6 @@
angular.module('createNetwork', [])
-.controller('CreateNetworkController', ['$scope', '$state', 'Messages', 'Network',
-function ($scope, $state, Messages, Network) {
+.controller('CreateNetworkController', ['$scope', '$state', 'Notifications', 'Network',
+function ($scope, $state, Notifications, Network) {
$scope.formValues = {
DriverOptions: [],
Subnet: '',
@@ -42,15 +42,15 @@ function ($scope, $state, Messages, Network) {
Network.create(config, function (d) {
if (d.message) {
$('#createNetworkSpinner').hide();
- Messages.error('Unable to create network', {}, d.message);
+ Notifications.error('Unable to create network', {}, d.message);
} else {
- Messages.send("Network created", d.Id);
+ Notifications.success("Network created", d.Id);
$('#createNetworkSpinner').hide();
$state.go('networks', {}, {reload: true});
}
}, function (e) {
$('#createNetworkSpinner').hide();
- Messages.error("Failure", e, 'Unable to create network');
+ Notifications.error("Failure", e, 'Unable to create network');
});
}
diff --git a/app/components/createService/createServiceController.js b/app/components/createService/createServiceController.js
index f7b1d100a..ce304ca4f 100644
--- a/app/components/createService/createServiceController.js
+++ b/app/components/createService/createServiceController.js
@@ -1,8 +1,8 @@
// @@OLD_SERVICE_CONTROLLER: this service should be rewritten to use services.
// See app/components/templates/templatesController.js as a reference.
angular.module('createService', [])
-.controller('CreateServiceController', ['$scope', '$state', 'Service', 'Volume', 'Network', 'ImageHelper', 'Authentication', 'ResourceControlService', 'Messages',
-function ($scope, $state, Service, Volume, Network, ImageHelper, Authentication, ResourceControlService, Messages) {
+.controller('CreateServiceController', ['$scope', '$state', 'Service', 'Volume', 'Network', 'ImageHelper', 'Authentication', 'ResourceControlService', 'Notifications',
+function ($scope, $state, Service, Volume, Network, ImageHelper, Authentication, ResourceControlService, Notifications) {
$scope.formValues = {
Ownership: $scope.applicationState.application.authentication ? 'private' : '',
@@ -219,21 +219,21 @@ function ($scope, $state, Service, Volume, Network, ImageHelper, Authentication,
ResourceControlService.setServiceResourceControl(Authentication.getUserDetails().ID, d.ID)
.then(function success() {
$('#createServiceSpinner').hide();
- Messages.send('Service created', d.ID);
+ Notifications.success('Service created', d.ID);
$state.go('services', {}, {reload: true});
})
.catch(function error(err) {
$('#createContainerSpinner').hide();
- Messages.error("Failure", err, 'Unable to apply resource control on service');
+ Notifications.error("Failure", err, 'Unable to apply resource control on service');
});
} else {
$('#createServiceSpinner').hide();
- Messages.send('Service created', d.ID);
+ Notifications.success('Service created', d.ID);
$state.go('services', {}, {reload: true});
}
}, function (e) {
$('#createServiceSpinner').hide();
- Messages.error("Failure", e, 'Unable to create service');
+ Notifications.error("Failure", e, 'Unable to create service');
});
}
@@ -246,7 +246,7 @@ function ($scope, $state, Service, Volume, Network, ImageHelper, Authentication,
Volume.query({}, function (d) {
$scope.availableVolumes = d.Volumes;
}, function (e) {
- Messages.error("Failure", e, "Unable to retrieve volumes");
+ Notifications.error("Failure", e, "Unable to retrieve volumes");
});
Network.query({}, function (d) {
@@ -256,6 +256,6 @@ function ($scope, $state, Service, Volume, Network, ImageHelper, Authentication,
}
});
}, function (e) {
- Messages.error("Failure", e, "Unable to retrieve networks");
+ Notifications.error("Failure", e, "Unable to retrieve networks");
});
}]);
diff --git a/app/components/createVolume/createVolumeController.js b/app/components/createVolume/createVolumeController.js
index fca49bcc1..b18a64f5e 100644
--- a/app/components/createVolume/createVolumeController.js
+++ b/app/components/createVolume/createVolumeController.js
@@ -1,6 +1,6 @@
angular.module('createVolume', [])
-.controller('CreateVolumeController', ['$scope', '$state', 'VolumeService', 'InfoService', 'ResourceControlService', 'Authentication', 'Messages',
-function ($scope, $state, VolumeService, InfoService, ResourceControlService, Authentication, Messages) {
+.controller('CreateVolumeController', ['$scope', '$state', 'VolumeService', 'InfoService', 'ResourceControlService', 'Authentication', 'Notifications',
+function ($scope, $state, VolumeService, InfoService, ResourceControlService, Authentication, Notifications) {
$scope.formValues = {
Ownership: $scope.applicationState.application.authentication ? 'private' : '',
@@ -30,19 +30,19 @@ function ($scope, $state, VolumeService, InfoService, ResourceControlService, Au
if ($scope.formValues.Ownership === 'private') {
ResourceControlService.setVolumeResourceControl(Authentication.getUserDetails().ID, data.Name)
.then(function success() {
- Messages.send("Volume created", data.Name);
+ Notifications.success("Volume created", data.Name);
$state.go('volumes', {}, {reload: true});
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to apply resource control on volume');
+ Notifications.error("Failure", err, 'Unable to apply resource control on volume');
});
} else {
- Messages.send("Volume created", data.Name);
+ Notifications.success("Volume created", data.Name);
$state.go('volumes', {}, {reload: true});
}
})
.catch(function error(err) {
- Messages.error('Failure', err, 'Unable to create volume');
+ Notifications.error('Failure', err, 'Unable to create volume');
})
.finally(function final() {
$('#createVolumeSpinner').hide();
@@ -56,7 +56,7 @@ function ($scope, $state, VolumeService, InfoService, ResourceControlService, Au
$scope.availableVolumeDrivers = data;
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to retrieve volume plugin information');
+ Notifications.error("Failure", err, 'Unable to retrieve volume plugin information');
})
.finally(function final() {
$('#loadingViewSpinner').hide();
diff --git a/app/components/dashboard/dashboardController.js b/app/components/dashboard/dashboardController.js
index e82cec9da..3ece5956d 100644
--- a/app/components/dashboard/dashboardController.js
+++ b/app/components/dashboard/dashboardController.js
@@ -1,6 +1,6 @@
angular.module('dashboard', [])
-.controller('DashboardController', ['$scope', '$q', 'Config', 'Container', 'ContainerHelper', 'Image', 'Network', 'Volume', 'Info', 'Messages',
-function ($scope, $q, Config, Container, ContainerHelper, Image, Network, Volume, Info, Messages) {
+.controller('DashboardController', ['$scope', '$q', 'Config', 'Container', 'ContainerHelper', 'Image', 'Network', 'Volume', 'Info', 'Notifications',
+function ($scope, $q, Config, Container, ContainerHelper, Image, Network, Volume, Info, Notifications) {
$scope.containerData = {
total: 0
@@ -82,7 +82,7 @@ function ($scope, $q, Config, Container, ContainerHelper, Image, Network, Volume
$('#loadingViewSpinner').hide();
}, function(e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to load dashboard data");
+ Notifications.error("Failure", e, "Unable to load dashboard data");
});
}
diff --git a/app/components/docker/dockerController.js b/app/components/docker/dockerController.js
index 42e8c7792..727724d7f 100644
--- a/app/components/docker/dockerController.js
+++ b/app/components/docker/dockerController.js
@@ -1,6 +1,6 @@
angular.module('docker', [])
-.controller('DockerController', ['$scope', 'Info', 'Version', 'Messages',
-function ($scope, Info, Version, Messages) {
+.controller('DockerController', ['$scope', 'Info', 'Version', 'Notifications',
+function ($scope, Info, Version, Notifications) {
$scope.state = {
loaded: false
};
@@ -14,11 +14,11 @@ function ($scope, Info, Version, Messages) {
$scope.state.loaded = true;
$('#loadingViewSpinner').hide();
}, function (e) {
- Messages.error("Failure", e, 'Unable to retrieve engine details');
+ Notifications.error("Failure", e, 'Unable to retrieve engine details');
$('#loadingViewSpinner').hide();
});
}, function (e) {
- Messages.error("Failure", e, 'Unable to retrieve engine information');
+ Notifications.error("Failure", e, 'Unable to retrieve engine information');
$('#loadingViewSpinner').hide();
});
}]);
diff --git a/app/components/endpoint/endpointController.js b/app/components/endpoint/endpointController.js
index c455e38dc..43a013834 100644
--- a/app/components/endpoint/endpointController.js
+++ b/app/components/endpoint/endpointController.js
@@ -1,6 +1,6 @@
angular.module('endpoint', [])
-.controller('EndpointController', ['$scope', '$state', '$stateParams', '$filter', 'EndpointService', 'Messages',
-function ($scope, $state, $stateParams, $filter, EndpointService, Messages) {
+.controller('EndpointController', ['$scope', '$state', '$stateParams', '$filter', 'EndpointService', 'Notifications',
+function ($scope, $state, $stateParams, $filter, EndpointService, Notifications) {
if (!$scope.applicationState.application.endpointManagement) {
$state.go('endpoints');
@@ -31,7 +31,7 @@ function ($scope, $state, $stateParams, $filter, EndpointService, Messages) {
EndpointService.updateEndpoint(ID, endpointParams)
.then(function success(data) {
- Messages.send("Endpoint updated", $scope.endpoint.Name);
+ Notifications.success("Endpoint updated", $scope.endpoint.Name);
$state.go('endpoints');
}, function error(err) {
$scope.state.error = err.msg;
@@ -58,7 +58,7 @@ function ($scope, $state, $stateParams, $filter, EndpointService, Messages) {
$scope.formValues.TLSKey = data.TLSKey;
}, function error(err) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", err, "Unable to retrieve endpoint details");
+ Notifications.error("Failure", err, "Unable to retrieve endpoint details");
});
}
diff --git a/app/components/endpointAccess/endpointAccessController.js b/app/components/endpointAccess/endpointAccessController.js
index 44ebb9c2c..8ec92e926 100644
--- a/app/components/endpointAccess/endpointAccessController.js
+++ b/app/components/endpointAccess/endpointAccessController.js
@@ -1,6 +1,6 @@
angular.module('endpointAccess', [])
-.controller('EndpointAccessController', ['$q', '$scope', '$state', '$stateParams', '$filter', 'EndpointService', 'UserService', 'Pagination', 'Messages',
-function ($q, $scope, $state, $stateParams, $filter, EndpointService, UserService, Pagination, Messages) {
+.controller('EndpointAccessController', ['$q', '$scope', '$state', '$stateParams', '$filter', 'EndpointService', 'UserService', 'Pagination', 'Notifications',
+function ($q, $scope, $state, $stateParams, $filter, EndpointService, UserService, Pagination, Notifications) {
$scope.state = {
pagination_count_users: Pagination.getPaginationCount('endpoint_access_users'),
@@ -43,10 +43,10 @@ function ($q, $scope, $state, $stateParams, $filter, EndpointService, UserServic
.then(function success(data) {
$scope.authorizedUsers = $scope.authorizedUsers.concat($scope.users);
$scope.users = [];
- Messages.send('Access granted for all users');
+ Notifications.success('Access granted for all users');
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to update endpoint permissions");
+ Notifications.error("Failure", err, "Unable to update endpoint permissions");
});
};
@@ -55,10 +55,10 @@ function ($q, $scope, $state, $stateParams, $filter, EndpointService, UserServic
.then(function success(data) {
$scope.users = $scope.users.concat($scope.authorizedUsers);
$scope.authorizedUsers = [];
- Messages.send('Access removed for all users');
+ Notifications.success('Access removed for all users');
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to update endpoint permissions");
+ Notifications.error("Failure", err, "Unable to update endpoint permissions");
});
};
@@ -72,10 +72,10 @@ function ($q, $scope, $state, $stateParams, $filter, EndpointService, UserServic
.then(function success(data) {
removeUserFromArray(user.Id, $scope.users);
$scope.authorizedUsers.push(user);
- Messages.send('Access granted for user', user.Username);
+ Notifications.success('Access granted for user', user.Username);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to update endpoint permissions");
+ Notifications.error("Failure", err, "Unable to update endpoint permissions");
});
};
@@ -91,10 +91,10 @@ function ($q, $scope, $state, $stateParams, $filter, EndpointService, UserServic
.then(function success(data) {
removeUserFromArray(user.Id, $scope.authorizedUsers);
$scope.users.push(user);
- Messages.send('Access removed for user', user.Username);
+ Notifications.success('Access removed for user', user.Username);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to update endpoint permissions");
+ Notifications.error("Failure", err, "Unable to update endpoint permissions");
});
};
@@ -128,7 +128,7 @@ function ($q, $scope, $state, $stateParams, $filter, EndpointService, UserServic
$scope.templates = [];
$scope.users = [];
$scope.authorizedUsers = [];
- Messages.error("Failure", err, "Unable to retrieve endpoint details");
+ Notifications.error("Failure", err, "Unable to retrieve endpoint details");
})
.finally(function final(){
$('#loadingViewSpinner').hide();
diff --git a/app/components/endpointInit/endpointInitController.js b/app/components/endpointInit/endpointInitController.js
index afaf48321..e2fc30725 100644
--- a/app/components/endpointInit/endpointInitController.js
+++ b/app/components/endpointInit/endpointInitController.js
@@ -1,6 +1,6 @@
angular.module('endpointInit', [])
-.controller('EndpointInitController', ['$scope', '$state', 'EndpointService', 'StateManager', 'EndpointProvider', 'Messages',
-function ($scope, $state, EndpointService, StateManager, EndpointProvider, Messages) {
+.controller('EndpointInitController', ['$scope', '$state', 'EndpointService', 'StateManager', 'EndpointProvider', 'Notifications',
+function ($scope, $state, EndpointService, StateManager, EndpointProvider, Notifications) {
$scope.state = {
error: '',
uploadInProgress: false
diff --git a/app/components/endpoints/endpointsController.js b/app/components/endpoints/endpointsController.js
index ba50144d4..7bf2a854a 100644
--- a/app/components/endpoints/endpointsController.js
+++ b/app/components/endpoints/endpointsController.js
@@ -1,6 +1,6 @@
angular.module('endpoints', [])
-.controller('EndpointsController', ['$scope', '$state', 'EndpointService', 'EndpointProvider', 'Messages', 'Pagination',
-function ($scope, $state, EndpointService, EndpointProvider, Messages, Pagination) {
+.controller('EndpointsController', ['$scope', '$state', 'EndpointService', 'EndpointProvider', 'Notifications', 'Pagination',
+function ($scope, $state, EndpointService, EndpointProvider, Notifications, Pagination) {
$scope.state = {
error: '',
uploadInProgress: false,
@@ -54,7 +54,7 @@ function ($scope, $state, EndpointService, EndpointProvider, Messages, Paginatio
var TLSCertFile = $scope.formValues.TLSCert;
var TLSKeyFile = $scope.formValues.TLSKey;
EndpointService.createRemoteEndpoint(name, URL, TLS, TLSCAFile, TLSCertFile, TLSKeyFile, false).then(function success(data) {
- Messages.send("Endpoint created", name);
+ Notifications.success("Endpoint created", name);
$state.reload();
}, function error(err) {
$scope.state.uploadInProgress = false;
@@ -79,12 +79,12 @@ function ($scope, $state, EndpointService, EndpointProvider, Messages, Paginatio
if (endpoint.Checked) {
counter = counter + 1;
EndpointService.deleteEndpoint(endpoint.Id).then(function success(data) {
- Messages.send("Endpoint deleted", endpoint.Name);
+ Notifications.success("Endpoint deleted", endpoint.Name);
var index = $scope.endpoints.indexOf(endpoint);
$scope.endpoints.splice(index, 1);
complete();
}, function error(err) {
- Messages.error("Failure", err, 'Unable to remove endpoint');
+ Notifications.error("Failure", err, 'Unable to remove endpoint');
complete();
});
}
@@ -99,7 +99,7 @@ function ($scope, $state, EndpointService, EndpointProvider, Messages, Paginatio
$scope.activeEndpointID = EndpointProvider.endpointID();
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to retrieve endpoints");
+ Notifications.error("Failure", err, "Unable to retrieve endpoints");
$scope.endpoints = [];
})
.finally(function final() {
diff --git a/app/components/events/eventsController.js b/app/components/events/eventsController.js
index b4f2ac9d8..41c2a8340 100644
--- a/app/components/events/eventsController.js
+++ b/app/components/events/eventsController.js
@@ -1,6 +1,6 @@
angular.module('events', [])
-.controller('EventsController', ['$scope', 'Messages', 'Events', 'Pagination',
-function ($scope, Messages, Events, Pagination) {
+.controller('EventsController', ['$scope', 'Notifications', 'Events', 'Pagination',
+function ($scope, Notifications, Events, Pagination) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('events');
$scope.sortType = 'Time';
@@ -27,6 +27,6 @@ function ($scope, Messages, Events, Pagination) {
},
function (e) {
$('#loadEventsSpinner').hide();
- Messages.error("Failure", e, "Unable to load events");
+ Notifications.error("Failure", e, "Unable to load events");
});
}]);
diff --git a/app/components/image/imageController.js b/app/components/image/imageController.js
index 8514ff1bb..6f0c17eae 100644
--- a/app/components/image/imageController.js
+++ b/app/components/image/imageController.js
@@ -1,6 +1,6 @@
angular.module('image', [])
-.controller('ImageController', ['$scope', '$stateParams', '$state', 'ImageService', 'Messages',
-function ($scope, $stateParams, $state, ImageService, Messages) {
+.controller('ImageController', ['$scope', '$stateParams', '$state', 'ImageService', 'Notifications',
+function ($scope, $stateParams, $state, ImageService, Notifications) {
$scope.config = {
Image: '',
Registry: ''
@@ -13,11 +13,11 @@ function ($scope, $stateParams, $state, ImageService, Messages) {
ImageService.tagImage($stateParams.id, image, registry)
.then(function success(data) {
- Messages.send('Image successfully tagged');
+ Notifications.success('Image successfully tagged');
$state.go('image', {id: $stateParams.id}, {reload: true});
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to tag image");
+ Notifications.error("Failure", err, "Unable to tag image");
})
.finally(function final() {
$('#loadingViewSpinner').hide();
@@ -28,10 +28,10 @@ function ($scope, $stateParams, $state, ImageService, Messages) {
$('#loadingViewSpinner').show();
ImageService.pushImage(tag)
.then(function success() {
- Messages.send('Image successfully pushed');
+ Notifications.success('Image successfully pushed');
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to push image tag");
+ Notifications.error("Failure", err, "Unable to push image tag");
})
.finally(function final() {
$('#loadingViewSpinner').hide();
@@ -45,10 +45,10 @@ function ($scope, $stateParams, $state, ImageService, Messages) {
ImageService.pullImage(image, registry)
.then(function success(data) {
- Messages.send('Image successfully pulled', image);
+ Notifications.success('Image successfully pulled', image);
})
.catch(function error(err){
- Messages.error("Failure", err, "Unable to pull image");
+ Notifications.error("Failure", err, "Unable to pull image");
})
.finally(function final() {
$('#loadingViewSpinner').hide();
@@ -60,15 +60,15 @@ function ($scope, $stateParams, $state, ImageService, Messages) {
ImageService.deleteImage(id, false)
.then(function success() {
if ($scope.image.RepoTags.length === 1) {
- Messages.send('Image successfully deleted', id);
+ Notifications.success('Image successfully deleted', id);
$state.go('images', {}, {reload: true});
} else {
- Messages.send('Tag successfully deleted', id);
+ Notifications.success('Tag successfully deleted', id);
$state.go('image', {id: $stateParams.id}, {reload: true});
}
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to remove image');
+ Notifications.error("Failure", err, 'Unable to remove image');
})
.finally(function final() {
$('#loadingViewSpinner').hide();
@@ -79,11 +79,11 @@ function ($scope, $stateParams, $state, ImageService, Messages) {
$('#loadingViewSpinner').show();
ImageService.deleteImage(id, false)
.then(function success() {
- Messages.send('Image successfully deleted', id);
+ Notifications.success('Image successfully deleted', id);
$state.go('images', {}, {reload: true});
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to remove image');
+ Notifications.error("Failure", err, 'Unable to remove image');
})
.finally(function final() {
$('#loadingViewSpinner').hide();
@@ -97,7 +97,7 @@ function ($scope, $stateParams, $state, ImageService, Messages) {
$scope.image = data;
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to retrieve image details");
+ Notifications.error("Failure", err, "Unable to retrieve image details");
$state.go('images');
})
.finally(function final() {
diff --git a/app/components/images/imagesController.js b/app/components/images/imagesController.js
index 350b77c2a..6a12eb7f2 100644
--- a/app/components/images/imagesController.js
+++ b/app/components/images/imagesController.js
@@ -1,6 +1,6 @@
angular.module('images', [])
-.controller('ImagesController', ['$scope', '$state', 'Config', 'ImageService', 'Messages', 'Pagination', 'ModalService',
-function ($scope, $state, Config, ImageService, Messages, Pagination, ModalService) {
+.controller('ImagesController', ['$scope', '$state', 'Config', 'ImageService', 'Notifications', 'Pagination', 'ModalService',
+function ($scope, $state, Config, ImageService, Notifications, Pagination, ModalService) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('images');
$scope.sortType = 'RepoTags';
@@ -47,7 +47,7 @@ function ($scope, $state, Config, ImageService, Messages, Pagination, ModalServi
$state.reload();
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to pull image");
+ Notifications.error("Failure", err, "Unable to pull image");
})
.finally(function final() {
$('#pullImageSpinner').hide();
@@ -76,12 +76,12 @@ function ($scope, $state, Config, ImageService, Messages, Pagination, ModalServi
counter = counter + 1;
ImageService.deleteImage(i.Id, force)
.then(function success(data) {
- Messages.send("Image deleted", i.Id);
+ Notifications.success("Image deleted", i.Id);
var index = $scope.images.indexOf(i);
$scope.images.splice(index, 1);
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to remove image');
+ Notifications.error("Failure", err, 'Unable to remove image');
})
.finally(function final() {
complete();
@@ -97,7 +97,7 @@ function ($scope, $state, Config, ImageService, Messages, Pagination, ModalServi
$scope.images = data;
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to retrieve images");
+ Notifications.error("Failure", err, "Unable to retrieve images");
$scope.images = [];
})
.finally(function final() {
diff --git a/app/components/network/networkController.js b/app/components/network/networkController.js
index 77287618d..4c89f343a 100644
--- a/app/components/network/networkController.js
+++ b/app/components/network/networkController.js
@@ -1,21 +1,21 @@
angular.module('network', [])
-.controller('NetworkController', ['$scope', '$state', '$stateParams', '$filter', 'Config', 'Network', 'Container', 'ContainerHelper', 'Messages',
-function ($scope, $state, $stateParams, $filter, Config, Network, Container, ContainerHelper, Messages) {
+.controller('NetworkController', ['$scope', '$state', '$stateParams', '$filter', 'Config', 'Network', 'Container', 'ContainerHelper', 'Notifications',
+function ($scope, $state, $stateParams, $filter, Config, Network, Container, ContainerHelper, Notifications) {
$scope.removeNetwork = function removeNetwork(networkId) {
$('#loadingViewSpinner').show();
Network.remove({id: $stateParams.id}, function (d) {
if (d.message) {
$('#loadingViewSpinner').hide();
- Messages.send("Error", {}, d.message);
+ Notifications.error("Error", d, "Unable to remove network");
} else {
$('#loadingViewSpinner').hide();
- Messages.send("Network removed", $stateParams.id);
+ Notifications.success("Network removed", $stateParams.id);
$state.go('networks', {});
}
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to remove network");
+ Notifications.error("Failure", e, "Unable to remove network");
});
};
@@ -24,15 +24,15 @@ function ($scope, $state, $stateParams, $filter, Config, Network, Container, Con
Network.disconnect({id: $stateParams.id}, { Container: containerId, Force: false }, function (d) {
if (d.message) {
$('#loadingViewSpinner').hide();
- Messages.send("Error", {}, d.message);
+ Notifications.error("Error", d, "Unable to disconnect container from network");
} else {
$('#loadingViewSpinner').hide();
- Messages.send("Container left network", $stateParams.id);
+ Notifications.success("Container left network", $stateParams.id);
$state.go('network', {id: network.Id}, {reload: true});
}
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to disconnect container from network");
+ Notifications.error("Failure", e, "Unable to disconnect container from network");
});
};
@@ -43,7 +43,7 @@ function ($scope, $state, $stateParams, $filter, Config, Network, Container, Con
getContainersInNetwork(data);
}, function error(err) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", err, "Unable to retrieve network info");
+ Notifications.error("Failure", err, "Unable to retrieve network info");
});
}
@@ -77,7 +77,7 @@ function ($scope, $state, $stateParams, $filter, Config, Network, Container, Con
$('#loadingViewSpinner').hide();
}, function error(err) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", err, "Unable to retrieve containers in network");
+ Notifications.error("Failure", err, "Unable to retrieve containers in network");
});
} else {
Container.query({
@@ -87,7 +87,7 @@ function ($scope, $state, $stateParams, $filter, Config, Network, Container, Con
$('#loadingViewSpinner').hide();
}, function error(err) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", err, "Unable to retrieve containers in network");
+ Notifications.error("Failure", err, "Unable to retrieve containers in network");
});
}
}
diff --git a/app/components/networks/networksController.js b/app/components/networks/networksController.js
index 120ab0c86..472081ef3 100644
--- a/app/components/networks/networksController.js
+++ b/app/components/networks/networksController.js
@@ -1,6 +1,6 @@
angular.module('networks', [])
-.controller('NetworksController', ['$scope', '$state', 'Network', 'Config', 'Messages', 'Pagination',
-function ($scope, $state, Network, Config, Messages, Pagination) {
+.controller('NetworksController', ['$scope', '$state', 'Network', 'Config', 'Notifications', 'Pagination',
+function ($scope, $state, Network, Config, Notifications, Pagination) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('networks');
$scope.state.selectedItemCount = 0;
@@ -34,15 +34,15 @@ function ($scope, $state, Network, Config, Messages, Pagination) {
Network.create(config, function (d) {
if (d.message) {
$('#createNetworkSpinner').hide();
- Messages.error('Unable to create network', {}, d.message);
+ Notifications.error('Unable to create network', {}, d.message);
} else {
- Messages.send("Network created", d.Id);
+ Notifications.success("Network created", d.Id);
$('#createNetworkSpinner').hide();
$state.reload();
}
}, function (e) {
$('#createNetworkSpinner').hide();
- Messages.error("Failure", e, 'Unable to create network');
+ Notifications.error("Failure", e, 'Unable to create network');
});
};
@@ -82,15 +82,15 @@ function ($scope, $state, Network, Config, Messages, Pagination) {
counter = counter + 1;
Network.remove({id: network.Id}, function (d) {
if (d.message) {
- Messages.send("Error", d.message);
+ Notifications.error("Error", d, "Unable to remove network");
} else {
- Messages.send("Network removed", network.Id);
+ Notifications.success("Network removed", network.Id);
var index = $scope.networks.indexOf(network);
$scope.networks.splice(index, 1);
}
complete();
}, function (e) {
- Messages.error("Failure", e, 'Unable to remove network');
+ Notifications.error("Failure", e, 'Unable to remove network');
complete();
});
}
@@ -104,7 +104,7 @@ function ($scope, $state, Network, Config, Messages, Pagination) {
$('#loadNetworksSpinner').hide();
}, function (e) {
$('#loadNetworksSpinner').hide();
- Messages.error("Failure", e, "Unable to retrieve networks");
+ Notifications.error("Failure", e, "Unable to retrieve networks");
$scope.networks = [];
});
}
diff --git a/app/components/node/nodeController.js b/app/components/node/nodeController.js
index 517424296..c09b7c604 100644
--- a/app/components/node/nodeController.js
+++ b/app/components/node/nodeController.js
@@ -1,6 +1,6 @@
angular.module('node', [])
-.controller('NodeController', ['$scope', '$state', '$stateParams', 'LabelHelper', 'Node', 'NodeHelper', 'Task', 'Pagination', 'Messages',
-function ($scope, $state, $stateParams, LabelHelper, Node, NodeHelper, Task, Pagination, Messages) {
+.controller('NodeController', ['$scope', '$state', '$stateParams', 'LabelHelper', 'Node', 'NodeHelper', 'Task', 'Pagination', 'Notifications',
+function ($scope, $state, $stateParams, LabelHelper, Node, NodeHelper, Task, Pagination, Notifications) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('node_tasks');
@@ -68,11 +68,11 @@ function ($scope, $state, $stateParams, LabelHelper, Node, NodeHelper, Task, Pag
Node.update({ id: node.Id, version: node.Version }, config, function (data) {
$('#loadServicesSpinner').hide();
- Messages.send("Node successfully updated", "Node updated");
+ Notifications.success("Node successfully updated", "Node updated");
$state.go('node', {id: node.Id}, {reload: true});
}, function (e) {
$('#loadServicesSpinner').hide();
- Messages.error("Failure", e, "Failed to update node");
+ Notifications.error("Failure", e, "Failed to update node");
});
};
@@ -81,7 +81,7 @@ function ($scope, $state, $stateParams, LabelHelper, Node, NodeHelper, Task, Pag
if ($scope.applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE') {
Node.get({ id: $stateParams.id}, function(d) {
if (d.message) {
- Messages.error("Failure", e, "Unable to inspect the node");
+ Notifications.error("Failure", e, "Unable to inspect the node");
} else {
var node = new NodeViewModel(d);
originalNode = angular.copy(node);
@@ -102,7 +102,7 @@ function ($scope, $state, $stateParams, LabelHelper, Node, NodeHelper, Task, Pag
return new TaskViewModel(task, [node]);
});
}, function (e) {
- Messages.error("Failure", e, "Unable to retrieve tasks associated to the node");
+ Notifications.error("Failure", e, "Unable to retrieve tasks associated to the node");
});
}
}
diff --git a/app/components/service/serviceController.js b/app/components/service/serviceController.js
index 961aa17b3..9f7661e2e 100644
--- a/app/components/service/serviceController.js
+++ b/app/components/service/serviceController.js
@@ -1,6 +1,6 @@
angular.module('service', [])
-.controller('ServiceController', ['$scope', '$stateParams', '$state', '$location', '$anchorScroll', 'Service', 'ServiceHelper', 'Task', 'Node', 'Messages', 'Pagination', 'ModalService',
-function ($scope, $stateParams, $state, $location, $anchorScroll, Service, ServiceHelper, Task, Node, Messages, Pagination, ModalService) {
+.controller('ServiceController', ['$scope', '$stateParams', '$state', '$location', '$anchorScroll', 'Service', 'ServiceHelper', 'Task', 'Node', 'Notifications', 'Pagination', 'ModalService',
+function ($scope, $stateParams, $state, $location, $anchorScroll, Service, ServiceHelper, Task, Node, Notifications, Pagination, ModalService) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('service_tasks');
@@ -213,12 +213,12 @@ function ($scope, $stateParams, $state, $location, $anchorScroll, Service, Servi
Service.update({ id: service.Id, version: service.Version }, config, function (data) {
$('#loadingViewSpinner').hide();
- Messages.send("Service successfully updated", "Service updated");
+ Notifications.success("Service successfully updated", "Service updated");
$scope.cancelChanges({});
fetchServiceDetails();
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to update service");
+ Notifications.error("Failure", e, "Unable to update service");
});
};
@@ -237,15 +237,15 @@ function ($scope, $stateParams, $state, $location, $anchorScroll, Service, Servi
Service.remove({id: $stateParams.id}, function (d) {
if (d.message) {
$('#loadingViewSpinner').hide();
- Messages.send("Error", {}, d.message);
+ Notifications.error("Error", d, "Unable to remove service");
} else {
$('#loadingViewSpinner').hide();
- Messages.send("Service removed", $stateParams.id);
+ Notifications.success("Service removed", $stateParams.id);
$state.go('services', {});
}
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to remove service");
+ Notifications.error("Failure", e, "Unable to remove service");
});
}
@@ -283,15 +283,15 @@ function ($scope, $stateParams, $state, $location, $anchorScroll, Service, Servi
$scope.tasks = tasks.map(function (task) {
return new TaskViewModel(task, null);
});
- Messages.error("Failure", e, "Unable to retrieve node information");
+ Notifications.error("Failure", e, "Unable to retrieve node information");
});
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to retrieve tasks associated to the service");
+ Notifications.error("Failure", e, "Unable to retrieve tasks associated to the service");
});
}, function (e) {
$('#loadingViewSpinner').hide();
- Messages.error("Failure", e, "Unable to retrieve service details");
+ Notifications.error("Failure", e, "Unable to retrieve service details");
});
}
diff --git a/app/components/services/servicesController.js b/app/components/services/servicesController.js
index 2a0522db6..72c5ada89 100644
--- a/app/components/services/servicesController.js
+++ b/app/components/services/servicesController.js
@@ -1,6 +1,6 @@
angular.module('services', [])
-.controller('ServicesController', ['$q', '$scope', '$stateParams', '$state', 'Service', 'ServiceHelper', 'Messages', 'Pagination', 'Task', 'Node', 'NodeHelper', 'Authentication', 'UserService', 'ModalService', 'ResourceControlService',
-function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Messages, Pagination, Task, Node, NodeHelper, Authentication, UserService, ModalService, ResourceControlService) {
+.controller('ServicesController', ['$q', '$scope', '$stateParams', '$state', 'Service', 'ServiceHelper', 'Notifications', 'Pagination', 'Task', 'Node', 'NodeHelper', 'Authentication', 'UserService', 'ModalService', 'ResourceControlService',
+function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Notifications, Pagination, Task, Node, NodeHelper, Authentication, UserService, ModalService, ResourceControlService) {
$scope.state = {};
$scope.state.selectedItemCount = 0;
$scope.state.pagination_count = Pagination.getPaginationCount('services');
@@ -21,10 +21,10 @@ function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Messages, Pa
})
.then(function success() {
delete service.Metadata.ResourceControl;
- Messages.send('Ownership changed to public', service.Id);
+ Notifications.success('Ownership changed to public', service.Id);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to change service ownership");
+ Notifications.error("Failure", err, "Unable to change service ownership");
});
}
@@ -58,13 +58,13 @@ function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Messages, Pa
config.Mode.Replicated.Replicas = service.Replicas;
Service.update({ id: service.Id, version: service.Version }, config, function (data) {
$('#loadServicesSpinner').hide();
- Messages.send("Service successfully scaled", "New replica count: " + service.Replicas);
+ Notifications.success("Service successfully scaled", "New replica count: " + service.Replicas);
$state.reload();
}, function (e) {
$('#loadServicesSpinner').hide();
service.Scale = false;
service.Replicas = service.ReplicaCount;
- Messages.error("Failure", e, "Unable to scale service");
+ Notifications.error("Failure", e, "Unable to scale service");
});
};
@@ -93,27 +93,27 @@ function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Messages, Pa
Service.remove({id: service.Id}, function (d) {
if (d.message) {
$('#loadServicesSpinner').hide();
- Messages.error("Unable to remove service", {}, d[0].message);
+ Notifications.error("Unable to remove service", {}, d[0].message);
} else {
if (service.Metadata && service.Metadata.ResourceControl) {
ResourceControlService.removeServiceResourceControl(service.Metadata.ResourceControl.OwnerId, service.Id)
.then(function success() {
- Messages.send("Service deleted", service.Id);
+ Notifications.success("Service deleted", service.Id);
var index = $scope.services.indexOf(service);
$scope.services.splice(index, 1);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to remove service ownership");
+ Notifications.error("Failure", err, "Unable to remove service ownership");
});
} else {
- Messages.send("Service deleted", service.Id);
+ Notifications.success("Service deleted", service.Id);
var index = $scope.services.indexOf(service);
$scope.services.splice(index, 1);
}
}
complete();
}, function (e) {
- Messages.error("Failure", e, 'Unable to remove service');
+ Notifications.error("Failure", e, 'Unable to remove service');
complete();
});
}
@@ -173,7 +173,7 @@ function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Messages, Pa
})
.catch(function error(err) {
$scope.services = [];
- Messages.error("Failure", err, "Unable to retrieve services");
+ Notifications.error("Failure", err, "Unable to retrieve services");
})
.finally(function final() {
$('#loadServicesSpinner').hide();
diff --git a/app/components/settings/settingsController.js b/app/components/settings/settingsController.js
index eb20ec9bb..010634800 100644
--- a/app/components/settings/settingsController.js
+++ b/app/components/settings/settingsController.js
@@ -1,6 +1,6 @@
angular.module('settings', [])
-.controller('SettingsController', ['$scope', '$state', '$sanitize', 'Authentication', 'UserService', 'Messages',
-function ($scope, $state, $sanitize, Authentication, UserService, Messages) {
+.controller('SettingsController', ['$scope', '$state', '$sanitize', 'Authentication', 'UserService', 'Notifications',
+function ($scope, $state, $sanitize, Authentication, UserService, Notifications) {
$scope.formValues = {
currentPassword: '',
newPassword: '',
@@ -15,14 +15,14 @@ function ($scope, $state, $sanitize, Authentication, UserService, Messages) {
UserService.updateUserPassword(userID, currentPassword, newPassword)
.then(function success() {
- Messages.send("Success", "Password successfully updated");
+ Notifications.success("Success", "Password successfully updated");
$state.reload();
})
.catch(function error(err) {
if (err.invalidPassword) {
$scope.invalidPassword = true;
} else {
- Messages.error("Failure", err, err.msg);
+ Notifications.error("Failure", err, err.msg);
}
});
};
diff --git a/app/components/sidebar/sidebarController.js b/app/components/sidebar/sidebarController.js
index 9b040af7f..75b91dd14 100644
--- a/app/components/sidebar/sidebarController.js
+++ b/app/components/sidebar/sidebarController.js
@@ -1,6 +1,6 @@
angular.module('sidebar', [])
-.controller('SidebarController', ['$scope', '$state', 'Settings', 'Config', 'EndpointService', 'StateManager', 'EndpointProvider', 'Messages', 'Authentication',
-function ($scope, $state, Settings, Config, EndpointService, StateManager, EndpointProvider, Messages, Authentication) {
+.controller('SidebarController', ['$scope', '$state', 'Settings', 'Config', 'EndpointService', 'StateManager', 'EndpointProvider', 'Notifications', 'Authentication',
+function ($scope, $state, Settings, Config, EndpointService, StateManager, EndpointProvider, Notifications, Authentication) {
Config.$promise.then(function (c) {
$scope.logo = c.logo;
@@ -17,7 +17,7 @@ function ($scope, $state, Settings, Config, EndpointService, StateManager, Endpo
$state.go('dashboard');
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to connect to the Docker endpoint");
+ Notifications.error("Failure", err, "Unable to connect to the Docker endpoint");
EndpointProvider.setEndpointID(activeEndpointID);
StateManager.updateEndpointState(true)
.then(function success() {});
diff --git a/app/components/stats/statsController.js b/app/components/stats/statsController.js
index 4329d0a05..a9977bf19 100644
--- a/app/components/stats/statsController.js
+++ b/app/components/stats/statsController.js
@@ -1,6 +1,6 @@
angular.module('stats', [])
-.controller('StatsController', ['Pagination', '$scope', 'Messages', '$timeout', 'Container', 'ContainerTop', '$stateParams', 'humansizeFilter', '$sce', '$document',
-function (Pagination, $scope, Messages, $timeout, Container, ContainerTop, $stateParams, humansizeFilter, $sce, $document) {
+.controller('StatsController', ['Pagination', '$scope', 'Notifications', '$timeout', 'Container', 'ContainerTop', '$stateParams', 'humansizeFilter', '$sce', '$document',
+function (Pagination, $scope, Notifications, $timeout, Container, ContainerTop, $stateParams, humansizeFilter, $sce, $document) {
// TODO: Force scale to 0-100 for cpu, fix charts on dashboard,
// TODO: Force memory scale to 0 - max memory
$scope.ps_args = '';
@@ -126,7 +126,7 @@ function (Pagination, $scope, Messages, $timeout, Container, ContainerTop, $stat
return d[key];
});
if (arr.join('').indexOf('no such id') !== -1) {
- Messages.error('Unable to retrieve stats', {}, 'Is this container running?');
+ Notifications.error('Unable to retrieve stats', {}, 'Is this container running?');
return;
}
@@ -137,7 +137,7 @@ function (Pagination, $scope, Messages, $timeout, Container, ContainerTop, $stat
updateNetworkChart(d);
setUpdateStatsTimeout();
}, function () {
- Messages.error('Unable to retrieve stats', {}, 'Is this container running?');
+ Notifications.error('Unable to retrieve stats', {}, 'Is this container running?');
setUpdateStatsTimeout();
});
}
@@ -211,7 +211,7 @@ function (Pagination, $scope, Messages, $timeout, Container, ContainerTop, $stat
Container.get({id: $stateParams.id}, function (d) {
$scope.container = d;
}, function (e) {
- Messages.error("Failure", e, "Unable to retrieve container info");
+ Notifications.error("Failure", e, "Unable to retrieve container info");
});
$scope.getTop();
}]);
diff --git a/app/components/task/taskController.js b/app/components/task/taskController.js
index e6a1dc33e..c705449d6 100644
--- a/app/components/task/taskController.js
+++ b/app/components/task/taskController.js
@@ -1,6 +1,6 @@
angular.module('task', [])
-.controller('TaskController', ['$scope', '$stateParams', '$state', 'Task', 'Service', 'Messages',
-function ($scope, $stateParams, $state, Task, Service, Messages) {
+.controller('TaskController', ['$scope', '$stateParams', '$state', 'Task', 'Service', 'Notifications',
+function ($scope, $stateParams, $state, Task, Service, Notifications) {
$scope.task = {};
$scope.serviceName = 'service';
@@ -13,7 +13,7 @@ function ($scope, $stateParams, $state, Task, Service, Messages) {
fetchAssociatedServiceDetails(d.ServiceID);
$('#loadingViewSpinner').hide();
}, function (e) {
- Messages.error("Failure", e, "Unable to retrieve task details");
+ Notifications.error("Failure", e, "Unable to retrieve task details");
});
}
@@ -21,7 +21,7 @@ function ($scope, $stateParams, $state, Task, Service, Messages) {
Service.get({id: serviceId}, function (d) {
$scope.serviceName = d.Spec.Name;
}, function (e) {
- Messages.error("Failure", e, "Unable to retrieve associated service details");
+ Notifications.error("Failure", e, "Unable to retrieve associated service details");
});
}
diff --git a/app/components/templates/templatesController.js b/app/components/templates/templatesController.js
index 003ddba7d..42bbe6de5 100644
--- a/app/components/templates/templatesController.js
+++ b/app/components/templates/templatesController.js
@@ -1,6 +1,6 @@
angular.module('templates', [])
-.controller('TemplatesController', ['$scope', '$q', '$state', '$stateParams', '$anchorScroll', 'Config', 'ContainerService', 'ContainerHelper', 'ImageService', 'NetworkService', 'TemplateService', 'TemplateHelper', 'VolumeService', 'Messages', 'Pagination', 'ResourceControlService', 'Authentication',
-function ($scope, $q, $state, $stateParams, $anchorScroll, Config, ContainerService, ContainerHelper, ImageService, NetworkService, TemplateService, TemplateHelper, VolumeService, Messages, Pagination, ResourceControlService, Authentication) {
+.controller('TemplatesController', ['$scope', '$q', '$state', '$stateParams', '$anchorScroll', 'Config', 'ContainerService', 'ContainerHelper', 'ImageService', 'NetworkService', 'TemplateService', 'TemplateHelper', 'VolumeService', 'Notifications', 'Pagination', 'ResourceControlService', 'Authentication',
+function ($scope, $q, $state, $stateParams, $anchorScroll, Config, ContainerService, ContainerHelper, ImageService, NetworkService, TemplateService, TemplateHelper, VolumeService, Notifications, Pagination, ResourceControlService, Authentication) {
$scope.state = {
selectedTemplate: null,
showAdvancedOptions: false,
@@ -56,7 +56,7 @@ function ($scope, $q, $state, $stateParams, $anchorScroll, Config, ContainerServ
return ContainerService.createAndStartContainer(templateConfiguration);
})
.then(function success(data) {
- Messages.send('Container Started', data.Id);
+ Notifications.success('Container started', data.Id);
if ($scope.formValues.Ownership === 'private') {
ResourceControlService.setContainerResourceControl(Authentication.getUserDetails().ID, data.Id)
.then(function success(data) {
@@ -67,7 +67,7 @@ function ($scope, $q, $state, $stateParams, $anchorScroll, Config, ContainerServ
}
})
.catch(function error(err) {
- Messages.error('Failure', err, err.msg);
+ Notifications.error('Failure', err, err.msg);
})
.finally(function final() {
$('#createContainerSpinner').hide();
@@ -155,7 +155,7 @@ function ($scope, $q, $state, $stateParams, $anchorScroll, Config, ContainerServ
})
.catch(function error(err) {
$scope.templates = [];
- Messages.error("Failure", err, "An error occured during apps initialization.");
+ Notifications.error("Failure", err, "An error occured during apps initialization.");
})
.finally(function final(){
$('#loadTemplatesSpinner').hide();
diff --git a/app/components/user/userController.js b/app/components/user/userController.js
index f62e5b243..abeb71fe7 100644
--- a/app/components/user/userController.js
+++ b/app/components/user/userController.js
@@ -1,6 +1,6 @@
angular.module('user', [])
-.controller('UserController', ['$scope', '$state', '$stateParams', 'UserService', 'ModalService', 'Messages',
-function ($scope, $state, $stateParams, UserService, ModalService, Messages) {
+.controller('UserController', ['$scope', '$state', '$stateParams', 'UserService', 'ModalService', 'Notifications',
+function ($scope, $state, $stateParams, UserService, ModalService, Notifications) {
$scope.state = {
updatePasswordError: '',
@@ -28,11 +28,11 @@ function ($scope, $state, $stateParams, UserService, ModalService, Messages) {
UserService.updateUser($scope.user.Id, undefined, role)
.then(function success(data) {
var newRole = role === 1 ? 'administrator' : 'user';
- Messages.send('Permissions successfully updated', $scope.user.Username + ' is now ' + newRole);
+ Notifications.success('Permissions successfully updated', $scope.user.Username + ' is now ' + newRole);
$state.reload();
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to update user permissions');
+ Notifications.error("Failure", err, 'Unable to update user permissions');
})
.finally(function final() {
$('#loadingViewSpinner').hide();
@@ -43,7 +43,7 @@ function ($scope, $state, $stateParams, UserService, ModalService, Messages) {
$('#loadingViewSpinner').show();
UserService.updateUser($scope.user.Id, $scope.formValues.newPassword, undefined)
.then(function success(data) {
- Messages.send('Password successfully updated');
+ Notifications.success('Password successfully updated');
$state.reload();
})
.catch(function error(err) {
@@ -58,11 +58,11 @@ function ($scope, $state, $stateParams, UserService, ModalService, Messages) {
$('#loadingViewSpinner').show();
UserService.deleteUser($scope.user.Id)
.then(function success(data) {
- Messages.send('User successfully deleted', $scope.user.Username);
+ Notifications.success('User successfully deleted', $scope.user.Username);
$state.go('users');
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to remove user');
+ Notifications.error("Failure", err, 'Unable to remove user');
})
.finally(function final() {
$('#loadingViewSpinner').hide();
@@ -78,7 +78,7 @@ function ($scope, $state, $stateParams, UserService, ModalService, Messages) {
$scope.formValues.Administrator = user.RoleId === 1 ? true : false;
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to retrieve user information');
+ Notifications.error("Failure", err, 'Unable to retrieve user information');
})
.finally(function final() {
$('#loadingViewSpinner').hide();
diff --git a/app/components/users/usersController.js b/app/components/users/usersController.js
index 7fb8e89b2..218b97cd7 100644
--- a/app/components/users/usersController.js
+++ b/app/components/users/usersController.js
@@ -1,6 +1,6 @@
angular.module('users', [])
-.controller('UsersController', ['$scope', '$state', 'UserService', 'ModalService', 'Messages', 'Pagination',
-function ($scope, $state, UserService, ModalService, Messages, Pagination) {
+.controller('UsersController', ['$scope', '$state', 'UserService', 'ModalService', 'Notifications', 'Pagination',
+function ($scope, $state, UserService, ModalService, Notifications, Pagination) {
$scope.state = {
userCreationError: '',
selectedItemCount: 0,
@@ -62,7 +62,7 @@ function ($scope, $state, UserService, ModalService, Messages, Pagination) {
var role = $scope.formValues.Administrator ? 1 : 2;
UserService.createUser(username, password, role)
.then(function success(data) {
- Messages.send("User created", username);
+ Notifications.success("User created", username);
$state.reload();
})
.catch(function error(err) {
@@ -89,10 +89,10 @@ function ($scope, $state, UserService, ModalService, Messages, Pagination) {
.then(function success(data) {
var index = $scope.users.indexOf(user);
$scope.users.splice(index, 1);
- Messages.send('User successfully deleted', user.Username);
+ Notifications.success('User successfully deleted', user.Username);
})
.catch(function error(err) {
- Messages.error("Failure", err, 'Unable to remove user');
+ Notifications.error("Failure", err, 'Unable to remove user');
})
.finally(function final() {
complete();
@@ -120,7 +120,7 @@ function ($scope, $state, UserService, ModalService, Messages, Pagination) {
});
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to retrieve users");
+ Notifications.error("Failure", err, "Unable to retrieve users");
$scope.users = [];
})
.finally(function final() {
diff --git a/app/components/volumes/volumesController.js b/app/components/volumes/volumesController.js
index 1df40343a..7ec5774ad 100644
--- a/app/components/volumes/volumesController.js
+++ b/app/components/volumes/volumesController.js
@@ -1,6 +1,6 @@
angular.module('volumes', [])
-.controller('VolumesController', ['$scope', '$state', 'Volume', 'Messages', 'Pagination', 'ModalService', 'Authentication', 'ResourceControlService', 'UserService',
-function ($scope, $state, Volume, Messages, Pagination, ModalService, Authentication, ResourceControlService, UserService) {
+.controller('VolumesController', ['$scope', '$state', 'Volume', 'Notifications', 'Pagination', 'ModalService', 'Authentication', 'ResourceControlService', 'UserService',
+function ($scope, $state, Volume, Notifications, Pagination, ModalService, Authentication, ResourceControlService, UserService) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('volumes');
$scope.state.selectedItemCount = 0;
@@ -14,10 +14,10 @@ function ($scope, $state, Volume, Messages, Pagination, ModalService, Authentica
ResourceControlService.removeVolumeResourceControl(volume.Metadata.ResourceControl.OwnerId, volume.Name)
.then(function success() {
delete volume.Metadata.ResourceControl;
- Messages.send('Ownership changed to public', volume.Name);
+ Notifications.success('Ownership changed to public', volume.Name);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to change volume ownership");
+ Notifications.error("Failure", err, "Unable to change volume ownership");
});
}
@@ -68,27 +68,27 @@ function ($scope, $state, Volume, Messages, Pagination, ModalService, Authentica
counter = counter + 1;
Volume.remove({name: volume.Name}, function (d) {
if (d.message) {
- Messages.error("Unable to remove volume", {}, d.message);
+ Notifications.error("Unable to remove volume", {}, d.message);
} else {
if (volume.Metadata && volume.Metadata.ResourceControl) {
ResourceControlService.removeVolumeResourceControl(volume.Metadata.ResourceControl.OwnerId, volume.Name)
.then(function success() {
- Messages.send("Volume deleted", volume.Name);
+ Notifications.success("Volume deleted", volume.Name);
var index = $scope.volumes.indexOf(volume);
$scope.volumes.splice(index, 1);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to remove volume ownership");
+ Notifications.error("Failure", err, "Unable to remove volume ownership");
});
} else {
- Messages.send("Volume deleted", volume.Name);
+ Notifications.success("Volume deleted", volume.Name);
var index = $scope.volumes.indexOf(volume);
$scope.volumes.splice(index, 1);
}
}
complete();
}, function (e) {
- Messages.error("Failure", e, "Unable to remove volume");
+ Notifications.error("Failure", e, "Unable to remove volume");
complete();
});
}
@@ -126,7 +126,7 @@ function ($scope, $state, Volume, Messages, Pagination, ModalService, Authentica
mapUsersToVolumes(data);
})
.catch(function error(err) {
- Messages.error("Failure", err, "Unable to retrieve users");
+ Notifications.error("Failure", err, "Unable to retrieve users");
})
.finally(function final() {
$('#loadVolumesSpinner').hide();
@@ -136,7 +136,7 @@ function ($scope, $state, Volume, Messages, Pagination, ModalService, Authentica
}
}, function (e) {
$('#loadVolumesSpinner').hide();
- Messages.error("Failure", e, "Unable to retrieve volumes");
+ Notifications.error("Failure", e, "Unable to retrieve volumes");
$scope.volumes = [];
});
}
diff --git a/app/services/messages.js b/app/services/messages.js
deleted file mode 100644
index 7ed10b87d..000000000
--- a/app/services/messages.js
+++ /dev/null
@@ -1,40 +0,0 @@
-angular.module('portainer.services')
-.factory('Messages', ['$sanitize', function MessagesFactory($sanitize) {
- 'use strict';
- return {
- send: function (title, text) {
- $.gritter.add({
- title: $sanitize(title),
- text: $sanitize(text),
- time: 2000,
- before_open: function () {
- if ($('.gritter-item-wrapper').length === 3) {
- return false;
- }
- }
- });
- },
- 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;
- }
- $.gritter.add({
- title: $sanitize(title),
- text: $sanitize(msg),
- time: 10000,
- before_open: function () {
- if ($('.gritter-item-wrapper').length === 4) {
- return false;
- }
- }
- });
- }
- };
-}]);
diff --git a/app/services/notifications.js b/app/services/notifications.js
new file mode 100644
index 000000000..20b943a4b
--- /dev/null
+++ b/app/services/notifications.js
@@ -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;
+}]);
diff --git a/assets/css/app.css b/assets/css/app.css
index ed58a6d81..966284973 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -398,3 +398,7 @@ ul.sidebar .sidebar-list .sidebar-sublist a.active {
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,.5), inset 0 0 40px #337ab7;
box-shadow: inset 0 0 1px rgba(0,0,0,.5), inset 0 0 40px #337ab7;
}
+
+#toast-container > div {
+ opacity: 0.9;
+}
diff --git a/assets/js/jquery.gritter.js b/assets/js/jquery.gritter.js
deleted file mode 100755
index 7230a87f0..000000000
--- a/assets/js/jquery.gritter.js
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Gritter for jQuery
- * http://www.boedesign.com/
- *
- * Copyright (c) 2012 Jordan Boesch
- * Dual licensed under the MIT and GPL licenses.
- *
- * Date: February 24, 2012
- * Version: 1.7.4
- */
-
-(function($){
-
- /**
- * Set it up as an object under the jQuery namespace
- */
- $.gritter = {};
-
- /**
- * Set up global options that the user can over-ride
- */
- $.gritter.options = {
- position: '',
- class_name: '', // could be set to 'gritter-light' to use white notifications
- fade_in_speed: 'medium', // how fast notifications fade in
- fade_out_speed: 1000, // how fast the notices fade out
- time: 6000 // hang on the screen for...
- }
-
- /**
- * Add a gritter notification to the screen
- * @see Gritter#add();
- */
- $.gritter.add = function(params){
-
- try {
- return Gritter.add(params || {});
- } catch(e) {
-
- var err = 'Gritter Error: ' + e;
- (typeof(console) != 'undefined' && console.error) ?
- console.error(err, params) :
- alert(err);
-
- }
-
- }
-
- /**
- * Remove a gritter notification from the screen
- * @see Gritter#removeSpecific();
- */
- $.gritter.remove = function(id, params){
- Gritter.removeSpecific(id, params || {});
- }
-
- /**
- * Remove all notifications
- * @see Gritter#stop();
- */
- $.gritter.removeAll = function(params){
- Gritter.stop(params || {});
- }
-
- /**
- * Big fat Gritter object
- * @constructor (not really since its object literal)
- */
- var Gritter = {
-
- // Public - options to over-ride with $.gritter.options in "add"
- position: '',
- fade_in_speed: '',
- fade_out_speed: '',
- time: '',
-
- // Private - no touchy the private parts
- _custom_timer: 0,
- _item_count: 0,
- _is_setup: 0,
- _tpl_close: '
Close Notification',
- _tpl_title: '
[[title]]',
- _tpl_item: '
',
- _tpl_wrap: '
',
-
- /**
- * Add a gritter notification to the screen
- * @param {Object} params The object that contains all the options for drawing the notification
- * @return {Integer} The specific numeric id to that gritter notification
- */
- add: function(params){
- // Handle straight text
- if(typeof(params) == 'string'){
- params = {text:params};
- }
-
- // We might have some issues if we don't have a title or text!
- if(params.text === null){
- throw 'You must supply "text" parameter.';
- }
-
- // Check the options and set them once
- if(!this._is_setup){
- this._runSetup();
- }
-
- // Basics
- var title = params.title,
- text = params.text,
- image = params.image || '',
- sticky = params.sticky || false,
- item_class = params.class_name || $.gritter.options.class_name,
- position = $.gritter.options.position,
- time_alive = params.time || '';
-
- this._verifyWrapper();
-
- this._item_count++;
- var number = this._item_count,
- tmp = this._tpl_item;
-
- // Assign callbacks
- $(['before_open', 'after_open', 'before_close', 'after_close']).each(function(i, val){
- Gritter['_' + val + '_' + number] = ($.isFunction(params[val])) ? params[val] : function(){}
- });
-
- // Reset
- this._custom_timer = 0;
-
- // A custom fade time set
- if(time_alive){
- this._custom_timer = time_alive;
- }
-
- var image_str = (image != '') ? '

' : '',
- class_name = (image != '') ? 'gritter-with-image' : 'gritter-without-image';
-
- // String replacements on the template
- if(title){
- title = this._str_replace('[[title]]',title,this._tpl_title);
- }else{
- title = '';
- }
-
- tmp = this._str_replace(
- ['[[title]]', '[[text]]', '[[close]]', '[[image]]', '[[number]]', '[[class_name]]', '[[item_class]]'],
- [title, text, this._tpl_close, image_str, this._item_count, class_name, item_class], tmp
- );
-
- // If it's false, don't show another gritter message
- if(this['_before_open_' + number]() === false){
- return false;
- }
-
- $('#gritter-notice-wrapper').addClass(position).append(tmp);
-
- var item = $('#gritter-item-' + this._item_count);
-
- item.fadeIn(this.fade_in_speed, function(){
- Gritter['_after_open_' + number]($(this));
- });
-
- if(!sticky){
- this._setFadeTimer(item, number);
- }
-
- // Bind the hover/unhover states
- $(item).bind('mouseenter mouseleave', function(event){
- if(event.type == 'mouseenter'){
- if(!sticky){
- Gritter._restoreItemIfFading($(this), number);
- }
- }
- else {
- if(!sticky){
- Gritter._setFadeTimer($(this), number);
- }
- }
- Gritter._hoverState($(this), event.type);
- });
-
- // Clicking (X) makes the perdy thing close
- $(item).find('.gritter-close').click(function(){
- Gritter.removeSpecific(number, {}, null, true);
- return false;
- });
-
- return number;
-
- },
-
- /**
- * If we don't have any more gritter notifications, get rid of the wrapper using this check
- * @private
- * @param {Integer} unique_id The ID of the element that was just deleted, use it for a callback
- * @param {Object} e The jQuery element that we're going to perform the remove() action on
- * @param {Boolean} manual_close Did we close the gritter dialog with the (X) button
- */
- _countRemoveWrapper: function(unique_id, e, manual_close){
-
- // Remove it then run the callback function
- e.remove();
- this['_after_close_' + unique_id](e, manual_close);
-
- // Check if the wrapper is empty, if it is.. remove the wrapper
- if($('.gritter-item-wrapper').length == 0){
- $('#gritter-notice-wrapper').remove();
- }
-
- },
-
- /**
- * Fade out an element after it's been on the screen for x amount of time
- * @private
- * @param {Object} e The jQuery element to get rid of
- * @param {Integer} unique_id The id of the element to remove
- * @param {Object} params An optional list of params to set fade speeds etc.
- * @param {Boolean} unbind_events Unbind the mouseenter/mouseleave events if they click (X)
- */
- _fade: function(e, unique_id, params, unbind_events){
-
- var params = params || {},
- fade = (typeof(params.fade) != 'undefined') ? params.fade : true,
- fade_out_speed = params.speed || this.fade_out_speed,
- manual_close = unbind_events;
-
- this['_before_close_' + unique_id](e, manual_close);
-
- // If this is true, then we are coming from clicking the (X)
- if(unbind_events){
- e.unbind('mouseenter mouseleave');
- }
-
- // Fade it out or remove it
- if(fade){
-
- e.animate({
- opacity: 0
- }, fade_out_speed, function(){
- e.animate({ height: 0 }, 300, function(){
- Gritter._countRemoveWrapper(unique_id, e, manual_close);
- })
- })
-
- }
- else {
-
- this._countRemoveWrapper(unique_id, e);
-
- }
-
- },
-
- /**
- * Perform actions based on the type of bind (mouseenter, mouseleave)
- * @private
- * @param {Object} e The jQuery element
- * @param {String} type The type of action we're performing: mouseenter or mouseleave
- */
- _hoverState: function(e, type){
-
- // Change the border styles and add the (X) close button when you hover
- if(type == 'mouseenter'){
-
- e.addClass('hover');
-
- // Show close button
- e.find('.gritter-close').show();
-
- }
- // Remove the border styles and hide (X) close button when you mouse out
- else {
-
- e.removeClass('hover');
-
- // Hide close button
- e.find('.gritter-close').hide();
-
- }
-
- },
-
- /**
- * Remove a specific notification based on an ID
- * @param {Integer} unique_id The ID used to delete a specific notification
- * @param {Object} params A set of options passed in to determine how to get rid of it
- * @param {Object} e The jQuery element that we're "fading" then removing
- * @param {Boolean} unbind_events If we clicked on the (X) we set this to true to unbind mouseenter/mouseleave
- */
- removeSpecific: function(unique_id, params, e, unbind_events){
-
- if(!e){
- var e = $('#gritter-item-' + unique_id);
- }
-
- // We set the fourth param to let the _fade function know to
- // unbind the "mouseleave" event. Once you click (X) there's no going back!
- this._fade(e, unique_id, params || {}, unbind_events);
-
- },
-
- /**
- * If the item is fading out and we hover over it, restore it!
- * @private
- * @param {Object} e The HTML element to remove
- * @param {Integer} unique_id The ID of the element
- */
- _restoreItemIfFading: function(e, unique_id){
-
- clearTimeout(this['_int_id_' + unique_id]);
- e.stop().css({ opacity: '', height: '' });
-
- },
-
- /**
- * Setup the global options - only once
- * @private
- */
- _runSetup: function(){
-
- for(var opt in $.gritter.options){
- this[opt] = $.gritter.options[opt];
- }
- this._is_setup = 1;
-
- },
-
- /**
- * Set the notification to fade out after a certain amount of time
- * @private
- * @param {Object} item The HTML element we're dealing with
- * @param {Integer} unique_id The ID of the element
- */
- _setFadeTimer: function(e, unique_id){
-
- var timer_str = (this._custom_timer) ? this._custom_timer : this.time;
- this['_int_id_' + unique_id] = setTimeout(function(){
- Gritter._fade(e, unique_id);
- }, timer_str);
-
- },
-
- /**
- * Bring everything to a halt
- * @param {Object} params A list of callback functions to pass when all notifications are removed
- */
- stop: function(params){
-
- // callbacks (if passed)
- var before_close = ($.isFunction(params.before_close)) ? params.before_close : function(){};
- var after_close = ($.isFunction(params.after_close)) ? params.after_close : function(){};
-
- var wrap = $('#gritter-notice-wrapper');
- before_close(wrap);
- wrap.fadeOut(function(){
- $(this).remove();
- after_close();
- });
-
- },
-
- /**
- * An extremely handy PHP function ported to JS, works well for templating
- * @private
- * @param {String/Array} search A list of things to search for
- * @param {String/Array} replace A list of things to replace the searches with
- * @return {String} sa The output
- */
- _str_replace: function(search, replace, subject, count){
-
- var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
- f = [].concat(search),
- r = [].concat(replace),
- s = subject,
- ra = r instanceof Array, sa = s instanceof Array;
- s = [].concat(s);
-
- if(count){
- this.window[count] = 0;
- }
-
- for(i = 0, sl = s.length; i < sl; i++){
-
- if(s[i] === ''){
- continue;
- }
-
- for (j = 0, fl = f.length; j < fl; j++){
-
- temp = s[i] + '';
- repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
- s[i] = (temp).split(f[j]).join(repl);
-
- if(count && s[i] !== temp){
- this.window[count] += (temp.length-s[i].length) / f[j].length;
- }
-
- }
- }
-
- return sa ? s : s[0];
-
- },
-
- /**
- * A check to make sure we have something to wrap our notices with
- * @private
- */
- _verifyWrapper: function(){
-
- if($('#gritter-notice-wrapper').length == 0){
- $('body').append(this._tpl_wrap);
- }
-
- }
-
- }
-
-})(jQuery);
diff --git a/bower.json b/bower.json
index 7bb9b5a25..ced5b086c 100644
--- a/bower.json
+++ b/bower.json
@@ -40,7 +40,6 @@
"bootstrap": "~3.3.6",
"filesize": "~3.3.0",
"jquery": "1.11.1",
- "jquery.gritter": "1.7.4",
"lodash": "4.12.0",
"rdash-ui": "1.0.*",
"moment": "~2.14.1",
@@ -48,7 +47,8 @@
"font-awesome": "~4.7.0",
"ng-file-upload": "~12.2.13",
"splitargs": "~0.2.0",
- "bootbox.js": "bootbox#^4.4.0"
+ "bootbox.js": "bootbox#^4.4.0",
+ "toastr": "~2.1.3"
},
"resolutions": {
"angular": "1.5.5"
diff --git a/gruntfile.js b/gruntfile.js
index f4891ec0b..0435e2675 100644
--- a/gruntfile.js
+++ b/gruntfile.js
@@ -140,7 +140,7 @@ module.exports = function (grunt) {
'bower_components/moment/min/moment.min.js',
'bower_components/xterm.js/dist/xterm.js',
'bower_components/bootbox.js/bootbox.js',
- 'assets/js/jquery.gritter.js', // Using custom version to fix error in minified build due to "use strict"
+ 'bower_components/toastr/toastr.min.js',
'assets/js/legend.js' // Not a bower package
],
html: ['index.html'],
@@ -148,11 +148,11 @@ module.exports = function (grunt) {
css: ['assets/css/app.css'],
cssVendor: [
'bower_components/bootstrap/dist/css/bootstrap.css',
- 'bower_components/jquery.gritter/css/jquery.gritter.css',
'bower_components/font-awesome/css/font-awesome.min.css',
'bower_components/rdash-ui/dist/css/rdash.min.css',
'bower_components/angular-ui-select/dist/select.min.css',
- 'bower_components/xterm.js/dist/xterm.css'
+ 'bower_components/xterm.js/dist/xterm.css',
+ 'bower_components/toastr/toastr.min.css'
]
},
clean: {
@@ -211,12 +211,6 @@ module.exports = function (grunt) {
{dest: '<%= distdir %>/fonts/', src: '*.{ttf,woff,woff2,eof,svg}', expand: true, cwd: 'bower_components/bootstrap/fonts/'},
{dest: '<%= distdir %>/fonts/', src: '*.{ttf,woff,woff2,eof,svg}', expand: true, cwd: 'bower_components/font-awesome/fonts/'},
{dest: '<%= distdir %>/fonts/', src: '*.{ttf,woff,woff2,eof,svg}', expand: true, cwd: 'bower_components/rdash-ui/dist/fonts/'},
- {
- dest: '<%= distdir %>/images/',
- src: ['**', '!trees.jpg'],
- expand: true,
- cwd: 'bower_components/jquery.gritter/images/'
- },
{
dest: '<%= distdir %>/images/',
src: ['**'],