settings: add button to get logs

This commit is contained in:
Harvey Tindall
2021-12-30 17:54:27 +00:00
parent 8888807780
commit 51b59ae103
8 changed files with 33 additions and 1 deletions
+2
View File
@@ -87,6 +87,8 @@ window.availableProfiles = window.availableProfiles || [];
window.modals.matrix = new Modal(document.getElementById("modal-matrix"));
window.modals.logs = new Modal(document.getElementById("modal-logs"));
if (window.telegramEnabled) {
window.modals.telegram = new Modal(document.getElementById("modal-telegram"));
}
+8 -1
View File
@@ -634,6 +634,13 @@ export class settingsList {
}
});
private _showLogs = () => _get("/logs", null, (req: XMLHttpRequest) => {
if (req.readyState == 4 && req.status == 200) {
(document.getElementById("log-area") as HTMLPreElement).textContent = req.response["log"] as string;
window.modals.logs.show();
}
});
constructor() {
this._sections = {};
this._buttons = {};
@@ -645,7 +652,7 @@ export class settingsList {
};
this._saveButton.onclick = this._save;
document.addEventListener("settings-requires-restart", () => { this._needsRestart = true; });
document.getElementById("settings-logs").onclick = this._showLogs;
const advancedEnableToggle = document.getElementById("settings-advanced-enabled") as HTMLInputElement;
advancedEnableToggle.onchange = () => {
document.dispatchEvent(new CustomEvent("settings-advancedState", { detail: advancedEnableToggle.checked }));
+1
View File
@@ -107,6 +107,7 @@ declare interface Modals {
discord: Modal;
matrix: Modal;
sendPWR?: Modal;
logs: Modal;
}
interface Invite {