Fix CRUD pages for tempmon clients, probes
for some reason if helptext had embedded newlines, it would now fail to render the form altogether. guess that is a result of recent change to e.g. `<b-field :message="['foo', 'bar']">` logic, somehow.. anyway hopefully this fixes and no more surprises
This commit is contained in:
parent
3dfab8e42d
commit
b30f6cdf3a
4 changed files with 31 additions and 47 deletions
|
@ -24,8 +24,6 @@
|
|||
Views for tempmon clients
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import subprocess
|
||||
|
||||
from rattail.config import parse_list
|
||||
|
@ -51,6 +49,7 @@ class TempmonClientView(MasterView):
|
|||
|
||||
has_rows = True
|
||||
model_row_class = tempmon.Reading
|
||||
rows_title = "Readings"
|
||||
|
||||
grid_columns = [
|
||||
'config_key',
|
||||
|
@ -83,7 +82,7 @@ class TempmonClientView(MasterView):
|
|||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(TempmonClientView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
|
||||
# config_key
|
||||
g.set_label('config_key', "Key")
|
||||
|
@ -116,7 +115,7 @@ class TempmonClientView(MasterView):
|
|||
return "No"
|
||||
|
||||
def configure_form(self, f):
|
||||
super(TempmonClientView, self).configure_form(f)
|
||||
super().configure_form(f)
|
||||
|
||||
# config_key
|
||||
f.set_validator('config_key', self.unique_config_key)
|
||||
|
@ -160,7 +159,7 @@ class TempmonClientView(MasterView):
|
|||
f.set_helptext('archived', tempmon.Client.archived.__doc__)
|
||||
|
||||
def template_kwargs_view(self, **kwargs):
|
||||
kwargs = super(TempmonClientView, self).template_kwargs_view(**kwargs)
|
||||
kwargs = super().template_kwargs_view(**kwargs)
|
||||
client = kwargs['instance']
|
||||
|
||||
kwargs['probes_data'] = self.normalize_probes(client.probes)
|
||||
|
@ -177,7 +176,7 @@ class TempmonClientView(MasterView):
|
|||
if data['enabled'] and form.model_instance.enabled:
|
||||
data['enabled'] = form.model_instance.enabled
|
||||
|
||||
return super(TempmonClientView, self).objectify(form, data=data)
|
||||
return super().objectify(form, data=data)
|
||||
|
||||
def unique_config_key(self, node, value):
|
||||
query = self.Session.query(tempmon.Client)\
|
||||
|
@ -230,7 +229,7 @@ class TempmonClientView(MasterView):
|
|||
return reading.client
|
||||
|
||||
def configure_row_grid(self, g):
|
||||
super(TempmonClientView, self).configure_row_grid(g)
|
||||
super().configure_row_grid(g)
|
||||
|
||||
# probe
|
||||
g.set_filter('probe', tempmon.Probe.description)
|
||||
|
|
|
@ -49,6 +49,7 @@ class TempmonProbeView(MasterView):
|
|||
|
||||
has_rows = True
|
||||
model_row_class = tempmon.Reading
|
||||
rows_title = "Readings"
|
||||
|
||||
labels = {
|
||||
'critical_max_timeout': "Critical High Timeout",
|
||||
|
@ -98,7 +99,7 @@ class TempmonProbeView(MasterView):
|
|||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(TempmonProbeView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
|
||||
g.joiners['client'] = lambda q: q.join(tempmon.Client)
|
||||
g.sorters['client'] = g.make_sorter(tempmon.Client.config_key)
|
||||
|
@ -121,7 +122,7 @@ class TempmonProbeView(MasterView):
|
|||
return "No"
|
||||
|
||||
def configure_form(self, f):
|
||||
super(TempmonProbeView, self).configure_form(f)
|
||||
super().configure_form(f)
|
||||
|
||||
# config_key
|
||||
f.set_validator('config_key', self.unique_config_key)
|
||||
|
@ -186,7 +187,7 @@ class TempmonProbeView(MasterView):
|
|||
if data['enabled'] and form.model_instance.enabled:
|
||||
data['enabled'] = form.model_instance.enabled
|
||||
|
||||
return super(TempmonProbeView, self).objectify(form, data=data)
|
||||
return super().objectify(form, data=data)
|
||||
|
||||
def unique_config_key(self, node, value):
|
||||
query = self.Session.query(tempmon.Probe)\
|
||||
|
@ -240,7 +241,7 @@ class TempmonProbeView(MasterView):
|
|||
return reading.client
|
||||
|
||||
def configure_row_grid(self, g):
|
||||
super(TempmonProbeView, self).configure_row_grid(g)
|
||||
super().configure_row_grid(g)
|
||||
|
||||
# # probe
|
||||
# g.set_filter('probe', tempmon.Probe.description)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue