jinja templating in markdown element or in iframe URL
Hi, is there any plan to implement templating in markdown frames of dashboard v2 ? I'd need to capture url parameters for changing charts.
thanks!
Alternatively, it could be sufficient enable templating in iframe component, for changing values of json of the chart viewed inside iframe...
I think we have 2 ways to get markdown in a dashboard at this time, the native dashboard component, and the "Markup" visualization. I think it'd be possible to add that feature to the second one (as the markdown is process in the backend), but probably harder for the the dashboard-native component. I think the idea was to deprecate the Markup visualization though, but now that all visualizations are plugins, you can run always keep it around as a plugin.
Thanks. I already edited MarkupViz in order to apply templates, and it works, but it isn't anymore possible add markup charts to dashboards because, I suppose, they are deprecated. Is it possible to re-enable this possibility? My idea is insert in markup visualization an with url of other charts with parameters. My main problem is that I have to draw country maps of every italian province and region, and I'd prefer to use only one chart instead of 130...
I tried to apply process_template() to iframe viz. I'm trying to call another chart with parameters in json data in url, for example %22select_country%22%3A%22{{url_param('cartina',default='Toscana_province_2020')}}%22 in place of original %22select_country%22%3A%22Toscana_province_2020%22
I tried to edit get_data() in this way: class IFrameViz(BaseViz):
"""You can squeeze just about anything in this iFrame component"""
viz_type = "iframe"
verbose_name = _("iFrame")
credits = 'a <a href="https://github.com/airbnb/superset">Superset</a> original'
is_timeseries = False
def query_obj(self):
return None
def get_df(self, query_obj: Optional[Dict[str, Any]] = None) -> pd.DataFrame:
return pd.DataFrame()
def get_data(self, df: pd.DataFrame) -> VizData:
template_processor = get_template_processor(self.datasource.database)
self.form_data['url']=template_processor.process_template(self.form_data['url'])
return {"iframe": True }
If I look at json I see "url" field with parameters replaced by correct values, but url called by browser in order to fill page has parameters replaced by anything. example: in iframe URL I put ....&height={{url_param('altezza',default=300)}} in json of chart I see ...&height=300 but page has been called with ...&height=
Can anyone help me ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.
Do you have any solution for this? @zufolo441
no. I still search a solution to use variables outside SQL queries.....
Solution partially found, with handlebars. here I can insert an iframe with a query that returns json code for creating a slice.