1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2012, Nachi Ueno, NTT MCL, Inc.
5
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6
# not use this file except in compliance with the License. You may obtain
7
# a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
# License for the specific language governing permissions and limitations
19
from django.template.defaultfilters import title
20
from django.utils.translation import ugettext_lazy as _
22
from horizon import tables
23
from openstack_dashboard import api
24
from openstack_dashboard.dashboards.project.routers import tables as r_tables
27
LOG = logging.getLogger(__name__)
30
class DeleteRouter(r_tables.DeleteRouter):
31
redirect_url = "horizon:admin:routers:index"
33
def allowed(self, request, router=None):
37
class CreateRouter(tables.LinkAction):
39
verbose_name = _("Create Router")
40
url = "horizon:admin:routers:create"
41
classes = ("ajax-modal", "btn-create")
44
class UpdateRow(tables.Row):
47
def get_data(self, request, router_id):
48
router = api.router_get(request, router_id)
52
class RoutersTable(tables.DataTable):
53
tenant = tables.Column("tenant_name", verbose_name=_("Project"))
54
name = tables.Column("name",
55
verbose_name=_("Name"),
56
link="horizon:admin:routers:detail")
57
status = tables.Column("status",
59
verbose_name=_("Status"),
62
def get_object_display(self, obj):
67
verbose_name = _("Routers")
68
status_columns = ["status"]
70
table_actions = (CreateRouter, DeleteRouter)
71
row_actions = (DeleteRouter, )