forked from mystiq/hydrogen-web
add options to send logs to server in settings ui
This commit is contained in:
parent
375d8b066c
commit
8fe8981ffa
2 changed files with 16 additions and 1 deletions
|
@ -54,3 +54,11 @@ export function insertAt(parentNode: Element, idx: number, childNode: Node): voi
|
||||||
export function removeChildren(parentNode: Element): void {
|
export function removeChildren(parentNode: Element): void {
|
||||||
parentNode.innerHTML = '';
|
parentNode.innerHTML = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function disableTargetCallback(callback: (evt: Event) => Promise<void>): (evt: Event) => Promise<void> {
|
||||||
|
return async (evt: Event) => {
|
||||||
|
(evt.target as HTMLElement)?.setAttribute("disabled", "disabled");
|
||||||
|
await callback(evt);
|
||||||
|
(evt.target as HTMLElement)?.removeAttribute("disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {TemplateView} from "../../general/TemplateView";
|
import {TemplateView} from "../../general/TemplateView";
|
||||||
|
import {disableTargetCallback} from "../../general/utils";
|
||||||
import {KeyBackupSettingsView} from "./KeyBackupSettingsView.js"
|
import {KeyBackupSettingsView} from "./KeyBackupSettingsView.js"
|
||||||
|
|
||||||
export class SettingsView extends TemplateView {
|
export class SettingsView extends TemplateView {
|
||||||
|
@ -101,11 +102,17 @@ export class SettingsView extends TemplateView {
|
||||||
return row(t, vm.i18n`Use the following theme`, this._themeOptions(t, vm));
|
return row(t, vm.i18n`Use the following theme`, this._themeOptions(t, vm));
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
const logButtons = [];
|
||||||
|
if (vm.canSendLogsToServer) {
|
||||||
|
logButtons.push(t.button({onClick: disableTargetCallback(() => vm.sendLogsToServer())}, `Submit logs to ${vm.logsServer}`));
|
||||||
|
}
|
||||||
|
logButtons.push(t.button({onClick: () => vm.exportLogs()}, "Download logs"));
|
||||||
settingNodes.push(
|
settingNodes.push(
|
||||||
t.h3("Application"),
|
t.h3("Application"),
|
||||||
row(t, vm.i18n`Version`, version),
|
row(t, vm.i18n`Version`, version),
|
||||||
row(t, vm.i18n`Storage usage`, vm => `${vm.storageUsage} / ${vm.storageQuota}`),
|
row(t, vm.i18n`Storage usage`, vm => `${vm.storageUsage} / ${vm.storageQuota}`),
|
||||||
row(t, vm.i18n`Debug logs`, t.button({onClick: () => vm.exportLogs()}, "Export")),
|
row(t, vm.i18n`Debug logs`, logButtons),
|
||||||
|
t.p({className: {hidden: vm => !vm.logsFeedbackMessage}}, vm => vm.logsFeedbackMessage),
|
||||||
t.p(["Debug logs contain application usage data including your username, the IDs or aliases of the rooms or groups you have visited, the usernames of other users and the names of files you send. They do not contain messages. For more information, review our ",
|
t.p(["Debug logs contain application usage data including your username, the IDs or aliases of the rooms or groups you have visited, the usernames of other users and the names of files you send. They do not contain messages. For more information, review our ",
|
||||||
t.a({href: "https://element.io/privacy", target: "_blank", rel: "noopener"}, "privacy policy"), "."]),
|
t.a({href: "https://element.io/privacy", target: "_blank", rel: "noopener"}, "privacy policy"), "."]),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue