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:
parent
8881ce22bc
commit
1846ea19fc
|
@ -57,6 +57,15 @@ def execution_list(request):
|
|||
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."), [])
|
||||
def task_list(request, execution_id=None):
|
||||
"""Returns all tasks.
|
||||
|
|
|
@ -15,14 +15,37 @@
|
|||
# limitations under the License.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import tables
|
||||
|
||||
from mistraldashboard import api
|
||||
from mistraldashboard.default.utils import humantime
|
||||
from mistraldashboard.default.utils import label
|
||||
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):
|
||||
id = tables.Column(
|
||||
"id",
|
||||
|
@ -37,6 +60,7 @@ class ExecutionsTable(tables.DataTable):
|
|||
verbose_name=_("Input"),
|
||||
filters=[prettyprint]
|
||||
)
|
||||
|
||||
output = tables.Column(
|
||||
"output",
|
||||
verbose_name=_("Output"),
|
||||
|
@ -54,11 +78,16 @@ class ExecutionsTable(tables.DataTable):
|
|||
filters=[humantime]
|
||||
)
|
||||
|
||||
state = tables.Column("state", verbose_name=_("State"), filters=[label])
|
||||
state = tables.Column(
|
||||
"state",
|
||||
verbose_name=_("State"),
|
||||
filters=[label])
|
||||
|
||||
class Meta(object):
|
||||
name = "executions"
|
||||
verbose_name = _("Executions")
|
||||
table_actions = (DeleteExecution,)
|
||||
row_actions = (DeleteExecution,)
|
||||
|
||||
|
||||
class TaskTable(tables.DataTable):
|
||||
|
|
Loading…
Reference in New Issue