mirror of
https://github.com/portainer/portainer.git
synced 2025-07-28 17:59:45 +02:00
Add build support for http request
This commit is contained in:
parent
7b7bb46844
commit
0f8da44165
3 changed files with 31 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue