Add download logs button to BugReportDialog
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
2a45ccaef3
commit
63853d9de1
4 changed files with 41 additions and 2 deletions
|
@ -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 {
|
|||
},
|
||||
) }
|
||||
</b></p>
|
||||
|
||||
<AccessibleButton onClick={this._onDownload} kind="link">
|
||||
{ _t("Click here to download your logs.") }
|
||||
</AccessibleButton>
|
||||
|
||||
<Field
|
||||
type="text"
|
||||
className="mx_BugReportDialog_field_input"
|
||||
|
|
|
@ -1499,8 +1499,10 @@
|
|||
"Logs sent": "Logs sent",
|
||||
"Thank you!": "Thank you!",
|
||||
"Failed to send logs: ": "Failed to send logs: ",
|
||||
"Preparing to download logs": "Preparing to download logs",
|
||||
"Debug logs contain application usage data including your username, the IDs or aliases of the rooms or groups you have visited and the usernames of other users. They do not contain messages.": "Debug logs contain application usage data including your username, the IDs or aliases of the rooms or groups you have visited and the usernames of other users. They do not contain messages.",
|
||||
"Before submitting logs, you must <a>create a GitHub issue</a> to describe your problem.": "Before submitting logs, you must <a>create a GitHub issue</a> to describe your problem.",
|
||||
"Click here to download your logs.": "Click here to download your logs.",
|
||||
"GitHub issue": "GitHub issue",
|
||||
"Notes": "Notes",
|
||||
"If there is additional context that would help in analysing the issue, such as what you were doing at the time, room IDs, user IDs, etc., please include those things here.": "If there is additional context that would help in analysing the issue, such as what you were doing at the time, room IDs, user IDs, etc., please include those things here.",
|
||||
|
|
|
@ -195,7 +195,7 @@ export async function downloadBugReport(opts) {
|
|||
resolve();
|
||||
});
|
||||
reader.readAsArrayBuffer(e[1]);
|
||||
}))
|
||||
}));
|
||||
} else {
|
||||
metadata += `${e[0]} = ${e[1]}\n`;
|
||||
}
|
||||
|
|
|
@ -8189,6 +8189,11 @@ tapable@^1.0.0, tapable@^1.1.3:
|
|||
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
|
||||
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==
|
||||
|
||||
tar-js@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/tar-js/-/tar-js-0.3.0.tgz#6949aabfb0ba18bb1562ae51a439fd0f30183a17"
|
||||
integrity sha1-aUmqv7C6GLsVYq5RpDn9DzAYOhc=
|
||||
|
||||
terser-webpack-plugin@^1.4.3:
|
||||
version "1.4.3"
|
||||
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz#5ecaf2dbdc5fb99745fd06791f46fc9ddb1c9a7c"
|
||||
|
|
Loading…
Reference in a new issue