Initial rewrite of the apps view

This commit is contained in:
Johannes Zellner
2024-12-29 00:36:48 +01:00
parent a42c7e4735
commit 55e0d734df
6 changed files with 164 additions and 14 deletions

View File

@@ -55,7 +55,7 @@ import { Terminal } from '@xterm/xterm';
import { AttachAddon } from '@xterm/addon-attach';
import { FitAddon } from '@xterm/addon-fit';
import { create } from '../models/AppModel.js';
import AppsModel from '../models/AppsModel.js';
import { createDirectoryModel } from '../models/DirectoryModel.js';
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
@@ -73,7 +73,7 @@ export default {
data() {
return {
accessToken: localStorage.token,
appModel: null,
appsModel: null,
directoryModel: null,
fatalError: false,
busyRestart: false,
@@ -197,7 +197,7 @@ export default {
if (!confirmed) return;
this.busyRestart = true;
await this.appModel.restart();
await this.appsModel.restart();
this.busyRestart = false;
},
async connect(retry = false) {
@@ -269,11 +269,11 @@ export default {
this.id = id;
this.name = id;
this.appModel = create(API_ORIGIN, this.accessToken, this.id);
this.appsModel = AppsModel.create(API_ORIGIN, this.accessToken, this.id);
this.directoryModel = createDirectoryModel(API_ORIGIN, this.accessToken, `apps/${id}`);
try {
const app = await this.appModel.get();
const app = await this.appsModel.get();
this.name = `${app.label || app.fqdn} (${app.manifest.title})`;
this.addons = app.manifest.addons;
this.manifestVersion = app.manifest.manifestVersion;