Commit 54228381 authored by Pierre Dittgen's avatar Pierre Dittgen

Hilite missing columns

parent 75fefb08
......@@ -4,7 +4,7 @@
{% for h in report.table.headers %}
<th
scope="col"
{% if report.table.headers_alert[loop.index - 1] != "" %}class="{{ report.table.headers_alert[loop.index - 1] }}"{% endif %}
{% if report.table.cols_alert[loop.index - 1] != "" %}class="{{ report.table.cols_alert[loop.index - 1] }}"{% endif %}
data-toggle="popover"
title="{{ report.table.headers_title[loop.index - 1]}}"
data-content="{{ report.table.headers_description[loop.index - 1] | commonmark2html | escape}}"
......@@ -26,7 +26,7 @@
<tr>
{% for val in row %}
<td
{% if report.table.headers_alert[loop.index - 1] != "" %}class="{{ report.table.headers_alert[loop.index - 1] }}"{% endif %}
{% if report.table.cols_alert[loop.index - 1] != "" %}class="{{ report.table.cols_alert[loop.index - 1] }}"{% endif %}
>{{ val }}</td>
{% endfor %}
</tr>
......
......@@ -227,7 +227,11 @@ def create_validata_ui_report(validata_core_report, schema_dict):
report['table']['headers_title'] = [fields_dict[h][0] if h in fields_dict else 'Colonne inconnue' for h in headers]
report['table']['headers_description'] = [fields_dict[h][1]
if h in fields_dict else 'Cette colonne n\'est pas définie dans le schema' for h in headers]
report['table']['headers_alert'] = ['' if h in fields_dict else 'table-danger' for h in headers]
missing_headers = [err['message-data']['column-name']
for err in report['table']['errors']
if err['code'] == 'missing-header']
report['table']['cols_alert'] = ['table-danger' if h not in fields_dict or h in missing_headers else ''
for h in headers]
# Provide better (french) messages
errors = improve_errors(report['table']['errors'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment