mirror of https://github.com/portainer/portainer
				
				
				
			Merge branch 'javascript' into dev
						commit
						f98116c5a5
					
				
							
								
								
									
										10
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										10
									
								
								Makefile
								
								
								
								
							| 
						 | 
				
			
			@ -1,15 +1,9 @@
 | 
			
		|||
REF = HEAD
 | 
			
		||||
VERSION = $(shell git describe --always $(REF))
 | 
			
		||||
 | 
			
		||||
all: ts less
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm js/*.js
 | 
			
		||||
 | 
			
		||||
ts:
 | 
			
		||||
	tsc js/*.ts
 | 
			
		||||
all: less
 | 
			
		||||
 | 
			
		||||
less:
 | 
			
		||||
	less css/*.less > css/app.css
 | 
			
		||||
 | 
			
		||||
.PHONY: all clean hash ts less
 | 
			
		||||
.PHONY: all less
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,6 @@ Open js/app.(ts/js - js file if you don't want to compile typescript) and change
 | 
			
		|||
* Angular.js
 | 
			
		||||
* Less
 | 
			
		||||
* Flatstrap ( Flat Twitter Bootstrap )
 | 
			
		||||
* Typescript ( I'm debating if this is providing any value. )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
###License - MIT
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										46
									
								
								js/app.js
								
								
								
								
							
							
						
						
									
										46
									
								
								js/app.js
								
								
								
								
							| 
						 | 
				
			
			@ -1,35 +1,13 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
angular.module('dockerui', [
 | 
			
		||||
    'dockerui.services', 
 | 
			
		||||
    'dockerui.filters'
 | 
			
		||||
]).config([
 | 
			
		||||
    '$routeProvider', 
 | 
			
		||||
    function ($routeProvider) {
 | 
			
		||||
        $routeProvider.when('/', {
 | 
			
		||||
            templateUrl: 'partials/home.html',
 | 
			
		||||
            controller: 'HomeController'
 | 
			
		||||
        });
 | 
			
		||||
        $routeProvider.when('/containers/', {
 | 
			
		||||
            templateUrl: 'partials/containers.html',
 | 
			
		||||
            controller: 'ContainersController'
 | 
			
		||||
        });
 | 
			
		||||
        $routeProvider.when('/containers/:id/', {
 | 
			
		||||
            templateUrl: 'partials/container.html',
 | 
			
		||||
            controller: 'ContainerController'
 | 
			
		||||
        });
 | 
			
		||||
        $routeProvider.when('/images/', {
 | 
			
		||||
            templateUrl: 'partials/images.html',
 | 
			
		||||
            controller: 'ImagesController'
 | 
			
		||||
        });
 | 
			
		||||
        $routeProvider.when('/images/:id/', {
 | 
			
		||||
            templateUrl: 'partials/image.html',
 | 
			
		||||
            controller: 'ImageController'
 | 
			
		||||
        });
 | 
			
		||||
        $routeProvider.when('/settings', {
 | 
			
		||||
            templateUrl: 'partials/settings.html',
 | 
			
		||||
            controller: 'SettingsController'
 | 
			
		||||
        });
 | 
			
		||||
        $routeProvider.otherwise({
 | 
			
		||||
            redirectTo: '/'
 | 
			
		||||
        });
 | 
			
		||||
    }]).constant('DOCKER_ENDPOINT', 'http://192.168.1.9:4243\:4243');
 | 
			
		||||
 | 
			
		||||
angular.module('dockerui', ['dockerui.services', 'dockerui.filters'])
 | 
			
		||||
    .config(['$routeProvider', function ($routeProvider) {
 | 
			
		||||
        $routeProvider.when('/', {templateUrl: 'partials/home.html', controller: 'HomeController'});
 | 
			
		||||
        $routeProvider.when('/containers/', {templateUrl: 'partials/containers.html', controller: 'ContainersController'});
 | 
			
		||||
        $routeProvider.when('/containers/:id/', {templateUrl: 'partials/container.html', controller: 'ContainerController'});
 | 
			
		||||
        $routeProvider.when('/images/', {templateUrl: 'partials/images.html', controller: 'ImagesController'});
 | 
			
		||||
        $routeProvider.when('/images/:id/', {templateUrl: 'partials/image.html', controller: 'ImageController'});
 | 
			
		||||
        $routeProvider.when('/settings', {templateUrl: 'partials/settings.html', controller: 'SettingsController'});
 | 
			
		||||
        $routeProvider.otherwise({redirectTo: '/'});
 | 
			
		||||
    }])
 | 
			
		||||
    .constant('DOCKER_ENDPOINT', 'http://192.168.1.9:4243\:4243');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								js/app.ts
								
								
								
								
							
							
						
						
									
										16
									
								
								js/app.ts
								
								
								
								
							| 
						 | 
				
			
			@ -1,16 +0,0 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
declare var angular: any;
 | 
			
		||||
 | 
			
		||||
angular.module('dockerui', ['dockerui.services', 'dockerui.filters'])
 | 
			
		||||
    .config([<any>'$routeProvider', ($routeProvider: any) => {
 | 
			
		||||
        $routeProvider.when('/', {templateUrl: 'partials/home.html', controller: 'HomeController'});
 | 
			
		||||
        $routeProvider.when('/containers/', {templateUrl: 'partials/containers.html', controller: 'ContainersController'});
 | 
			
		||||
        $routeProvider.when('/containers/:id/', {templateUrl: 'partials/container.html', controller: 'ContainerController'});
 | 
			
		||||
        $routeProvider.when('/images/', {templateUrl: 'partials/images.html', controller: 'ImagesController'});
 | 
			
		||||
        $routeProvider.when('/images/:id/', {templateUrl: 'partials/image.html', controller: 'ImageController'});
 | 
			
		||||
        $routeProvider.when('/settings', {templateUrl: 'partials/settings.html', controller: 'SettingsController'});
 | 
			
		||||
        $routeProvider.otherwise({redirectTo: '/'});
 | 
			
		||||
    }])
 | 
			
		||||
    .constant('DOCKER_ENDPOINT', 'http://192.168.1.9:4243\:4243');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,133 +1,92 @@
 | 
			
		|||
var __extends = this.__extends || function (d, b) {
 | 
			
		||||
    function __() { this.constructor = d; }
 | 
			
		||||
    __.prototype = b.prototype;
 | 
			
		||||
    d.prototype = new __();
 | 
			
		||||
};
 | 
			
		||||
var MastheadController = (function () {
 | 
			
		||||
    function MastheadController($scope) {
 | 
			
		||||
        $scope.template = 'partials/masthead.html';
 | 
			
		||||
        $scope.hclass = 'active';
 | 
			
		||||
 | 
			
		||||
function MastheadController($scope) {
 | 
			
		||||
    $scope.template = 'partials/masthead.html';
 | 
			
		||||
 | 
			
		||||
    $scope.hclass = 'active';
 | 
			
		||||
    $scope.cclass = '';
 | 
			
		||||
    $scope.iclass = '';
 | 
			
		||||
    $scope.sclass = '';
 | 
			
		||||
 | 
			
		||||
    $scope.linkChange = function(link) {
 | 
			
		||||
        $scope.hclass = '';
 | 
			
		||||
        $scope.cclass = '';
 | 
			
		||||
        $scope.iclass = '';
 | 
			
		||||
        $scope.sclass = '';
 | 
			
		||||
        $scope.linkChange = function (link) {
 | 
			
		||||
            $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);
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    return MastheadController;
 | 
			
		||||
})();
 | 
			
		||||
var SideBarController = (function () {
 | 
			
		||||
    function SideBarController($scope, Container) {
 | 
			
		||||
        $scope.template = 'partials/sidebar.html';
 | 
			
		||||
        Container.query({
 | 
			
		||||
        }, function (d) {
 | 
			
		||||
            $scope.containers = d;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    return SideBarController;
 | 
			
		||||
})();
 | 
			
		||||
var HomeController = (function () {
 | 
			
		||||
    function HomeController() {
 | 
			
		||||
    }
 | 
			
		||||
    return HomeController;
 | 
			
		||||
})();
 | 
			
		||||
var SettingsController = (function () {
 | 
			
		||||
    function SettingsController() {
 | 
			
		||||
    }
 | 
			
		||||
    return SettingsController;
 | 
			
		||||
})();
 | 
			
		||||
var ContainerControllerBase = (function () {
 | 
			
		||||
    function ContainerControllerBase() { }
 | 
			
		||||
    ContainerControllerBase.prototype.start = function ($scope, $routeParams, Container) {
 | 
			
		||||
        Container.start({
 | 
			
		||||
            id: $routeParams.id
 | 
			
		||||
        }, function (d) {
 | 
			
		||||
 | 
			
		||||
        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;        
 | 
			
		||||
        });     
 | 
			
		||||
    };
 | 
			
		||||
    ContainerControllerBase.prototype.stop = function ($scope, $routeParams, Container) {
 | 
			
		||||
        Container.stop({
 | 
			
		||||
            id: $routeParams.id
 | 
			
		||||
        }, function (d) {
 | 
			
		||||
 | 
			
		||||
    $scope.stop = function() {
 | 
			
		||||
        Container.stop({id: $routeParams.id}, function(d) {
 | 
			
		||||
            $scope.response = d;        
 | 
			
		||||
        });
 | 
			
		||||
    };
 | 
			
		||||
    ContainerControllerBase.prototype.remove = function ($scope, $routeParams, Container) {
 | 
			
		||||
        if(confirm("Are you sure you want to remove the container?")) {
 | 
			
		||||
            Container.remove({
 | 
			
		||||
                id: $routeParams.id
 | 
			
		||||
            }, function (d) {
 | 
			
		||||
 | 
			
		||||
    $scope.remove = function() {
 | 
			
		||||
        if (confirm("Are you sure you want to remove the container?")) {
 | 
			
		||||
            Container.remove({id: $routeParams.id}, function(d) {
 | 
			
		||||
                $scope.response = d; 
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    return ContainerControllerBase;
 | 
			
		||||
})();
 | 
			
		||||
var ContainerController = (function (_super) {
 | 
			
		||||
    __extends(ContainerController, _super);
 | 
			
		||||
    function ContainerController($scope, $routeParams, Container) {
 | 
			
		||||
        var _this = this;
 | 
			
		||||
        _super.call(this);
 | 
			
		||||
        $scope.start = function () {
 | 
			
		||||
            return _this.start($scope, $routeParams, Container);
 | 
			
		||||
        };
 | 
			
		||||
        $scope.stop = function () {
 | 
			
		||||
            return _this.stop($scope, $routeParams, Container);
 | 
			
		||||
        };
 | 
			
		||||
        $scope.remove = function () {
 | 
			
		||||
            return _this.remove($scope, $routeParams, Container);
 | 
			
		||||
        };
 | 
			
		||||
        $scope.changes = [];
 | 
			
		||||
        $scope.getChanges = function () {
 | 
			
		||||
            Container.changes({
 | 
			
		||||
                id: $routeParams.id
 | 
			
		||||
            }, function (d) {
 | 
			
		||||
                $scope.changes = d;
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
        Container.get({
 | 
			
		||||
            id: $routeParams.id
 | 
			
		||||
        }, function (d) {
 | 
			
		||||
            $scope.container = d;
 | 
			
		||||
 | 
			
		||||
    $scope.changes = [];
 | 
			
		||||
 | 
			
		||||
    $scope.getChanges = function() {
 | 
			
		||||
        Container.changes({id: $routeParams.id}, function(d) {
 | 
			
		||||
            $scope.changes = d;        
 | 
			
		||||
        });
 | 
			
		||||
        $scope.getChanges();
 | 
			
		||||
    }
 | 
			
		||||
    return ContainerController;
 | 
			
		||||
})(ContainerControllerBase);
 | 
			
		||||
var ContainersController = (function (_super) {
 | 
			
		||||
    __extends(ContainersController, _super);
 | 
			
		||||
    function ContainersController($scope, $routeParams, Container) {
 | 
			
		||||
        var _this = this;
 | 
			
		||||
        _super.call(this);
 | 
			
		||||
        $scope.start = function () {
 | 
			
		||||
            return _this.start($scope, $routeParams, Container);
 | 
			
		||||
        };
 | 
			
		||||
        $scope.stop = function () {
 | 
			
		||||
            return _this.stop($scope, $routeParams, Container);
 | 
			
		||||
        };
 | 
			
		||||
        Container.query({
 | 
			
		||||
        }, function (d) {
 | 
			
		||||
            $scope.containers = d;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    return ContainersController;
 | 
			
		||||
})(ContainerControllerBase);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    Container.get({id: $routeParams.id}, function(d) {
 | 
			
		||||
        $scope.container = d;        
 | 
			
		||||
   }); 
 | 
			
		||||
 | 
			
		||||
   $scope.getChanges();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function ContainersController($scope, Container) {
 | 
			
		||||
    Container.query({}, function(d) {
 | 
			
		||||
        $scope.containers = d;        
 | 
			
		||||
   }); 
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,117 +0,0 @@
 | 
			
		|||
 | 
			
		||||
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);
 | 
			
		||||
        $scope.changes = [];
 | 
			
		||||
 | 
			
		||||
        $scope.getChanges = () => {
 | 
			
		||||
            Container.changes({id: $routeParams.id}, (d) => {
 | 
			
		||||
                $scope.changes = d;        
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        Container.get({id: $routeParams.id}, (d) => {
 | 
			
		||||
            $scope.container = d;        
 | 
			
		||||
       }); 
 | 
			
		||||
 | 
			
		||||
       $scope.getChanges();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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;        
 | 
			
		||||
       }); 
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,30 +1,27 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
angular.module('dockerui.filters', []).filter('truncate', function () {
 | 
			
		||||
    return function (text, length, end) {
 | 
			
		||||
        if(isNaN(length)) {
 | 
			
		||||
            length = 10;
 | 
			
		||||
        }
 | 
			
		||||
        if(end === undefined) {
 | 
			
		||||
            end = "...";
 | 
			
		||||
        }
 | 
			
		||||
        if(text.length <= length || text.length - end.length <= length) {
 | 
			
		||||
            return text;
 | 
			
		||||
        } else {
 | 
			
		||||
            return String(text).substring(0, length - end.length) + end;
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}).filter('statusbadge', function () {
 | 
			
		||||
    return function (text) {
 | 
			
		||||
        if(text === 'Ghost') {
 | 
			
		||||
            return 'important';
 | 
			
		||||
        }
 | 
			
		||||
        return 'success';
 | 
			
		||||
    };
 | 
			
		||||
}).filter('isactive', function ($location) {
 | 
			
		||||
    return function (text) {
 | 
			
		||||
        if(text == $location) {
 | 
			
		||||
            return 'active';
 | 
			
		||||
        }
 | 
			
		||||
        return '';
 | 
			
		||||
    };
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
angular.module('dockerui.filters', [])
 | 
			
		||||
    .filter('truncate', function() {
 | 
			
		||||
        return function(text, length, end) {
 | 
			
		||||
            if (isNaN(length))
 | 
			
		||||
                length = 10;
 | 
			
		||||
 | 
			
		||||
            if (end === undefined)
 | 
			
		||||
                end = "...";
 | 
			
		||||
 | 
			
		||||
            if (text.length <= length || text.length - end.length <= length) {
 | 
			
		||||
                return text;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                return String(text).substring(0, length-end.length) + end;
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
    })
 | 
			
		||||
    .filter('statusbadge', function() {
 | 
			
		||||
        return function(text) {
 | 
			
		||||
            if (text === 'Ghost') {
 | 
			
		||||
                return 'important';
 | 
			
		||||
            }
 | 
			
		||||
            return 'success';
 | 
			
		||||
        };
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,38 +0,0 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
declare var angular: any;
 | 
			
		||||
 | 
			
		||||
angular.module('dockerui.filters', [])
 | 
			
		||||
    .filter('truncate', () => {
 | 
			
		||||
        return (text: string, length:any, end:string) => {
 | 
			
		||||
            if (isNaN(length))
 | 
			
		||||
                length = 10;
 | 
			
		||||
 | 
			
		||||
            if (end === undefined)
 | 
			
		||||
                end = "...";
 | 
			
		||||
 | 
			
		||||
            if (text.length <= length || text.length - end.length <= length) {
 | 
			
		||||
                return text;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                return String(text).substring(0, length-end.length) + end;
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
    })
 | 
			
		||||
    .filter('statusbadge', () => {
 | 
			
		||||
        return (text: string) => {
 | 
			
		||||
            if (text === 'Ghost') {
 | 
			
		||||
                return 'important';
 | 
			
		||||
            }
 | 
			
		||||
            return 'success';
 | 
			
		||||
        };
 | 
			
		||||
    })
 | 
			
		||||
    .filter('isactive', ($location: any) => {
 | 
			
		||||
        return (text: string) => {
 | 
			
		||||
            if (text == $location) {
 | 
			
		||||
                return 'active';
 | 
			
		||||
            }
 | 
			
		||||
            return '';
 | 
			
		||||
        };
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										153
									
								
								js/services.js
								
								
								
								
							
							
						
						
									
										153
									
								
								js/services.js
								
								
								
								
							| 
						 | 
				
			
			@ -1,124 +1,33 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
angular.module('dockerui.services', [
 | 
			
		||||
    'ngResource'
 | 
			
		||||
]).factory('Container', function ($resource, DOCKER_ENDPOINT) {
 | 
			
		||||
    return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', {
 | 
			
		||||
    }, {
 | 
			
		||||
        query: {
 | 
			
		||||
            method: 'GET',
 | 
			
		||||
            params: {
 | 
			
		||||
                all: 0,
 | 
			
		||||
                action: 'json'
 | 
			
		||||
            },
 | 
			
		||||
            isArray: true
 | 
			
		||||
        },
 | 
			
		||||
        get: {
 | 
			
		||||
            method: 'GET',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'json'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        start: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'start'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        stop: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                t: 5,
 | 
			
		||||
                action: 'stop'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        restart: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                t: 5,
 | 
			
		||||
                action: 'restart'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        kill: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'kill'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        changes: {
 | 
			
		||||
            method: 'GET',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'changes'
 | 
			
		||||
            },
 | 
			
		||||
            isArray: true
 | 
			
		||||
        },
 | 
			
		||||
        create: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'create'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        remove: {
 | 
			
		||||
            method: 'DELETE',
 | 
			
		||||
            params: {
 | 
			
		||||
                v: 0
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
angular.module('dockerui.services', ['ngResource'])
 | 
			
		||||
    .factory('Container', function($resource, DOCKER_ENDPOINT) {
 | 
			
		||||
        // Resource for interacting with the docker containers
 | 
			
		||||
        // http://docs.docker.io/en/latest/api/docker_remote_api.html#containers
 | 
			
		||||
        return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', {}, {
 | 
			
		||||
            query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
 | 
			
		||||
            get :{method: 'GET', params: { action:'json'}},
 | 
			
		||||
            start: {method: 'POST', params: { action: 'start'}},
 | 
			
		||||
            stop: {method: 'POST', params: {t: 5, action: 'stop'}},
 | 
			
		||||
            restart: {method: 'POST', params: {t: 5, action: 'restart' }},
 | 
			
		||||
            kill :{method: 'POST', params: {action:'kill'}},
 | 
			
		||||
            changes :{method: 'GET', params: {action:'changes'}, isArray: true},
 | 
			
		||||
            create :{method: 'POST', params: {action:'create'}},
 | 
			
		||||
            remove :{method: 'DELETE', params: {v:0}}
 | 
			
		||||
        });
 | 
			
		||||
    })
 | 
			
		||||
    .factory('Image', function($resource, DOCKER_ENDPOINT) {
 | 
			
		||||
        // Resource for docker images
 | 
			
		||||
        // http://docs.docker.io/en/latest/api/docker_remote_api.html#images
 | 
			
		||||
        return $resource(DOCKER_ENDPOINT + '/images/:name/:action', {}, {
 | 
			
		||||
            query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
 | 
			
		||||
            get :{method: 'GET', params: { action:'json'}},
 | 
			
		||||
            search :{method: 'GET', params: { action:'search'}},
 | 
			
		||||
            history :{method: 'GET', params: { action:'history'}},
 | 
			
		||||
            create :{method: 'POST', params: {action:'create'}},
 | 
			
		||||
            insert :{method: 'POST', params: {action:'insert'}},
 | 
			
		||||
            push :{method: 'POST', params: {action:'push'}},
 | 
			
		||||
            tag :{method: 'POST', params: {action:'tag'}},
 | 
			
		||||
            delete :{method: 'DELETE'}
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}).factory('Image', function ($resource, DOCKER_ENDPOINT) {
 | 
			
		||||
    return $resource(DOCKER_ENDPOINT + '/images/:name/:action', {
 | 
			
		||||
    }, {
 | 
			
		||||
        query: {
 | 
			
		||||
            method: 'GET',
 | 
			
		||||
            params: {
 | 
			
		||||
                all: 0,
 | 
			
		||||
                action: 'json'
 | 
			
		||||
            },
 | 
			
		||||
            isArray: true
 | 
			
		||||
        },
 | 
			
		||||
        get: {
 | 
			
		||||
            method: 'GET',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'json'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        search: {
 | 
			
		||||
            method: 'GET',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'search'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        history: {
 | 
			
		||||
            method: 'GET',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'history'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        create: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'create'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        insert: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'insert'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        push: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'push'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        tag: {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            params: {
 | 
			
		||||
                action: 'tag'
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        delete: {
 | 
			
		||||
            method: 'DELETE'
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,36 +0,0 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
declare var angular: any;
 | 
			
		||||
 | 
			
		||||
angular.module('dockerui.services', ['ngResource'])
 | 
			
		||||
    .factory('Container', ($resource: any, DOCKER_ENDPOINT: string) => {
 | 
			
		||||
        // Resource for interacting with the docker containers
 | 
			
		||||
        // http://docs.docker.io/en/latest/api/docker_remote_api.html#containers
 | 
			
		||||
        return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', {}, {
 | 
			
		||||
            query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
 | 
			
		||||
            get :{method: 'GET', params: { action:'json'}},
 | 
			
		||||
            start: {method: 'POST', params: { action: 'start'}},
 | 
			
		||||
            stop: {method: 'POST', params: {t: 5, action: 'stop'}},
 | 
			
		||||
            restart: {method: 'POST', params: {t: 5, action: 'restart' }},
 | 
			
		||||
            kill :{method: 'POST', params: {action:'kill'}},
 | 
			
		||||
            changes :{method: 'GET', params: {action:'changes'}, isArray: true},
 | 
			
		||||
            create :{method: 'POST', params: {action:'create'}},
 | 
			
		||||
            remove :{method: 'DELETE', params: {v:0}}
 | 
			
		||||
        });
 | 
			
		||||
    })
 | 
			
		||||
    .factory('Image', ($resource: any, DOCKER_ENDPOINT: string) => {
 | 
			
		||||
        // Resource for docker images
 | 
			
		||||
        // http://docs.docker.io/en/latest/api/docker_remote_api.html#images
 | 
			
		||||
        return $resource(DOCKER_ENDPOINT + '/images/:name/:action', {}, {
 | 
			
		||||
            query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
 | 
			
		||||
            get :{method: 'GET', params: { action:'json'}},
 | 
			
		||||
            search :{method: 'GET', params: { action:'search'}},
 | 
			
		||||
            history :{method: 'GET', params: { action:'history'}},
 | 
			
		||||
            create :{method: 'POST', params: {action:'create'}},
 | 
			
		||||
            insert :{method: 'POST', params: {action:'insert'}},
 | 
			
		||||
            push :{method: 'POST', params: {action:'push'}},
 | 
			
		||||
            tag :{method: 'POST', params: {action:'tag'}},
 | 
			
		||||
            delete :{method: 'DELETE'}
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue