Add UpdateRow method and status_columns to AdminImagesTable

Make image status changing automaticly after created

Change-Id: I7196d60384aec31f3584ecd165526142099977b3
Fixes: bug #1248884
This commit is contained in:
Zhenguo Niu 2013-11-08 16:15:09 +08:00 committed by Gerrit Code Review
parent 33322a856b
commit adc62b3168
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,7 @@ from django.utils.translation import ugettext_lazy as _ # noqa
from horizon import tables
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.images_and_snapshots.images \
import tables as project_tables
@ -41,6 +42,14 @@ class AdminEditImage(project_tables.EditImage):
return True
class UpdateRow(tables.Row):
ajax = True
def get_data(self, request, image_id):
image = api.glance.image_get(request, image_id)
return image
class AdminImagesTable(project_tables.ImagesTable):
name = tables.Column("name",
link="horizon:admin:images:detail",
@ -48,6 +57,8 @@ class AdminImagesTable(project_tables.ImagesTable):
class Meta:
name = "images"
row_class = UpdateRow
status_columns = ["status"]
verbose_name = _("Images")
table_actions = (AdminCreateImage, AdminDeleteImage)
row_actions = (AdminEditImage, AdminDeleteImage)