const React = require('react'); const ReactRedux = require('react-redux'); const EmptyInstances = require('@components/empty/instances'); const PropTypes = require('@root/prop-types'); const List = require('@ui/components/list'); const selectors = require('@state/selectors'); const { connect } = ReactRedux; const { instancesByServiceIdSelector } = selectors; const { ListItem, ListItemView, ListItemMeta, ListItemTitle, ListItemOptions } = List; const Instances = ({ instances = [] }) => { const empty = instances.length ? null : ( ); const instanceList = instances.map((service) => ( {service.name} )); return (
{empty} {instanceList}
); }; Instances.propTypes = { instances: React.PropTypes.arrayOf(PropTypes.instance) }; const mapStateToProps = (state, { params = {} }) => ({ instances: instancesByServiceIdSelector(params.serviceId)(state) }); module.exports = connect( mapStateToProps )(Instances);