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