discoveryjs / discovery

A framework for rapid data (JSON) analysis, shareable serverless reports and dashboards
https://discoveryjs.github.io/discovery/
MIT License
331 stars 6 forks source link

Pass url params to defineObjectMarker #71

Open smelukov opened 3 years ago

smelukov commented 3 years ago

Want to use defineObjectMarker like:

defineObjectMarker('package', {
        page: 'package',
        ref: 'id',
        title: 'name',
        params: { instance: 'instance.path' }
})
lahmatiy commented 3 years ago

To solve this problem, I thought to use a special parameter href, which allows you to set the link generation function like so:

defineObjectMarker('package', {
        page: 'package',
        ref: 'id',
        title: 'name',
        href: (page, ref, object) => `#${page}:${ref}&instance=${instance.path}`
})

On the other hand, I see it's a source of bugs, e.g. all the values need to be escaped.

Also I not sure you use this feature right. Let's take a closer look at what you have and what you want to get?