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 { 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 {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -23,6 +33,24 @@ class ErrorBoundary extends React.Component {
|
||||
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() {
|
||||
const { t } = this.props;
|
||||
const { error, info } = this.state;
|
||||
@@ -32,22 +60,20 @@ class ErrorBoundary extends React.Component {
|
||||
return (
|
||||
<div>
|
||||
<Result
|
||||
status='500'
|
||||
status="500"
|
||||
title={t("general.labels.exceptiontitle")}
|
||||
subTitle={t("general.messages.exception")}
|
||||
extra={
|
||||
<Space>
|
||||
<Button
|
||||
type='primary'
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
window.location.reload();
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
{t("general.actions.refresh")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
alert("Not implemented yet.");
|
||||
}}>
|
||||
<Button onClick={this.handleErrorSubmit}>
|
||||
{t("general.actions.submitticket")}
|
||||
</Button>
|
||||
</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