24 lines
709 B
CoffeeScript
24 lines
709 B
CoffeeScript
$ ->
|
|
console.log('ready.')
|
|
|
|
$('#report-benchmarks').on 'change', ->
|
|
try
|
|
benchmarkSearchParams = new URLSearchParams
|
|
benchmark_id: $('#report-benchmarks').val()
|
|
benchmarkRes = await fetch("/api/v1/benchmark/tests?#{benchmarkSearchParams}")
|
|
benchmarkData = await benchmarkRes.json()
|
|
|
|
# clear old contents from the selector
|
|
$('#report-tests').empty()
|
|
# add new elements to the selector
|
|
addOption(test) for test in benchmarkData
|
|
catch error
|
|
console.error 'An error occurred while fetching benchmark results.', error
|
|
|
|
addOption = (test) ->
|
|
$('#report-tests').append(
|
|
$('<option/>')
|
|
.attr('value', test.id)
|
|
.text(test.title)
|
|
)
|