Skip to content
Snippets Groups Projects
Commit 2e41ddaa authored by Benoit Alessandroni's avatar Benoit Alessandroni
Browse files

update: fixing the connector script

parent d00e7a78
No related branches found
No related tags found
1 merge request!21update: adding missing label
Pipeline #10367 passed with stage
in 53 seconds
......@@ -78,6 +78,42 @@ function manageAccordionByStep(){
}
}
/**
* Handle local / federated data search
*/
function searchDataSource(){
//select checkbox
//add clic event listener
let searchCheckbox = document.querySelector(".searchLocalInstance");
searchCheckbox.addEventListener("click",(e) => {
//get the last element & use it as ID in the queryselector
let apiURL = document
.querySelector('solid-display.resource_by_step')
.getAttribute("data-src").split("/").slice(0,3).join("/");
console.log(apiURL);
//select search data sources
let searchDataSources = document.querySelectorAll("div.step > solid-display.resource_by_step");
//for each data source, replace it with the wanted value
searchDataSources.forEach(function(searchDataSource, index) {
//change host to localhost
if (e.target.checked == true){
//create new data-src
var newLocalDataSrc = apiURL + "/steps/" + (index + 1) +"/resources/validated/";
//push it
searchDataSource.attributes['data-src'].value = newLocalDataSrc;
}
//change host to federated
else if (e.target.checked == false) {
var newFederatedDataSrc = apiURL + "/sources/step" + (index + 1) +"/";
//push it
searchDataSource.attributes['data-src'].value = newFederatedDataSrc;
}
});
refreshPagination();
});
}
/**
* Manage select hidden for type to fullfill them with more "more criterias" selection
* @param {HTMLElement} tab - Selected type tabs.
......@@ -159,6 +195,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
manageAccordionByStep();
addProperFilterToSearchComponents("coopedia-search-results-component", "coopedia-search-box-component");
initManagementForType("coopedia-search-box-component");
searchDataSource()
}, 4000);
})();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment