validation_report.html 4.99 KB
Newer Older
1
{% extends "base_template.html" %}
2

Christophe Benz's avatar
Christophe Benz committed
3
4
{% import 'schema_info_macros.html' as schema_info_macros %}
{% import 'validation_macros.html' as macros %}
5

Christophe Benz's avatar
Christophe Benz committed
6
{% block title %}{{ section_title }} – {{ schema_info.title }}{% endblock %}
7

8
9
{% block head %}
{{ super() }}
Pierre Dittgen's avatar
Pierre Dittgen committed
10
<style>
Pierre Dittgen's avatar
Pierre Dittgen committed
11
12
13
14
  #table-errors td h2 {
    font-size: 1em;
    font-weight: bold;
  }
Pierre Dittgen's avatar
Fix CSS    
Pierre Dittgen committed
15
  ul.structure_errors li p {
16
17
      margin-bottom: 0;
  }
Pierre Dittgen's avatar
Pierre Dittgen committed
18
19
20
21

  @media print {
    .hidden-print {
      display: none;
22
    }
Pierre Dittgen's avatar
Pierre Dittgen committed
23
  }
Pierre Dittgen's avatar
Pierre Dittgen committed
24
</style>
25
{% endblock %}
26

27
{% block content %}
28
<div class="container">
Christophe Benz's avatar
Christophe Benz committed
29

30
    <p class="text-muted">Validation effectuée {{ validation_date }}</p>
Christophe Benz's avatar
Christophe Benz committed
31

Pierre Dittgen's avatar
Pierre Dittgen committed
32
    {% if pdf_report_url %}
33
    <p class="hidden-print">
34
        <a class="btn btn-outline-secondary" href="{{ pdf_report_url }}">
35
36
37
38
            Télécharger en PDF
        </a>
    </p>
    {% endif %}
Christophe Benz's avatar
Christophe Benz committed
39
40

    <div class="row my-4">
Pierre Dittgen's avatar
Pierre Dittgen committed
41
        {# Schema info #}
Christophe Benz's avatar
Christophe Benz committed
42
43
44
        <div class="col-lg-6 mb-4">
            <div class="card">
                <div class="card-body">
45
                    {{ schema_info_macros.html(schema_info, None, None, schema_current_version, doc_url) }}
Christophe Benz's avatar
Christophe Benz committed
46
47
48
                </div>
            </div>
        </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
49
        {# Validation stats #}
Christophe Benz's avatar
Christophe Benz committed
50
51
        <div class="col-lg-6">
            <div class="card">
Christophe Benz's avatar
Christophe Benz committed
52
                <div class="card-body">
Christophe Benz's avatar
Christophe Benz committed
53
                    <h2 class="card-title">
Pierre Dittgen's avatar
Pierre Dittgen committed
54
55
56
57
58
59
60
                        Fichier
                        {% if report.error_count == 0 %}
                            {% if report.warn_count != 0 %}partiellement{% endif %}
                            valide
                        {% else %}
                            invalide
                        {% endif %}
Christophe Benz's avatar
Christophe Benz committed
61
62
63
64
65
66
67
68
                    </h2>

                    {% if display_badge %}
                    <p><img src="{{ badge_url }}" alt="{{ badge_msg }}" /></p>
                    {% endif %}

                    <p>
                        <code>
Pierre Dittgen's avatar
Pierre Dittgen committed
69
70
                        {% if source.type == 'file' %}
                            {{ source.filename }}
Christophe Benz's avatar
Christophe Benz committed
71
72
                        {% elif source.type == 'url' %}
                            <a href="{{source.url}}" target="_blank">{{source.filename}}</a>
73
                        {% endif %}
Christophe Benz's avatar
Christophe Benz committed
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
                        </code>
                        ({{ report.table.col_count }} colonnes × {{ report.table.row_count }} lignes)
                    </p>

                    {% if report.error_count == 0 %}
                    <p>Aucune erreur détectée</p>
                    {% else %}
                    {{ macros.error_statistics(report) }}
                    <p>
                        {% set error_count = report.table['error-stats']['count'] %}
                        Total :
                        {% if error_count == 1 %}
                        1 erreur détectée
                        {% else %}
                        {{ error_count }} erreurs détectées
89
                        {% endif %}
Christophe Benz's avatar
Christophe Benz committed
90
91
                    </p>
                    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
92
93
94
95
96
97
98
99
100
                    {% if report.warn_count != 0 %}
                    <p>
                        {% if report.warn_count == 1 %}
                        1 recommandation
                        {% else %}
                        {{ report.warn_count }} recommandations
                        {% endif %}
                    </p>
                    {% endif %}
101
                </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
102
103
            </div>
        </div>
104
    </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
105
106
107
108
</div>

<div class="mx-4">
    {% if report.table.errors.structure %}
109
110
111
112
113
114
    <h3 class="my-4">Erreurs de structure ({{ report.table['error-stats']['structure-errors']['count']}})</h3>
    <ul>
        {% for err in report.table.errors.structure %}
            <li>{{ err.message | commonmark2html | safe}}</li>
        {% endfor %}
    </ul>
Pierre Dittgen's avatar
Pierre Dittgen committed
115
116
    {% endif %}
</div>
117

Pierre Dittgen's avatar
Pierre Dittgen committed
118
119
{# Display body errors #}
<div class="mx-4">
120
    {% if report.warn_count != 0 %}
Pierre Dittgen's avatar
Pierre Dittgen committed
121
122
123
124
125
126
127
    <h3 class="my-4">Recommandations</h3>
    <ul>
    {% for warn in report.warnings %}
        <li>{{ warn.message | commonmark2html | safe}}</li>
    {% endfor %}
    </ul>
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
128
129
    <h3 class="my-4">
    {% if report.table.errors.body %}
130
        {% set value_errors = report.table['error-stats']['body-errors'] %}
Pierre Dittgen's avatar
Pierre Dittgen committed
131
        Erreurs de contenu ({{ value_errors['count'] }} sur {{ value_errors['rows-count'] }} ligne{% if value_errors['rows-count'] > 1 %}s{% endif %})
Pierre Dittgen's avatar
Pierre Dittgen committed
132
133
134
135
136
137
138
139
140
141
    {% else %}
        {% if report.table.errors.structure %}
            Aucune erreur de contenu
        {% else %}
            Aucune erreur détectée
        {% endif %}
    {% endif %}
    </h3>
    <p>Prévisualisation du fichier source
    {% if not report.table.errors.body %}
Pierre Dittgen's avatar
Pierre Dittgen committed
142
143
     (affichage de {{ source_data.preview_rows_count }}
            ligne{% if source_data.preview_rows_count > 1 %}s{% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
144
145
146
            sur {{ source_data.rows_nb }} au total)
    {% endif %}
    </p>
147
    {% if report.table.errors.body %}
Pierre Dittgen's avatar
Pierre Dittgen committed
148
    {{ macros.body_errors(report, source_data, print_mode) }}
149
    {% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
150
    {{ macros.preview(report, source_data) }}
151
152
    {% endif %}
</div>
153
{% endblock %}
Pierre Dittgen's avatar
Pierre Dittgen committed
154

Christophe Benz's avatar
Christophe Benz committed
155
{% block page_scripts %}
156
<script src="{{ url_for('static', filename='validata_popover.js') }}"></script>
Christophe Benz's avatar
Christophe Benz committed
157
{% endblock %}