UNPKG

cluedin-widget

Version:

This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.

59 lines (48 loc) 1.4 kB
import React, { Component } from 'react'; import { fetchAggregationSearch } from '../../../core/action/search'; import { connect } from 'react-redux'; import SearchFilter from '../../../core/components/search/SearchFilter.jsx'; class AggregationForEntity extends Component { componentWillMount() { const { entity, } = this.props; console.log(entity); this.props.dispatch(fetchAggregationSearch(entity.id)); } render() { const { isFetchingAggregationSearch, aggregationSearchResult, entity, } = this.props; if (isFetchingAggregationSearch) { return (<div>loading...</div>); } if (!isFetchingAggregationSearch && !aggregationSearchResult.Facets) { return (<div>No Related Information found.</div>) } if (!aggregationSearchResult.Facets) { return (<div></div>); } return ( <div> <SearchFilter type="entityType" useLink={true} entitydId={entity.id} allVisible={true} facets={aggregationSearchResult.Facets.entityType} name="Related Information" /> </div> ); } } var select = (state) => { return { isFetchingAggregationSearch: state.search.isFetchingAggregationSearch, aggregationSearchResult: state.search.aggregationSearchResult, }; }; export default connect(select)(AggregationForEntity);