import React from 'react'; import { connect } from 'react-redux'; import cn from 'classnames'; import withSiteIdRouter from 'HOCs/withSiteIdRouter'; import { ErrorDetails, IconButton, Icon, Loader, Button } from 'UI'; import { sessions as sessionsRoute } from 'App/routes'; import { TYPES as EV_FILER_TYPES } from 'Types/filter/event'; import { UNRESOLVED, RESOLVED, IGNORED } from 'Types/errorInfo'; import { addFilterByKeyAndValue } from 'Duck/search'; import { resolve, unresolve, ignore, toggleFavorite } from 'Duck/errors'; import { resentOrDate } from 'App/date'; import Divider from 'Components/Errors/ui/Divider'; import ErrorName from 'Components/Errors/ui/ErrorName'; import Label from 'Components/Errors/ui/Label'; import SharePopup from 'Shared/SharePopup'; import { FilterKey } from 'Types/filter/filterType'; import SessionBar from './SessionBar'; @withSiteIdRouter @connect( (state) => ({ error: state.getIn(['errors', 'instance']), trace: state.getIn(['errors', 'instanceTrace']), sourcemapUploaded: state.getIn(['errors', 'sourcemapUploaded']), resolveToggleLoading: state.getIn(['errors', 'resolve', 'loading']) || state.getIn(['errors', 'unresolve', 'loading']), ignoreLoading: state.getIn(['errors', 'ignore', 'loading']), toggleFavoriteLoading: state.getIn(['errors', 'toggleFavorite', 'loading']), traceLoading: state.getIn(['errors', 'fetchTrace', 'loading']), }), { resolve, unresolve, ignore, toggleFavorite, addFilterByKeyAndValue, } ) export default class MainSection extends React.PureComponent { resolve = () => { const { error } = this.props; this.props.resolve(error.errorId); }; unresolve = () => { const { error } = this.props; this.props.unresolve(error.errorId); }; ignore = () => { const { error } = this.props; this.props.ignore(error.errorId); }; bookmark = () => { const { error } = this.props; this.props.toggleFavorite(error.errorId); }; findSessions = () => { this.props.addFilterByKeyAndValue(FilterKey.ERROR, this.props.error.message); this.props.history.push(sessionsRoute()); }; render() { const { error, trace, sourcemapUploaded, ignoreLoading, resolveToggleLoading, toggleFavoriteLoading, className, traceLoading } = this.props; const isPlayer = window.location.pathname.includes('/session/') return (