mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
feat(global): multi endpoint management (#407)
This commit is contained in:
parent
a08ea134fc
commit
d54d30a7be
47 changed files with 1837 additions and 161 deletions
|
@ -1,10 +1,38 @@
|
|||
angular.module('sidebar', [])
|
||||
.controller('SidebarController', ['$scope', 'Settings', 'Config', 'Info',
|
||||
function ($scope, Settings, Config, Info) {
|
||||
.controller('SidebarController', ['$scope', '$state', 'Settings', 'Config', 'EndpointService', 'EndpointMode', 'Messages',
|
||||
function ($scope, $state, Settings, Config, EndpointService, EndpointMode, Messages) {
|
||||
|
||||
Config.$promise.then(function (c) {
|
||||
$scope.logo = c.logo;
|
||||
});
|
||||
|
||||
$scope.uiVersion = Settings.uiVersion;
|
||||
|
||||
$scope.switchEndpoint = function(endpoint) {
|
||||
EndpointService.setActive(endpoint.Id).then(function success(data) {
|
||||
EndpointMode.determineEndpointMode();
|
||||
$state.reload();
|
||||
}, function error(err) {
|
||||
Messages.error("Failure", err, "Unable to switch to new endpoint");
|
||||
});
|
||||
};
|
||||
|
||||
function fetchEndpoints() {
|
||||
EndpointService.endpoints().then(function success(data) {
|
||||
$scope.endpoints = data;
|
||||
EndpointService.getActive().then(function success(data) {
|
||||
angular.forEach($scope.endpoints, function (endpoint) {
|
||||
if (endpoint.Id === data.Id) {
|
||||
$scope.activeEndpoint = endpoint;
|
||||
}
|
||||
});
|
||||
}, function error(err) {
|
||||
Messages.error("Failure", err, "Unable to retrieve active endpoint");
|
||||
});
|
||||
}, function error(err) {
|
||||
$scope.endpoints = [];
|
||||
});
|
||||
}
|
||||
|
||||
fetchEndpoints();
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue