1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2012 Openstack, LLC
4
# Copyright 2012 Nebula, Inc.
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7
# not use this file except in compliance with the License. You may obtain
8
# a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
# License for the specific language governing permissions and limitations
20
from django import template
21
from django.template.defaultfilters import title
22
from django.utils.datastructures import SortedDict
23
from django.utils.translation import ugettext as _
25
from horizon import api
26
from horizon import tables
27
from horizon.dashboards.nova.instances_and_volumes.instances.tables import \
28
(LaunchLink, TerminateInstance, EditInstance, ConsoleLink, LogLink,
29
SnapshotLink, TogglePause, ToggleSuspend, RebootInstance, get_size,
30
TerminateInstance, UpdateRow, get_ips, get_power_state)
31
from horizon.templatetags import sizeformat
33
LOG = logging.getLogger(__name__)
36
class SyspanelInstancesTable(tables.DataTable):
37
TASK_STATUS_CHOICES = (
41
tenant = tables.Column("tenant_name", verbose_name=_("Tenant"))
42
user = tables.Column("user_id", verbose_name=_("User"))
43
internal_id = tables.Column("internal_identifier",
44
verbose_name=_("Instance ID"))
45
host = tables.Column("OS-EXT-SRV-ATTR:host", verbose_name=_("Host"))
46
name = tables.Column("name", link="horizon:nova:instances_and_volumes:" \
48
ip = tables.Column(get_ips, verbose_name=_("IP Address"))
49
size = tables.Column(get_size, verbose_name=_("Size"))
50
status = tables.Column("status", filters=(title,))
51
task = tables.Column("OS-EXT-STS:task_state",
52
verbose_name=_("Task"),
55
status_choices=TASK_STATUS_CHOICES)
56
state = tables.Column(get_power_state,
58
verbose_name=_("Power State"))
62
verbose_name = _("Instances")
63
status_column = "task"
64
table_actions = (LaunchLink, TerminateInstance)
65
row_actions = (EditInstance, ConsoleLink, LogLink, SnapshotLink,
66
TogglePause, ToggleSuspend, RebootInstance,
67
TerminateInstance, UpdateRow)