validation_report.html 2.09 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>

<div class="card bg-faded" style="width: 30rem;">
    <div class="card-body">
        <h5 class="card-title">
            Schéma {{ val_info.code }}
            <span class="badge badge-primary">{{ val_info.version }}</span>
        </h5>
        <h6 class="card-subtitle mb-2 text-muted">{{ val_info.description }}</h6>
        <p class="text">
            {% if source_type == 'file' %}Fichier{% endif %}
            {% if source_type == 'url' %}URL{% endif %}
            à valider : {{ source }}
        </p>
    </div>
</div>

{% if report.valid %}
<h2>La table est valide</h2>
<p>Aucune erreur détectée</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
27
28
29

{% include 'table_preview.html' %}

30
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
31

32
<h2>La table est invalide</h2>
Pierre Dittgen's avatar
Pierre Dittgen committed
33
<p>{{ report['tables'][0]['errors']|length }} erreur(s) détectée(s)</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
34

Pierre Dittgen's avatar
Pierre Dittgen committed
35
36
37
<!-- table checks -->

<div>
38
    <h3>Erreurs de table</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
39
40
41
42
43
44
45
46
47
48
    <ul>
        {% for err in report['tables'][0]['errors'] %}
        {% if err.context == 'table' or err.context == 'head' %}
        <li>
            <pre>{{ err }}</pre>
        </li>
        {% endif %}
        {% endfor %}
    </ul>
</div>
49

Pierre Dittgen's avatar
Pierre Dittgen committed
50
51
<!-- row checks -->
<div>
52
    <h3>Erreurs de valeurs</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
53
54

    {% for err in report['tables'][0]['errors'] %}
55

Pierre Dittgen's avatar
Pierre Dittgen committed
56
57
    {% if err.context == 'body' %}

58
    <table class="table-sm table-bordered table-striped table-hover">
Pierre Dittgen's avatar
Pierre Dittgen committed
59
60
61
62
63
64
65
66
67
        <thead>
            <th>#</th>
            {% for h in report['tables'][0]['headers'] %}
            <th>{{ h }}</th>
            {% endfor %}
        </thead>
        <!-- TODO: regrouper les erreurs par ligne ? -->
        <tbody>
            <tr>
68
69
70
71
                <td>{{ err['row-number'] - 1 }}</td>
                {% for d in source_data.data_rows[err['row-number'] - 2] %}
                <td>{{ d }}</td>
                {% endfor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
72
73
74
            </tr>
        </tbody>
    </table>
75
    <p class="text">{{ err.message }}</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
76
77
78
79
80

    {% endif %}
    {% endfor %}

</div>
81
82


83
<!--
84
<pre>
85
    {{ report_str }}
86
</pre>
87
-->
88

Pierre Dittgen's avatar
Pierre Dittgen committed
89
{% endif %}
90
91
92
{% endblock %}
{% block footer %}
{% endblock %}