Use same form for Create Router in network topology
Previously the create router form in network topology panel used its own form template and by some mistake no message was shown in the right side. It seems the reason of the original template is to use a dedicate form submit url, but it can be done by overriding the form class. This commit overrides the create router form and deletes the form templates specific to network-topology panel. This reduces the maintenance cost of templates. In addition, a page now remains in the network topology panel when a router creation fails. Change-Id: I78aeead952d5bcd31606cb3d561ccfa8f095ec36
This commit is contained in:
parent
1f9e7b685e
commit
e5899f9e8f
@ -0,0 +1,18 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack_dashboard.dashboards.project.routers \
|
||||
import forms as router_forms
|
||||
|
||||
|
||||
class NTCreateRouterForm(router_forms.CreateForm):
|
||||
failure_url = 'horizon:project:network_topology:index'
|
@ -1,16 +0,0 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n horizon humanize %}
|
||||
|
||||
{% block form_id %}{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:project:network_topology:createrouter' %}?{{ request.GET.urlencode }}{% endblock %}
|
||||
|
||||
{% block modal_id %}create_router_modal{% endblock %}
|
||||
{% block modal-header %}{% trans "Create Router" %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,7 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Router" %}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/network_topology/_create_router.html' %}
|
||||
{% endblock %}
|
@ -30,6 +30,7 @@ from horizon import tabs
|
||||
from horizon.utils.lazy_encoder import LazyTranslationEncoder
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.network_topology import forms
|
||||
from openstack_dashboard.dashboards.project.network_topology.instances \
|
||||
import tables as instances_tables
|
||||
from openstack_dashboard.dashboards.project.network_topology.networks \
|
||||
@ -118,8 +119,9 @@ class NTAddInterfaceView(p_views.AddInterfaceView):
|
||||
|
||||
|
||||
class NTCreateRouterView(r_views.CreateView):
|
||||
template_name = 'project/network_topology/create_router.html'
|
||||
form_class = forms.NTCreateRouterForm
|
||||
success_url = reverse_lazy("horizon:project:network_topology:index")
|
||||
submit_url = reverse_lazy("horizon:project:network_topology:createrouter")
|
||||
page_title = _("Create a Router")
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user