From b3c1e189a03adea846280d17d9b27fdde82446ce Mon Sep 17 00:00:00 2001 From: Kirill Izotov Date: Tue, 29 Apr 2014 18:07:01 +0700 Subject: [PATCH] Add list of tasks for an execution Change-Id: I15993d359d858190f5692916e24f0b0e9c500767 --- .../dashboards/mistral/executions/tables.py | 16 ++++++++++++++-- .../executions/templates/executions/index.html | 2 +- .../dashboards/mistral/executions/urls.py | 6 +++++- .../dashboards/mistral/executions/views.py | 12 ++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/tables.py b/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/tables.py index 68b77749..6b379724 100644 --- a/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/tables.py +++ b/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/tables.py @@ -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") diff --git a/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/templates/executions/index.html b/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/templates/executions/index.html index cf0671b4..864a4d40 100644 --- a/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/templates/executions/index.html +++ b/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/templates/executions/index.html @@ -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 %} diff --git a/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/urls.py b/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/urls.py index fca7a361..c36de582 100644 --- a/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/urls.py +++ b/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/urls.py @@ -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[^/]+)/%s$' urlpatterns = patterns( '', url(r'^$', IndexView.as_view(), name='index'), + url(EXECUTIONS % 'tasks', TaskView.as_view(), name='tasks'), ) diff --git a/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/views.py b/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/views.py index 2ef979e0..9861cdfc 100644 --- a/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/views.py +++ b/horizon_dashboard/demo_dashboard/dashboards/mistral/executions/views.py @@ -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'])]