Only add checklist items if they apply due to sso state

This commit is contained in:
Johannes Zellner
2024-04-17 18:29:47 +02:00
parent 3c7e6b59f0
commit 7d6636bb54
5 changed files with 53 additions and 2 deletions

View File

@@ -241,6 +241,30 @@ async function downloadImage(manifest) {
await docker.downloadImage(manifest);
}
async function updateChecklist(app, newChecks) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof newChecks, 'object');
// add new checklist items depending on sso state
const checklist = app.checklist || {};
for (let k in newChecks) {
if (app.checklist[k]) return;
const item = {
acknowledged: false,
sso: newChecks[k].sso,
message: newChecks[k].message
};
if (typeof item.sso === 'undefined') checklist[k] = item;
else if (item.sso && app.sso) checklist[k] = item;
else if (!item.sso && !app.sso) checklist[k] = item;
}
await updateApp(app, { checklist });
}
async function startApp(app) {
debug('startApp: starting container');
@@ -350,6 +374,8 @@ async function install(app, args, progressCallback) {
await progressCallback({ percent: 95, message: 'Configuring reverse proxy' });
await reverseProxy.configureApp(app, AuditSource.APPTASK);
await updateChecklist(app, app.manifest.checklist);
await progressCallback({ percent: 100, message: 'Done' });
await updateApp(app, { installationState: apps.ISTATE_INSTALLED, error: null, health: null });
}
@@ -629,6 +655,8 @@ async function update(app, args, progressCallback) {
await reverseProxy.configureApp(app, AuditSource.APPTASK);
}
await updateChecklist(app, updateConfig.manifest.checklist || {});
await progressCallback({ percent: 100, message: 'Done' });
await updateApp(app, { installationState: apps.ISTATE_INSTALLED, error: null, health: null, updateTime: new Date() });
}