Fix params field when deleting a report

This commit is contained in:
Lance Edgar 2021-12-14 19:08:32 -06:00
parent 197d3de74a
commit 6f62f141d2
3 changed files with 44 additions and 10 deletions

View file

@ -0,0 +1,16 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/delete.mako" />
<%def name="modify_this_page_vars()">
${parent.modify_this_page_vars()}
<script type="text/javascript">
% if params_data is not Undefined:
${form.component_studly}Data.paramsData = ${json.dumps(params_data)|n}
% endif
</script>
</%def>
${parent.body()}

View file

@ -2250,6 +2250,12 @@ class MasterView(View):
""" """
return kwargs return kwargs
def template_kwargs_delete(self, **kwargs):
"""
Method stub, so subclass can always invoke super() for it.
"""
return kwargs
def get_db_engines(self): def get_db_engines(self):
""" """
Must return a dict (or even better, OrderedDict) which contains all Must return a dict (or even better, OrderedDict) which contains all

View file

@ -278,18 +278,30 @@ class ReportOutputView(ExportMasterView):
url = self.get_action_url('download', report) url = self.get_action_url('download', report)
return self.render_file_field(path, url=url) return self.render_file_field(path, url=url)
def template_kwargs_view(self, **kwargs): def get_params_context(self, report):
use_buefy = self.get_use_buefy() params_data = []
if use_buefy: for name, value in (report.params or {}).items():
params_data.append({
'key': name,
'value': value,
})
return params_data
def template_kwargs_view(self, **kwargs):
kwargs = super(ReportOutputView, self).template_kwargs_view(**kwargs)
if self.get_use_buefy():
report = kwargs['instance'] report = kwargs['instance']
params_data = [] kwargs['params_data'] = self.get_params_context(report)
for name, value in (report.params or {}).items():
params_data.append({ return kwargs
'key': name,
'value': value, def template_kwargs_delete(self, **kwargs):
}) kwargs = super(ReportOutputView, self).template_kwargs_delete(**kwargs)
kwargs['params_data'] = params_data
if self.get_use_buefy():
report = kwargs['instance']
kwargs['params_data'] = self.get_params_context(report)
return kwargs return kwargs