~stefanor/lp-ftbfs-report/partner

« back to all changes in this revision

Viewing changes to source/build_status.html

  • Committer: Michael Bienia
  • Date: 2011-10-28 18:36:34 UTC
  • mfrom: (49.1.17 historical)
  • Revision ID: geser@ubuntu.com-20111028183634-j05v4m69yip88maq
MergeĀ lp:~stefanor/lp-ftbfs-report/historical

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
                    {% if archs_by_archive['ports'] %}
43
43
                    <th colspan="{{ archs_by_archive['ports']|count }}" class="center">Ports archive</th>
44
44
                    {% endif %}
45
 
                    <th rowspan="2"/>Bugs</th>
 
45
                    <th rowspan="2">Bugs</th>
46
46
                    <th rowspan="2"/>
47
47
                </tr>
48
48
                <tr>
119
119
</head>
120
120
 
121
121
<body>
122
 
    <script type="text/javascript" src="source/wz_tooltip.js"></script>
123
122
    <h1 id="top">Build status for {{ series.fullseriesname }} in {{ archive.displayname }}</h1>
124
123
 
125
124
    <p>Jump to:
198
197
    {{ table(multiverse_superseded) }}
199
198
    {%- endif %}
200
199
 
 
200
    <h2>Historical trends:</h2>
 
201
    <p id="historical-components">
 
202
        Components/packagesets:
 
203
    </p>
 
204
    <p>Architecture:
 
205
        <select id="historical-arch">
 
206
        {% for arch in arch_list -%}
 
207
            <option value="{{ arch }}">{{ arch }}</option>
 
208
        {%- endfor %}
 
209
        </select>
 
210
    </p>
 
211
    <div id="historical-graph"></div>
201
212
    <hr/>
202
213
    <p style="font-size:smaller">Last update: {{ lastupdate }}</p>
203
214
    <p>
206
217
        alt="Valid XHTML 1.1" height="31" width="88"
207
218
        style="border-width:0px" /></a>
208
219
    </p>
209
 
    <p style="font-size:smaller"><a href="source">source</a></p>
 
220
    <p style="font-size:smaller">Source: <a href="https://code.launchpad.net/lp-ftbfs-report">lp:lp-ftbfs-report</a></p>
 
221
    <script type="text/javascript" src="source/wz_tooltip.js"></script>
 
222
    <script type="text/javascript" src="source/jquery.min.js"></script>
 
223
    <script type="text/javascript" src="source/jquery.flot.min.js"></script>
 
224
    <script type="text/javascript">
 
225
    /* Return the currently selected architecture, by querying the input
 
226
     * dropdown
 
227
     */
 
228
    function selected_arch() {
 
229
        var arch = $('#historical-arch option:selected').text();
 
230
        return $.trim(arch);
 
231
    }
 
232
 
 
233
    /* Fill in all the missing 0 data points in json_data.
 
234
     * The SQL query is a COUNT(*), so timestamps with no build failures won't
 
235
     * be listed.
 
236
     * We find all reported timestamps, and add 0s to the missing timestamps in
 
237
     * each component/pset.
 
238
     */
 
239
    function fill_in_data() {
 
240
        var timestamps = [];
 
241
        $.each(json_data, function(arch, by_arch) {
 
242
            $.each(by_arch, function(pset, by_pset) {
 
243
                $.each(by_pset, function(i, row) {
 
244
                    timestamps.push(row[0]);
 
245
                });
 
246
            });
 
247
        });
 
248
 
 
249
        // Eliminate duplicates:
 
250
        timestamps.sort();
 
251
        for(i = 1; i < timestamps.length; i++) {
 
252
            if (timestamps[i] == timestamps[i-1]) {
 
253
                timestamps.splice(i, 1);
 
254
                i--;
 
255
            }
 
256
        }
 
257
 
 
258
        $.each(json_data, function(arch, by_arch) {
 
259
            $.each(by_arch, function(pset, data) {
 
260
                for (i = 0; i < timestamps.length; i++) {
 
261
                    if (i == data.length) {
 
262
                        data.push([timestamps[i], 0]);
 
263
                    } else if (timestamps[i] < data[i][0]) {
 
264
                        data.splice(i, 0, [timestamps[i], 0]);
 
265
                        i--;
 
266
                    }
 
267
                }
 
268
            });
 
269
        });
 
270
    }
 
271
 
 
272
    /* Add checkboxes for each component and packageset present in json_data
 
273
     */
 
274
    function add_show_controls() {
 
275
        $.each(json_data[selected_arch()], function(component) {
 
276
            var button = document.createElement('input');
 
277
            button.type = 'checkbox';
 
278
            button.name = component;
 
279
            button.id = component;
 
280
            button.value = component;
 
281
            var components=["main", "universe", "multiverse", "restricted"];
 
282
            if ($.inArray(component, components) >= 0) {
 
283
                button.checked = true;
 
284
            }
 
285
            $(button).click(function() {
 
286
                draw()
 
287
            });
 
288
            var label = document.createElement('label');
 
289
            label['for'] = component;
 
290
            label.setAttribute('text', component);
 
291
            label.appendChild(document.createTextNode(component));
 
292
            $('#historical-components').append(button);
 
293
            $('#historical-components').append(label);
 
294
        });
 
295
        var button = document.createElement('input');
 
296
        button.type = 'button';
 
297
        button.value = 'Clear';
 
298
        $(button).click(function() {
 
299
            $.each($('#historical-components input:checkbox'), function(i, checkbox) {
 
300
                checkbox.checked = false;
 
301
            });
 
302
            draw();
 
303
        });
 
304
        $('#historical-components').append(button);
 
305
    }
 
306
 
 
307
    /* Update the graph
 
308
     */
 
309
    function draw() {
 
310
        var data = json_data[selected_arch()];
 
311
        var series = [];
 
312
 
 
313
        var components = ["main", "universe", "multiverse", "restricted"];
 
314
        var i = 3;
 
315
 
 
316
        $.each($('#historical-components :checkbox'), function(i, checkbox) {
 
317
            var component = checkbox.value;
 
318
            var color = $.inArray(component, components);
 
319
            if (color === -1)
 
320
                color = ++i;
 
321
            if (!checkbox.checked)
 
322
                return;
 
323
            var series_data = data[component];
 
324
            series.push({
 
325
                data: series_data,
 
326
                label: component,
 
327
                color: color,
 
328
            });
 
329
        });
 
330
        var options = {
 
331
            series: {
 
332
                lines: {show: true},
 
333
                points: {show: true},
 
334
            },
 
335
            xaxis: {
 
336
                mode: "time",
 
337
            },
 
338
            yaxis: {
 
339
                min: 0,
 
340
                minTickSize: 1,
 
341
            },
 
342
            legend: {
 
343
                position: "nw",
 
344
            },
 
345
        };
 
346
        $.plot($("#historical-graph"), series, options);
 
347
    }
 
348
 
 
349
    /* Main function, run when things have settled down. */
 
350
    $(function () {
 
351
        fill_in_data();
 
352
        add_show_controls();
 
353
        $("#historical-arch").change(draw);
 
354
        draw();
 
355
    });
 
356
 
 
357
    /* Build failures raw data */
 
358
    var json_data={{ historical_json }};
 
359
    </script>
210
360
</body>
211
361
</html>