~ubuntu-branches/ubuntu/precise/horizon/precise-updates

« back to all changes in this revision

Viewing changes to horizon/horizon/dashboards/syspanel/instances/tables.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-24 10:49:27 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120224104927-0v71grkyxtu106l4
Tags: 2012.1~e4~20120224.1386-0ubuntu1
New upstream version. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
# Copyright 2012 Openstack, LLC
 
4
# Copyright 2012 Nebula, Inc.
 
5
#
 
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
 
9
#
 
10
#         http://www.apache.org/licenses/LICENSE-2.0
 
11
#
 
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
 
16
#    under the License.
 
17
 
 
18
import logging
 
19
 
 
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 _
 
24
 
 
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
 
32
 
 
33
LOG = logging.getLogger(__name__)
 
34
 
 
35
 
 
36
class SyspanelInstancesTable(tables.DataTable):
 
37
    TASK_STATUS_CHOICES = (
 
38
        (None, True),
 
39
        ("none", True)
 
40
    )
 
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:" \
 
47
                                      "instances:detail")
 
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"),
 
53
                         filters=(title,),
 
54
                         status=True,
 
55
                         status_choices=TASK_STATUS_CHOICES)
 
56
    state = tables.Column(get_power_state,
 
57
                          filters=(title,),
 
58
                          verbose_name=_("Power State"))
 
59
 
 
60
    class Meta:
 
61
        name = "instances"
 
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)