{% load i18n ui %}{% comment %} The indices job's progress, polled by htmx while it is queued or running (stations:results_progress, outerHTML swap). When the job succeeds the view answers with HX-Redirect to the dashboard (or the index the user came from), so the fragment never shows a finished run. Built from the progress and stages components. Parameters: job, analysis, phases, index, and jobs.views.progress_context. {% endcomment %}
{% if job.status == "queued" or job.status == "running" %}
{% if stage_label %}{{ stage_label }}{% else %}{{ job.get_status_display }}{% endif %} {% if job.total %}{% blocktranslate with percent=job.percent %}{{ percent }}%{% endblocktranslate %}{% endif %}
{% blocktranslate with percent=job.percent %}{{ percent }}%{% endblocktranslate %}

{% if job.total %}{% blocktranslate with step=job.step total=job.total %}Step {{ step }} of {{ total }}.{% endblocktranslate %}{% else %}{{ job.get_status_display }}{% endif %} {% if elapsed %}{% blocktranslate %}Time so far: {{ elapsed }}.{% endblocktranslate %}{% endif %} {% if remaining %}{% blocktranslate %}About {{ remaining }} left.{% endblocktranslate %}{% endif %}

{% translate "Stages of the calculation" as stages_label %} {% include "components/stages.html" with label=stages_label stages=phases %} {% if worker_missing %} {% translate "No calculation worker is running, so this job cannot start yet. If you run Climpact yourself, restart it with the climpact-web command." as worker_message %} {% include "components/alert.html" with kind="warning" message=worker_message title="" %} {% endif %} {% if job.cancel_requested %}

{% translate "Cancelling…" %}

{% endif %} {% if job.can_cancel %}
{% csrf_token %} {% translate "Cancel" as cancel_label %} {% include "components/button.html" with label=cancel_label type="submit" variant="secondary" size="sm" icon="close" %}
{% endif %} {% endif %} {% if job.status == "failed" %} {% translate "Stages of the calculation" as stages_label %} {% include "components/stages.html" with label=stages_label stages=phases %} {% endif %} {% if job.status == "cancelled" %} {% translate "The calculation was cancelled." as cancelled_message %} {% include "components/alert.html" with kind="info" message=cancelled_message live="polite" title="" %} {% endif %} {% if job.is_finished %}
{% if job.can_retry %}
{% csrf_token %} {% translate "Try again" as retry_label %} {% include "components/button.html" with label=retry_label type="submit" icon="refresh" %}
{% endif %} {% url 'stations:indices' analysis.pk as indices_url %}{% translate "Change the settings" as change_label %} {% include "components/button.html" with label=change_label href=indices_url variant="secondary" icon="sliders" %}
{% endif %}