Show floating IP checkbox only for 'routed'
Set floatingIp to the unit level blueprint auto-assign-floating-ip Change-Id: I980c97157f27adba2b98d2c6126a0f1bd6e91654
This commit is contained in:
parent
a161d05c53
commit
d23497d18b
|
@ -574,6 +574,15 @@ class BooleanField(forms.BooleanField, CustomPropertiesField):
|
|||
super(BooleanField, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class FloatingIpBooleanField(BooleanField):
|
||||
@with_request
|
||||
def update(self, request, environment_id, **kwargs):
|
||||
env = api.environment_get(request, environment_id)
|
||||
network_topology = env.networking.get('topology')
|
||||
if network_topology != 'routed':
|
||||
self.widget.is_hidden = True
|
||||
|
||||
|
||||
class ClusterIPField(CharField):
|
||||
existing_subnet = None
|
||||
network_topology = None
|
||||
|
|
|
@ -38,7 +38,8 @@ TYPES = {
|
|||
'keypair': fields.KeyPairChoiceField,
|
||||
'image': fields.ImageChoiceField,
|
||||
'azone': fields.AZoneChoiceField,
|
||||
'text': (fields.CharField, forms.Textarea)
|
||||
'text': (fields.CharField, forms.Textarea),
|
||||
'floatingip': fields.FloatingIpBooleanField
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -112,11 +112,12 @@ class OverviewTab(tabs.Tab):
|
|||
}
|
||||
break
|
||||
|
||||
unit_detail['Floating IP'] = unit.get('floatingip')
|
||||
|
||||
if len(service_data.units) > 1:
|
||||
units.append(unit_detail)
|
||||
else:
|
||||
detail_info.update(unit_detail)
|
||||
|
||||
return {'service': detail_info, 'units': units}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue