Handle split of addon and services
This commit is contained in:
+12
-12
@@ -627,12 +627,12 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
|
||||
}
|
||||
};
|
||||
|
||||
Client.prototype.getAddonLogs = function (addonName, follow, lines, callback) {
|
||||
Client.prototype.getServiceLogs = function (serviceName, follow, lines, callback) {
|
||||
if (follow) {
|
||||
var eventSource = new EventSource(client.apiOrigin + '/api/v1/services/' + addonName + '/logstream?lines=' + lines + '&access_token=' + token);
|
||||
var eventSource = new EventSource(client.apiOrigin + '/api/v1/services/' + serviceName + '/logstream?lines=' + lines + '&access_token=' + token);
|
||||
callback(null, eventSource);
|
||||
} else {
|
||||
get('/api/v1/services/' + addonName + '/logs?lines=100').success(function (data, status) {
|
||||
get('/api/v1/services/' + serviceName + '/logs?lines=100').success(function (data, status) {
|
||||
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
|
||||
callback(null, data);
|
||||
}).error(defaultErrorHandler(callback));
|
||||
@@ -665,29 +665,29 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
|
||||
}).error(defaultErrorHandler(callback));
|
||||
};
|
||||
|
||||
Client.prototype.getAddons = function (callback) {
|
||||
Client.prototype.getServices = function (callback) {
|
||||
get('/api/v1/services').success(function (data, status) {
|
||||
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
|
||||
callback(null, data.addons);
|
||||
callback(null, data.services);
|
||||
}).error(defaultErrorHandler(callback));
|
||||
};
|
||||
|
||||
Client.prototype.getAddon = function (addonName, callback) {
|
||||
get('/api/v1/services/' + addonName).success(function (data, status) {
|
||||
Client.prototype.getService = function (serviceName, callback) {
|
||||
get('/api/v1/services/' + serviceName).success(function (data, status) {
|
||||
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
|
||||
callback(null, data.addon);
|
||||
callback(null, data.service);
|
||||
}).error(defaultErrorHandler(callback));
|
||||
};
|
||||
|
||||
Client.prototype.configureAddon = function (addonName, memoryLimit, callback) {
|
||||
post('/api/v1/services/' + addonName, { memory: memoryLimit }).success(function (data, status) {
|
||||
Client.prototype.configureService = function (serviceName, memoryLimit, callback) {
|
||||
post('/api/v1/services/' + serviceName, { memory: memoryLimit }).success(function (data, status) {
|
||||
if (status !== 202) return callback(new ClientError(status, data));
|
||||
callback(null);
|
||||
}).error(defaultErrorHandler(callback));
|
||||
};
|
||||
|
||||
Client.prototype.restartAddon = function (addonName, callback) {
|
||||
post('/api/v1/services/' + addonName + '/restart').success(function (data, status) {
|
||||
Client.prototype.restartService = function (serviceName, callback) {
|
||||
post('/api/v1/services/' + serviceName + '/restart').success(function (data, status) {
|
||||
if (status !== 202) return callback(new ClientError(status, data));
|
||||
callback(null);
|
||||
}).error(defaultErrorHandler(callback));
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ app.controller('LogsController', ['$scope', '$timeout', '$location', 'Client', f
|
||||
|
||||
var func;
|
||||
if ($scope.selected.type === 'platform') func = Client.getPlatformLogs;
|
||||
else if ($scope.selected.type === 'addon') func = Client.getAddonLogs;
|
||||
else if ($scope.selected.type === 'addon') func = Client.getServiceLogs;
|
||||
else func = Client.getAppLogs;
|
||||
|
||||
func($scope.selected.value, true, $scope.lines, function handleLogs(error, result) {
|
||||
@@ -73,7 +73,7 @@ app.controller('LogsController', ['$scope', '$timeout', '$location', 'Client', f
|
||||
{ name: 'MongoDB', type: 'addon', value: 'mongodb', url: Client.makeURL('/api/v1/services/mongodb/logs') },
|
||||
{ name: 'MySQL', type: 'addon', value: 'mysql', url: Client.makeURL('/api/v1/services/mysql/logs') },
|
||||
{ name: 'PostgreSQL', type: 'addon', value: 'postgresql', url: Client.makeURL('/api/v1/services/postgresql/logs') },
|
||||
{ name: 'Email', type: 'addon', value: 'email', url: Client.makeURL('/api/v1/services/email/logs') },
|
||||
{ name: 'Mail', type: 'addon', value: 'mail', url: Client.makeURL('/api/v1/services/mail/logs') },
|
||||
{ name: 'Docker', type: 'addon', value: 'docker', url: Client.makeURL('/api/v1/services/docker/logs') }
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user