operator: add app task status route

This commit is contained in:
Girish Ramakrishnan
2021-09-21 22:19:20 -07:00
parent d7bd3dfe7c
commit 214540ebfa
3 changed files with 20 additions and 0 deletions

View File

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