dashboard: show app checklist

This commit is contained in:
Johannes Zellner
2024-04-19 12:40:35 +02:00
parent 16521d5434
commit 49243822af
6 changed files with 49 additions and 8 deletions
+10
View File
@@ -32,6 +32,7 @@ exports = module.exports = {
setIcon,
setTags,
setNotes,
setChecklist,
setMemoryLimit,
setCpuQuota,
setMounts,
@@ -1543,6 +1544,15 @@ async function setNotes(app, notes, auditSource) {
await eventlog.add(eventlog.ACTION_APP_CONFIGURE, auditSource, { appId: app.id, app, notes });
}
async function setChecklist(app, checklist, auditSource) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof checklist, 'object');
assert.strictEqual(typeof auditSource, 'object');
await update(app.id, { checklist });
await eventlog.add(eventlog.ACTION_APP_CONFIGURE, auditSource, { appId: app.id, app, checklist });
}
async function setIcon(app, icon, auditSource) {
assert.strictEqual(typeof app, 'object');
assert(icon === null || typeof icon === 'string');
+13
View File
@@ -24,6 +24,7 @@ exports = module.exports = {
setLabel,
setTags,
setNotes,
setChecklist,
setIcon,
setTurn,
setRedis,
@@ -270,6 +271,18 @@ async function setNotes(req, res, next) {
next(new HttpSuccess(200, {}));
}
async function setChecklist(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.app, 'object');
if (typeof req.body.checklist !== 'object') return next(new HttpError(400, 'checklist must be an object'));
const [error] = await safe(apps.setChecklist(req.app, req.body.checklist, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, {}));
}
async function setIcon(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.app, 'object');
+1
View File
@@ -244,6 +244,7 @@ async function initializeExpressSync() {
router.post('/api/v1/apps/:id/configure/tags', json, token, routes.apps.load, authorizeOperator, routes.apps.setTags);
router.post('/api/v1/apps/:id/configure/icon', json, token, routes.apps.load, authorizeOperator, routes.apps.setIcon);
router.post('/api/v1/apps/:id/configure/notes', json, token, routes.apps.load, authorizeOperator, routes.apps.setNotes);
router.post('/api/v1/apps/:id/configure/checklist', json, token, routes.apps.load, authorizeOperator, routes.apps.setChecklist);
router.post('/api/v1/apps/:id/configure/memory_limit', json, token, routes.apps.load, authorizeOperator, routes.apps.setMemoryLimit);
router.post('/api/v1/apps/:id/configure/cpu_quota', json, token, routes.apps.load, authorizeOperator, routes.apps.setCpuQuota);
router.post('/api/v1/apps/:id/configure/automatic_backup', json, token, routes.apps.load, authorizeOperator, routes.apps.setAutomaticBackup);