Show app configure menu items only when applicable
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user