diff --git a/frontend/src/metabase/home/containers/SearchApp.jsx b/frontend/src/metabase/home/containers/SearchApp.jsx index e535386df6c8d9e27f79cee9ff063535d6890f7c..475c7a7c54d8d281d54b20c21282c8f920f645d3 100644 --- a/frontend/src/metabase/home/containers/SearchApp.jsx +++ b/frontend/src/metabase/home/containers/SearchApp.jsx @@ -12,8 +12,6 @@ import Card from "metabase/components/Card"; import EntityItem from "metabase/components/EntityItem"; import Subhead from "metabase/components/Subhead"; -import { entityTypeForModel } from "metabase/schema"; - export default class SearchApp extends React.Component { render() { return ( @@ -36,36 +34,89 @@ export default class SearchApp extends React.Component { </Box> <Box mt={4}> <Subhead>{t`It's quiet around here...`}</Subhead> - <Text - >{t`Metabase couldn't find any results for this.`}</Text> + <p>{t`Metabase couldn't find any results for this.`}</p> </Box> </Flex> ); } + const types = _.chain(list) + .groupBy("model") + .value(); + return ( <Box> - {_.chain(list) - .groupBy("model") - .pairs() - .value() - .map(([model, items]) => ( - <Box mt={2} mb={3}> - <div className="text-uppercase text-grey-4 text-small text-bold my1"> - {entityTypeForModel(model)} - </div> - <Card> - {items.map(item => ( - <Link to={item.getUrl()}> - <EntityItem - name={item.getName()} - iconName={item.getIcon()} - iconColor={item.getColor()} - /> - </Link> - ))} - </Card> - </Box> - ))} + {types.dashboard && ( + <Box mt={2} mb={3}> + <div className="text-uppercase text-grey-4 text-small text-bold my1"> + {t`Dashboards`} + </div> + <Card px={2}> + {types.dashboard.map(item => ( + <Link to={item.getUrl()}> + <EntityItem + name={item.getName()} + iconName={item.getIcon()} + iconColor={item.getColor()} + /> + </Link> + ))} + </Card> + </Box> + )} + {types.collection && ( + <Box mt={2} mb={3}> + <div className="text-uppercase text-grey-4 text-small text-bold my1"> + {t`Collections`} + </div> + <Card px={2}> + {types.collection.map(item => ( + <Link to={item.getUrl()}> + <EntityItem + name={item.getName()} + iconName={item.getIcon()} + iconColor={item.getColor()} + /> + </Link> + ))} + </Card> + </Box> + )} + {types.card && ( + <Box mt={2} mb={3}> + <div className="text-uppercase text-grey-4 text-small text-bold my1"> + {t`Questions`} + </div> + <Card px={2}> + {types.card.map(item => ( + <Link to={item.getUrl()}> + <EntityItem + name={item.getName()} + iconName={item.getIcon()} + iconColor={item.getColor()} + /> + </Link> + ))} + </Card> + </Box> + )} + {types.pulse && ( + <Box mt={2} mb={3}> + <div className="text-uppercase text-grey-4 text-small text-bold my1"> + {t`Pulse`} + </div> + <Card px={2}> + {types.pulse.map(item => ( + <Link to={item.getUrl()}> + <EntityItem + name={item.getName()} + iconName={item.getIcon()} + iconColor={item.getColor()} + /> + </Link> + ))} + </Card> + </Box> + )} </Box> ); }}