First version of vuejs terminal

This commit is contained in:
Johannes Zellner
2023-07-14 14:48:43 +02:00
parent 6bf7a1a2d8
commit d162ffe508
10 changed files with 347 additions and 9 deletions
+8 -5
View File
@@ -11,7 +11,7 @@
<Button type="button" :label="$t('logs.clear')" icon="pi pi-eraser" @click="onClear()" style="margin-right: 5px" />
<a style="margin-right: 25px;" :href="downloadUrl" target="_blank"><Button :label="$t('logs.download')" icon="pi pi-download" /></a>
<a style="margin-right: 5px;" :href="'/frontend/filemanager.html#/home/app/' + id" target="_blank" v-show="type === 'app'"><Button type="button" severity="secondary" icon="pi pi-folder" :label="$t('filemanager.title')" /></a>
<a style="margin-right: 5px;" :href="'/terminal.html?id=' + id" target="_blank" v-show="type === 'app'"><Button severity="secondary" icon="pi pi-desktop" :label="$t('terminal.title')" /></a>
<a style="margin-right: 5px;" :href="'/frontend/terminal.html?id=' + id" target="_blank" v-show="type === 'app'"><Button severity="secondary" icon="pi pi-desktop" :label="$t('terminal.title')" /></a>
<Button type="button" :label="$t('filemanager.toolbar.restartApp')" severity="secondary" icon="pi pi-sync" @click="onRestartApp" :loading="busyRestart" v-show="type === 'app'"/>
</template>
</TopBar>
@@ -35,7 +35,8 @@ import ProgressSpinner from 'primevue/progressspinner';
import { TopBar, MainLayout } from 'pankow';
import { create } from '../models/LogsModel.js';
import LogsModel from '../models/LogsModel.js';
import AppModel from '../models/AppModel.js';
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? 'https://' + import.meta.env.VITE_API_ORIGIN : '';
@@ -55,6 +56,7 @@ export default {
accessToken: localStorage.token,
apiOrigin: API_ORIGIN || '',
logsModel: null,
appModel: null,
busyRestart: false,
id: '',
name: '',
@@ -75,7 +77,7 @@ export default {
this.busyRestart = true;
await this.logsModel.restartApp();
await this.appModel.restart();
this.busyRestart = false;
}
@@ -119,11 +121,12 @@ export default {
return;
}
this.logsModel = create(this.apiOrigin, this.accessToken, this.type, this.id);
this.logsModel = LogsModel.create(this.apiOrigin, this.accessToken, this.type, this.id);
if (this.type === 'app') {
this.appModel = AppModel.create(this.apiOrigin, this.accessToken, this.id);
try {
const app = await this.logsModel.getApp();
const app = await this.appModel.get();
this.name = `${app.label || app.fqdn} (${app.manifest.title})`;
} catch (e) {
console.error(`Failed to get app info for ${this.id}:`, e);