{% load i18n ui help %}{% comment %} The gridded run's jobs (thresholds, then indices): progress while they run, polled by htmx (outerHTML swap) as the job page's fragment is; then each job's files to download. When the last job finishes the server asks htmx to reload the page, so the map appears. Parameters: run, rows (kind, job, stage_label, elapsed, remaining, worker_missing, files), active, delay, all_done. {% endcomment %}
{% for row in rows %}{% with job=row.job %}

{% if row.kind == "thresholds" %}{% translate "Thresholds file" %}{% else %}{% translate "Indices" %}{% endif %}

{% include "jobs/_status.html" %}
{% if job.status == "queued" or job.status == "running" %}
{% if job.status == "running" %}{{ row.stage_label|default:_("Starting") }}{% else %}{% translate "Waiting to start" %}{% 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 %}{% endif %} {% if row.elapsed %}{% blocktranslate with elapsed=row.elapsed %}Time so far: {{ elapsed }}.{% endblocktranslate %}{% endif %} {% if row.remaining %}{% blocktranslate with remaining=row.remaining %}About {{ remaining }} left.{% endblocktranslate %}{% endif %} {% if job.status == "queued" and row.kind == "indices" and run.thresholds_job and not run.thresholds_job.is_finished %}{% translate "The indices start when the thresholds file is finished." %}{% endif %}

{% if job.cancel_requested %}

{% translate "Cancelling…" %}

{% endif %} {% if row.worker_missing %} {% translate "No calculation worker is running, so this 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.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" %} {% endif %} {% if job.status == "cancelled" %} {% translate "The calculation was cancelled." as cancelled_message %} {% include "components/alert.html" with kind="info" message=cancelled_message title="" %} {% endif %} {% if job.can_retry %}
{% csrf_token %} {% translate "Try again" as retry_label %} {% include "components/button.html" with label=retry_label type="submit" icon="refresh" size="sm" %}
{% endif %} {% if job.status == "succeeded" %}

{% blocktranslate count counter=row.files|length with elapsed=row.elapsed trimmed %}Finished in {{ elapsed }}: {{ counter }} file.{% plural %}Finished in {{ elapsed }}: {{ counter }} files.{% endblocktranslate %}{% if job.result.copied_to %} {% blocktranslate with folder=job.result.copied_to %}Also copied to {{ folder }}.{% endblocktranslate %}{% endif %}

{% if row.kind == "indices" %}{% help_topic "gridded.output" %}{% endif %}
{% icon "file" %}{% blocktranslate count counter=row.files|length trimmed %}The file to download{% plural %}The {{ counter }} files to download{% endblocktranslate %}{% icon "chevron-down" %}
{% for f in row.files %} {% endfor %}
{% if row.kind == "thresholds" %}{% translate "Thresholds file" %}{% else %}{% translate "Index files" %}{% endif %}
{% translate "File" %}{% translate "Index" %}{% translate "Frequency" %}{% translate "Size" %}
{{ f.name }}{{ f.index }}{% if f.freq == "ANN" %}{% translate "annual" %}{% elif f.freq == "MON" %}{% translate "monthly" %}{% elif f.freq == "DAY" %}{% translate "daily" %}{% endif %}{{ f.size|filesizeformat }}
{% endif %}
{% endwith %}{% endfor %} {% if all_done %}

{% translate "Download all (zip)" as zip_label %}{% url 'gridded:download_all' run.pk as zip_url %}{% include "components/button.html" with label=zip_label href=zip_url icon="download" size="lg" %}

{% for row in rows|slice:":1" %}

{% icon "clock" %}{% blocktranslate with date=row.job.expires_at|date:"j F Y, H:i e" %}The results are deleted on {{ date }}.{% endblocktranslate %}

{% endfor %} {% endif %}