validation_report.html 5.58 KB
Newer Older
1
{% extends "base_template.html" %}
2 3 4
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
Pierre Dittgen's avatar
Pierre Dittgen committed
5 6 7 8 9
<style>
    .popover .popover-body h2 {
        font-size: 1.2em;
        font-weight: bold;
    }
Pierre Dittgen's avatar
Pierre Dittgen committed
10

11 12 13 14 15
    @media print {
        .hidden-print {
            display: none;
        }
    }
Pierre Dittgen's avatar
Pierre Dittgen committed
16
</style>
17 18
{% endblock %}
{% block content %}
19
{% if print_mode %}
Pierre Dittgen's avatar
Pierre Dittgen committed
20
<div class="row">
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
    <div class="col-md-5">
        {% endif %}
        <h1>{{ title }}</h1>
        <p class="text">Validation effectuée {{ validation_date }}</p>
        <p class="text alert alert-info hidden-print">
            Pour relancer la validation, <a href="#" onclick="location.reload();">rechargez</a> la page.
        </p>
        {% if print_mode %}
    </div>
    <div class="col-md-7">
        <img src="{{ url_for('static', filename='img/logo-horizontal.png') }}" height="80" alt="Validata" />
    </div>
</div>
{% endif %}
{% if source.type == 'url' %}
<p class="text hidden-print">Obtenir le rapport au format <a href="{{ url_for('pdf_report', val_code=val_info.code) }}?url={{source.name|urlencode}}">PDF</a>
    {% endif %}
    {# Schema info #}
    <div class="row">
        <div class="col-md-{% if print_mode %}12{% else %}5{% endif %} my-4">
            <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>
                    {% if val_info.author or val_info.contributor %}
                    <p class="text">
                        {% if val_info.author %}
                        Auteur : {{ val_info.author }}
                        {% endif %}
                        {% if val_info.contributor %}
                        <br />Contributeur(s) : {{ val_info.contributor }}
                        {% endif %}
                    </p>
Pierre Dittgen's avatar
Pierre Dittgen committed
57
                    {% endif %}
58
                    <p>
59
                        <a href="{{ val_info.doc_url }}" target="_blank" class="card-link">Documentation</a>
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
                    </p>
                    <hr />
                    <p class="text alert alert-secondary" style="margin-bottom: 0;">
                        Source
                        {% if source_type == 'file' %}
                        (fichier) : <em>{{ source.name }}</em>
                        {% endif %}
                        {% if source_type == 'url' %}
                        (URL) : <em><a href="{{source.name}}" target="_blank" title="{{source.name}}">
                                {% if print_mode %}
                                {{source.name}}
                                {% else %}
                                {{source.name | truncate(60)}}
                                {% endif %}
                            </a></em>
                        {% endif %}
                        <br />
                        Dimensions : <em>{{ report.table.col_count }} colonnes et {{ report.table.row_count }}
                            lignes</em>
                    </p>
                </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
81 82
            </div>
        </div>
83 84
    </div>

85
    {% import 'table_macros.html' as tables %}
Pierre Dittgen's avatar
Pierre Dittgen committed
86

87 88 89
    {% if report.error_count == 0 %}
    <h2>La table est valide</h2>
    <p>Aucune erreur détectée</p>
Pierre Dittgen's avatar
Pierre Dittgen committed
90

91
    {{ tables.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
92

93
    {% else %}
Pierre Dittgen's avatar
Pierre Dittgen committed
94

95
    <h2>La table est invalide</h2>
Pierre Dittgen's avatar
Pierre Dittgen committed
96

Pierre Dittgen's avatar
Pierre Dittgen committed
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
    <p class="text">{{ report.table['error-stats']['total'] }} erreur(s) détectée(s).</p>

    {% set structure_errors = report.table['error-stats']['structure-errors'] %}
    {% if structure_errors['nb'] != 0 %}
    Erreur(s) de structure ({{ structure_errors['nb'] }}) :
    <ul>
        {% for elt in structure_errors['distribution'] %}
        <li>{{ elt[0] }} ({{ elt[1] }})</li>
        {% endfor %}
    </ul>
    {% endif %}

    {% if report.table.do_display_body_errors %}
    {% set value_errors = report.table['error-stats']['value-errors'] %}
    {% if value_errors %}
    {% if value_errors['nb'] != 0 %}
    Erreur(s) de valeur ({{ value_errors['nb'] }}) :
    <ul>
        {% for elt in value_errors['distribution'] %}
        <li>{{ elt[0] }} ({{ elt[1] }})</li>
        {% endfor %}
    </ul>
    {% endif %}
    {% endif %}
    {% endif %}

123
    {# table checks #}
Pierre Dittgen's avatar
Pierre Dittgen committed
124

125 126
    {% if report.table.errors.structure %}
    <div>
Pierre Dittgen's avatar
Pierre Dittgen committed
127
        <h3>Structure</h3>
128 129 130 131 132
        {% for err in report.table.errors.structure %}
        <div class="alert alert-danger">
            {{ err.message | safe}}
        </div>
        {% endfor %}
133
    </div>
Pierre Dittgen's avatar
Pierre Dittgen committed
134 135
    {% else %}
    <p class="text">Aucune erreur de structure</p>
136
    {% endif %}
137

138
    <!-- row checks -->
139

Pierre Dittgen's avatar
Pierre Dittgen committed
140 141 142 143 144
    {# We do display body errors! #}
    {% if report.table.do_display_body_errors %}
    <h3>Contenu</h3>

    {# No errors - display preview #}
145 146 147 148 149
    {% if not report.table.errors.body %}
    <p class="text">
        Aucune erreur de contenu
    </p>
    {{ tables.preview(source_data) }}
Pierre Dittgen's avatar
Pierre Dittgen committed
150 151
    
    {% else %}
152

Pierre Dittgen's avatar
Pierre Dittgen committed
153 154 155
    {# display errors #}
    {{ tables.body_errors(report, source_data) }}
    
156
    {% endif %}
Pierre Dittgen's avatar
Pierre Dittgen committed
157

Pierre Dittgen's avatar
Pierre Dittgen committed
158 159
    {# do not display errors #}
    {% else %}
160
    <p class="text">
Pierre Dittgen's avatar
Pierre Dittgen committed
161
        Veuillez corriger ce(s) erreur(s) pour visualiser les éventuels problèmes de contenu.
162 163 164 165 166
    </p>
    {% endif %}


    {% endblock %}
Pierre Dittgen's avatar
Pierre Dittgen committed
167

168 169 170 171 172 173 174 175 176
    {% block footer %}
    <script>
        $(function () {
            // Errors tooltip activate
            $('[data-toggle="popover"]').popover({
                html: true,
                placement: 'auto',
                trigger: 'hover'
            });
177
        })
178
    </script>
179

Pierre Dittgen's avatar
Pierre Dittgen committed
180
    {% endblock %}