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

{% block main %}

    <div class="guide">
        <ol>
            <li>
                <div>
                    <div>{% blocktrans %}The first step is to determine which type of
                    cluster you want to run.  You may have several choices
                    available depending on the configuration of your system.
                    Click on "choose plugin" to bring up the list of data
                    processing plugins.  There you will be able to choose the
                    data processing plugin along with the version number.
                    Choosing this up front will allow the rest of the cluster
                    creation steps to focus only on options that are pertinent
                    to your desired cluster type.{% endblocktrans %}
                    </div>
                    <a class="btn btn-default btn-small btn-create btn-inline ajax-modal" href="
                      {% url 'horizon:project:data_processing.wizard:plugin_select' %}">{% trans "Choose plugin" %}</a>
                    <div>{% trans "Current choice:" %}
                        {% if request.session.plugin_name and request.session.plugin_version %}
                            <span class="text-success">
                                {% trans "Plugin:" %}
                               {{ request.session.plugin_name }}
                                {% trans "Version:" %}
                               {{ request.session.plugin_version }}
                            </span>
                        {% else %}
                            <span class="text-danger">
                                {% trans "No plugin chosen" %}
                            </span>
                        {% endif %}
                    </div>
                </div>
            </li>
            <hr/>
            <li>
                <div>
                    <div>{% blocktrans %}Next, you need to define the different
                        types of machines in your cluster.  This is done by
                        defining a Node Group Template for each type of
                        machine.  A very common case is where you
                        need to have one or more machines running a "master"
                        set of processes while another set of machines need
                        to be running the "worker" processes.  Here,
                        you will define the Node Group Template for your
                        "master" node(s).
                     {% endblocktrans %}
                    </div>
                    <div>
                          <a class="btn btn-default btn-small btn-create btn-inline ajax-modal
                            {% if not request.session.plugin_name or not request.session.plugin_version %} disabled {% endif %}"
                            href="{% if request.session.plugin_name and request.session.plugin_version %}{% url 'horizon:project:data_processing.nodegroup_templates:configure-nodegroup-template-defaults' request.session.plugin_name request.session.plugin_version 'master' %}{% endif %}">
                            <span class="fa fa-plus"></span> {% trans "Create a Master Node Group Template" %}</a>
                    </div>
                    <div>{% trans "Current choice:" %}
                        {% if request.session.master_name %}
                            <span class="text-success">
                                {% trans "Master Node Group Template:" %}
                               {{ request.session.master_name }}
                            </span>
                        {% else %}
                            <span class="text-danger">
                                {% trans "No Master Node Group Template Created" %}
                            </span>
                        {% endif %}
                    </div>
                </div>
            </li>
            <hr/>
            <li>
                <div>
                    <div>{% blocktrans %}Repeat the Node Group Template
                        creation process, but this time you are creating
                        your "worker" Node Group Template.{% endblocktrans %}
                    </div>
                    <div>
                        <a class="btn btn-default btn-small btn-create btn-inline ajax-modal
                            {% if not request.session.master_name %} disabled{% endif %}"
                            href="{% if request.session.plugin_name and request.session.plugin_version %}{% url 'horizon:project:data_processing.nodegroup_templates:configure-nodegroup-template-defaults' request.session.plugin_name request.session.plugin_version 'worker' %}{% endif %}">
                            <span class="fa fa-plus"></span> {% trans "Create a Worker Node Group Template" %}</a>
                    </div>
                    <div>{% trans "Current choice:" %}
                        {% if request.session.worker_name %}
                            <span class="text-success">
                                {% trans "Worker Node Group Template:" %}
                               {{ request.session.worker_name }}
                            </span>
                        {% else %}
                            <span class="text-danger">
                                {% trans "No Worker Node Group Template Created" %}
                            </span>
                        {% endif %}
                    </div>
                </div>
            </li>
            <hr/>
            <li>
                <div>
                    <div>{% blocktrans %}Now you need to set the layout of your
                        cluster.  By
                        creating a Cluster Template, you will be choosing the
                        number of instances of each Node Group Template that
                        will appear in your cluster.  Additionally,
                        you will have a chance to set any cluster-specific
                        configuration items in the additional tabs on the
                        create Cluster Template form.{% endblocktrans %}
                    </div>
                    <div>
                        <a class="btn btn-default btn-small btn-create btn-inline ajax-modal
                            {% if not request.session.worker_name %} disabled{% endif %}"
                             href="{% url 'horizon:project:data_processing.cluster_templates:configure-cluster-template' %}?plugin_name={{ request.session.plugin_name }}&hadoop_version={{ request.session.plugin_version }}&forms_ids=[0,1]&count_0=1&group_name_0={{ request.session.master_name }}&template_id_0={{ request.session.master_id }}&count_1=1&group_name_1={{ request.session.worker_name }}&template_id_1={{ request.session.worker_id }}&serialized_0=null&serialized_1=null">
                            <span class="fa fa-plus"></span> {% trans "Create a Cluster Template" %}</a>
                    </div>
                    <div>{% trans "Current choice:" %}
                        {% if request.session.guide_cluster_template_name %}
                            <span class="text-success">
                                {% trans "Worker Node Group Template:" %}
                               {{ request.session.guide_cluster_template_name }}
                            </span>
                        {% else %}
                            <span class="text-danger">
                                {% trans "No Cluster Template Created" %}
                            </span>
                        {% endif %}
                    </div>
                </div>
           </li>
            <hr/>
            <li>
                <div>
                    <div>{% blocktrans %}You are now ready to
                        launch your cluster.  When you click on the link
                        below, you will need to give your cluster a name,
                        choose the Cluster Template to use and choose which
                        image to use to build your instances.  After you
                        click on "Create", your instances will begin to
                        spawn.  Your cluster should be operational in a few
                        minutes.{% endblocktrans %}
                    </div>
                    <div>
                        <a class="btn btn-default btn-small btn-create btn-inline ajax-modal
                            {% if not request.session.guide_cluster_template_name %} disabled{% endif %}"
                            href="{% if request.session.guide_cluster_template_name %}{% url 'horizon:project:data_processing.clusters:configure-cluster' request.session.plugin_name request.session.plugin_version request.session.guide_cluster_template_name%}{% endif %}">
                            <span class="fa fa-plus"></span> {% trans "Launch a Cluster" %}</a>
                    </div>
                </div>
            </li>
        </ol>
        <div>
            <a id="reset_cluster_guide_btn"
               class=" btn btn-default btn-small btn-create btn-inline btn-danger"
               title="{% trans "Reset Cluster Guide" %}"
               href="{% url 'horizon:project:data_processing.wizard:reset_cluster_guide' True %}">
                {% trans "Reset Cluster Creation Guide" %}
            </a>
        </div>
    </div>

{% endblock %}
