diff --git a/frontend/filemanager.html b/frontend/filemanager.html
index bd71c491b..c2e1a9490 100644
--- a/frontend/filemanager.html
+++ b/frontend/filemanager.html
@@ -2,9 +2,9 @@
-
+
- FileManager
+ File Manager
diff --git a/frontend/src/components/LogsViewer.vue b/frontend/src/components/LogsViewer.vue
index 7e6a43468..d9ffd1968 100644
--- a/frontend/src/components/LogsViewer.vue
+++ b/frontend/src/components/LogsViewer.vue
@@ -8,10 +8,11 @@
{{ name }}
- {{ $t('terminal.title') }}
- {{ $t('filemanager.title') }}
- {{ $t('logs.download') }}
+
+
+
+
@@ -54,6 +55,7 @@ export default {
accessToken: localStorage.token,
apiOrigin: API_ORIGIN || '',
logsModel: null,
+ busyRestart: false,
id: '',
name: '',
type: '',
@@ -67,6 +69,15 @@ export default {
},
onDownload() {
this.logsModel.download();
+ },
+ async onRestartApp() {
+ if (this.type !== 'app') return;
+
+ this.busyRestart = true;
+
+ await this.logsModel.restartApp();
+
+ this.busyRestart = false;
}
},
async mounted() {
@@ -113,12 +124,14 @@ export default {
if (this.type === 'app') {
try {
const app = await this.logsModel.getApp();
- this.name = app.fqdn + ' (' + app.manifest.title + ')';
+ this.name = `${app.label || app.fqdn} (${app.manifest.title})`;
} catch (e) {
console.error(`Failed to get app info for ${this.id}:`, e);
}
}
+ window.document.title = `Logs Viewer - ${this.name}`;
+
this.downloadUrl = this.logsModel.getDownloadUrl();
this.logsModel.stream((id, time, html) => {
@@ -155,6 +168,7 @@ body {
background-color: black;
color: white;
margin-bottom: 0 !important;
+ padding: 5px 10px;
}
.log-line {
@@ -186,12 +200,5 @@ body {
height: 5px;
}
-a.p-button:hover, a.p-button:focus {
- color: white;
- text-decoration: none;
- background: #0d89ec;
- border-color: #0d89ec;
-}
-
diff --git a/frontend/src/models/LogsModel.js b/frontend/src/models/LogsModel.js
index 6ce1c1fb2..ecb358de4 100644
--- a/frontend/src/models/LogsModel.js
+++ b/frontend/src/models/LogsModel.js
@@ -2,6 +2,8 @@
import moment from 'moment';
import superagent from 'superagent';
import { ansiToHtml } from 'anser';
+import { ISTATES } from '../constants.js';
+import { sleep } from 'pankow/utils';
// https://github.com/janl/mustache.js/blob/master/mustache.js#L60
const entityMap = {
@@ -93,6 +95,34 @@ export function create(origin, accessToken, type, id) {
}
return result.body;
+ },
+ async restartApp() {
+ if (type !== 'app') return;
+
+ let error, result;
+ try {
+ result = await superagent.post(`${origin}/api/v1/apps/${id}/restart`).query({ access_token: accessToken });
+ } catch (e) {
+ error = e;
+ }
+
+ if (error || result.statusCode !== 202) {
+ console.error(`Failed to restart app ${this.id}`, error || result.statusCode);
+ return;
+ }
+
+ while(true) {
+ let result;
+ try {
+ result = await superagent.get(`${origin}/api/v1/apps/${id}`).query({ access_token: accessToken });
+ } catch (e) {
+ console.error(e);
+ }
+
+ if (result && result.statusCode === 200 && result.body.installationState === ISTATES.INSTALLED) break;
+
+ await sleep(2000);
+ }
}
};
}
diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue
index e46afd0ff..f147ef012 100644
--- a/frontend/src/views/Home.vue
+++ b/frontend/src/views/Home.vue
@@ -58,8 +58,8 @@
- {{ $t('filemanager.toolbar.openLogs') }}
- {{ $t('filemanager.toolbar.openTerminal') }}
+
+
@@ -472,7 +472,7 @@ export default {
return;
}
- this.title = result.body.label || result.body.fqdn;
+ this.title = `${result.body.label || result.body.fqdn} (${result.body.manifest.title})`;
} else if (type === 'volume') {
let error, result;
try {
@@ -493,7 +493,7 @@ export default {
return;
}
- window.document.title = this.title + ' - File Manager';
+ window.document.title = `File Manager - ${this.title}`;
this.cwd = sanitize('/' + (cwd ? cwd.join('/') : '/'));
this.resourceType = type;
@@ -553,11 +553,4 @@ export default {
margin-top: 5px;
}
-a.p-button:hover {
- text-decoration: none;
- background: #0d89ec;
- color: #ffffff;
- border-color: #0d89ec;
-}
-