<!DOCTYPE html>
<html>
<head lang="en">
	<meta charset="UTF-8" />
	<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
	<meta name="viewport" content="user-scalable=0,initial-scale=1.0,minimal-ui" />
	<title>Pipeline Stats</title>
	<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
	<link href="/style.css" rel="stylesheet">
	<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
<body>
    <div class="message-detail">
        <div class="message-detail-header">
            <h1>Process ID: {{ process }}</h1>
            <h1>Host: {{ hostname }}</h1>
            <h2>Process state: {{ process_stats.state }}</h2>
            <h2>Success messages: {{ process_stats.success }}</h2>
            <h2>Waiting messages: {{ process_stats.waiting }}</h2>
            <h2>Failed messages: {{ process_stats.failed }}</h2>
        </div>
        <div class="message-detail-list">
            <h2>Messages being processed</h2>
            <table>
                <tr>
                    <th>ID</th>
                    <th>Created at</th>
                    <th>Grouping value</th>
                    <th>Content</th>
                </tr>
                {% for msg in messages_being_processed %}
                    <tr>
                        <td>{{ msg.ramp_unique_id }}</td>
                        <td>{{ msg.init_time }}</td>
                        <td>{{ msg.grouping_value }}</td>
                        <td>{{ msg.content }}</td>
                    </tr>
                {% endfor %}
            </table>
        </div>
        <div class="message-detail-list">
            <h2>Errors</h2>
            <table>
                <tr>
                    <th>Date</th>
                    <th>Message</th>
                    <th>Exception</th>
                </tr>
                {% for date, process, exception, message in failed_messages %}
                    <tr>
                        <td>{{ date }}</td>
                        <td><pre>{{ message }}</pre></td>
                        <td><pre>{{ exception }}</pre></td>
                    </tr>
                {% endfor %}
            </table>
        </div>
    </div>
</body>
</html>