diff --git a/mistraldashboard/default/templates/default/_prettyprint.html b/mistraldashboard/default/templates/default/_prettyprint.html index 2d3290d..f087117 100644 --- a/mistraldashboard/default/templates/default/_prettyprint.html +++ b/mistraldashboard/default/templates/default/_prettyprint.html @@ -1,9 +1,3 @@ -{% if short %}
-
{{ short }}
{{ full }}
-{% else %} -
-
{{ full }}
-{% endif %} -
+
\ No newline at end of file diff --git a/mistraldashboard/executions/tables.py b/mistraldashboard/executions/tables.py index e0ee6ff..b214de3 100644 --- a/mistraldashboard/executions/tables.py +++ b/mistraldashboard/executions/tables.py @@ -50,11 +50,18 @@ class ExecutionsTable(tables.DataTable): id = tables.Column( "id", verbose_name=_("ID"), - link="horizon:mistral:executions:tasks" + link="horizon:mistral:executions:detail" ) workflow_name = tables.Column("workflow_name", verbose_name=_("Workflow")) + task = tables.Column( + "task", + verbose_name=_("Task"), + empty_value=_("View"), + link="horizon:mistral:executions:tasks" + ) + input = tables.Column( "input", verbose_name=_("Input"), diff --git a/mistraldashboard/executions/templates/executions/detail.html b/mistraldashboard/executions/templates/executions/detail.html new file mode 100644 index 0000000..aff85e5 --- /dev/null +++ b/mistraldashboard/executions/templates/executions/detail.html @@ -0,0 +1,38 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Execution Overview" %}{% endblock %} + +{% block page_header %} +

+ {% trans "Execution Overview: " %} + {{ execution.id|default:_("None") }} +

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

{% trans "Information" %}

+
+
+
{% trans "ID" %}
+
{{ execution.id|default:_("None") }}
+
{% trans "State" %}
+
{{ execution.state }}
+ {% if execution.description %} +
{% trans "Description" %}
+
{{ execution.description }}
+ {% endif %} +
{% trans "Worflow Name" %}
+
{{ execution.workflow_name }}
+
{% trans "Updated At" %}
+
{{ execution.updated_at }}
+
{% trans "Params" %}
+
{{ execution.params }}
+
{% trans "Input" %}
+
{{ execution.input }}
+
{% trans "Output" %}
+
{{ execution.output }}
+
+
+{% endblock %} diff --git a/mistraldashboard/executions/urls.py b/mistraldashboard/executions/urls.py index abc751a..4d918f9 100644 --- a/mistraldashboard/executions/urls.py +++ b/mistraldashboard/executions/urls.py @@ -20,10 +20,13 @@ from django.conf.urls import url # noqa from mistraldashboard.executions.views import IndexView from mistraldashboard.executions.views import TaskView +from mistraldashboard.executions import views + EXECUTIONS = r'^(?P[^/]+)/%s$' urlpatterns = patterns( '', url(r'^$', IndexView.as_view(), name='index'), url(EXECUTIONS % 'tasks', TaskView.as_view(), name='tasks'), + url(EXECUTIONS % 'detail', views.DetailView.as_view(), name='detail'), ) diff --git a/mistraldashboard/executions/views.py b/mistraldashboard/executions/views.py index e905d81..c6474b6 100644 --- a/mistraldashboard/executions/views.py +++ b/mistraldashboard/executions/views.py @@ -14,9 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +from django.views import generic + +from django.core.urlresolvers import reverse +from django.utils.translation import ugettext_lazy as _ + +from horizon import exceptions from horizon import tables from mistraldashboard import api +from mistraldashboard.default.utils import prettyprint from mistraldashboard.executions.tables import ExecutionsTable from mistraldashboard.executions.tables import TaskTable @@ -35,3 +42,28 @@ class TaskView(tables.DataTableView): def get_data(self): return api.task_list(self.request, self.kwargs['execution_id']) + + +class DetailView(generic.TemplateView): + template_name = 'mistral/executions/detail.html' + page_title = _("Execution Overview") + + def get_context_data(self, **kwargs): + context = super(DetailView, self).get_context_data(**kwargs) + execution = self.get_data(self.request, **kwargs) + execution.input = prettyprint(execution.input) + execution.output = prettyprint(execution.output) + execution.params = prettyprint(execution.params) + context['execution'] = execution + return context + + def get_data(self, request, **kwargs): + try: + execution_id = kwargs['execution_id'] + execution = api.execution_get(request, execution_id) + except Exception: + msg = _('Unable to get execution "%s".') % execution_id + redirect = reverse('horizon:mistral:executions:index') + exceptions.handle(self.request, msg, redirect=redirect) + + return execution