{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Data Processing" %}{% endblock %}

{% block main %}

    <div class="guide">
        <ol>
            <li>
                <div>
                    <div>
                        {% blocktrans %}First, select which type of job that
                            you want to run.  This choice will determine which
                            other steps are required
                        {% endblocktrans %}
                    </div>
                    <div>
                        <a class="btn btn-default btn-small btn-create btn-inline ajax-modal"
                           href="{% url 'horizon:project:data_processing.jobs:job_type_select' %}">
                            <span class="fa fa-plus"></span> {% trans "Select type" %}
                        </a>
                    </div>
                    <div>{% trans "Current type:" %}
                        {% if request.session.guide_job_type %}
                            <span class="text-success">
                               {{ request.session.guide_job_type}}
                            </span>
                        {% else %}
                            <span class="text-danger">
                                {% trans "No type chosen" %}
                            </span>
                        {% endif %}
                    </div>
                </div>
            </li>
            <hr/>
        {% if request.session.guide_job_type %}
            {% if view.show_data_sources %}
                <li>
                    <div>
                        <div>{% blocktrans %}Data Sources are what your
                            job uses for input and output.  Depending on the type
                            of job you will be running, you may need to define one
                            or more data sources.  You can create multiple data
                            sources by repeating this step.
                        {% endblocktrans %}
                        </div>
                        <div>
                            <a class="btn btn-default btn-small btn-create btn-inline ajax-modal"
                               href="{% url 'horizon:project:data_processing.jobs:create-data-source' %}">
                                <span class="fa fa-plus"></span> {% trans "Create a data source" %}
                            </a>
                        </div>
                    </div>
                </li>
                <hr/>
            {% endif %}
            <li>
                <div>
                    <div>{% blocktrans %}Define your Job Template.
                        This is where you choose the type of job that you
                        want to run (Pig, Java Action, Spark, etc) and choose
                        or upload the files necessary to run it.  The inputs
                        and outputs will be defined later.
                    {% endblocktrans %}
                    </div>
                    <div>
                        <a class="btn btn-default btn-small btn-create btn-inline ajax-modal{% if not request.session.guide_job_type %} disabled{% endif %}"
                           href="{% url 'horizon:project:data_processing.jobs:create-job'%}?guide_job_type={{ request.session.guide_job_type }}">
                            <span class="fa fa-plus"></span> {% trans "Create a job template" %}</a>
                    </div>
                    <div>{% trans "Job template:" %}
                        {% if request.session.guide_job_name %}
                            <span class="text-success">
                           {{ request.session.guide_job_name }}
                        </span>
                        {% else %}
                            <span class="text-danger">
                            {% trans "No job template created" %}
                        </span>
                        {% endif %}
                    </div>
                </div>
            </li>
            <hr/>
            <li>
                <div>
                    <div>{% blocktrans %}Launch your job.  When
                        launching, you may need to choose your input and
                        output data sources.  This is where you would also
                        add any special configuration values, parameters,
                        or arguments that you need to pass along
                        to your job.
                        {% endblocktrans %}
                    </div>
                    <div>
                        <a class="btn btn-default btn-small btn-create btn-inline ajax-modal {% if not request.session.guide_job_id %} disabled{% endif %}"
                           href="{% url 'horizon:project:data_processing.jobs:launch-job' %}?job_id={{ request.session.guide_job_id }}">{% trans "Launch job" %}</a>
                    </div>
                </div>
            </li>
        {% endif %}
        </ol>
        <div class="guide">
            <a id="reset_cluster_guide_btn"
               class=" btn btn-default btn-small btn-create btn-inline btn-danger"
               title="{% trans "Reset Job Execution Guide" %}"
               href="{% url 'horizon:project:data_processing.jobs:reset_jobex_guide' True %}">
                {% trans "Reset Job Execution Guide" %}
            </a>
        </div>
    </div>

{% endblock %}
