import { connect } from 'react-redux'; import withSiteIdRouter from 'HOCs/withSiteIdRouter'; import withPermissions from 'HOCs/withPermissions' import { UNRESOLVED, RESOLVED, IGNORED, BOOKMARK } from "Types/errorInfo"; import { fetchBookmarks, editOptions } from "Duck/errors"; import { applyFilter } from 'Duck/filters'; import { fetchList as fetchSlackList } from 'Duck/integrations/slack'; import { errors as errorsRoute, isRoute } from "App/routes"; import DateRange from 'Components/BugFinder/DateRange'; import withPageTitle from 'HOCs/withPageTitle'; import cn from 'classnames'; import List from './List/List'; import ErrorInfo from './Error/ErrorInfo'; import Header from './Header'; import SideMenuSection from './SideMenu/SideMenuSection'; import SideMenuDividedItem from './SideMenu/SideMenuDividedItem'; const ERRORS_ROUTE = errorsRoute(); function getStatusLabel(status) { switch(status) { case UNRESOLVED: return "Unresolved"; case RESOLVED: return "Resolved"; case IGNORED: return "Ignored"; default: return ""; } } @withPermissions(['ERRORS'], 'page-margin container-90') @withSiteIdRouter @connect(state => ({ list: state.getIn([ "errors", "list" ]), status: state.getIn([ "errors", "options", "status" ]), }), { fetchBookmarks, applyFilter, fetchSlackList, editOptions, }) @withPageTitle("Errors - OpenReplay") export default class Errors extends React.PureComponent { constructor(props) { super(props) this.state = { filter: '', } } componentDidMount() { this.props.fetchSlackList(); // Delete after implementing cache } ensureErrorsPage() { const { history } = this.props; if (!isRoute(ERRORS_ROUTE, history.location.pathname)) { history.push(ERRORS_ROUTE); } } onStatusItemClick = ({ key }) => { this.props.editOptions({ status: key }); } onBookmarksClick = () => { this.props.editOptions({ status: BOOKMARK }); } render() { const { count, match: { params: { errorId } }, status, list, history, } = this.props; return (