validation_report.html 3.24 KB
Newer Older
1
2
3
4
5
6
7
8
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>

9
<!-- Schema info -->
Pierre Dittgen's avatar
Pierre Dittgen committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<div class="row">
    <div class="col-md-5">
        <div class="card bg-faded">
            <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>
26
27
28
    </div>
</div>

Pierre Dittgen's avatar
Pierre Dittgen committed
29

30
{% if report.error_count == 0 %}
31
32
<h2>La table est valide</h2>
<p>Aucune erreur détectée</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
33
34
35

{% include 'table_preview.html' %}

36
{% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
37

38
<h2>La table est invalide</h2>
39
<p>{{ report.error_count }} erreur(s) détectée(s)</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
40

41
42
43
{% if source_type == 'url' %}
<button class="btn btn-primary" id="btn-reload">Relancer la validation</button>
{% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
44
45
<!-- table checks -->

46
{% if report.table.errors.structure %}
Pierre Dittgen's avatar
Pierre Dittgen committed
47
<div>
48
    <h3>Problèmes de structure</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
49
    <ul>
50
        {% for err in report.table.errors.structure %}
51
        <li>[{{ err.code }}] {{ err.message }}</li>
Pierre Dittgen's avatar
Pierre Dittgen committed
52
53
54
        {% endfor %}
    </ul>
</div>
55
{% endif %}
56

Pierre Dittgen's avatar
Pierre Dittgen committed
57
<!-- row checks -->
58
59

{% if report.table.errors.body %}
Pierre Dittgen's avatar
Pierre Dittgen committed
60
<div>
61
    <h3>Erreurs de valeurs</h3>
Pierre Dittgen's avatar
Pierre Dittgen committed
62

Pierre Dittgen's avatar
Pierre Dittgen committed
63
    <div class="table-responsive-sm">
Pierre Dittgen's avatar
Pierre Dittgen committed
64
65
        <table class="table-sm table-bordered">
            <thead class="thead-light">
Pierre Dittgen's avatar
Pierre Dittgen committed
66
                <th scope="col">1</th>
67
                {% for h in report['table']['headers'] %}
Pierre Dittgen's avatar
Pierre Dittgen committed
68
                <th scope="col">{{ h }}</th>
69
                {% endfor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
70
71
            </thead>
            <tbody>
72
                {% for row in report.table.errors.by_rows %}
Pierre Dittgen's avatar
Pierre Dittgen committed
73
                <tr>
74
                    {% if 'row' in row.errors %}
Pierre Dittgen's avatar
Pierre Dittgen committed
75
                    <th class="table-danger" data-toggle="tooltip" title="{{ row.errors.row.message }}">{{ row.row_id
76
77
                        }}</th>
                    {% else %}
78
                    <th>{{ row.row_id }}</th>
79
                    {% endif %}
80
81
                    {% for d in source_data.data_rows[row.row_id - 2] %}
                    {% if loop.index in row.errors %}
82
                    <td class="table-danger" data-toggle="tooltip" title="[{{row.errors[loop.index].code}}] {{ row.errors[loop.index].message }}">
83
84
85
                        {% else %}
                    <td>
                        {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
86
                        {{ d }}
87
                    </td>
Pierre Dittgen's avatar
Pierre Dittgen committed
88
89
                    {% endfor %}
                </tr>
90
                {% endfor %}
Pierre Dittgen's avatar
Pierre Dittgen committed
91
92
93
            </tbody>
        </table>
    </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
94
95
96
97

    {% endif %}

</div>
98
99


100
<!--
101
<pre>
102
    {{ report_str }}
103
</pre>
104
-->
105

Pierre Dittgen's avatar
Pierre Dittgen committed
106
{% endif %}
107
108
{% endblock %}
{% block footer %}
109
110
<script>
    $(function () {
111
        // Errors tooltip activate
112
        $('[data-toggle="tooltip"]').tooltip()
113
114
115
116
117
118

        // Reload to re-validate
        $('#btn-reload').on('click', function () {
            $(this).prop('disabled', true)
            window.location.reload(true);
        })
119
120
    })
</script>
121
{% endblock %}