Add volume UI

This commit is contained in:
Girish Ramakrishnan
2020-10-28 16:14:32 -07:00
parent f8f0c50ed8
commit 377c2f678e
6 changed files with 290 additions and 0 deletions

View File

@@ -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);