diff --git a/frontend/src/components/Terminal.vue b/frontend/src/components/Terminal.vue index 7cd49398b..e8e159c64 100644 --- a/frontend/src/components/Terminal.vue +++ b/frontend/src/components/Terminal.vue @@ -8,16 +8,19 @@ {{ name }} @@ -67,7 +70,9 @@ export default { busyRestart: false, connected: false, addons: {}, + schedulerTasks: [], manifestVersion: '', + schedulerMenuModel: [], id: '', name: '', socket: null, @@ -78,7 +83,7 @@ export default { usesAddon(addon) { return !!Object.keys(this.addons).find(function (a) { return a === addon; }); }, - terminalInject(addon, extra) { + terminalInject(addon, command) { if (!this.socket) return; let cmd = ''; @@ -106,8 +111,8 @@ export default { } else { cmd = 'redis-cli -h "${CLOUDRON_REDIS_HOST}" -p "${CLOUDRON_REDIS_PORT}" -a "${CLOUDRON_REDIS_PASSWORD}" --no-auth-warning'; } - } else if (addon === 'scheduler' && extra) { - cmd = extra.command; + } else if (addon === 'scheduler' && command) { + cmd = command; } if (!cmd) return; @@ -117,6 +122,9 @@ export default { this.socket.send(cmd); this.terminal.focus(); }, + onSchedulerMenu(event) { + this.$refs.schedulerMenu.toggle(event); + }, async onRestartApp() { if (this.type !== 'app') return; @@ -202,6 +210,13 @@ export default { this.name = `${app.label || app.fqdn} (${app.manifest.title})`; this.addons = app.manifest.addons; this.manifestVersion = app.manifest.manifestVersion; + + this.schedulerMenuModel = !app.manifest.addons.scheduler ? [] : Object.keys(app.manifest.addons.scheduler).map((k) => { + return { + label: () => k, + command: () => this.terminalInject('scheduler', app.manifest.addons.scheduler[k].command) + }; + }); } catch (e) { console.error(`Failed to get app info for ${this.id}:`, e); }