mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 17:28:54 +00:00
bb62993ea5
* Host side panel * Query form handles labels * QueryComposer handles labels * ManageHostsPage add label transitions * Stop preventing default on click outside of ellipsis menu * get labels from API * use real label data in hosts side panel * create label on label form submit * adds platform dropdown * Validate query text * Label header * validate presence of query text
50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
import React, { Component, PropTypes } from 'react';
|
|
import { isEqual, noop } from 'lodash';
|
|
|
|
import labelInterface from 'interfaces/label';
|
|
import PanelGroupItem from '../PanelGroupItem';
|
|
|
|
class PanelGroup extends Component {
|
|
static propTypes = {
|
|
groupItems: PropTypes.arrayOf(labelInterface),
|
|
onLabelClick: PropTypes.func,
|
|
selectedLabel: labelInterface,
|
|
};
|
|
|
|
static defaultProps = {
|
|
onLabelClick: noop,
|
|
};
|
|
|
|
renderGroupItem = (item) => {
|
|
const {
|
|
onLabelClick,
|
|
selectedLabel,
|
|
} = this.props;
|
|
const selected = isEqual(selectedLabel, item);
|
|
|
|
return (
|
|
<PanelGroupItem
|
|
isSelected={selected}
|
|
item={item}
|
|
key={item.display_text}
|
|
onLabelClick={onLabelClick(item)}
|
|
/>
|
|
);
|
|
}
|
|
|
|
render () {
|
|
const { groupItems } = this.props;
|
|
const { renderGroupItem } = this;
|
|
|
|
return (
|
|
<div>
|
|
{groupItems.map((item) => {
|
|
return renderGroupItem(item);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default PanelGroup;
|