From 3de32160a98787bcde0bc0be72911d8f3f7ee57f Mon Sep 17 00:00:00 2001 From: Liat Fried Date: Thu, 17 Sep 2015 07:03:06 +0000 Subject: [PATCH] Mistral-dashboard: Tasks list-addition of Execution detail screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added “Execution detail” screen link Implements blueprint: tasks-screen-improvments Change-Id: I21f615c576f86364085e458b451ac02646882656 --- mistraldashboard/tasks/tables.py | 9 +---- .../tasks/templates/tasks/execution.html | 39 +++++++++++++++++++ mistraldashboard/tasks/urls.py | 5 +-- mistraldashboard/tasks/views.py | 20 +++++++--- 4 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 mistraldashboard/tasks/templates/tasks/execution.html diff --git a/mistraldashboard/tasks/tables.py b/mistraldashboard/tasks/tables.py index 7d85766..69c22b4 100644 --- a/mistraldashboard/tasks/tables.py +++ b/mistraldashboard/tasks/tables.py @@ -20,24 +20,19 @@ from horizon import tables from mistraldashboard.default.utils import humantime from mistraldashboard.default.utils import label -from mistraldashboard.default.utils import prettyprint class TaskTable(tables.DataTable): id = tables.Column( "id", verbose_name=_("ID"), - link="horizon:mistral:tasks:result") + link="horizon:mistral:tasks:detail") name = tables.Column("name", verbose_name=_("Name")) workflow_execution_id = tables.Column( "workflow_execution_id", verbose_name=_("Workflow Execution ID"), - ) - output = tables.Column( - "output", - verbose_name=_("Output"), - filters=[prettyprint] + link="horizon:mistral:tasks:execution" ) created_at = tables.Column( "created_at", diff --git a/mistraldashboard/tasks/templates/tasks/execution.html b/mistraldashboard/tasks/templates/tasks/execution.html new file mode 100644 index 0000000..4dcf7dd --- /dev/null +++ b/mistraldashboard/tasks/templates/tasks/execution.html @@ -0,0 +1,39 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block page_header %} +

+ {% trans "Execution Overview " %} +

+{% endblock page_header %} + +{% block main %} + {% load i18n sizeformat %} + +
+

{% trans "Information" %}

+
+
+
{% trans "ID" %}
+
{{ execution.id|default:_("None") }}
+
{% trans "Worflow Name" %}
+
{{ execution.workflow_name }}
+
{% trans "State" %}
+
{{ execution.state }}
+ {% if execution.description %} +
{% trans "Description" %}
+
{{ execution.description }}
+ {% endif %} +
{% trans "Created At" %}
+
{{ execution.created_at }}
+
{% trans "Updated At" %}
+
{{ execution.updated_at }}
+
{% trans "Params" %}
+
{{ execution.params }}
+
{% trans "Input" %}
+
{{ execution.input }}
+
{% trans "Output" %}
+
{{ execution.output }}
+
+
+{% endblock %} diff --git a/mistraldashboard/tasks/urls.py b/mistraldashboard/tasks/urls.py index 9b84c95..5f4d67b 100644 --- a/mistraldashboard/tasks/urls.py +++ b/mistraldashboard/tasks/urls.py @@ -24,7 +24,6 @@ TASKS = r'^(?P[^/]+)/%s$' urlpatterns = patterns( '', url(r'^$', views.IndexView.as_view(), name='index'), - url(TASKS % 'result', views.ResultView.as_view(), name='result'), - url(TASKS % 'detail', views.OverviewView.as_view(), name='detail') - + url(TASKS % 'detail', views.OverviewView.as_view(), name='detail'), + url(TASKS % 'execution', views.ExecutionView.as_view(), name='execution'), ) diff --git a/mistraldashboard/tasks/views.py b/mistraldashboard/tasks/views.py index 26b6041..952890c 100644 --- a/mistraldashboard/tasks/views.py +++ b/mistraldashboard/tasks/views.py @@ -18,21 +18,29 @@ from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from django.views import generic + from horizon import exceptions from horizon import tables from mistraldashboard import api +from mistraldashboard.default.utils import prettyprint from mistraldashboard.tasks.tables import TaskTable -class ResultView(generic.TemplateView): - template_name = 'mistral/tasks/result.html' - page_title = _("Task Result") +class ExecutionView(generic.TemplateView): + template_name = 'mistral/tasks/execution.html' + page_title = _("Execution Overview") def get_context_data(self, **kwargs): - context = super(ResultView, self).get_context_data(**kwargs) + context = super(ExecutionView, self).get_context_data(**kwargs) task = self.get_data(self.request, **kwargs) - context['result'] = task.result + execution = api.execution_get(self.request, task.workflow_execution_id) + execution.input = prettyprint(execution.input) + execution.output = prettyprint(execution.output) + execution.params = prettyprint(execution.params) + + context['task'] = task + context['execution'] = execution return context @@ -55,8 +63,8 @@ class OverviewView(generic.TemplateView): def get_context_data(self, **kwargs): context = super(OverviewView, self).get_context_data(**kwargs) task = self.get_data(self.request, **kwargs) + task.result = prettyprint(task.result) context['task'] = task - return context def get_data(self, request, **kwargs):