Add auto-filter hyperlinks for batch row status breakdown
This commit is contained in:
parent
5b697cdf26
commit
4d404cb20b
6 changed files with 93 additions and 17 deletions
|
@ -188,13 +188,23 @@ class BatchMasterView(MasterView):
|
|||
else:
|
||||
kwargs['why_not_execute'] = self.handler.why_not_execute(batch)
|
||||
|
||||
kwargs['status_breakdown'] = self.make_status_breakdown(batch)
|
||||
breakdown = self.make_status_breakdown(batch)
|
||||
|
||||
if use_buefy:
|
||||
data = [{'title': title, 'count': count}
|
||||
for title, count in kwargs['status_breakdown']]
|
||||
Grid = self.get_grid_factory()
|
||||
kwargs['status_breakdown_grid'] = Grid('batch_row_status_breakdown',
|
||||
data, ['title', 'count'])
|
||||
factory = self.get_grid_factory()
|
||||
g = factory('batch_row_status_breakdown', [],
|
||||
columns=['title', 'count'])
|
||||
g.set_click_handler('title', "autoFilterStatus(props.row)")
|
||||
kwargs['status_breakdown_data'] = breakdown
|
||||
kwargs['status_breakdown_grid'] = HTML.literal(
|
||||
g.render_buefy_table_element(data_prop='statusBreakdownData',
|
||||
empty_labels=True))
|
||||
|
||||
else:
|
||||
kwargs['status_breakdown'] = [
|
||||
(status['title'], status['count'])
|
||||
for status in breakdown]
|
||||
|
||||
return kwargs
|
||||
|
||||
def make_upload_worksheet_form(self, batch):
|
||||
|
@ -281,10 +291,7 @@ class BatchMasterView(MasterView):
|
|||
'count': 0,
|
||||
}
|
||||
breakdown[row.status_code]['count'] += 1
|
||||
breakdown = [
|
||||
(status['title'], status['count'])
|
||||
for code, status in six.iteritems(breakdown)]
|
||||
return breakdown
|
||||
return list(breakdown.values())
|
||||
|
||||
def allow_worksheet(self, batch):
|
||||
return not batch.executed and not batch.complete
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue