Fix webterminal usage of AppsModel
This commit is contained in:
@@ -149,7 +149,7 @@ export default {
|
||||
if (!confirmed) return;
|
||||
|
||||
this.busyRestart = true;
|
||||
await this.appsModel.restart();
|
||||
await this.appsModel.restart(this.id);
|
||||
this.busyRestart = false;
|
||||
},
|
||||
async connect(retry = false) {
|
||||
@@ -221,27 +221,27 @@ export default {
|
||||
this.id = id;
|
||||
this.name = id;
|
||||
|
||||
this.appsModel = AppsModel.create(API_ORIGIN, this.accessToken, this.id);
|
||||
this.appsModel = AppsModel.create(API_ORIGIN, this.accessToken);
|
||||
this.directoryModel = createDirectoryModel(API_ORIGIN, this.accessToken, `apps/${id}`);
|
||||
|
||||
try {
|
||||
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;
|
||||
this.showFilemanager = !!app.manifest.addons.localstorage;
|
||||
|
||||
this.schedulerMenuModel = !app.manifest.addons.scheduler ? [] : Object.keys(app.manifest.addons.scheduler).map((k) => {
|
||||
return {
|
||||
label: k,
|
||||
action: () => this.terminalInject('scheduler', app.manifest.addons.scheduler[k].command)
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(`Failed to get app info for ${this.id}:`, e);
|
||||
const [error, app] = await this.appsModel.get(this.id);
|
||||
if (error) {
|
||||
console.error(`Failed to get app info for ${this.id}:`, error);
|
||||
return this.onFatalError(`Unknown app ${this.id}. Cannot continue.`);
|
||||
}
|
||||
|
||||
this.name = `${app.label || app.fqdn} (${app.manifest.title})`;
|
||||
this.addons = app.manifest.addons;
|
||||
this.manifestVersion = app.manifest.manifestVersion;
|
||||
this.showFilemanager = !!app.manifest.addons.localstorage;
|
||||
|
||||
this.schedulerMenuModel = !app.manifest.addons.scheduler ? [] : Object.keys(app.manifest.addons.scheduler).map((k) => {
|
||||
return {
|
||||
label: k,
|
||||
action: () => this.terminalInject('scheduler', app.manifest.addons.scheduler[k].command)
|
||||
};
|
||||
});
|
||||
|
||||
window.document.title = `Terminal - ${this.name}`;
|
||||
|
||||
window.addEventListener('beforeunload', function (e) {
|
||||
|
||||
Reference in New Issue
Block a user