Commit 6bebc3a4 authored by Martin Peres's avatar Martin Peres Committed by Martin Peres

latency: use listeners to detect changes in projects and tests

The current method is non-standard, or considered obsolete, so let's
use the normal method, and hopefully it will resolve some issues that
are hit by some users.

Suggested-by: @ivyl / Arkadiusz Hiler
parent daea1aca
......@@ -108,7 +108,6 @@ function pw_test_latency_fetch(project, tests_target, plot_target, weeks, defaul
var option = document.createElement("option");
option.text = test_name;
option.value = test_name.trim();
option.addEventListener('click', function(e) {pw_latency_plot(e.target.value);});
select_tests.appendChild(option);
});
select_tests.disabled = false;
......
......@@ -7,7 +7,7 @@ This view enables you to visualize the latency between a patch has been sent and
<div class="inline-form">
Select a project / test to get statistics for:
<select id="projects" onchange="pw_test_latency_fetch(this.options[this.selectedIndex].value, 'tests', 'plot', 1);">
<select id="projects">
<option value="" disabled selected hidden>Please select a project</option>
</select>
<select id="tests" disabled>
......@@ -62,12 +62,12 @@ This view enables you to visualize the latency between a patch has been sent and
};
// Add all the available projects
var e = document.getElementById('projects');
var select_projects = document.getElementById('projects');
for (let p_name in projects) {
var o = document.createElement("option");
o.value = p_name;
o.text = projects[p_name].name;
e.appendChild(o);
select_projects.appendChild(o);
}
// If a project has been set in the URL, select it
......@@ -76,4 +76,13 @@ This view enables you to visualize the latency between a patch has been sent and
pw_test_latency_fetch(default_project, 'tests', 'plot', 1, get_url_parameter('test', undefined));
document.getElementById('projects').value = default_project;
}
select_projects.addEventListener('change', function() {
pw_test_latency_fetch(this.options[this.selectedIndex].value, 'tests', 'plot', 1);
});
var select_tests = document.getElementById('tests');
select_tests.addEventListener('change', function() {
pw_latency_plot(this.options[this.selectedIndex].value);
});
</script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment