Skip to content
Snippets Groups Projects
Unverified Commit 1010a6fb authored by Kyle Doherty's avatar Kyle Doherty Committed by GitHub
Browse files

better ordering of search results (#7982)

* better ordering of search results

* explicit ordering
parent 23978bd6
No related branches found
No related tags found
No related merge requests found
...@@ -12,8 +12,6 @@ import Card from "metabase/components/Card"; ...@@ -12,8 +12,6 @@ import Card from "metabase/components/Card";
import EntityItem from "metabase/components/EntityItem"; import EntityItem from "metabase/components/EntityItem";
import Subhead from "metabase/components/Subhead"; import Subhead from "metabase/components/Subhead";
import { entityTypeForModel } from "metabase/schema";
export default class SearchApp extends React.Component { export default class SearchApp extends React.Component {
render() { render() {
return ( return (
...@@ -36,36 +34,89 @@ export default class SearchApp extends React.Component { ...@@ -36,36 +34,89 @@ export default class SearchApp extends React.Component {
</Box> </Box>
<Box mt={4}> <Box mt={4}>
<Subhead>{t`It's quiet around here...`}</Subhead> <Subhead>{t`It's quiet around here...`}</Subhead>
<Text <p>{t`Metabase couldn't find any results for this.`}</p>
>{t`Metabase couldn't find any results for this.`}</Text>
</Box> </Box>
</Flex> </Flex>
); );
} }
const types = _.chain(list)
.groupBy("model")
.value();
return ( return (
<Box> <Box>
{_.chain(list) {types.dashboard && (
.groupBy("model") <Box mt={2} mb={3}>
.pairs() <div className="text-uppercase text-grey-4 text-small text-bold my1">
.value() {t`Dashboards`}
.map(([model, items]) => ( </div>
<Box mt={2} mb={3}> <Card px={2}>
<div className="text-uppercase text-grey-4 text-small text-bold my1"> {types.dashboard.map(item => (
{entityTypeForModel(model)} <Link to={item.getUrl()}>
</div> <EntityItem
<Card> name={item.getName()}
{items.map(item => ( iconName={item.getIcon()}
<Link to={item.getUrl()}> iconColor={item.getColor()}
<EntityItem />
name={item.getName()} </Link>
iconName={item.getIcon()} ))}
iconColor={item.getColor()} </Card>
/> </Box>
</Link> )}
))} {types.collection && (
</Card> <Box mt={2} mb={3}>
</Box> <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> </Box>
); );
}} }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment