mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
Initial commit
This commit is contained in:
commit
bec8f53386
218 changed files with 55344 additions and 0 deletions
108
js/controllers.ts
Normal file
108
js/controllers.ts
Normal file
|
@ -0,0 +1,108 @@
|
|||
|
||||
class MastheadController {
|
||||
constructor($scope: any) {
|
||||
$scope.template = 'partials/masthead.html';
|
||||
|
||||
$scope.hclass = 'active';
|
||||
$scope.cclass = '';
|
||||
$scope.iclass = '';
|
||||
$scope.sclass = '';
|
||||
|
||||
$scope.linkChange = (link: string) => {
|
||||
$scope.hclass = '';
|
||||
$scope.cclass = '';
|
||||
$scope.iclass = '';
|
||||
$scope.sclass = '';
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class SideBarController {
|
||||
constructor($scope: any, Container: any) {
|
||||
$scope.template = 'partials/sidebar.html';
|
||||
|
||||
Container.query({}, (d) => {
|
||||
$scope.containers = d;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class HomeController {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsController {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class ContainerControllerBase {
|
||||
//Start the current container
|
||||
start($scope: any, $routeParams: any, Container: any) {
|
||||
Container.start({id: $routeParams.id}, (d) => {
|
||||
$scope.response = d;
|
||||
});
|
||||
}
|
||||
|
||||
//Stop the current container
|
||||
stop($scope: any, $routeParams: any, Container: any) {
|
||||
Container.stop({id: $routeParams.id}, (d) => {
|
||||
$scope.response = d;
|
||||
});
|
||||
}
|
||||
|
||||
//Remove the current container
|
||||
remove($scope: any, $routeParams: any, Container: any) {
|
||||
if (confirm("Are you sure you want to remove the container?")) {
|
||||
Container.remove({id: $routeParams.id}, (d) => {
|
||||
$scope.response = d;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ContainerController extends ContainerControllerBase {
|
||||
constructor($scope: any, $routeParams: any, Container: any) {
|
||||
super();
|
||||
$scope.start = () => this.start($scope, $routeParams, Container);
|
||||
$scope.stop = () => this.stop($scope, $routeParams, Container);
|
||||
$scope.remove = () => this.remove($scope, $routeParams, Container);
|
||||
|
||||
Container.get({id: $routeParams.id}, (d) => {
|
||||
$scope.container = d;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class ContainersController extends ContainerControllerBase {
|
||||
constructor($scope: any, $routeParams: any, Container: any) {
|
||||
super();
|
||||
$scope.start = () => this.start($scope, $routeParams, Container);
|
||||
$scope.stop = () => this.stop($scope, $routeParams, Container);
|
||||
|
||||
Container.query({}, (d) => {
|
||||
$scope.containers = d;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue