Remove unused Dockerfile service, rename services to match API endpoint names: Docker => Version, System => Info.

pull/2/head
Kevan Ahlquist 2015-12-20 20:23:17 -06:00
parent 5f4641af67
commit 8a900254ae
6 changed files with 14 additions and 35 deletions

View File

@ -71,5 +71,4 @@ angular.module('dockerui', [
// You need to set this to the api endpoint without the port i.e. http://192.168.1.9 // You need to set this to the api endpoint without the port i.e. http://192.168.1.9
.constant('DOCKER_ENDPOINT', 'dockerapi') .constant('DOCKER_ENDPOINT', 'dockerapi')
.constant('DOCKER_PORT', '') // Docker port, leave as an empty string if no port is requred. If you have a port, prefix it with a ':' i.e. :4243 .constant('DOCKER_PORT', '') // Docker port, leave as an empty string if no port is requred. If you have a port, prefix it with a ':' i.e. :4243
.constant('UI_VERSION', 'v0.9.0-beta') .constant('UI_VERSION', 'v0.9.0-beta');
.constant('DOCKER_API_VERSION', 'v1.20');

View File

@ -1,5 +1,5 @@
angular.module('builder', []) angular.module('builder', [])
.controller('BuilderController', ['$scope', 'Dockerfile', 'Messages', .controller('BuilderController', ['$scope',
function ($scope, Dockerfile, Messages) { function ($scope) {
$scope.template = 'app/components/builder/builder.html'; $scope.template = 'app/components/builder/builder.html';
}]); }]);

View File

@ -1,9 +1,9 @@
angular.module('footer', []) angular.module('footer', [])
.controller('FooterController', ['$scope', 'Settings', 'Docker', function ($scope, Settings, Docker) { .controller('FooterController', ['$scope', 'Settings', 'Version', function ($scope, Settings, Version) {
$scope.template = 'app/components/footer/statusbar.html'; $scope.template = 'app/components/footer/statusbar.html';
$scope.uiVersion = Settings.uiVersion; $scope.uiVersion = Settings.uiVersion;
Docker.get({}, function (d) { Version.get({}, function (d) {
$scope.apiVersion = d.ApiVersion; $scope.apiVersion = d.ApiVersion;
}); });
}]); }]);

View File

@ -1,15 +1,14 @@
angular.module('info', []) angular.module('info', [])
.controller('InfoController', ['$scope', 'System', 'Docker', 'Settings', 'Messages', .controller('InfoController', ['$scope', 'Info', 'Version', 'Settings',
function ($scope, System, Docker, Settings, Messages) { function ($scope, Info, Version, Settings) {
$scope.info = {}; $scope.info = {};
$scope.docker = {}; $scope.docker = {};
$scope.endpoint = Settings.endpoint; $scope.endpoint = Settings.endpoint;
$scope.apiVersion = Settings.version;
Docker.get({}, function (d) { Version.get({}, function (d) {
$scope.docker = d; $scope.docker = d;
}); });
System.get({}, function (d) { Info.get({}, function (d) {
$scope.info = d; $scope.info = d;
}); });
}]); }]);

View File

@ -1,6 +1,6 @@
angular.module('pullImage', []) angular.module('pullImage', [])
.controller('PullImageController', ['$scope', '$log', 'Dockerfile', 'Messages', 'Image', 'ViewSpinner', .controller('PullImageController', ['$scope', '$log', 'Messages', 'Image', 'ViewSpinner',
function ($scope, $log, Dockerfile, Messages, Image, ViewSpinner) { function ($scope, $log, Messages, Image, ViewSpinner) {
$scope.template = 'app/components/pullImage/pullImage.html'; $scope.template = 'app/components/pullImage/pullImage.html';
$scope.init = function () { $scope.init = function () {

View File

@ -95,7 +95,7 @@ angular.module('dockerui.services', ['ngResource'])
remove: {method: 'DELETE', params: {id: '@id'}, isArray: true} remove: {method: 'DELETE', params: {id: '@id'}, isArray: true}
}); });
}]) }])
.factory('Docker', ['$resource', 'Settings', function DockerFactory($resource, Settings) { .factory('Version', ['$resource', 'Settings', function VersionFactory($resource, Settings) {
'use strict'; 'use strict';
// http://docs.docker.com/reference/api/docker_remote_api_<%= remoteApiVersion %>/#show-the-docker-version-information // http://docs.docker.com/reference/api/docker_remote_api_<%= remoteApiVersion %>/#show-the-docker-version-information
return $resource(Settings.url + '/version', {}, { return $resource(Settings.url + '/version', {}, {
@ -110,7 +110,7 @@ angular.module('dockerui.services', ['ngResource'])
update: {method: 'POST'} update: {method: 'POST'}
}); });
}]) }])
.factory('System', ['$resource', 'Settings', function SystemFactory($resource, Settings) { .factory('Info', ['$resource', 'Settings', function InfoFactory($resource, Settings) {
'use strict'; 'use strict';
// http://docs.docker.com/reference/api/docker_remote_api_<%= remoteApiVersion %>/#display-system-wide-information // http://docs.docker.com/reference/api/docker_remote_api_<%= remoteApiVersion %>/#display-system-wide-information
return $resource(Settings.url + '/info', {}, { return $resource(Settings.url + '/info', {}, {
@ -129,7 +129,7 @@ angular.module('dockerui.services', ['ngResource'])
disconnect: {method: 'POST', params: {action: 'disconnect'}} disconnect: {method: 'POST', params: {action: 'disconnect'}}
}); });
}]) }])
.factory('Settings', ['DOCKER_ENDPOINT', 'DOCKER_PORT', 'DOCKER_API_VERSION', 'UI_VERSION', function SettingsFactory(DOCKER_ENDPOINT, DOCKER_PORT, DOCKER_API_VERSION, UI_VERSION) { .factory('Settings', ['DOCKER_ENDPOINT', 'DOCKER_PORT', 'UI_VERSION', function SettingsFactory(DOCKER_ENDPOINT, DOCKER_PORT, UI_VERSION) {
'use strict'; 'use strict';
var url = DOCKER_ENDPOINT; var url = DOCKER_ENDPOINT;
if (DOCKER_PORT) { if (DOCKER_PORT) {
@ -138,8 +138,6 @@ angular.module('dockerui.services', ['ngResource'])
return { return {
displayAll: false, displayAll: false,
endpoint: DOCKER_ENDPOINT, endpoint: DOCKER_ENDPOINT,
version: DOCKER_API_VERSION,
rawUrl: DOCKER_ENDPOINT + DOCKER_PORT + '/' + DOCKER_API_VERSION,
uiVersion: UI_VERSION, uiVersion: UI_VERSION,
url: url, url: url,
firstLoad: true firstLoad: true
@ -188,23 +186,6 @@ angular.module('dockerui.services', ['ngResource'])
} }
}; };
}]) }])
.factory('Dockerfile', ['Settings', function DockerfileFactory(Settings) {
'use strict';
// http://docs.docker.com/reference/api/docker_remote_api_<%= remoteApiVersion %>/#build-image-from-a-dockerfile
var url = Settings.rawUrl + '/build';
return {
build: function (file, callback) {
var data = new FormData();
var dockerfile = new Blob([file], {type: 'text/text'});
data.append('Dockerfile', dockerfile);
var request = new XMLHttpRequest();
request.onload = callback;
request.open('POST', url);
request.send(data);
}
};
}])
.factory('LineChart', ['Settings', function LineChartFactory(Settings) { .factory('LineChart', ['Settings', function LineChartFactory(Settings) {
'use strict'; 'use strict';
return { return {