[Data Processing] Changing node group form to be switchable
The create node group template form for the data processing system was using custom javascript to hide/show form elements related to volume storage. This changes that form to use the switched/switchable mechanism native to horizon. Change-Id: I3061ec5029e225cceb7015a15a5b34019f649e44 Closes-Bug: #1420412
This commit is contained in:
parent
c158c56e7a
commit
74f7f0441c
|
@ -54,21 +54,6 @@
|
|||
$("." + plugin.val() + "_version_choice").closest(".form-group").show();
|
||||
}
|
||||
|
||||
$(".storage_field").change(switch_storage).change();
|
||||
|
||||
function switch_storage() {
|
||||
var show = $(".storage_field").val() == "cinder_volume";
|
||||
if (show) {
|
||||
$(".volume_per_node_field").closest(".form-group").show();
|
||||
$(".volume_size_field").closest(".form-group").show();
|
||||
$(".volumes_availability_zone_field").closest(".form-group").show();
|
||||
} else {
|
||||
$(".volume_per_node_field").closest(".form-group").hide();
|
||||
$(".volume_size_field").closest(".form-group").hide();
|
||||
$(".volumes_availability_zone_field").closest(".form-group").hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(".plugin_name_choice").change();
|
||||
|
||||
//handle node processes change
|
||||
|
|
|
@ -56,27 +56,42 @@ class GeneralConfigAction(workflows.Action):
|
|||
help_text=_("Choose a storage location"),
|
||||
choices=[("ephemeral_drive", "Ephemeral Drive"),
|
||||
("cinder_volume", "Cinder Volume")],
|
||||
widget=forms.Select(attrs={"class": "storage_field"}))
|
||||
widget=forms.Select(attrs={
|
||||
"class": "storage_field switchable",
|
||||
'data-slug': 'storage_loc'
|
||||
}))
|
||||
|
||||
volumes_per_node = forms.IntegerField(
|
||||
label=_("Volumes per node"),
|
||||
required=False,
|
||||
initial=1,
|
||||
widget=forms.TextInput(attrs={"class": "volume_per_node_field"})
|
||||
widget=forms.TextInput(attrs={
|
||||
"class": "volume_per_node_field switched",
|
||||
"data-switch-on": "storage_loc",
|
||||
"data-storage_loc-cinder_volume": _('Volumes per node')
|
||||
})
|
||||
)
|
||||
|
||||
volumes_size = forms.IntegerField(
|
||||
label=_("Volumes size (GB)"),
|
||||
required=False,
|
||||
initial=10,
|
||||
widget=forms.TextInput(attrs={"class": "volume_size_field"})
|
||||
widget=forms.TextInput(attrs={
|
||||
"class": "volume_size_field switched",
|
||||
"data-switch-on": "storage_loc",
|
||||
"data-storage_loc-cinder_volume": _('Volumes size (GB)')
|
||||
})
|
||||
)
|
||||
|
||||
volumes_availability_zone = forms.ChoiceField(
|
||||
label=_("Volumes Availability Zone"),
|
||||
help_text=_("Create volumes in this availability zone."),
|
||||
required=False,
|
||||
widget=forms.Select(attrs={"class": "volumes_availability_zone_field"})
|
||||
widget=forms.Select(attrs={
|
||||
"class": "volumes_availability_zone_field switched",
|
||||
"data-switch-on": "storage_loc",
|
||||
"data-storage_loc-cinder_volume": _('Volumes Availability Zone')
|
||||
})
|
||||
)
|
||||
|
||||
hidden_configure_field = forms.CharField(
|
||||
|
|
Loading…
Reference in New Issue