~ubuntu-branches/ubuntu/trusty/horizon/trusty-updates

« back to all changes in this revision

Viewing changes to openstack_dashboard/dashboards/project/routers/views.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-12-05 14:39:15 UTC
  • mfrom: (1.1.35)
  • Revision ID: package-import@ubuntu.com-20131205143915-40991ba69inywk0u
Tags: 1:2014.1~b1-0ubuntu1
* New upstream release.
* debian/control: open icehouse release.
* debian/static/openstack-dashboard: Refreshed static assets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
2
 
3
3
# Copyright 2012,  Nachi Ueno,  NTT MCL,  Inc.
 
4
# Copyright 2013,  Big Switch Networks, Inc.
4
5
#
5
6
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
6
7
#    not use this file except in compliance with the License. You may obtain
25
26
from horizon import exceptions
26
27
from horizon import forms
27
28
from horizon import tables
 
29
from horizon import tabs
28
30
from openstack_dashboard import api
29
 
 
30
 
from openstack_dashboard.dashboards.project.routers \
 
31
from openstack_dashboard.dashboards.project.routers\
31
32
    import forms as project_forms
32
 
from openstack_dashboard.dashboards.project.routers.ports \
33
 
    import tables as port_tables
34
 
from openstack_dashboard.dashboards.project.routers \
35
 
    import tables as project_tables
 
33
from openstack_dashboard.dashboards.project.routers import tables as rtables
 
34
from openstack_dashboard.dashboards.project.routers import tabs as rdtabs
36
35
 
37
36
 
38
37
class IndexView(tables.DataTableView):
39
 
    table_class = project_tables.RoutersTable
 
38
    table_class = rtables.RoutersTable
40
39
    template_name = 'project/routers/index.html'
41
40
 
42
41
    def _get_routers(self, search_opts=None):
86
85
                exceptions.handle(self.request, msg)
87
86
 
88
87
 
89
 
class DetailView(tables.MultiTableView):
90
 
    table_classes = (port_tables.PortsTable, )
 
88
class DetailView(tabs.TabbedTableView):
 
89
    tab_group_class = rdtabs.RouterDetailTabs
91
90
    template_name = 'project/routers/detail.html'
92
91
    failure_url = reverse_lazy('horizon:project:routers:index')
93
92
 
101
100
                msg = _('Unable to retrieve details for router "%s".') \
102
101
                    % (router_id)
103
102
                exceptions.handle(self.request, msg, redirect=self.failure_url)
104
 
 
105
103
            if router.external_gateway_info:
106
104
                ext_net_id = router.external_gateway_info['network_id']
107
105
                try:
123
121
        context["router"] = self._get_data()
124
122
        return context
125
123
 
126
 
    def get_interfaces_data(self):
127
 
        try:
128
 
            device_id = self.kwargs['router_id']
129
 
            ports = api.neutron.port_list(self.request,
130
 
                                          device_id=device_id)
131
 
        except Exception:
132
 
            ports = []
133
 
            msg = _('Port list can not be retrieved.')
134
 
            exceptions.handle(self.request, msg)
135
 
        for p in ports:
136
 
            p.set_id_as_name_if_empty()
137
 
        return ports
 
124
    def get(self, request, *args, **kwargs):
 
125
        router = self._get_data()
 
126
        self.kwargs['router'] = router
 
127
        return super(DetailView, self).get(request, *args, **kwargs)
138
128
 
139
129
 
140
130
class CreateView(forms.ModalFormView):