/** * * Controller * */ import React from 'react'; import PropTypes from 'prop-types'; import { get, map } from 'lodash'; import cn from 'classnames'; import { FormattedMessage } from 'react-intl'; import pluginId from '../../pluginId'; import InputCheckbox from '../InputCheckboxPlugin'; import styles from './styles.scss'; class Controller extends React.Component { state = { inputSelected: '' }; setNewInputSelected = name => { this.setState({ inputSelected: name }); }; handleChange = () => { this.context.selectAllActions( `${this.props.inputNamePath}.controllers.${this.props.name}`, !this.areAllActionsSelected() ); }; hasSomeActionsSelected = () => { const { actions } = this.props; return Object.keys(actions).some( action => actions[action].enabled === true ); }; areAllActionsSelected = () => { const { actions } = this.props; return Object.keys(actions).every( action => actions[action].enabled === true ); }; render() { const labelId = this.areAllActionsSelected() ? 'unselectAll' : 'selectAll'; return (