Add column filters for import/export main grid

This commit is contained in:
Lance Edgar 2024-05-31 14:51:01 -05:00
parent 9b88f01378
commit 3ac131cb51

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar # Copyright © 2010-2024 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -25,13 +25,13 @@ View for running arbitrary import/export jobs
""" """
import getpass import getpass
import socket import json
import sys
import logging import logging
import socket
import subprocess import subprocess
import sys
import time import time
import json
import sqlalchemy as sa import sqlalchemy as sa
from rattail.exceptions import ConfigurationError from rattail.exceptions import ConfigurationError
@ -152,10 +152,15 @@ class ImportingView(MasterView):
return data return data
def configure_grid(self, g): def configure_grid(self, g):
super(ImportingView, self).configure_grid(g) super().configure_grid(g)
g.set_link('host_title') g.set_link('host_title')
g.set_searchable('host_title')
g.set_link('local_title') g.set_link('local_title')
g.set_searchable('local_title')
g.set_searchable('handler_spec')
def get_instance(self): def get_instance(self):
""" """
@ -177,7 +182,7 @@ class ImportingView(MasterView):
return ImportHandlerSchema() return ImportHandlerSchema()
def make_form_kwargs(self, **kwargs): def make_form_kwargs(self, **kwargs):
kwargs = super(ImportingView, self).make_form_kwargs(**kwargs) kwargs = super().make_form_kwargs(**kwargs)
# nb. this is set as sort of a hack, to prevent SA model # nb. this is set as sort of a hack, to prevent SA model
# inspection logic # inspection logic
@ -186,7 +191,7 @@ class ImportingView(MasterView):
return kwargs return kwargs
def configure_form(self, f): def configure_form(self, f):
super(ImportingView, self).configure_form(f) super().configure_form(f)
f.set_renderer('models', self.render_models) f.set_renderer('models', self.render_models)
@ -198,7 +203,7 @@ class ImportingView(MasterView):
return HTML.tag('ul', c=items) return HTML.tag('ul', c=items)
def template_kwargs_view(self, **kwargs): def template_kwargs_view(self, **kwargs):
kwargs = super(ImportingView, self).template_kwargs_view(**kwargs) kwargs = super().template_kwargs_view(**kwargs)
handler_info = kwargs['instance'] handler_info = kwargs['instance']
kwargs['handler'] = handler_info['_handler'] kwargs['handler'] = handler_info['_handler']
return kwargs return kwargs