mirror of
https://github.com/portainer/portainer.git
synced 2025-07-21 06:19:41 +02:00
feat(notifications): replace gritter with toastr (#793)
This commit is contained in:
parent
8e8b0578b2
commit
f15cf3e8be
38 changed files with 277 additions and 728 deletions
|
@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue