Merge branch 'javascript' into dev

pull/2/head
Michael Crosby 12 years ago
commit f98116c5a5

@ -1,15 +1,9 @@
REF = HEAD REF = HEAD
VERSION = $(shell git describe --always $(REF)) VERSION = $(shell git describe --always $(REF))
all: ts less all: less
clean:
rm js/*.js
ts:
tsc js/*.ts
less: less:
less css/*.less > css/app.css 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 * Angular.js
* Less * Less
* Flatstrap ( Flat Twitter Bootstrap ) * Flatstrap ( Flat Twitter Bootstrap )
* Typescript ( I'm debating if this is providing any value. )
###License - MIT ###License - MIT

@ -1,35 +1,13 @@
'use strict'; 'use strict';
angular.module('dockerui', [
'dockerui.services', angular.module('dockerui', ['dockerui.services', 'dockerui.filters'])
'dockerui.filters' .config(['$routeProvider', function ($routeProvider) {
]).config([ $routeProvider.when('/', {templateUrl: 'partials/home.html', controller: 'HomeController'});
'$routeProvider', $routeProvider.when('/containers/', {templateUrl: 'partials/containers.html', controller: 'ContainersController'});
function ($routeProvider) { $routeProvider.when('/containers/:id/', {templateUrl: 'partials/container.html', controller: 'ContainerController'});
$routeProvider.when('/', { $routeProvider.when('/images/', {templateUrl: 'partials/images.html', controller: 'ImagesController'});
templateUrl: 'partials/home.html', $routeProvider.when('/images/:id/', {templateUrl: 'partials/image.html', controller: 'ImageController'});
controller: 'HomeController' $routeProvider.when('/settings', {templateUrl: 'partials/settings.html', controller: 'SettingsController'});
}); $routeProvider.otherwise({redirectTo: '/'});
$routeProvider.when('/containers/', { }])
templateUrl: 'partials/containers.html', .constant('DOCKER_ENDPOINT', 'http://192.168.1.9:4243\:4243');
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,133 +1,92 @@
var __extends = this.__extends || function (d, b) {
function __() { this.constructor = d; } function MastheadController($scope) {
__.prototype = b.prototype; $scope.template = 'partials/masthead.html';
d.prototype = new __();
}; $scope.hclass = 'active';
var MastheadController = (function () { $scope.cclass = '';
function MastheadController($scope) { $scope.iclass = '';
$scope.template = 'partials/masthead.html'; $scope.sclass = '';
$scope.hclass = 'active';
$scope.linkChange = function(link) {
$scope.hclass = '';
$scope.cclass = ''; $scope.cclass = '';
$scope.iclass = ''; $scope.iclass = '';
$scope.sclass = ''; $scope.sclass = '';
$scope.linkChange = function (link) {
$scope.hclass = ''; switch(link) {
$scope.cclass = ''; case 'home':
$scope.iclass = ''; $scope.hclass = 'active';
$scope.sclass = ''; break;
switch(link) { case 'containers':
case 'home': $scope.cclass = 'active';
$scope.hclass = 'active'; break;
break; case 'images':
case 'containers': $scope.iclass = 'active';
$scope.cclass = 'active'; break;
break; case 'settings':
case 'images': $scope.sclass = 'active';
$scope.iclass = 'active'; break;
break; default:
case 'settings': console.log('Not supported:' + link);
$scope.sclass = 'active'; }
break; };
default: }
console.log('Not supported:' + link);
} function SideBarController($scope, Container) {
}; $scope.template = 'partials/sidebar.html';
}
return MastheadController; Container.query({}, function(d) {
})(); $scope.containers = d;
var SideBarController = (function () { });
function SideBarController($scope, Container) { }
$scope.template = 'partials/sidebar.html';
Container.query({ function HomeController() {
}, function (d) {
$scope.containers = d; }
});
} function SettingsController() {
return SideBarController;
})(); }
var HomeController = (function () {
function HomeController() { function ContainerController($scope, $routeParams, Container) {
}
return HomeController; $scope.start = function(){
})(); Container.start({id: $routeParams.id}, function(d) {
var SettingsController = (function () { $scope.response = d;
function SettingsController() { });
}
return SettingsController;
})();
var ContainerControllerBase = (function () {
function ContainerControllerBase() { }
ContainerControllerBase.prototype.start = function ($scope, $routeParams, Container) {
Container.start({
id: $routeParams.id
}, function (d) {
$scope.response = d;
});
}; };
ContainerControllerBase.prototype.stop = function ($scope, $routeParams, Container) {
Container.stop({ $scope.stop = function() {
id: $routeParams.id Container.stop({id: $routeParams.id}, function(d) {
}, function (d) { $scope.response = d;
$scope.response = d;
}); });
}; };
ContainerControllerBase.prototype.remove = function ($scope, $routeParams, Container) {
if(confirm("Are you sure you want to remove the container?")) { $scope.remove = function() {
Container.remove({ if (confirm("Are you sure you want to remove the container?")) {
id: $routeParams.id Container.remove({id: $routeParams.id}, function(d) {
}, function (d) { $scope.response = d;
$scope.response = d;
}); });
} }
}; };
return ContainerControllerBase;
})(); $scope.changes = [];
var ContainerController = (function (_super) {
__extends(ContainerController, _super); $scope.getChanges = function() {
function ContainerController($scope, $routeParams, Container) { Container.changes({id: $routeParams.id}, function(d) {
var _this = this; $scope.changes = d;
_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.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'; 'use strict';
angular.module('dockerui.filters', []).filter('truncate', function () {
return function (text, length, end) { angular.module('dockerui.filters', [])
if(isNaN(length)) { .filter('truncate', function() {
length = 10; return function(text, length, end) {
} if (isNaN(length))
if(end === undefined) { length = 10;
end = "...";
} if (end === undefined)
if(text.length <= length || text.length - end.length <= length) { end = "...";
return text;
} else { if (text.length <= length || text.length - end.length <= length) {
return String(text).substring(0, length - end.length) + end; return text;
} }
}; else {
}).filter('statusbadge', function () { return String(text).substring(0, length-end.length) + end;
return function (text) { }
if(text === 'Ghost') { };
return 'important'; })
} .filter('statusbadge', function() {
return 'success'; return function(text) {
}; if (text === 'Ghost') {
}).filter('isactive', function ($location) { return 'important';
return function (text) { }
if(text == $location) { return 'success';
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'; 'use strict';
angular.module('dockerui.services', [
'ngResource' angular.module('dockerui.services', ['ngResource'])
]).factory('Container', function ($resource, DOCKER_ENDPOINT) { .factory('Container', function($resource, DOCKER_ENDPOINT) {
return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', { // Resource for interacting with the docker containers
}, { // http://docs.docker.io/en/latest/api/docker_remote_api.html#containers
query: { return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', {}, {
method: 'GET', query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
params: { get :{method: 'GET', params: { action:'json'}},
all: 0, start: {method: 'POST', params: { action: 'start'}},
action: 'json' stop: {method: 'POST', params: {t: 5, action: 'stop'}},
}, restart: {method: 'POST', params: {t: 5, action: 'restart' }},
isArray: true kill :{method: 'POST', params: {action:'kill'}},
}, changes :{method: 'GET', params: {action:'changes'}, isArray: true},
get: { create :{method: 'POST', params: {action:'create'}},
method: 'GET', remove :{method: 'DELETE', params: {v:0}}
params: { });
action: 'json' })
} .factory('Image', function($resource, DOCKER_ENDPOINT) {
}, // Resource for docker images
start: { // http://docs.docker.io/en/latest/api/docker_remote_api.html#images
method: 'POST', return $resource(DOCKER_ENDPOINT + '/images/:name/:action', {}, {
params: { query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
action: 'start' get :{method: 'GET', params: { action:'json'}},
} search :{method: 'GET', params: { action:'search'}},
}, history :{method: 'GET', params: { action:'history'}},
stop: { create :{method: 'POST', params: {action:'create'}},
method: 'POST', insert :{method: 'POST', params: {action:'insert'}},
params: { push :{method: 'POST', params: {action:'push'}},
t: 5, tag :{method: 'POST', params: {action:'tag'}},
action: 'stop' delete :{method: 'DELETE'}
} });
},
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'
}
});
});

@ -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…
Cancel
Save