operator: add app task status route
This commit is contained in:
@@ -11,6 +11,7 @@ exports = module.exports = {
|
||||
exportApp,
|
||||
backup,
|
||||
update,
|
||||
getTask,
|
||||
getLogs,
|
||||
getLogStream,
|
||||
listEventlog,
|
||||
@@ -826,3 +827,13 @@ async function checkForUpdates(req, res, next) {
|
||||
await updateChecker.checkForUpdates({ automatic: false }); // appId argument is ignored for the moment
|
||||
next(new HttpSuccess(200, { update: updateChecker.getUpdateInfo() }));
|
||||
}
|
||||
|
||||
async function getTask(req, res, next) {
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
const [error, result] = await safe(apps.getTask(req.app));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
if (result === null) return next(new HttpError(400, 'No active task'));
|
||||
|
||||
next(new HttpSuccess(200, result));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user