mirror of https://github.com/portainer/portainer
commit
f98116c5a5
@ -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
|
||||
|
@ -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');
|
||||
|
@ -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,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 () {
|
||||
|
||||
angular.module('dockerui.filters', [])
|
||||
.filter('truncate', function() {
|
||||
return function(text, length, end) {
|
||||
if(isNaN(length)) {
|
||||
if (isNaN(length))
|
||||
length = 10;
|
||||
}
|
||||
if(end === undefined) {
|
||||
|
||||
if (end === undefined)
|
||||
end = "...";
|
||||
}
|
||||
|
||||
if (text.length <= length || text.length - end.length <= length) {
|
||||
return text;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return String(text).substring(0, length-end.length) + end;
|
||||
}
|
||||
};
|
||||
}).filter('statusbadge', function () {
|
||||
})
|
||||
.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 '';
|
||||
};
|
||||
});
|
||||
|
@ -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 '';
|
||||
};
|
||||
});
|
||||
|
@ -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) {
|
||||
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) {
|
||||
// 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'}
|
||||
});
|
||||
});
|
||||
|
@ -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