Sha256: bc80fe8edfbdc9f0b863f343cff22a15b8265dba8b117cfb3cf792ac01b04a08
Contents?: true
Size: 1.14 KB
Versions: 44
Compression:
Stored size: 1.14 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { Row, Label } from 'patternfly-react'; import { noop } from 'foremanReact/common/helpers'; import { translate as __ } from 'foremanReact/common/I18n'; import './TargetingHostsLabelsRow.scss'; const TargetingHostsLabelsRow = ({ query, updateQuery }) => { const onDeleteClick = keyToDelete => { const { [keyToDelete]: deleted, ...queryWithoutDeleted } = query; updateQuery(queryWithoutDeleted); }; const queryEntries = Object.entries(query); return ( queryEntries.length > 0 && ( <Row className="tasks-labels-row"> <span className="title">{__('Active Filters:')}</span> {queryEntries.map(([key, value]) => ( <Label bsStyle="info" key={key} onRemoveClick={() => onDeleteClick(key)} > {`${key} = ${value}`} </Label> ))} </Row> ) ); }; TargetingHostsLabelsRow.propTypes = { query: PropTypes.object, updateQuery: PropTypes.func, }; TargetingHostsLabelsRow.defaultProps = { query: {}, updateQuery: noop, }; export default TargetingHostsLabelsRow;
Version data entries
44 entries across 44 versions & 1 rubygems