From c782ed73d398bd3a7af6f0333f72eb9c99aebdbb Mon Sep 17 00:00:00 2001 From: Gloria Gu Date: Wed, 5 Nov 2014 13:37:39 -0800 Subject: [PATCH] added code for checking bug Change-Id: I76949af9a83e14dc868f0ab5bd8409009edecec3 --- .../admin/volumes/volume_types/tables.py | 26 ++++++++++++++++++- .../dashboards/admin/volumes/volumes/tables.py | 29 ++++++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/volumes/volume_types/tables.py b/openstack_dashboard/dashboards/admin/volumes/volume_types/tables.py index 506f7ea..e5afb6d 100644 --- a/openstack_dashboard/dashboards/admin/volumes/volume_types/tables.py +++ b/openstack_dashboard/dashboards/admin/volumes/volume_types/tables.py @@ -14,6 +14,7 @@ from django.template import defaultfilters as filters from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy +from horizon import forms from horizon import tables from openstack_dashboard.api import cinder @@ -66,9 +67,32 @@ class DeleteVolumeType(tables.DeleteAction): def delete(self, request, obj_id): cinder.volume_type_delete(request, obj_id) +class UpdateRow(tables.Row): + ajax = True + + def get_data(self, request, id): + type = cinder.volume_type_get(request, id) + return type + +class UpdateCell(tables.UpdateAction): + def allowed(self, request, volume_type, cell): + return True + + def update_cell(self, request, data, id, + cell_name, new_cell_value): + + obj = data + setattr(obj, cell_name, new_cell_value) + value = getattr(obj, 'name', None) + + return True class VolumeTypesTable(tables.DataTable): - name = tables.Column("name", verbose_name=_("Name")) + #name = tables.Column("name", verbose_name=_("Name")) + name = tables.Column("name", verbose_name=_("Name"), + form_field=forms.CharField( + max_length=64, required=False), + update_action=UpdateCell) assoc_qos_spec = tables.Column("associated_qos_spec", verbose_name=_("Associated QoS Spec")) diff --git a/openstack_dashboard/dashboards/admin/volumes/volumes/tables.py b/openstack_dashboard/dashboards/admin/volumes/volumes/tables.py index 694f173..9606143 100644 --- a/openstack_dashboard/dashboards/admin/volumes/volumes/tables.py +++ b/openstack_dashboard/dashboards/admin/volumes/volumes/tables.py @@ -12,10 +12,11 @@ from django.utils.translation import ugettext_lazy as _ +from horizon import forms from horizon import tables from openstack_dashboard.dashboards.project.volumes \ .volumes import tables as volumes_tables - +from openstack_dashboard.api import cinder class VolumesFilterAction(tables.FilterAction): @@ -36,10 +37,34 @@ class UpdateVolumeStatusAction(tables.LinkAction): "volume_extension:volume_admin_actions:reset_status"),) +class UpdateRow(tables.Row): + ajax = True + + def get_data(self, request, volume_id): + volume = cinder.volume_get(request, volume_id) + return volume + +class UpdateCell(tables.UpdateAction): + def allowed(self, request, volume, cell): + return True + + def update_cell(self, request, data, id, + cell_name, new_cell_value): + + obj = data + setattr(obj, cell_name, new_cell_value) + value = getattr(obj, 'name', None) + + return True class VolumesTable(volumes_tables.VolumesTable): + """ name = tables.Column("name", verbose_name=_("Name"), - link="horizon:admin:volumes:volumes:detail") + link="horizon:admin:volumes:volumes:detail")""" + name = tables.Column("name", verbose_name=_("Name"), + form_field=forms.CharField( + max_length=64, required=False), + update_action=UpdateCell) host = tables.Column("os-vol-host-attr:host", verbose_name=_("Host")) tenant = tables.Column("tenant_name", verbose_name=_("Project")) -- 1.9.1