{% set nosidebar = True %} {% import "utils.html" as utils %} {% set db = request.get_db() %} {% extends "layout.html" %} {% set components = [(testsuite_name, v4_url_for(".v4_recent_activity"))] %} {% block title %}Regression Triage{% endblock %} {% block head %} {% endblock %} {% block javascript %} var g = {} {% set api_graph = "api/db_default/v4/" + testsuite_name + "/graph"%} var changes = [ {% for form_change in form.field_changes%} {% set fc = changes[loop.index -1] %} {% set fc_ri_field_index = ts.get_field_index(fc.ri.field) %} {"url": "/{{api_graph}}/{{ fc.ri.machine.id}}/{{fc.ri.test.id}}/{{fc_ri_field_index}}", "start": "{{fc.ri.start_order.as_ordered_string()}}", "end": "{{fc.ri.end_order.as_ordered_string()}}" }, {% endfor %} ]; /* Bind events to the zoom bar buttons, so that * the zoom buttons work, then position them * over top of the main graph. */ function bind_zoom_bar(my_plot) { $('#out').click(function (e) { e.preventDefault(); my_plot.zoomOut(); }); $('#in').click(function (e) { e.preventDefault(); my_plot.zoom(); }); // Now move the bottons onto the graph. $('#zoombar').css('position', 'relative'); $('#zoombar').css('left', '40px'); $('#zoombar').css('top', '-235px'); } $('#normalize').click(function (e) { normalize = !normalize; alert(normalize); update_graph(); }); function init(data, start_highlight, end_highlight) { // Set up the primary graph. var graph = $("#graph"); var graph_plots = data; var line_width = 1; if (data.length > 0 && data[0]['data'].length < 50) { line_width = 2; } var graph_options = { series : { lines : { lineWidth : line_width }, shadowSize : 0 }, highlight : { range: {"end": [end_highlight], "start": [start_highlight]}, alpha: "0.1", stroke: false, }, zoom : { interactive : false }, pan : { interactive : true, frameRate: 60 }, grid : { hoverable : true } }; var main_plot = $.plot("#graph", graph_plots, graph_options); // Add tooltips. $("#graph").bind("plothover", function(e,p,i) { update_tooltip(e, p, i, show_tooltip, graph_plots); }); bind_zoom_bar(main_plot); } // Show our overlay tooltip. g.current_tip_point = null; function show_tooltip(x, y, item, pos, graph_data) { // Given the event handler item, get the graph metadata. function extract_metadata(item, graph_data) { var index = item.dataIndex; var series_index = item.seriesIndex; // Graph data is formatted as [x, y, meta_data]. var meta_data = item.series.data[series_index][2]; return meta_data; } var data = item.datapoint; var meta_data = extract_metadata(item, graph_data); var tip_body = '