Closed ileodo closed 7 months ago
hi @ileodo, yes that's possible, take a look at the example dashboard: https://github.com/andreasgerstmayr/fava-dashboards/blob/4d6340babb69ce77722cdcafbb17262d25a08fea/example/dashboards.yaml#L592
You can access the account and filter in the same way.
thanks @andreasgerstmayr, it would be great to just support a special variable name in the link filed which will be replaced with the time instead of manually do it in js.
I'd like to keep the extension as simple as possible, and don't plan to support this for now.
@ileodo: Related to this, just wanted to share this snippet of code that makes the above request pretty easy to implement within the new utils
configuration:
# dashboards.yml
utils:
inline: |
const linkReplacer = () => {
const windowUrl = new URL(window.location.href);
window.document.querySelectorAll('h2 a').forEach(function (el) {
const linkUrl = new URL(el.href);
linkUrl.searchParams.set('time', windowUrl.searchParams.get('time'));
linkUrl.searchParams.set('conversion', windowUrl.searchParams.get('conversion'));
el.href = linkUrl;
});
}
linkReplacer();
This JS snippet runs after each page load, loops through all the dashboard's panel headlines, and updates their href
with the current page's time
and conversion
parameters. It's easy to extend with other dynamic parts as well.
@mattmattmatt thanks for the snippet!
I've added a generic way to copy Fava's filter parameters to all links in #41.
as per above, is that possible to refer to the fava's current filters, including time, account and filter?
Thanks