diff options
Diffstat (limited to 'bh20simplewebuploader/static')
-rw-r--r-- | bh20simplewebuploader/static/main.js | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js index 9373199..d90b5af 100644 --- a/bh20simplewebuploader/static/main.js +++ b/bh20simplewebuploader/static/main.js @@ -28,6 +28,28 @@ function fetchAPI(apiEndPoint) { } +function fetchAPIV2(apiEndPoint) { + fetch(scriptRoot + apiEndPoint) + .then(response => { + return response.json(); + }) + .then(data => { + console.log(data) + htmlString="<table>" + + // Depending on what we want to explore we'd have to call a different function ....? But how to Include that? + for (var i=0; i<data.length;i++) { + htmlString=htmlString+"<tr><td><a href='#' onclick='fetchSEQByLocation(\""+data[i]["key"]+"\");'>"+data[i]["label"]+"</a></td><td>"+data[i]["count"]+"<td></tr>" + } + htmlString=htmlString+"</table>" + + document.getElementById("table").innerHTML = htmlString + }); + + document.getElementById("results").classList.add("invisible"); +} + + let search = () => { let m = document.getElementById('search-input').value; fetchAPI(scriptRoot + "/api/getDetailsForSeq?seq=" + encodeURIComponent(m)); @@ -37,22 +59,36 @@ let fetchCount = () => { fetchAPI("/api/getCount"); } -let fetchSEQBySpecimen = () => { - fetchAPI("/api/getSEQCountbySpecimenSource"); +let fetchSEQCountBySpecimen = () => { + fetchAPIV2("/api/getSEQCountbySpecimenSource"); } -let fetchSEQByLocation = () => { - fetchAPI("/api/getSEQCountbyLocation"); +let fetchSEQCountByLocation = () => { + fetchAPIV2("/api/getSEQCountbyLocation"); } -let fetchSEQByTech = () => { - fetchAPI("/api/getSEQCountbytech"); +let fetchSEQCountByTech = () => { + fetchAPIV2("/api/getSEQCountbytech"); } let fetchAllaccessions = () => { fetchAPI("/api/getAllaccessions"); }; +let fetchCountByGPS = () => { + fetchAPI("/api/getCountByGPS"); +}; + +let fetchSEQCountbyLocation = () => { + fetchAPIV2("/api/getSEQCountbyLocation"); +}; + +let fetchSEQByLocation = () => { + console.log("Missing - set parameter for request, retrieve data") +}; + + + /* * Make sure that only one of the manual metadata entry and metadata upload * form components is *actually* a child of the form element in the DOM. |