Add support for "appliance type"

This commit is contained in:
Lance Edgar 2018-10-19 20:27:04 -05:00
parent 7e28619e9d
commit fe2905e9df

View file

@ -53,12 +53,14 @@ class TempmonApplianceView(MasterView):
grid_columns = [ grid_columns = [
'name', 'name',
'appliance_type',
'location', 'location',
'image', 'image',
] ]
form_fields = [ form_fields = [
'name', 'name',
'appliance_type',
'location', 'location',
'clients', 'clients',
'probes', 'probes',
@ -67,11 +69,22 @@ class TempmonApplianceView(MasterView):
def configure_grid(self, g): def configure_grid(self, g):
super(TempmonApplianceView, self).configure_grid(g) super(TempmonApplianceView, self).configure_grid(g)
# name
g.set_sort_defaults('name') g.set_sort_defaults('name')
g.set_link('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') g.set_link('location')
# image
g.set_renderer('image', self.render_grid_thumbnail) g.set_renderer('image', self.render_grid_thumbnail)
g.set_link('image')
def render_grid_thumbnail(self, appliance, field): def render_grid_thumbnail(self, appliance, field):
route_prefix = self.get_route_prefix() route_prefix = self.get_route_prefix()
@ -86,6 +99,9 @@ class TempmonApplianceView(MasterView):
# name # name
f.set_validator('name', self.unique_name) f.set_validator('name', self.unique_name)
# appliance_type
f.set_enum('appliance_type', self.enum.TEMPMON_APPLIANCE_TYPE)
# image # image
if self.creating or self.editing: if self.creating or self.editing:
f.set_type('image', 'file') f.set_type('image', 'file')