Add list of tasks for an execution

Change-Id: I15993d359d858190f5692916e24f0b0e9c500767
This commit is contained in:
Kirill Izotov
2014-04-29 18:07:01 +07:00
parent 48c9018a1a
commit b3c1e189a0
4 changed files with 32 additions and 4 deletions

View File

@@ -4,11 +4,23 @@ from horizon import tables
class ExecutionsTable(tables.DataTable):
id = tables.Column("id", verbose_name=_("ID"))
id = tables.Column("id",
verbose_name=_("ID"),
link=("horizon:mistral:executions:tasks"))
wb_name = tables.Column("workbook_name", verbose_name=_("Workbook"))
state = tables.Column("state", verbose_name=_("State"))
class Meta:
name = "executions"
verbose_name = _("Executions")
# row_actions = (ExecuteWorkflow,)
class TaskTable(tables.DataTable):
id = tables.Column("id", verbose_name=_("ID"))
name = tables.Column("name", verbose_name=_("Name"))
action = tables.Column("action", verbose_name=_("Action"))
state = tables.Column("state", verbose_name=_("State"))
class Meta:
name = "tasks"
verbose_name = _("Tasks")

View File

@@ -3,7 +3,7 @@
{% block title %}{% trans "Executions" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Workbooks") %}
{% include "horizon/common/_page_header.html" with title=_("Executions") %}
{% endblock page_header %}
{% block main %}

View File

@@ -1,9 +1,13 @@
from django.conf.urls import patterns # noqa
from django.conf.urls import url # noqa
from demo_dashboard.dashboards.mistral.executions.views import IndexView
from demo_dashboard.dashboards.mistral.executions.views \
import IndexView, TaskView
EXECUTIONS = r'^(?P<execution_id>[^/]+)/%s$'
urlpatterns = patterns(
'',
url(r'^$', IndexView.as_view(), name='index'),
url(EXECUTIONS % 'tasks', TaskView.as_view(), name='tasks'),
)

View File

@@ -2,6 +2,7 @@ from horizon import tables
from demo_dashboard.dashboards.mistral import api
from demo_dashboard.dashboards.mistral.executions.tables import ExecutionsTable
from demo_dashboard.dashboards.mistral.executions.tables import TaskTable
class IndexView(tables.DataTableView):
@@ -12,3 +13,14 @@ class IndexView(tables.DataTableView):
client = api.mistralclient(self.request)
return [item for wb in client.workbooks.list()
for item in client.executions.list(wb.name)]
class TaskView(tables.DataTableView):
table_class = TaskTable
template_name = 'mistral/executions/index.html'
def get_data(self):
client = api.mistralclient(self.request)
return [item for wb in client.workbooks.list()
for item in client.tasks.list(wb.name,
self.kwargs['execution_id'])]