{# Main App Dashboard #}
{% extends "layout.jinja" %}

{% block title %}Dashboard{% endblock %}

{% block content %}
{# ERROR Section #}
{% if error %}
<div class="section">
    <div class="row row-equal">
        <div class="col s12">
            <div class="card red white-text">
                <div class="card-content valign-wrapper">
                    <strong>{{ error }}</strong>
                </div>
            </div>
        </div>
    </div>
</div>
{% endif %}

{# Experiment Section #}
{% if experiments %}
<div class="section">
    <div class="row row-equal">
        <div class="col s12"><h3 class="header teal-text text-darken-2">Experiments</h3></div>
        {% for idx, data in experiments.items() %}
            <div class="col s12 m4">
                <div class="card">
                    <div class="card-content">
                        <span class="card-title">{{ data.name }}</span>
                        <p>
                            {% if data.count == 1 %}
                                <small>Run: <em>{{ data.count }}</em> time</small>
                            {% else %}
                                <small>Run: <em>{{ data.count }}</em> times</small>
                            {% endif %}
                        </p>
                    </div>
                    <div class="card-action">
                        <a href="{{ url_for('experiments.run', experiment=idx) }}" class="teal-text text-darken-2">Run</a>
                        <a href="{{ url_for('experiments.plots', experiment=idx) }}" class="teal-text text-darken-2">Show Plots</a>
                    </div>
                </div>
            </div>
        {% endfor %}
        {# <div class="col s12 m4">
            <div class="card-add">
                <i class="material-icons">add_circle_outline</i>
                Add Experiment
            </div>
        </div> #}
    </div>
</div>
{% endif %}

{# Migration Section #}
<div class="divider"></div>
{% include "dashboard/migrations.jinja" with context %}

{% endblock %}
