[FIX] runbot: fix stats page following 17.0 upgrade

Some issue where remaining regarding stats click events and scales.
This commit is contained in:
Xavier-Do 2024-02-23 11:05:08 +01:00
parent 2ba3238a34
commit be030cd6f5
2 changed files with 19 additions and 14 deletions

View File

@ -16,35 +16,39 @@ var config = {
mode: 'point' mode: 'point'
}, },
scales: { scales: {
xAxes: [{ x: {
display: true, display: true,
scaleLabel: { scaleLabel: {
display: true, display: true,
labelString: 'Builds' labelString: 'Builds'
} }
}], },
yAxes: [{ y: {
display: true, display: true,
scaleLabel: { scaleLabel: {
display: true, display: true,
labelString: 'Value' labelString: 'Value'
}, },
}] },
} },
} },
}; };
var shifted = false;
$(document).on('keyup keydown', function(e){shifted = e.shiftKey} );
config.options.onClick = function(event, activeElements) { config.options.onClick = function(event, activeElements) {
if (activeElements.length === 0){ if (activeElements.length === 0){
var x_label_index = this.scales['x-axis-0'].getValueForPixel(event.x); return
var build_id = config.data.labels[x_label_index]
if (event.layerY > this.chartArea.bottom && event.layerY < this.chartArea.bottom + this.scales['x-axis-0'].height){
config.searchParams['center_build_id'] = build_id;
fetchUpdateChart();
}
return;
} }
window.open('/runbot/build/stats/' + config.data.labels[activeElements[0]._index]); const build_id = config.data.labels[activeElements[0].index];
if (shifted){
config.searchParams['center_build_id'] = build_id;
fetchUpdateChart();
} else {
window.open('/runbot/build/stats/' + build_id);
}
}; };
function fetch(path, data, then) { function fetch(path, data, then) {

View File

@ -92,6 +92,7 @@
<button id="fast_forward_button" class="btn btn-default" title="Previous Builds" aria-label="Previous Builds"> <button id="fast_forward_button" class="btn btn-default" title="Previous Builds" aria-label="Previous Builds">
<i t-attf-class="fa fa-fast-forward"/> <i t-attf-class="fa fa-fast-forward"/>
</button> </button>
<p>Tips: click a bullet to see corresponding build stats, shift+click to center the graph on this build</p>
<i id="chart_spinner" class="fa fa-2x fa-circle-o-notch fa-spin"/> <i id="chart_spinner" class="fa fa-2x fa-circle-o-notch fa-spin"/>
</div> </div>
</nav> </nav>