Fix row status filter for Import/Export batches

per Buefy theme
This commit is contained in:
Lance Edgar 2020-03-23 20:55:46 -05:00
parent af4be59fe0
commit eaeda6ca36
2 changed files with 10 additions and 3 deletions

View file

@ -210,7 +210,7 @@ class GridFilter(object):
normalized = choices normalized = choices
elif isinstance(choices, dict): elif isinstance(choices, dict):
normalized = OrderedDict([ normalized = OrderedDict([
(key, choices[value]) (key, choices[key])
for key in sorted(choices)]) for key in sorted(choices)])
elif isinstance(choices, list): elif isinstance(choices, list):
normalized = OrderedDict([ normalized = OrderedDict([

View file

@ -140,6 +140,7 @@ class ImporterBatchView(BatchMasterView):
def configure_row_grid(self, g): def configure_row_grid(self, g):
super(ImporterBatchView, self).configure_row_grid(g) super(ImporterBatchView, self).configure_row_grid(g)
use_buefy = self.get_use_buefy()
def make_filter(field, **kwargs): def make_filter(field, **kwargs):
column = getattr(self.current_row_table.c, field) column = getattr(self.current_row_table.c, field)
@ -147,8 +148,14 @@ class ImporterBatchView(BatchMasterView):
make_filter('object_key') make_filter('object_key')
make_filter('object_str') make_filter('object_str')
make_filter('status_code', label="Status",
value_enum=self.enum.IMPORTER_BATCH_ROW_STATUS) # for some reason we have to do this differently for Buefy?
kwargs = {}
if not use_buefy:
kwargs['value_enum'] = self.enum.IMPORTER_BATCH_ROW_STATUS
make_filter('status_code', label="Status", **kwargs)
if use_buefy:
g.filters['status_code'].set_choices(self.enum.IMPORTER_BATCH_ROW_STATUS)
def make_sorter(field): def make_sorter(field):
column = getattr(self.current_row_table.c, field) column = getattr(self.current_row_table.c, field)