IO-273 Submit SD ticket from error boundary
This commit is contained in:
@@ -3,6 +3,16 @@ import React from "react";
|
|||||||
import { withTranslation } from "react-i18next";
|
import { withTranslation } from "react-i18next";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
currentUser: selectCurrentUser,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
|
||||||
class ErrorBoundary extends React.Component {
|
class ErrorBoundary extends React.Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@@ -23,6 +33,24 @@ class ErrorBoundary extends React.Component {
|
|||||||
this.setState({ ...this.state, error, info });
|
this.setState({ ...this.state, error, info });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleErrorSubmit = () => {
|
||||||
|
const errorDescription = `**Please add relevant details about what you were doing before you encountered this issue**
|
||||||
|
|
||||||
|
----
|
||||||
|
System Generated Log:
|
||||||
|
${this.state.error.message}
|
||||||
|
${this.state.error.stack}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const URL = `https://bodyshop.atlassian.net/servicedesk/customer/portal/3/group/8/create/26?summary=123&description=${encodeURI(
|
||||||
|
errorDescription
|
||||||
|
)}&customfield_10049=${window.location}&email=${
|
||||||
|
this.props.currentUser.email
|
||||||
|
}`;
|
||||||
|
console.log(`URL`, URL);
|
||||||
|
window.open(URL, "_blank");
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
const { error, info } = this.state;
|
const { error, info } = this.state;
|
||||||
@@ -32,22 +60,20 @@ class ErrorBoundary extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Result
|
<Result
|
||||||
status='500'
|
status="500"
|
||||||
title={t("general.labels.exceptiontitle")}
|
title={t("general.labels.exceptiontitle")}
|
||||||
subTitle={t("general.messages.exception")}
|
subTitle={t("general.messages.exception")}
|
||||||
extra={
|
extra={
|
||||||
<Space>
|
<Space>
|
||||||
<Button
|
<Button
|
||||||
type='primary'
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{t("general.actions.refresh")}
|
{t("general.actions.refresh")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button onClick={this.handleErrorSubmit}>
|
||||||
onClick={() => {
|
|
||||||
alert("Not implemented yet.");
|
|
||||||
}}>
|
|
||||||
{t("general.actions.submitticket")}
|
{t("general.actions.submitticket")}
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
@@ -72,4 +98,8 @@ class ErrorBoundary extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default withTranslation()(ErrorBoundary);
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(withTranslation()(ErrorBoundary));
|
||||||
|
|||||||
Reference in New Issue
Block a user