Remove delete action and bar when stack is DELETE_COMPLETE.

Heat is returning stack in DELETE_COMPLETE status. Beside that
the table don't consider DELETE_COMPLETE status so the animation is
always visible after deletion.

As a side effect, the checkbox and delete (row action) button are enabled.

This patch will remove the animation on DELETE_COMPLETE state and
disable 'Delete' button and checkbox so it cannot be delete again
by Table Delete action.

Change-Id: Id9c8d34c99a4079d2afa7438353490bfaf91072b
Closes-Bug: #1243087
This commit is contained in:
Leandro I. Costantino 2014-01-25 10:13:38 -05:00
parent 184f1d8d3e
commit a541f954a4
1 changed files with 9 additions and 0 deletions

View File

@ -45,10 +45,18 @@ class DeleteStack(tables.BatchAction):
def action(self, request, stack_id):
api.heat.stack_delete(request, stack_id)
def allowed(self, request, stack):
if stack is not None:
return stack.stack_status != 'DELETE_COMPLETE'
return True
class StacksUpdateRow(tables.Row):
ajax = True
def can_be_selected(self, datum):
return datum.stack_status != 'DELETE_COMPLETE'
def get_data(self, request, stack_id):
try:
return api.heat.stack_get(request, stack_id)
@ -66,6 +74,7 @@ class StacksTable(tables.DataTable):
("Update Complete", True),
("Create Failed", False),
("Update Failed", False),
('Delete Complete', True)
)
name = tables.Column("stack_name",
verbose_name=_("Stack Name"),