1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 21:39:40 +02:00
portainer/js/controllers.js

93 lines
2.2 KiB
JavaScript
Raw Normal View History

2013-06-08 16:20:29 -09:00
function MastheadController($scope) {
$scope.template = 'partials/masthead.html';
$scope.hclass = 'active';
$scope.cclass = '';
$scope.iclass = '';
$scope.sclass = '';
$scope.linkChange = function(link) {
$scope.hclass = '';
2013-06-08 15:12:14 -09:00
$scope.cclass = '';
$scope.iclass = '';
$scope.sclass = '';
2013-06-08 16:20:29 -09:00
switch(link) {
case 'home':
$scope.hclass = 'active';
break;
case 'containers':
$scope.cclass = 'active';
break;
case 'images':
$scope.iclass = 'active';
break;
case 'settings':
$scope.sclass = 'active';
break;
default:
console.log('Not supported:' + link);
}
};
}
function SideBarController($scope, Container) {
$scope.template = 'partials/sidebar.html';
Container.query({}, function(d) {
$scope.containers = d;
});
}
function HomeController() {
}
function SettingsController() {
}
function ContainerController($scope, $routeParams, Container) {
$scope.start = function(){
Container.start({id: $routeParams.id}, function(d) {
$scope.response = d;
});
2013-06-08 15:12:14 -09:00
};
2013-06-08 16:20:29 -09:00
$scope.stop = function() {
Container.stop({id: $routeParams.id}, function(d) {
$scope.response = d;
2013-06-08 15:12:14 -09:00
});
};
2013-06-08 16:20:29 -09:00
$scope.remove = function() {
if (confirm("Are you sure you want to remove the container?")) {
Container.remove({id: $routeParams.id}, function(d) {
$scope.response = d;
2013-06-08 15:12:14 -09:00
});
}
};
2013-06-08 16:20:29 -09:00
$scope.changes = [];
$scope.getChanges = function() {
Container.changes({id: $routeParams.id}, function(d) {
$scope.changes = d;
2013-06-08 15:12:14 -09:00
});
2013-06-08 16:20:29 -09:00
};
Container.get({id: $routeParams.id}, function(d) {
$scope.container = d;
});
$scope.getChanges();
}
function ContainersController($scope, Container) {
Container.query({}, function(d) {
$scope.containers = d;
});
}