Commit 7f80408e by Bach Dániel

dashboard: add remove_port template

parent d0cc86ea
...@@ -948,21 +948,6 @@ class VmPortRemoveForm(OperationForm): ...@@ -948,21 +948,6 @@ class VmPortRemoveForm(OperationForm):
if self.rule: if self.rule:
self.fields['rule'].widget = HiddenInput() self.fields['rule'].widget = HiddenInput()
@property
def helper(self):
helper = super(VmPortRemoveForm, self).helper
if self.rule:
helper.layout = Layout(
AnyTag(
"div",
HTML(format_html(_("<label>Port:</label> {0}/{1}"),
escape(self.rule.dport), escape(self.rule.proto))),
css_class="form-group",
),
Field("rule"),
)
return helper
class VmPortAddForm(OperationForm): class VmPortAddForm(OperationForm):
port = forms.IntegerField(required=True, label=_('Port'), port = forms.IntegerField(required=True, label=_('Port'),
......
{% extends "dashboard/operate.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block formfields %}
{% if form %}
{% crispy form %}
{% endif %}
{% if form.fields.rule.initial != None %}
{% with rule=form.fields.rule.initial %}
<dl>
<dt>{% trans "Port" %}:</dt>
<dd>{{ rule.dport }}/{{ rule.proto }}</dd>
<dt>{% trans "Host" %}:</dt>
<dd>{{ rule.host.hostname }}</dd>
<dt>{% trans "Vlan" %}:</dt>
<dd>{{ rule.host.vlan.name }}</dd>
</dl>
{% endwith %}
{% endif %}
{% endblock %}
...@@ -418,6 +418,7 @@ class VmMigrateView(FormOperationMixin, VmOperationView): ...@@ -418,6 +418,7 @@ class VmMigrateView(FormOperationMixin, VmOperationView):
class VmPortRemoveView(FormOperationMixin, VmOperationView): class VmPortRemoveView(FormOperationMixin, VmOperationView):
template_name = 'dashboard/_vm-remove-port.html'
op = 'remove_port' op = 'remove_port'
show_in_toolbar = False show_in_toolbar = False
with_reload = True with_reload = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment