validation_report.html 2.42 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' %}

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

    {% endif %}
    {% endfor %}

</div>
87
88


89
<!--
90
<pre>
91
    {{ report_str }}
92
</pre>
93
-->
94

Pierre Dittgen's avatar
Pierre Dittgen committed
95
{% endif %}
96
97
98
{% endblock %}
{% block footer %}
{% endblock %}