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";
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>
);
}}
......
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