{% extends "base.html" %}

{% block title %} {{ _('Export to %(dataverse_name)s', dataverse_name=config['DATAVERSE_NAME'])}}— {{ service_name }} {% endblock %}

{% block template_values %}
  {% if polling %}
    {% do set_template_value("polling_url", url_for('.dataverse_export_status', task_id=task_id, token=token)) %}
  {% endif %}

  {{ super() }}
{% endblock %}

{% block scripts %}
  {{ super() }}
  {% if polling %}
    <script src="{{ fingerprinted_static('sampledb/js/page/dataverse-export-loading.js') }}" type="module"></script>
  {% endif %}
{% endblock scripts %}

{% block content %}
  {% if polling %}
    <h1>{{ _('Waiting for Export') }}</h1>
    <p>{{ _('The object is currently being exported. Once the export has been completed, you will be redirected to %(dataverse_name)s.', dataverse_name=config['DATAVERSE_NAME']) }}</p>
    <div class="mt-3 text-center">
        <i class="fa fa-spinner fa-4x fa-fw fa-pulse"></i>
    </div>
  {% else %}
    <h1>{{ _('Export failed') }}</h1>
    <p>{{ _('The export failed with the following message: %(error_message)s', error_message=_(error_message, service_name=config["SERVICE_NAME"], dataverse_name=config["DATAVERSE_NAME"])) }}</p>
  {% endif %}
{% endblock content %}
