|
|
@ -5,17 +5,19 @@ angular.module('dockerui.services', ['ngResource'])
|
|
|
|
// 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(Settings.url + '/containers/:id/:action', {
|
|
|
|
return $resource(Settings.url + '/containers/:id/:action', {
|
|
|
|
name: '@name'
|
|
|
|
name: '@name'
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
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'}},
|
|
|
|
stop: {method: 'POST', params: {id: '@id', t: 5, action: 'stop'}},
|
|
|
|
stop: {method: 'POST', params: {id: '@id', t: 5, action: 'stop'}},
|
|
|
|
restart: {method: 'POST', params: {id: '@id', t: 5, action: 'restart' }},
|
|
|
|
restart: {method: 'POST', params: {id: '@id', t: 5, action: 'restart' }},
|
|
|
|
kill :{method: 'POST', params: {id: '@id', action:'kill'}},
|
|
|
|
kill: {method: 'POST', params: {id: '@id', action: 'kill'}},
|
|
|
|
changes :{method: 'GET', params: {action:'changes'}, isArray: true},
|
|
|
|
pause: {method: 'POST', params: {id: '@id', action: 'pause'}},
|
|
|
|
create :{method: 'POST', params: {action:'create'}},
|
|
|
|
unpause: {method: 'POST', params: {id: '@id', action: 'unpause'}},
|
|
|
|
remove :{method: 'DELETE', params: {id: '@id', v:0}}
|
|
|
|
changes: {method: 'GET', params: {action:'changes'}, isArray: true},
|
|
|
|
|
|
|
|
create: {method: 'POST', params: {action:'create'}},
|
|
|
|
|
|
|
|
remove: {method: 'DELETE', params: {id: '@id', v:0}}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.factory('Image', function($resource, Settings) {
|
|
|
|
.factory('Image', function($resource, Settings) {
|
|
|
@ -23,14 +25,14 @@ angular.module('dockerui.services', ['ngResource'])
|
|
|
|
// 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(Settings.url + '/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'}},
|
|
|
|
history :{method: 'GET', params: { action:'history'}, isArray: true},
|
|
|
|
history: {method: 'GET', params: { action:'history'}, isArray: true},
|
|
|
|
create :{method: 'POST', params: {action:'create'}},
|
|
|
|
create: {method: 'POST', params: {action:'create'}},
|
|
|
|
insert :{method: 'POST', params: {id: '@id', action:'insert'}},
|
|
|
|
insert: {method: 'POST', params: {id: '@id', action:'insert'}},
|
|
|
|
push :{method: 'POST', params: {id: '@id', action:'push'}},
|
|
|
|
push: {method: 'POST', params: {id: '@id', action:'push'}},
|
|
|
|
tag :{method: 'POST', params: {id: '@id', action:'tag', force: 0, repo: '@repo'}},
|
|
|
|
tag: {method: 'POST', params: {id: '@id', action:'tag', force: 0, repo: '@repo'}},
|
|
|
|
remove :{method: 'DELETE', params: {id: '@id'}, isArray: true}
|
|
|
|
remove: {method: 'DELETE', params: {id: '@id'}, isArray: true}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.factory('Docker', function($resource, Settings) {
|
|
|
|
.factory('Docker', function($resource, Settings) {
|
|
|
@ -74,52 +76,51 @@ angular.module('dockerui.services', ['ngResource'])
|
|
|
|
var spinner = new Spinner();
|
|
|
|
var spinner = new Spinner();
|
|
|
|
var target = document.getElementById('view');
|
|
|
|
var target = document.getElementById('view');
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
spin: function() { spinner.spin(target); },
|
|
|
|
spin: function() { spinner.spin(target); },
|
|
|
|
stop: function() { spinner.stop(); }
|
|
|
|
stop: function() { spinner.stop(); }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.factory('Messages', function($rootScope) {
|
|
|
|
.factory('Messages', function($rootScope) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
send: function(title, text) {
|
|
|
|
send: function(title, text) {
|
|
|
|
$.gritter.add({
|
|
|
|
$.gritter.add({
|
|
|
|
title: title,
|
|
|
|
title: title,
|
|
|
|
text: text,
|
|
|
|
text: text,
|
|
|
|
time: 2000,
|
|
|
|
time: 2000,
|
|
|
|
before_open: function() {
|
|
|
|
before_open: function() {
|
|
|
|
if($('.gritter-item-wrapper').length == 3) {
|
|
|
|
if($('.gritter-item-wrapper').length == 3) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
error: function(title, text) {
|
|
|
|
error: function(title, text) {
|
|
|
|
|
|
|
|
$.gritter.add({
|
|
|
|
$.gritter.add({
|
|
|
|
title: title,
|
|
|
|
title: title,
|
|
|
|
text: text,
|
|
|
|
text: text,
|
|
|
|
time: 6000,
|
|
|
|
time: 6000,
|
|
|
|
before_open: function() {
|
|
|
|
before_open: function() {
|
|
|
|
if($('.gritter-item-wrapper').length == 4) {
|
|
|
|
if($('.gritter-item-wrapper').length == 4) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.factory('Dockerfile', function(Settings) {
|
|
|
|
.factory('Dockerfile', function(Settings) {
|
|
|
|
var url = Settings.rawUrl + '/build';
|
|
|
|
var url = Settings.rawUrl + '/build';
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
build: function(file, callback) {
|
|
|
|
build: function(file, callback) {
|
|
|
|
var data = new FormData();
|
|
|
|
var data = new FormData();
|
|
|
|
var dockerfile = new Blob([file], { type: 'text/text' });
|
|
|
|
var dockerfile = new Blob([file], { type: 'text/text' });
|
|
|
|
data.append('Dockerfile', dockerfile);
|
|
|
|
data.append('Dockerfile', dockerfile);
|
|
|
|
|
|
|
|
|
|
|
|
var request = new XMLHttpRequest();
|
|
|
|
var request = new XMLHttpRequest();
|
|
|
|
request.onload = callback;
|
|
|
|
request.onload = callback;
|
|
|
|
request.open('POST', url);
|
|
|
|
request.open('POST', url);
|
|
|
|
request.send(data);
|
|
|
|
request.send(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|