in wiki-interface/ui/js/sidebar_br.js [154:191]
function fetchAndPopulateSelect(type) {
switch (type) {
case "userstory":
url = "/api/v1/userstoryoptions";
break;
case "testcase":
url = "/api/v1/testcaseoptions";
break;
case "testscript":
url = "/api/v1/testscriptoptions";
break;
}
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then(data => {
const selectElement = document.getElementById("inputDocumentId");
// Clear existing options (optional)
selectElement.innerHTML = '';
data.forEach(item => {
const option = document.createElement('option');
option.value = item.value; // Assuming your JSON has a 'value' property
option.text = item.label || item.value; // Use 'label' property if available, otherwise use 'value'
selectElement.appendChild(option);
});
})
.catch(error => {
console.error('Error fetching data:', error);
});
}