diff --git a/dashboard/src/models/AppsModel.js b/dashboard/src/models/AppsModel.js index 1a97317d8..2f58560cd 100644 --- a/dashboard/src/models/AppsModel.js +++ b/dashboard/src/models/AppsModel.js @@ -1,5 +1,5 @@ -import { APP_TYPES, HSTATES, ISTATES, RSTATES } from '../constants.js'; +import { APP_TYPES, PROXY_APP_ID, HSTATES, ISTATES, RSTATES } from '../constants.js'; import { fetcher } from 'pankow'; import { sleep } from 'pankow/utils'; import moment from 'moment'; @@ -136,6 +136,7 @@ function create() { for (const app of result.body.apps) { app.ssoAuth = app.sso && (app.manifest.addons['ldap'] || app.manifest.addons['oidc'] || app.manifest.addons['proxyAuth']); // checking app.sso first ensures app.manifest.addons is not null + app.type = app.manifest.id === PROXY_APP_ID ? APP_TYPES.PROXIED : APP_TYPES.APP; // only fetch if we have permissions and a taskId is set/active if (!app.taskId || (app.accessLevel !== 'operator' && app.accessLevel !== 'admin')) { @@ -168,7 +169,31 @@ function create() { } if (error || result.status !== 200) return [error || result]; - return [null, result.body]; + + const app = result.body; + + app.ssoAuth = app.sso && (app.manifest.addons['ldap'] || app.manifest.addons['oidc'] || app.manifest.addons['proxyAuth']); // checking app.sso first ensures app.manifest.addons is not null + app.type = app.manifest.id === PROXY_APP_ID ? APP_TYPES.PROXIED : APP_TYPES.APP; + + // only fetch if we have permissions and a taskId is set/active + if (!app.taskId || (app.accessLevel !== 'operator' && app.accessLevel !== 'admin')) { + app.progress = 0; + app.message = ''; + app.taskMinutesActive = 0; + } else { + const task = await getTask(app.id); + if (task) { + app.progress = task.percent; + app.message = task.message; + app.taskMinutesActive = moment.duration(moment.utc().diff(moment.utc(task.creationTime))).asMinutes(); + } else { + app.progress = 0; + app.message = ''; + app.taskMinutesActive = 0; + } + } + + return [null, app]; }, async restart(id) { let result; diff --git a/dashboard/src/views/AppConfigureView.vue b/dashboard/src/views/AppConfigureView.vue index 91a3a5ce0..396c48a48 100644 --- a/dashboard/src/views/AppConfigureView.vue +++ b/dashboard/src/views/AppConfigureView.vue @@ -27,6 +27,8 @@ const view = ref(''); const link = ref(''); const infoMenu = ref([]); const hasLocalStorage = ref(false); +const hasOptionalServices = ref(false); +const hasEmail = ref(false); const isAppStopped = computed(() => { return appsModel.isStopped(app.value); @@ -56,6 +58,8 @@ async function refresh() { link.value = (result.installationState !== ISTATES.INSTALLED || result.health !== HSTATES.HEALTHY || result.runState === RSTATES.STOPPED) ? '' : result.fqdn; hasLocalStorage.value = result.manifest && result.manifest.addons && result.manifest.addons.localstorage; + hasOptionalServices.value = result.manifest && result.manifest.addons && (result.manifest.addons.turn?.optional || result.manifest.addons.redis?.optional); + hasEmail.value = result.manifest && result.manifest.addons && (result.manifest.addons.sendmail || result.manifest.addons.recvmail); // TODO info menu will likely not change during polling infoMenu.value = []; @@ -130,15 +134,15 @@ onBeforeUnmount(() => {