Merge "Refactored the templates code"
This commit is contained in:
commit
477b73a187
@ -1,9 +1,9 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Specify VIP" %}{% endblock %}
|
||||
{% block title %}{% trans workflow.name %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Specify VIP") %}
|
||||
{% include "horizon/common/_page_header.html" with title=workflow.name %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
@ -54,7 +54,7 @@ class WorkflowView(generic.TemplateView):
|
||||
|
||||
"""
|
||||
workflow_class = None
|
||||
template_name = None
|
||||
template_name = 'horizon/common/_workflow_base.html'
|
||||
context_object_name = "workflow"
|
||||
ajax_template_name = 'horizon/common/_workflow.html'
|
||||
step_errors = {}
|
||||
|
@ -34,9 +34,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class CreateView(project_views.CreateView):
|
||||
workflow_class = CreateSubnet
|
||||
template_name = 'admin/networks/subnets/create.html'
|
||||
|
||||
|
||||
class UpdateView(project_views.UpdateView):
|
||||
workflow_class = UpdateSubnet
|
||||
template_name = 'admin/networks/subnets/update.html'
|
||||
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Subnet" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Create Subnet") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include "horizon/common/_workflow.html" %}
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Update Subnet" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Update Subnet") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include "horizon/common/_workflow.html" %}
|
||||
{% endblock %}
|
@ -23,6 +23,7 @@ from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
from openstack_dashboard.dashboards.project.networks.tests \
|
||||
import form_data_subnet
|
||||
from horizon.workflows.views import WorkflowView
|
||||
|
||||
|
||||
INDEX_URL = reverse('horizon:admin:networks:index')
|
||||
@ -381,7 +382,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
args=[network.id])
|
||||
res = self.client.get(url)
|
||||
|
||||
self.assertTemplateUsed(res, 'admin/networks/subnets/create.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
'subnet_create',)})
|
||||
|
@ -1,12 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Project" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Create Project") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
@ -1,12 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Edit Project" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Edit Project") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
@ -27,6 +27,7 @@ from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
from openstack_dashboard.usage import quotas
|
||||
from .workflows import CreateProject, UpdateProject
|
||||
from horizon.workflows.views import WorkflowView
|
||||
|
||||
INDEX_URL = reverse('horizon:admin:projects:index')
|
||||
|
||||
@ -91,7 +92,7 @@ class CreateProjectWorkflowTests(test.BaseAdminViewTests):
|
||||
url = reverse('horizon:admin:projects:create')
|
||||
res = self.client.get(url)
|
||||
|
||||
self.assertTemplateUsed(res, 'admin/projects/create.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
workflow = res.context['workflow']
|
||||
self.assertEqual(res.context['workflow'].name, CreateProject.name)
|
||||
@ -194,7 +195,7 @@ class CreateProjectWorkflowTests(test.BaseAdminViewTests):
|
||||
url = reverse('horizon:admin:projects:create')
|
||||
res = self.client.get(url)
|
||||
|
||||
self.assertTemplateUsed(res, 'admin/projects/create.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
self.assertContains(res, "Unable to retrieve default quota values")
|
||||
|
||||
@test.create_stubs({api.keystone: ('tenant_create',
|
||||
@ -443,7 +444,7 @@ class UpdateProjectWorkflowTests(test.BaseAdminViewTests):
|
||||
args=[self.tenant.id])
|
||||
res = self.client.get(url)
|
||||
|
||||
self.assertTemplateUsed(res, 'admin/projects/update.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
workflow = res.context['workflow']
|
||||
self.assertEqual(res.context['workflow'].name, UpdateProject.name)
|
||||
|
@ -128,7 +128,6 @@ class TenantUsageView(usage.UsageView):
|
||||
|
||||
class CreateProjectView(workflows.WorkflowView):
|
||||
workflow_class = CreateProject
|
||||
template_name = "admin/projects/create.html"
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(CreateProjectView, self).get_initial()
|
||||
@ -148,7 +147,6 @@ class CreateProjectView(workflows.WorkflowView):
|
||||
|
||||
class UpdateProjectView(workflows.WorkflowView):
|
||||
workflow_class = UpdateProject
|
||||
template_name = "admin/projects/update.html"
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(UpdateProjectView, self).get_initial()
|
||||
|
@ -30,6 +30,7 @@ from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
from .utils import get_int_or_uuid
|
||||
from horizon.workflows.views import WorkflowView
|
||||
|
||||
|
||||
INDEX_URL = reverse('horizon:project:access_and_security:index')
|
||||
@ -48,8 +49,7 @@ class FloatingIpViewTests(test.TestCase):
|
||||
|
||||
url = reverse('%s:associate' % NAMESPACE)
|
||||
res = self.client.get(url)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/access_and_security/floating_ips/associate.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
workflow = res.context['workflow']
|
||||
choices = dict(workflow.steps[0].action.fields['ip_id'].choices)
|
||||
# Verify that our "associated" floating IP isn't in the choices list.
|
||||
|
@ -38,7 +38,6 @@ from .workflows import IPAssociationWorkflow
|
||||
|
||||
class AssociateView(workflows.WorkflowView):
|
||||
workflow_class = IPAssociationWorkflow
|
||||
template_name = "project/access_and_security/floating_ips/associate.html"
|
||||
|
||||
|
||||
class AllocateView(forms.ModalFormView):
|
||||
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Associate Floating IP" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Associate Floating IP") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
@ -27,6 +27,7 @@ from mox import IsA
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
from horizon.workflows.views import WorkflowView
|
||||
|
||||
|
||||
class AccessAndSecurityTests(test.TestCase):
|
||||
@ -86,8 +87,7 @@ class AccessAndSecurityTests(test.TestCase):
|
||||
|
||||
res = self.client.get(reverse("horizon:project:access_and_security:"
|
||||
"floating_ips:associate"))
|
||||
self.assertTemplateUsed(res,
|
||||
'project/access_and_security/floating_ips/associate.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
self.assertContains(res,
|
||||
'<option value="1">server_1 (1)</option>')
|
||||
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Launch Instance" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Launch Instance") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Edit Instance" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Edit Instance") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
@ -34,6 +34,7 @@ from openstack_dashboard.usage import quotas
|
||||
from .tables import LaunchLink
|
||||
from .tabs import InstanceDetailTabs
|
||||
from .workflows import LaunchInstance
|
||||
from horizon.workflows.views import WorkflowView
|
||||
|
||||
|
||||
INDEX_URL = reverse('horizon:project:instances:index')
|
||||
@ -660,7 +661,7 @@ class InstanceTests(test.TestCase):
|
||||
url = reverse('horizon:project:instances:update', args=[server.id])
|
||||
res = self.client.get(url)
|
||||
|
||||
self.assertTemplateUsed(res, 'project/instances/update.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs(instance_update_get_stubs)
|
||||
def test_instance_update_get_server_get_exception(self):
|
||||
@ -844,8 +845,7 @@ class InstanceTests(test.TestCase):
|
||||
res = self.client.get("%s?%s" % (url, params))
|
||||
|
||||
workflow = res.context['workflow']
|
||||
self.assertTemplateUsed(res,
|
||||
'project/instances/launch.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
self.assertEqual(res.context['workflow'].name, LaunchInstance.name)
|
||||
step = workflow.get_step("setinstancedetailsaction")
|
||||
self.assertEqual(step.action.initial['image_id'], image.id)
|
||||
@ -1005,8 +1005,7 @@ class InstanceTests(test.TestCase):
|
||||
self.assertFormErrors(res, 1, 'There are no image sources available; '
|
||||
'you must first create an image before '
|
||||
'attempting to launch an instance.')
|
||||
self.assertTemplateUsed(res,
|
||||
'project/instances/launch.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
@ -1052,8 +1051,7 @@ class InstanceTests(test.TestCase):
|
||||
url = reverse('horizon:project:instances:launch')
|
||||
res = self.client.get(url)
|
||||
|
||||
self.assertTemplateUsed(res,
|
||||
'project/instances/launch.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
|
@ -94,7 +94,6 @@ class IndexView(tables.DataTableView):
|
||||
|
||||
class LaunchInstanceView(workflows.WorkflowView):
|
||||
workflow_class = LaunchInstance
|
||||
template_name = "project/instances/launch.html"
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(LaunchInstanceView, self).get_initial()
|
||||
@ -145,7 +144,6 @@ def spice(request, instance_id):
|
||||
|
||||
class UpdateView(workflows.WorkflowView):
|
||||
workflow_class = UpdateInstance
|
||||
template_name = 'project/instances/update.html'
|
||||
success_url = reverse_lazy("horizon:project:instances:index")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Add New Member" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Add New Member") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Add New Monitor" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Add New Monitor") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Add New Pool" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Add New Pool") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
@ -12,6 +12,7 @@ from openstack_dashboard.api.lbaas import Pool, Vip, Member, PoolMonitor
|
||||
|
||||
from .tabs import LoadBalancerTabs, MembersTab, PoolsTab, MonitorsTab
|
||||
from .workflows import AddPool, AddMember, AddMonitor, AddVip
|
||||
from horizon.workflows.views import WorkflowView
|
||||
|
||||
|
||||
class LoadBalancerTests(test.TestCase):
|
||||
@ -220,7 +221,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
res = self.client.get(reverse(self.ADDPOOL_PATH))
|
||||
|
||||
workflow = res.context['workflow']
|
||||
self.assertTemplateUsed(res, 'project/loadbalancers/addpool.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
self.assertEqual(workflow.name, AddPool.name)
|
||||
|
||||
expected_objs = ['<AddPoolStep: addpoolaction>', ]
|
||||
@ -326,7 +327,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
res = self.client.get(reverse(self.ADDVIP_PATH, args=(pool.id,)))
|
||||
|
||||
workflow = res.context['workflow']
|
||||
self.assertTemplateUsed(res, 'project/loadbalancers/addvip.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
self.assertEqual(workflow.name, AddVip.name)
|
||||
|
||||
expected_objs = ['<AddVipStep: addvipaction>', ]
|
||||
@ -422,7 +423,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
res = self.client.get(reverse(self.ADDMONITOR_PATH))
|
||||
|
||||
workflow = res.context['workflow']
|
||||
self.assertTemplateUsed(res, 'project/loadbalancers/addmonitor.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
self.assertEqual(workflow.name, AddMonitor.name)
|
||||
|
||||
expected_objs = ['<AddMonitorStep: addmonitoraction>', ]
|
||||
@ -526,7 +527,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
res = self.client.get(reverse(self.ADDMEMBER_PATH))
|
||||
|
||||
workflow = res.context['workflow']
|
||||
self.assertTemplateUsed(res, 'project/loadbalancers/addmember.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
self.assertEqual(workflow.name, AddMember.name)
|
||||
|
||||
expected_objs = ['<AddMemberStep: addmemberaction>', ]
|
||||
|
@ -85,7 +85,6 @@ class IndexView(tabs.TabView):
|
||||
|
||||
class AddPoolView(workflows.WorkflowView):
|
||||
workflow_class = AddPool
|
||||
template_name = "project/loadbalancers/addpool.html"
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(AddPoolView, self).get_initial()
|
||||
@ -94,7 +93,6 @@ class AddPoolView(workflows.WorkflowView):
|
||||
|
||||
class AddVipView(workflows.WorkflowView):
|
||||
workflow_class = AddVip
|
||||
template_name = "project/loadbalancers/addvip.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(AddVipView, self).get_context_data(**kwargs)
|
||||
@ -116,7 +114,6 @@ class AddVipView(workflows.WorkflowView):
|
||||
|
||||
class AddMemberView(workflows.WorkflowView):
|
||||
workflow_class = AddMember
|
||||
template_name = "project/loadbalancers/addmember.html"
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(AddMemberView, self).get_initial()
|
||||
@ -125,7 +122,6 @@ class AddMemberView(workflows.WorkflowView):
|
||||
|
||||
class AddMonitorView(workflows.WorkflowView):
|
||||
workflow_class = AddMonitor
|
||||
template_name = "project/loadbalancers/addmonitor.html"
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(AddMonitorView, self).get_initial()
|
||||
|
@ -36,7 +36,6 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class CreateView(workflows.WorkflowView):
|
||||
workflow_class = CreateSubnet
|
||||
template_name = 'project/networks/subnets/create.html'
|
||||
|
||||
def get_object(self):
|
||||
if not hasattr(self, "_object"):
|
||||
@ -59,7 +58,6 @@ class CreateView(workflows.WorkflowView):
|
||||
|
||||
class UpdateView(workflows.WorkflowView):
|
||||
workflow_class = UpdateSubnet
|
||||
template_name = 'project/networks/subnets/update.html'
|
||||
|
||||
def _get_object(self, *args, **kwargs):
|
||||
if not hasattr(self, "_object"):
|
||||
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Network" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Create Network") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include "horizon/common/_workflow.html" %}
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Subnet" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Create Subnet") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include "horizon/common/_workflow.html" %}
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Update Subnet" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Update Subnet") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include "horizon/common/_workflow.html" %}
|
||||
{% endblock %}
|
@ -24,6 +24,7 @@ import netaddr
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
from .workflows import CreateNetwork
|
||||
from horizon.workflows.views import WorkflowView
|
||||
|
||||
|
||||
INDEX_URL = reverse('horizon:project:networks:index')
|
||||
@ -225,7 +226,7 @@ class NetworkTests(test.TestCase):
|
||||
res = self.client.get(url)
|
||||
|
||||
workflow = res.context['workflow']
|
||||
self.assertTemplateUsed(res, 'project/networks/create.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
self.assertEqual(workflow.name, CreateNetwork.name)
|
||||
expected_objs = ['<CreateNetworkInfo: createnetworkinfoaction>',
|
||||
'<CreateSubnetInfo: createsubnetinfoaction>',
|
||||
@ -602,7 +603,7 @@ class NetworkSubnetTests(test.TestCase):
|
||||
args=[network.id])
|
||||
res = self.client.get(url)
|
||||
|
||||
self.assertTemplateUsed(res, 'project/networks/subnets/create.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
'subnet_create',)})
|
||||
@ -759,8 +760,7 @@ class NetworkSubnetTests(test.TestCase):
|
||||
|
||||
expected_msg = 'Network Address and IP version are inconsistent.'
|
||||
self.assertFormErrors(res, 1, expected_msg)
|
||||
self.assertTemplateUsed(res,
|
||||
'project/networks/subnets/create.html')
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
def test_subnet_create_post_gw_inconsistent(self):
|
||||
|
@ -58,7 +58,6 @@ class IndexView(tables.DataTableView):
|
||||
|
||||
class CreateView(workflows.WorkflowView):
|
||||
workflow_class = CreateNetwork
|
||||
template_name = 'project/networks/create.html'
|
||||
|
||||
def get_initial(self):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user