Skip to content
Snippets Groups Projects
Unverified Commit cba58286 authored by dpsutton's avatar dpsutton Committed by GitHub
Browse files

Annotate collection tree with datasets and cards (#18833)

* Annotate collection tree with datasets and cards

In order to know which collections have items of interest, they are
annotated with two new keys: `:here` and `:below`. These keys will have
a collection (in clojure a set, in js an array) which could contain
dataset and card, depending if they have those items "here" or in
collections below this node.

We include information about which subtrees are interesting so we know
to show or highlight those. We include information about which nodes
have interesting things versus which contain nodes which have things so
we can possibly implement drilldown in an intelligent manner.

ie

```
.
├── root
```

could expand automatically to

```
.
├── root
│   ├── collection
│   │   ├── collection that actually has items
```

without requiring someone to click on the intermediate collection which
has no items itself, just a collection with items.

http://localhost:3000/api/collection/tree?tree=true

```js
{
    "name": "super",
    "id": 154,
    "location": "/",
    "below": ["dataset"]  ;; indicates collections below have datasets
    "children": [{
        "name": "parent",
        "id": 155,
        "location": "/154/",
        "below": ["dataset"]  ;; indicates the same
        "children": [{
            "children": [],
            "slug": "contains",
            "name": "contains",
            "here": ["dataset"],  ;; this node has datasets
            "id": 157,
            "location": "/154/155/",
        }],

    }, {
        "children": [],
        "name": "sibling",
        "id": 156,
        "location": "/154/",
    }],
}
```

* docstring

* Alignment for readability
parent b4610877
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment