Add support for "appliance type"
This commit is contained in:
parent
7e28619e9d
commit
fe2905e9df
|
@ -53,12 +53,14 @@ class TempmonApplianceView(MasterView):
|
|||
|
||||
grid_columns = [
|
||||
'name',
|
||||
'appliance_type',
|
||||
'location',
|
||||
'image',
|
||||
]
|
||||
|
||||
form_fields = [
|
||||
'name',
|
||||
'appliance_type',
|
||||
'location',
|
||||
'clients',
|
||||
'probes',
|
||||
|
@ -67,11 +69,22 @@ class TempmonApplianceView(MasterView):
|
|||
|
||||
def configure_grid(self, g):
|
||||
super(TempmonApplianceView, self).configure_grid(g)
|
||||
|
||||
# name
|
||||
g.set_sort_defaults('name')
|
||||
g.set_link('name')
|
||||
|
||||
# appliance_type
|
||||
g.set_enum('appliance_type', self.enum.TEMPMON_APPLIANCE_TYPE)
|
||||
g.set_label('appliance_type', "Type")
|
||||
g.filters['appliance_type'].label = "Appliance Type"
|
||||
|
||||
# location
|
||||
g.set_link('location')
|
||||
|
||||
# image
|
||||
g.set_renderer('image', self.render_grid_thumbnail)
|
||||
g.set_link('image')
|
||||
|
||||
def render_grid_thumbnail(self, appliance, field):
|
||||
route_prefix = self.get_route_prefix()
|
||||
|
@ -86,6 +99,9 @@ class TempmonApplianceView(MasterView):
|
|||
# name
|
||||
f.set_validator('name', self.unique_name)
|
||||
|
||||
# appliance_type
|
||||
f.set_enum('appliance_type', self.enum.TEMPMON_APPLIANCE_TYPE)
|
||||
|
||||
# image
|
||||
if self.creating or self.editing:
|
||||
f.set_type('image', 'file')
|
||||
|
|
Loading…
Reference in a new issue