{% extends "package/_resource_edit_base.html" %}
{% block primary_content_inner %}
{% set has_error = status.error or status.error.message %}
{%- set modal_id = ui.util.id() -%}
{%- set form_id = ui.util.id() -%}
{%- call ui.util.call(ui.form, method="POST", action=h.url_for('datapusher.delete_datastore_table', id=pkg_dict.id, resource_id=resource.id), attrs={"id": form_id}) -%}
{{ ui.confirm_modal(_('Are you sure you want to delete the DataStore and Data Dictionary?'), id=modal_id, form_id=form_id) }}
{{ ui.modal_handle(_('Delete from DataStore'), id=modal_id, style="danger") }}
{%- endcall %}
{%- call ui.util.call(ui.form, method="POST", action=h.url_for('datapusher.resource_data', id=pkg_dict.name, resource_id=resource.id)) -%}
{{ ui.button(_('Upload to DataStore'), type="submit") }}
{%- endcall %}
{% if has_error %}
{%- call ui.util.call(ui.alert, style="danger") -%}
{{ _('Upload error:') }}
{{ status.error.message }}
{%- endcall %}
{% elif status.task_info and status.task_info.error %}
{%- call ui.util.call(ui.alert, style="danger") -%}
{% if status.task_info.error is mapping %}
{{ _('Error:') }} {{ status.task_info.error.message }}
{% for error_key, error_value in status.task_info.error.items() %}
{% if error_key != "message" and error_value %}
{{ error_key }}:
{{ error_value }}
{% endif %}
{% endfor %}
{% elif status.task_info.error is iterable %}
{{ _('Error traceback:') }}
{{ ''.join(status.task_info.error) }}
{% endif %}
{%- endcall %}
{% endif %}
{%- call ui.util.call(ui.table) -%}