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

« back to all changes in this revision

Viewing changes to horizon/dashboards/nova/instances_and_volumes/volumes/tables.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman, Adrien Cunin
  • Date: 2012-04-04 07:21:15 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20120404072115-lb9v3gq3yv93ern2
Tags: 2012.1~rc2-0ubuntu1
[ Chuck Short ]
* New usptream release.
* debian/control: Use python-cherrypy3
* debian/rules: Update pythonpath in order to run tests.
* debian/patches/fix-coverage-binary-name.patch: Make the testsuite
  run.
* debian/rules: Fail build if tests fail.

[ Adam Gandelman ]
* debian/control: Add python-memcache 
* debain/dashboard.conf: Update to match current upstream documentation
  (LP: #966069)

[ Adrien Cunin ]
* Renamed Apache config file from dashboard.conf to openstack-dashboard.conf
  (LP: #965410)
  - Updated post{inst,rm} and added preinst to handle correctly the rename

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from django.core.urlresolvers import reverse
20
20
from django.template.defaultfilters import title
21
21
from django.utils import safestring
22
 
from django.utils.translation import ugettext as _
 
22
from django.utils.translation import ugettext_lazy as _
23
23
 
24
24
from horizon import api
25
25
from horizon import tables
74
74
class UpdateRow(tables.Row):
75
75
    ajax = True
76
76
 
77
 
    @classmethod
78
 
    def get_data(cls, request, volume_id):
 
77
    def get_data(self, request, volume_id):
79
78
        volume = api.volume_get(request, volume_id)
80
79
        return volume
81
80
 
91
90
    # Filter out "empty" attachments which the client returns...
92
91
    for attachment in [att for att in volume.attachments if att]:
93
92
        url = reverse("%s:instances:detail" % URL_PREFIX,
94
 
                      args=(attachment["serverId"],))
 
93
                      args=(attachment["server_id"],))
95
94
        # TODO(jake): Make "instance" the instance name
96
95
        vals = {"url": url,
97
 
                "instance": attachment["serverId"],
 
96
                "instance": attachment["server_id"],
98
97
                "dev": attachment["device"]}
99
98
        attachments.append(link % vals)
100
99
    return safestring.mark_safe(", ".join(attachments))
107
106
        ("creating", None),
108
107
        ("error", False),
109
108
    )
110
 
    name = tables.Column("displayName", verbose_name=_("Name"),
 
109
    name = tables.Column("display_name", verbose_name=_("Name"),
111
110
                         link="%s:volumes:detail" % URL_PREFIX)
112
 
    description = tables.Column("displayDescription",
 
111
    description = tables.Column("display_description",
113
112
                                verbose_name=_("Description"))
114
113
    size = tables.Column(get_size, verbose_name=_("Size"))
115
114
    status = tables.Column("status",
119
118
                           status_choices=STATUS_CHOICES)
120
119
 
121
120
    def get_object_display(self, obj):
122
 
        return obj.displayName
 
121
        return obj.display_name
123
122
 
124
123
 
125
124
class VolumesTable(VolumesTableBase):
126
 
    name = tables.Column("displayName",
 
125
    name = tables.Column("display_name",
127
126
                         verbose_name=_("Name"),
128
127
                         link="%s:volumes:detail" % URL_PREFIX)
129
128
    attachments = tables.Column(get_attachment,
147
146
    classes = ('btn-danger', 'btn-detach')
148
147
 
149
148
    def action(self, request, obj_id):
150
 
        instance_id = self.table.get_object_by_id(obj_id)['serverId']
 
149
        instance_id = self.table.get_object_by_id(obj_id)['server_id']
151
150
        api.volume_detach(request, instance_id, obj_id)
152
151
 
153
152
    def get_success_url(self, request):
155
154
 
156
155
 
157
156
class AttachmentsTable(tables.DataTable):
158
 
    instance = tables.Column("serverId", verbose_name=_("Instance"))
 
157
    instance = tables.Column("server_id", verbose_name=_("Instance"))
159
158
    device = tables.Column("device")
160
159
 
161
160
    def get_object_id(self, obj):
163
162
 
164
163
    def get_object_display(self, obj):
165
164
        vals = {"dev": obj['device'],
166
 
                "instance": obj['serverId']}
 
165
                "instance": obj['server_id']}
167
166
        return "Attachment %(dev)s on %(instance)s" % vals
168
167
 
169
168
    def get_object_by_id(self, obj_id):