Added delete button to execution screen ui on mistral-dashboard

* added delete button to execution screen ui

Partially implements blueprint: mistral-dashboard-executions-screen

Change-Id: I12b28f46a89ba5188fba5d5b2aa8534e46505ac2
This commit is contained in:
Gal Margalit 2015-07-22 12:22:01 +00:00
parent 8881ce22bc
commit 1846ea19fc
2 changed files with 39 additions and 1 deletions

View File

@ -57,6 +57,15 @@ def execution_list(request):
return mistralclient(request).executions.list() return mistralclient(request).executions.list()
def execution_delete(request, execution_name):
"""Delete execution.
:param execution_name: Execution name
"""
return mistralclient(request).executions.delete(execution_name)
@handle_errors(_("Unable to retrieve tasks."), []) @handle_errors(_("Unable to retrieve tasks."), [])
def task_list(request, execution_id=None): def task_list(request, execution_id=None):
"""Returns all tasks. """Returns all tasks.

View File

@ -15,14 +15,37 @@
# limitations under the License. # limitations under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables from horizon import tables
from mistraldashboard import api
from mistraldashboard.default.utils import humantime from mistraldashboard.default.utils import humantime
from mistraldashboard.default.utils import label from mistraldashboard.default.utils import label
from mistraldashboard.default.utils import prettyprint from mistraldashboard.default.utils import prettyprint
class DeleteExecution(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Execution",
u"Delete Executions",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Execution",
u"Deleted Executions",
count
)
def delete(self, request, execution_name):
api.execution_delete(request, execution_name)
class ExecutionsTable(tables.DataTable): class ExecutionsTable(tables.DataTable):
id = tables.Column( id = tables.Column(
"id", "id",
@ -37,6 +60,7 @@ class ExecutionsTable(tables.DataTable):
verbose_name=_("Input"), verbose_name=_("Input"),
filters=[prettyprint] filters=[prettyprint]
) )
output = tables.Column( output = tables.Column(
"output", "output",
verbose_name=_("Output"), verbose_name=_("Output"),
@ -54,11 +78,16 @@ class ExecutionsTable(tables.DataTable):
filters=[humantime] filters=[humantime]
) )
state = tables.Column("state", verbose_name=_("State"), filters=[label]) state = tables.Column(
"state",
verbose_name=_("State"),
filters=[label])
class Meta(object): class Meta(object):
name = "executions" name = "executions"
verbose_name = _("Executions") verbose_name = _("Executions")
table_actions = (DeleteExecution,)
row_actions = (DeleteExecution,)
class TaskTable(tables.DataTable): class TaskTable(tables.DataTable):