Add api version

pull/2/head
Michael Crosby 12 years ago
parent 528565afc8
commit 1a11d7bb3a

@ -11,4 +11,5 @@ angular.module('dockerui', ['dockerui.services', 'dockerui.filters'])
$routeProvider.otherwise({redirectTo: '/'}); $routeProvider.otherwise({redirectTo: '/'});
}]) }])
// This is your docker url that the api will use to make requests // This is your docker url that the api will use to make requests
.constant('DOCKER_ENDPOINT', 'http://192.168.1.9:4243\:4243'); .constant('DOCKER_ENDPOINT', 'http://192.168.1.9:4243\:4243')
.constant('DOCKER_API_VERSION', '/v1.1');

@ -42,6 +42,8 @@ function SettingsController($scope, Auth, System, Docker, Settings) {
$scope.auth = {}; $scope.auth = {};
$scope.info = {}; $scope.info = {};
$scope.docker = {}; $scope.docker = {};
$scope.endpoint = Settings.endpoint;
$scope.apiVersion = Settings.version;
$('#response').hide(); $('#response').hide();
$scope.alertClass = 'block'; $scope.alertClass = 'block';

@ -1,10 +1,10 @@
'use strict'; 'use strict';
angular.module('dockerui.services', ['ngResource']) angular.module('dockerui.services', ['ngResource'])
.factory('Container', function($resource, DOCKER_ENDPOINT) { .factory('Container', function($resource, Settings) {
// Resource for interacting with the docker containers // Resource for interacting with the docker containers
// http://docs.docker.io/en/latest/api/docker_remote_api.html#containers // http://docs.docker.io/en/latest/api/docker_remote_api.html#containers
return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', {}, { return $resource(Settings.url + '/containers/:id/:action', {}, {
query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true}, query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
get :{method: 'GET', params: { action:'json'}}, get :{method: 'GET', params: { action:'json'}},
start: {method: 'POST', params: {id: '@id', action: 'start'}}, start: {method: 'POST', params: {id: '@id', action: 'start'}},
@ -16,10 +16,10 @@ angular.module('dockerui.services', ['ngResource'])
remove :{method: 'DELETE', params: {id: '@id', v:0}} remove :{method: 'DELETE', params: {id: '@id', v:0}}
}); });
}) })
.factory('Image', function($resource, DOCKER_ENDPOINT) { .factory('Image', function($resource, Settings) {
// Resource for docker images // Resource for docker images
// http://docs.docker.io/en/latest/api/docker_remote_api.html#images // http://docs.docker.io/en/latest/api/docker_remote_api.html#images
return $resource(DOCKER_ENDPOINT + '/images/:id/:action', {}, { return $resource(Settings.url + '/images/:id/:action', {}, {
query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true}, query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
get :{method: 'GET', params: { action:'json'}}, get :{method: 'GET', params: { action:'json'}},
search :{method: 'GET', params: { action:'search'}}, search :{method: 'GET', params: { action:'search'}},
@ -31,31 +31,33 @@ angular.module('dockerui.services', ['ngResource'])
delete :{id: '@id', method: 'DELETE'} delete :{id: '@id', method: 'DELETE'}
}); });
}) })
.factory('Docker', function($resource, DOCKER_ENDPOINT) { .factory('Docker', function($resource, Settings) {
// Information for docker // Information for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information // http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information
return $resource(DOCKER_ENDPOINT + '/version', {}, { return $resource(Settings.url + '/version', {}, {
get: {method: 'GET'} get: {method: 'GET'}
}); });
}) })
.factory('Auth', function($resource, DOCKER_ENDPOINT) { .factory('Auth', function($resource, Settings) {
// Auto Information for docker // Auto Information for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#set-auth-configuration // http://docs.docker.io/en/latest/api/docker_remote_api.html#set-auth-configuration
return $resource(DOCKER_ENDPOINT + '/auth', {}, { return $resource(Settings.url + '/auth', {}, {
get: {method: 'GET'}, get: {method: 'GET'},
update: {method: 'POST'} update: {method: 'POST'}
}); });
}) })
.factory('System', function($resource, DOCKER_ENDPOINT) { .factory('System', function($resource, Settings) {
// System for docker // System for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information // http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information
return $resource(DOCKER_ENDPOINT + '/info', {}, { return $resource(Settings.url + '/info', {}, {
get: {method: 'GET'} get: {method: 'GET'}
}); });
}) })
.factory('Settings', function(DOCKER_ENDPOINT) { .factory('Settings', function(DOCKER_ENDPOINT, DOCKER_API_VERSION) {
return { return {
displayAll: false, displayAll: false,
endpoint: DOCKER_ENDPOINT endpoint: DOCKER_ENDPOINT,
version: DOCKER_API_VERSION,
url: DOCKER_ENDPOINT + DOCKER_API_VERSION
}; };
}); });

@ -6,10 +6,11 @@
<h3>Docker Information</h3> <h3>Docker Information</h3>
<div> <div>
<p class="lead"> <p class="lead">
<strong>Endpoint</strong>{{ endpoint }}<br /> <strong>Endpoint: </strong>{{ endpoint }}<br />
<strong>Version</strong>{{ docker.Version }}<br /> <strong>Api Version: </strong>{{ apiVersion }}<br />
<strong>GitCommit</strong>{{ docker.GitCommit }}<br /> <strong>Version: </strong>{{ docker.Version }}<br />
<strong>GoVersion</strong>{{ docker.GoVersion }}<br /> <strong>Git Commit: </strong>{{ docker.GitCommit }}<br />
<strong>Go Version: </strong>{{ docker.GoVersion }}<br />
</p> </p>
</div> </div>

Loading…
Cancel
Save