From 63853d9de19fc45f8253fb41c465f8924c19008b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 30 Mar 2020 16:12:28 +0100 Subject: [PATCH] Add download logs button to BugReportDialog Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/dialogs/BugReportDialog.js | 34 ++++++++++++++++++- src/i18n/strings/en_EN.json | 2 ++ src/rageshake/submit-rageshake.js | 2 +- yarn.lock | 5 +++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/components/views/dialogs/BugReportDialog.js b/src/components/views/dialogs/BugReportDialog.js index 6e337d53dc..0916e680e0 100644 --- a/src/components/views/dialogs/BugReportDialog.js +++ b/src/components/views/dialogs/BugReportDialog.js @@ -23,7 +23,8 @@ import * as sdk from '../../../index'; import SdkConfig from '../../../SdkConfig'; import Modal from '../../../Modal'; import { _t } from '../../../languageHandler'; -import sendBugReport from '../../../rageshake/submit-rageshake'; +import sendBugReport, {downloadBugReport} from '../../../rageshake/submit-rageshake'; +import AccessibleButton from "../elements/AccessibleButton"; export default class BugReportDialog extends React.Component { constructor(props) { @@ -95,6 +96,32 @@ export default class BugReportDialog extends React.Component { }); } + _onDownload = async (ev) => { + this.setState({ busy: true, progress: null, err: null }); + this._sendProgressCallback(_t("Preparing to download logs")); + + try { + await downloadBugReport({ + sendLogs: true, + progressCallback: this._sendProgressCallback, + label: this.props.label, + }); + + this.setState({ + busy: false, + progress: null, + }); + } catch (err) { + if (!this._unmounted) { + this.setState({ + busy: false, + progress: null, + err: _t("Failed to send logs: ") + `${err.message}`, + }); + } + } + }; + _onTextChange(ev) { this.setState({ text: ev.target.value }); } @@ -165,6 +192,11 @@ export default class BugReportDialog extends React.Component { }, ) }
+ +