move platform status into services
This commit is contained in:
@@ -979,7 +979,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
|
||||
};
|
||||
|
||||
Client.prototype.getPlatformStatus = function (callback) {
|
||||
get('/api/v1/platform_status', null, function (error, data, status) {
|
||||
get('/api/v1/services/platform_status', null, function (error, data, status) {
|
||||
if (error) return callback(error);
|
||||
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
|
||||
callback(null, data);
|
||||
|
||||
@@ -6,8 +6,6 @@ exports = module.exports = {
|
||||
updateDashboardDomain,
|
||||
prepareDashboardDomain,
|
||||
|
||||
getPlatformStatus,
|
||||
|
||||
listLanguages,
|
||||
getLanguage,
|
||||
setLanguage,
|
||||
@@ -22,7 +20,6 @@ const assert = require('assert'),
|
||||
cloudron = require('../cloudron.js'),
|
||||
HttpError = require('connect-lastmile').HttpError,
|
||||
HttpSuccess = require('connect-lastmile').HttpSuccess,
|
||||
platform = require('../platform.js'),
|
||||
safe = require('safetydance'),
|
||||
translation = require('../translation.js');
|
||||
|
||||
@@ -58,10 +55,6 @@ async function listLanguages(req, res, next) {
|
||||
next(new HttpSuccess(200, { languages }));
|
||||
}
|
||||
|
||||
async function getPlatformStatus(req, res, next) {
|
||||
next(new HttpSuccess(200, platform.getStatus()));
|
||||
}
|
||||
|
||||
async function getTimeZone(req, res, next) {
|
||||
const [error, timeZone] = await safe(cloudron.getTimeZone());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
@@ -8,7 +8,8 @@ exports = module.exports = {
|
||||
getLogStream,
|
||||
restart,
|
||||
rebuild,
|
||||
getGraphs
|
||||
getGraphs,
|
||||
getPlatformStatus
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
@@ -17,6 +18,7 @@ const assert = require('assert'),
|
||||
graphs = require('../graphs.js'),
|
||||
HttpError = require('connect-lastmile').HttpError,
|
||||
HttpSuccess = require('connect-lastmile').HttpSuccess,
|
||||
platform = require('../platform.js'),
|
||||
safe = require('safetydance'),
|
||||
services = require('../services.js');
|
||||
|
||||
@@ -146,3 +148,7 @@ async function getGraphs(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(200, result));
|
||||
}
|
||||
|
||||
async function getPlatformStatus(req, res, next) {
|
||||
next(new HttpSuccess(200, platform.getStatus()));
|
||||
}
|
||||
|
||||
@@ -114,8 +114,6 @@ async function initializeExpressSync() {
|
||||
router.get ('/api/v1/cloudron/time_zone', token, authorizeAdmin, routes.cloudron.getTimeZone);
|
||||
router.post('/api/v1/cloudron/time_zone', json, token, authorizeAdmin, routes.cloudron.setTimeZone);
|
||||
|
||||
router.get ('/api/v1/platform_status', token, authorizeUser, routes.cloudron.getPlatformStatus);
|
||||
|
||||
// config route for dashboard that any auth user (not just admin) can access
|
||||
router.get ('/api/v1/dashboard/config', token, authorizeUser, routes.dashboard.getConfig);
|
||||
router.post('/api/v1/cloudron/prepare_dashboard_domain', json, token, authorizeAdmin, routes.cloudron.prepareDashboardDomain);
|
||||
@@ -403,6 +401,7 @@ async function initializeExpressSync() {
|
||||
|
||||
// service routes
|
||||
router.get ('/api/v1/services', token, authorizeAdmin, routes.services.list);
|
||||
router.get ('/api/v1/services/platform_status', token, authorizeUser, routes.services.getPlatformStatus);
|
||||
router.get ('/api/v1/services/:service', token, authorizeAdmin, routes.services.get);
|
||||
router.post('/api/v1/services/:service', json, token, authorizeAdmin, routes.services.configure);
|
||||
router.get ('/api/v1/services/:service/graphs', token, authorizeAdmin, routes.services.getGraphs);
|
||||
|
||||
Reference in New Issue
Block a user