Add volume UI
This commit is contained in:
@@ -2451,6 +2451,57 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
|
||||
});
|
||||
};
|
||||
|
||||
// Volumes
|
||||
Client.prototype.getVolumes = function (callback) {
|
||||
get('/api/v1/volumes', null, function (error, data, status) {
|
||||
if (error) return callback(error);
|
||||
if (status !== 200) return callback(new ClientError(status, data));
|
||||
|
||||
callback(null, data.volumes);
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.getVolume = function (volume, callback) {
|
||||
get('/api/v1/volumes/' + volume, null, function (error, data, status) {
|
||||
if (error) return callback(error);
|
||||
if (status !== 200) return callback(new ClientError(status, data));
|
||||
|
||||
callback(null, data);
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.addVolume = function (name, hostPath, callback) {
|
||||
var data = {
|
||||
name: name,
|
||||
hostPath: hostPath
|
||||
};
|
||||
var that = this;
|
||||
|
||||
post('/api/v1/volumes', data, null, function (error, data, status) {
|
||||
if (error) return callback(error);
|
||||
if (status !== 201) return callback(new ClientError(status, data));
|
||||
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.removeVolume = function (volume, callback) {
|
||||
var config = {
|
||||
data: {
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
|
||||
del('/api/v1/volumes/' + volume, config, function (error, data, status) {
|
||||
if (error) return callback(error);
|
||||
if (status !== 204) return callback(new ClientError(status, data));
|
||||
|
||||
callback(null);
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.getAppstoreUserToken = function (callback) {
|
||||
post('/api/v1/appstore/user_token', {}, null, function (error, data, status) {
|
||||
if (error) return callback(error);
|
||||
|
||||
Reference in New Issue
Block a user