import * as React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as appActions from 'src/store/modules/app/actions'; import * as testsActions from 'src/store/modules/tests/actions'; import Dropdown from 'src/components/ui/Dropdown'; import Button from 'src/components/ui/Button'; import TextInput from 'src/components/ui/TextInput'; import ControlPanelStyled from './styled'; import { failedSuitesSelector } from './selectors'; import { ControlPanelProps } from './types'; import { RootStore } from 'src/store/types/store'; const runTestItems = [ { value: 'all', title: 'Run all tests' }, { value: 'failed', title: 'Restart failed tests' }, ]; const testsViewItems = [ { value: 'collapseAll', title: 'Collapse all' }, { value: 'expandAll', title: 'Expand all' }, { value: 'expandErrors', title: 'Expand errors' }, { value: 'expandRetries', title: 'Expand retries' }, ]; const screenViewItems = [ { value: '3-up', title: '3-up' }, { value: 'onlyDiff', title: 'Only Diff' }, { value: 'loupe', title: 'Loupe' }, { value: 'swipe', title: 'Swipe' }, { value: 'onionSkin', title: 'Onion Skin' }, ]; class ControlPanel extends React.Component { public componentDidMount() { const { isGui, initGui } = this.props; if (isGui) { initGui(); } } private handleInputUrl = (ev) => this.props.setUrl(ev.target.value); private handleAcceptAllClick = () => { const { failed, acceptAll } = this.props; acceptAll(failed); } private handleRunTestsClick = (value: string) => { const { runAllTests, runFailedTests, failed } = this.props; if (value === 'all') { runAllTests(); } else { runFailedTests(failed); } } private handleScreenViewMode = (value: string) => this.props.setScreenViewMode(value); private handleTestsViewMode = (value: string) => this.props.setTestsViewMode(value); public render(): JSX.Element { const { isGui, isRunning } = this.props; return ( { isGui && } { isGui &&