Mistral-dashboard: Tasks list-addition of Execution detail screen

* Added “Execution detail” screen  link

Implements blueprint: tasks-screen-improvments
Change-Id: I21f615c576f86364085e458b451ac02646882656
This commit is contained in:
Liat Fried 2015-09-17 07:03:06 +00:00
parent e084e2bc65
commit 3de32160a9
4 changed files with 57 additions and 16 deletions

View File

@ -20,24 +20,19 @@ from horizon import tables
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
class TaskTable(tables.DataTable): class TaskTable(tables.DataTable):
id = tables.Column( id = tables.Column(
"id", "id",
verbose_name=_("ID"), verbose_name=_("ID"),
link="horizon:mistral:tasks:result") link="horizon:mistral:tasks:detail")
name = tables.Column("name", verbose_name=_("Name")) name = tables.Column("name", verbose_name=_("Name"))
workflow_execution_id = tables.Column( workflow_execution_id = tables.Column(
"workflow_execution_id", "workflow_execution_id",
verbose_name=_("Workflow Execution ID"), verbose_name=_("Workflow Execution ID"),
) link="horizon:mistral:tasks:execution"
output = tables.Column(
"output",
verbose_name=_("Output"),
filters=[prettyprint]
) )
created_at = tables.Column( created_at = tables.Column(
"created_at", "created_at",

View File

@ -0,0 +1,39 @@
{% extends 'base.html' %}
{% load i18n %}
{% block page_header %}
<h1>
{% trans "Execution Overview " %}
</h1>
{% endblock page_header %}
{% block main %}
{% load i18n sizeformat %}
<div class="detail">
<h4>{% trans "Information" %}</h4>
<hr class="header_rule">
<dl class="dl-horizontal">
<dt>{% trans "ID" %}</dt>
<dd>{{ execution.id|default:_("None") }}</dd>
<dt>{% trans "Worflow Name" %}</dt>
<dd>{{ execution.workflow_name }}</dd>
<dt>{% trans "State" %}</dt>
<dd>{{ execution.state }}</dd>
{% if execution.description %}
<dt>{% trans "Description" %}</dt>
<dd>{{ execution.description }}</dd>
{% endif %}
<dt>{% trans "Created At" %}</dt>
<dd>{{ execution.created_at }}</dd>
<dt>{% trans "Updated At" %}</dt>
<dd>{{ execution.updated_at }}</dd>
<dt>{% trans "Params" %}</dt>
<dd>{{ execution.params }}</dd>
<dt>{% trans "Input" %}</dt>
<dd>{{ execution.input }}</dd>
<dt>{% trans "Output" %}</dt>
<dd>{{ execution.output }}</dd>
</dl>
</div>
{% endblock %}

View File

@ -24,7 +24,6 @@ TASKS = r'^(?P<task_id>[^/]+)/%s$'
urlpatterns = patterns( urlpatterns = patterns(
'', '',
url(r'^$', views.IndexView.as_view(), name='index'), 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'),
) )

View File

@ -18,21 +18,29 @@ from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views import generic from django.views import generic
from horizon import exceptions from horizon import exceptions
from horizon import tables from horizon import tables
from mistraldashboard import api from mistraldashboard import api
from mistraldashboard.default.utils import prettyprint
from mistraldashboard.tasks.tables import TaskTable from mistraldashboard.tasks.tables import TaskTable
class ResultView(generic.TemplateView): class ExecutionView(generic.TemplateView):
template_name = 'mistral/tasks/result.html' template_name = 'mistral/tasks/execution.html'
page_title = _("Task Result") page_title = _("Execution Overview")
def get_context_data(self, **kwargs): 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) 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 return context
@ -55,8 +63,8 @@ class OverviewView(generic.TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(OverviewView, self).get_context_data(**kwargs) context = super(OverviewView, self).get_context_data(**kwargs)
task = self.get_data(self.request, **kwargs) task = self.get_data(self.request, **kwargs)
task.result = prettyprint(task.result)
context['task'] = task context['task'] = task
return context return context
def get_data(self, request, **kwargs): def get_data(self, request, **kwargs):