|
|
|
@ -53,12 +53,32 @@ angular.module('dockerui.services', ['ngResource'])
|
|
|
|
|
get: {method: 'GET'}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.factory('Settings', function(DOCKER_ENDPOINT, DOCKER_API_VERSION, UI_VERSION) {
|
|
|
|
|
.factory('Settings', function(DOCKER_ENDPOINT, DOCKER_PORT, DOCKER_API_VERSION, UI_VERSION) {
|
|
|
|
|
var url = DOCKER_ENDPOINT;
|
|
|
|
|
if (DOCKER_PORT) {
|
|
|
|
|
url = url + DOCKER_PORT + '\\' + DOCKER_PORT;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
displayAll: false,
|
|
|
|
|
endpoint: DOCKER_ENDPOINT,
|
|
|
|
|
version: DOCKER_API_VERSION,
|
|
|
|
|
url: DOCKER_ENDPOINT + '/' + DOCKER_API_VERSION,
|
|
|
|
|
uiVersion: UI_VERSION
|
|
|
|
|
};
|
|
|
|
|
rawUrl: DOCKER_ENDPOINT + '/' + DOCKER_API_VERSION,
|
|
|
|
|
uiVersion: UI_VERSION,
|
|
|
|
|
url: url
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
.factory('Dockerfile', function(Settings) {
|
|
|
|
|
return {
|
|
|
|
|
settings: Settings,
|
|
|
|
|
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', 'http://192.168.1.9:4243/v1.1/build');
|
|
|
|
|
request.send(data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|