{% extends 'base.html' %}

{#
	Eos - Verifiable elections
	Copyright © 2017-18  RunasSudo (Yingtong Li)
	
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU Affero General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Affero General Public License for more details.
	
	You should have received a copy of the GNU Affero General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
#}

{% block title %}{{ task.label }}{% endblock %}

{% block content %}
	<h1>{{ task.label }}</h1>
	
	<table class="ui celled definition table">
		<tbody>
			<tr>
				<td>Status</td>
				<td>{{ task.status.name|title }}</td>
			</tr>
			<tr>
				<td>Strategy</td>
				<td>{{ task.run_strategy._name }}</td>
			</tr>
			<tr>
				<td>Scheduled</td>
				<td>{% if task.run_at %}{{ task.run_at|pretty_date }}{% endif %}</td>
			</tr>
			<tr>
				<td>Started</td>
				<td>{% if task.started_at %}{{ task.started_at|pretty_date }}{% endif %}</td>
			</tr>
			<tr>
				<td>Exited</td>
				<td>{% if task.completed_at %}{{ task.completed_at|pretty_date }}{% endif %}</td>
			</tr>
			<tr>
				<td>Messages</td>
				<td>
					{% if task.messages %}
						<div class="monoout" style="max-height: 10em;">{{ '\n'.join(task.messages) }}</div>
					{% endif %}
				</td>
			</tr>
			<tr>
				<td>Result</td>
				<td>
					{% if task.result %}
						<div class="monoout" style="max-height: 3em;">{{ eos.core.object.EosObject.to_json(eos.core.object.EosObject.serialise_and_wrap(task.result)) }}</div>
					{% endif %}
				</td>
			</tr>
		</tbody>
	</table>
{% endblock %}