Skip to content
Snippets Groups Projects
Commit aa78f200 authored by Tom Robinson's avatar Tom Robinson
Browse files

Get listSelect working on CollectionLanding

parent 4b7ace01
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,8 @@ import CollectionEmptyState from "metabase/components/CollectionEmptyState"; ...@@ -22,7 +22,8 @@ import CollectionEmptyState from "metabase/components/CollectionEmptyState";
import EntityMenu from "metabase/components/EntityMenu"; import EntityMenu from "metabase/components/EntityMenu";
import CollectionListLoader from "metabase/containers/CollectionListLoader"; import CollectionListLoader from "metabase/containers/CollectionListLoader";
import CollectionItemsLoader from "metabase/containers/CollectionItemsLoader"; import CollectionLoader from "metabase/containers/CollectionItemsLoader";
import { entityListLoader } from "metabase/entities/containers/EntityListLoader";
import Collections from "metabase/entities/collections"; import Collections from "metabase/entities/collections";
...@@ -85,15 +86,19 @@ const CollectionList = () => { ...@@ -85,15 +86,19 @@ const CollectionList = () => {
); );
}; };
@connect((state, { collectionId }) => ({ entityQuery: { collectionId } }))
@entityListLoader({
entityType: "search",
wrapped: true,
})
@listSelect() @listSelect()
@connect(null, mapDispatchToProps)
class DefaultLanding extends React.Component { class DefaultLanding extends React.Component {
state = { state = {
reload: false, reload: false,
}; };
render() { render() {
const { collectionId, onToggleSelected, selection } = this.props; const { collectionId, list, onToggleSelected, selection } = this.props;
// Show the // Show the
const showCollectionList = collectionId === "root"; const showCollectionList = collectionId === "root";
...@@ -110,18 +115,14 @@ class DefaultLanding extends React.Component { ...@@ -110,18 +115,14 @@ class DefaultLanding extends React.Component {
)} )}
<Box w={2 / 3}> <Box w={2 / 3}>
<Box> <Box>
<CollectionItemsLoader <CollectionLoader collectionId={collectionId || "root"}>
reload {({ collection }) => {
wrapped if (list.length === 0) {
collectionId={collectionId || "root"}
>
{({ collection, items }) => {
if (items.length === 0) {
return <CollectionEmptyState />; return <CollectionEmptyState />;
} }
const [pinned, other] = _.partition( const [pinned, other] = _.partition(
items, list,
i => i.collection_position != null, i => i.collection_position != null,
); );
...@@ -212,7 +213,7 @@ class DefaultLanding extends React.Component { ...@@ -212,7 +213,7 @@ class DefaultLanding extends React.Component {
</Box> </Box>
); );
}} }}
</CollectionItemsLoader> </CollectionLoader>
</Box> </Box>
</Box> </Box>
</Flex> </Flex>
......
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