Horizon selects are now themable: Admin Panels
Horizon was using a standard select input. Unfortunately this type of input is only customizable to a small extent. Co-Authored-By: Matthew Wood <woodm1979@gmail.com> Co-Authored-By: Brian Tully <brian.tully@hp.com> Change-Id: Id86abbf5e8f0fd9b4a7bab05f5b56e6d0d82b778 Partially-implements: blueprint horizon-theme-css-reorg
This commit is contained in:
parent
4a6df55120
commit
d0ddd223cb
@ -38,7 +38,7 @@ class MinifiedNode(Node):
|
||||
def render(self, context):
|
||||
return ' '.join(
|
||||
force_text(self.nodelist.render(context).strip()).split()
|
||||
)
|
||||
).replace(' > ', '>').replace(' <', '<')
|
||||
|
||||
|
||||
@register.filter
|
||||
|
@ -25,7 +25,7 @@ class EvacuateHostForm(forms.SelfHandlingForm):
|
||||
current_host = forms.CharField(label=_("Current Host"),
|
||||
widget=forms.TextInput(
|
||||
attrs={'readonly': 'readonly'}))
|
||||
target_host = forms.ChoiceField(
|
||||
target_host = forms.ThemableChoiceField(
|
||||
label=_("Target Host"),
|
||||
help_text=_("Choose a Host to evacuate servers to."))
|
||||
|
||||
@ -108,7 +108,7 @@ class MigrateHostForm(forms.SelfHandlingForm):
|
||||
('live_migrate', _('Live Migrate')),
|
||||
('cold_migrate', _('Cold Migrate'))
|
||||
],
|
||||
widget=forms.Select(
|
||||
widget=forms.ThemableSelectWidget(
|
||||
attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'source'
|
||||
|
@ -28,9 +28,10 @@ class LiveMigrateForm(forms.SelfHandlingForm):
|
||||
required=False,
|
||||
widget=forms.TextInput(
|
||||
attrs={'readonly': 'readonly'}))
|
||||
host = forms.ChoiceField(label=_("New Host"),
|
||||
help_text=_("Choose a Host to migrate to."),
|
||||
required=False)
|
||||
host = forms.ThemableChoiceField(
|
||||
label=_("New Host"),
|
||||
help_text=_("Choose a Host to migrate to."),
|
||||
required=False)
|
||||
disk_over_commit = forms.BooleanField(label=_("Disk Over Commit"),
|
||||
initial=False, required=False)
|
||||
block_migration = forms.BooleanField(label=_("Block Migration"),
|
||||
|
@ -36,7 +36,7 @@ class CreateNamespaceForm(forms.SelfHandlingForm):
|
||||
required=False,
|
||||
choices=[('file', _('Metadata Definition File')),
|
||||
('raw', _('Direct Input'))],
|
||||
widget=forms.Select(
|
||||
widget=forms.ThemableSelectWidget(
|
||||
attrs={'class': 'switchable', 'data-slug': 'source'}))
|
||||
|
||||
metadef_file = forms.FileField(
|
||||
|
@ -29,9 +29,9 @@ class UsageReportForm(forms.SelfHandlingForm):
|
||||
("365", _("Last year")),
|
||||
("other", _("Other")),
|
||||
)
|
||||
period = forms.ChoiceField(label=_("Period"),
|
||||
required=True,
|
||||
choices=PERIOD_CHOICES)
|
||||
period = forms.ThemableChoiceField(label=_("Period"),
|
||||
required=True,
|
||||
choices=PERIOD_CHOICES)
|
||||
date_from = forms.DateField(label=_("From"), required=False,
|
||||
widget=forms.TextInput(
|
||||
attrs={'data-date-picker': True}))
|
||||
|
@ -27,7 +27,7 @@ class AddDHCPAgent(forms.SelfHandlingForm):
|
||||
network_name = forms.CharField(label=_("Network Name"),
|
||||
widget=forms.TextInput(
|
||||
attrs={'readonly': 'readonly'}))
|
||||
agent = forms.ChoiceField(
|
||||
agent = forms.ThemableChoiceField(
|
||||
label=_("New DHCP Agent"),
|
||||
help_text=_("Choose an DHCP Agent to attach to."))
|
||||
|
||||
|
@ -93,7 +93,7 @@ class CreateNetwork(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length=255,
|
||||
label=_("Name"),
|
||||
required=False)
|
||||
tenant_id = forms.ChoiceField(label=_("Project"))
|
||||
tenant_id = forms.ThemableChoiceField(label=_("Project"))
|
||||
if api.neutron.is_port_profiles_supported():
|
||||
widget = None
|
||||
else:
|
||||
@ -105,7 +105,7 @@ class CreateNetwork(forms.SelfHandlingForm):
|
||||
label=_("Provider Network Type"),
|
||||
help_text=_("The physical mechanism by which the virtual "
|
||||
"network is implemented."),
|
||||
widget=forms.Select(attrs={
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'network_type'
|
||||
}))
|
||||
@ -125,9 +125,10 @@ class CreateNetwork(forms.SelfHandlingForm):
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'network_type',
|
||||
}))
|
||||
admin_state = forms.ChoiceField(choices=[(True, _('UP')),
|
||||
(False, _('DOWN'))],
|
||||
label=_("Admin State"))
|
||||
admin_state = forms.ThemableChoiceField(
|
||||
choices=[(True, _('UP')),
|
||||
(False, _('DOWN'))],
|
||||
label=_("Admin State"))
|
||||
shared = forms.BooleanField(label=_("Shared"),
|
||||
initial=False, required=False)
|
||||
external = forms.BooleanField(label=_("External Network"),
|
||||
@ -304,9 +305,9 @@ class UpdateNetwork(forms.SelfHandlingForm):
|
||||
network_id = forms.CharField(label=_("ID"),
|
||||
widget=forms.TextInput(
|
||||
attrs={'readonly': 'readonly'}))
|
||||
admin_state = forms.ChoiceField(choices=[(True, _('UP')),
|
||||
(False, _('DOWN'))],
|
||||
label=_("Admin State"))
|
||||
admin_state = forms.ThemableChoiceField(choices=[(True, _('UP')),
|
||||
(False, _('DOWN'))],
|
||||
label=_("Admin State"))
|
||||
shared = forms.BooleanField(label=_("Shared"), required=False)
|
||||
external = forms.BooleanField(label=_("External Network"), required=False)
|
||||
failure_url = 'horizon:admin:networks:index'
|
||||
|
@ -43,9 +43,9 @@ class CreatePort(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length=255,
|
||||
label=_("Name"),
|
||||
required=False)
|
||||
admin_state = forms.ChoiceField(choices=[(True, _('UP')),
|
||||
(False, _('DOWN'))],
|
||||
label=_("Admin State"))
|
||||
admin_state = forms.ThemableChoiceField(choices=[(True, _('UP')),
|
||||
(False, _('DOWN'))],
|
||||
label=_("Admin State"))
|
||||
device_id = forms.CharField(max_length=100, label=_("Device ID"),
|
||||
help_text=_("Device ID attached to the port"),
|
||||
required=False)
|
||||
@ -79,12 +79,14 @@ class CreatePort(forms.SelfHandlingForm):
|
||||
if vnic_type[0] in supported_vnic_types
|
||||
]
|
||||
|
||||
self.fields['binding__vnic_type'] = forms.ChoiceField(
|
||||
choices=vnic_type_choices,
|
||||
label=_("Binding: VNIC Type"),
|
||||
help_text=_(
|
||||
"The VNIC type that is bound to the neutron port"),
|
||||
required=False)
|
||||
self.fields['binding__vnic_type'] = \
|
||||
forms.ThemableChoiceField(
|
||||
choices=vnic_type_choices,
|
||||
label=_("Binding: VNIC Type"),
|
||||
help_text=_(
|
||||
"The VNIC type that is bound to the neutron "
|
||||
"port"),
|
||||
required=False)
|
||||
except Exception:
|
||||
msg = _("Unable to verify the VNIC types extension in Neutron")
|
||||
exceptions.handle(self.request, msg)
|
||||
|
@ -40,7 +40,7 @@ def populate_status_choices(initial, status_choices):
|
||||
|
||||
|
||||
class UpdateStatus(forms.SelfHandlingForm):
|
||||
status = forms.ChoiceField(label=_("Status"))
|
||||
status = forms.ThemableChoiceField(label=_("Status"))
|
||||
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(UpdateStatus, self).__init__(request, *args, **kwargs)
|
||||
|
@ -67,8 +67,8 @@ class CreateVolumeType(forms.SelfHandlingForm):
|
||||
|
||||
class CreateQosSpec(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length=255, label=_("Name"))
|
||||
consumer = forms.ChoiceField(label=_("Consumer"),
|
||||
choices=cinder.CONSUMER_CHOICES)
|
||||
consumer = forms.ThemableChoiceField(label=_("Consumer"),
|
||||
choices=cinder.CONSUMER_CHOICES)
|
||||
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
@ -96,12 +96,12 @@ class CreateVolumeTypeEncryption(forms.SelfHandlingForm):
|
||||
widget=forms.TextInput(attrs={'readonly':
|
||||
'readonly'}))
|
||||
provider = forms.CharField(max_length=255, label=_("Provider"))
|
||||
control_location = forms.ChoiceField(label=_("Control Location"),
|
||||
choices=(('front-end',
|
||||
_('front-end')),
|
||||
('back-end',
|
||||
_('back-end')))
|
||||
)
|
||||
control_location = forms.ThemableChoiceField(label=_("Control Location"),
|
||||
choices=(('front-end',
|
||||
_('front-end')),
|
||||
('back-end',
|
||||
_('back-end')))
|
||||
)
|
||||
cipher = forms.CharField(label=_("Cipher"), required=False)
|
||||
key_size = forms.IntegerField(label=_("Key Size (bits)"),
|
||||
required=False,
|
||||
@ -158,7 +158,7 @@ class UpdateVolumeTypeEncryption(CreateVolumeTypeEncryption):
|
||||
|
||||
|
||||
class ManageQosSpecAssociation(forms.SelfHandlingForm):
|
||||
qos_spec_choice = forms.ChoiceField(
|
||||
qos_spec_choice = forms.ThemableChoiceField(
|
||||
label=_("QoS Spec to be associated"),
|
||||
help_text=_("Choose associated QoS Spec."))
|
||||
|
||||
@ -229,7 +229,7 @@ class EditQosSpecConsumer(forms.SelfHandlingForm):
|
||||
widget=forms.TextInput(
|
||||
attrs={'readonly': 'readonly'}),
|
||||
required=False)
|
||||
consumer_choice = forms.ChoiceField(
|
||||
consumer_choice = forms.ThemableChoiceField(
|
||||
label=_("New QoS Spec Consumer"),
|
||||
choices=cinder.CONSUMER_CHOICES,
|
||||
help_text=_("Choose consumer for this QoS Spec."))
|
||||
|
@ -50,7 +50,7 @@ class ManageVolume(forms.SelfHandlingForm):
|
||||
max_length=255,
|
||||
label=_("Identifier"),
|
||||
help_text=_("Name or other identifier for existing volume"))
|
||||
id_type = forms.ChoiceField(
|
||||
id_type = forms.ThemableChoiceField(
|
||||
label=_("Identifier Type"),
|
||||
help_text=_("Type of backend device identifier provided"))
|
||||
host = forms.CharField(
|
||||
@ -71,10 +71,10 @@ class ManageVolume(forms.SelfHandlingForm):
|
||||
label=_("Metadata"), required=False,
|
||||
help_text=_("Comma-separated key=value pairs"),
|
||||
validators=[utils_validators.validate_metadata])
|
||||
volume_type = forms.ChoiceField(
|
||||
volume_type = forms.ThemableChoiceField(
|
||||
label=_("Volume Type"),
|
||||
required=False)
|
||||
availability_zone = forms.ChoiceField(
|
||||
availability_zone = forms.ThemableChoiceField(
|
||||
label=_("Availability Zone"),
|
||||
required=False)
|
||||
|
||||
@ -174,8 +174,9 @@ class MigrateVolume(forms.SelfHandlingForm):
|
||||
required=False,
|
||||
widget=forms.TextInput(
|
||||
attrs={'readonly': 'readonly'}))
|
||||
host = forms.ChoiceField(label=_("Destination Host"),
|
||||
help_text=_("Choose a Host to migrate to."))
|
||||
host = forms.ThemableChoiceField(
|
||||
label=_("Destination Host"),
|
||||
help_text=_("Choose a Host to migrate to."))
|
||||
force_host_copy = forms.BooleanField(label=_("Force Host Copy"),
|
||||
initial=False, required=False)
|
||||
|
||||
@ -215,7 +216,7 @@ class MigrateVolume(forms.SelfHandlingForm):
|
||||
|
||||
|
||||
class UpdateStatus(forms.SelfHandlingForm):
|
||||
status = forms.ChoiceField(label=_("Status"))
|
||||
status = forms.ThemableChoiceField(label=_("Status"))
|
||||
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(UpdateStatus, self).__init__(request, *args, **kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user