From 4fd02c47a8a1d202177fc8964dd45dae4666b36b Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 7 Feb 2023 22:10:11 +0000 Subject: [PATCH] hotfix-part2 --- application/templates/index.html | 50 +++++++++++++++++--------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/application/templates/index.html b/application/templates/index.html index c9c2fb0..9ccd0bc 100644 --- a/application/templates/index.html +++ b/application/templates/index.html @@ -104,10 +104,36 @@ This will return a new DataFrame with all the columns from both tables, and only .then(data => { console.log('Success:', data); localStorage.setItem("docsIndex", JSON.stringify(data)); + generateOptions() } + ) } + function generateOptions(){ + docsIndex = localStorage.getItem('docsIndex') + // create option on select with id select-docs + var select = document.getElementById("select-docs"); + // convert docsIndex to json + docsIndex = JSON.parse(docsIndex) + // create option for each key in docsIndex + for (var key in docsIndex) { + var option = document.createElement("option"); + console.log(key) + console.log(docsIndex[key]) + if (docsIndex[key].name == docsIndex[key].language) { + option.text = docsIndex[key].name + " " + docsIndex[key].version; + option.value = docsIndex[key].name + "/" + ".project" + "/" + docsIndex[key].version + "/"; + select.add(option); + } + else { + option.text = docsIndex[key].name + " " + docsIndex[key].version; + option.value = docsIndex[key].language + "/" + docsIndex[key].name + "/" + docsIndex[key].version + "/"; + select.add(option); + } + } + + } // check if api_key is set if (localStorage.getItem('apiKey') === null) { console.log("apiKey is not set") @@ -118,29 +144,7 @@ This will return a new DataFrame with all the columns from both tables, and only docsIndex() } - docsIndex = localStorage.getItem('docsIndex') - // create option on select with id select-docs - var select = document.getElementById("select-docs"); - // convert docsIndex to json - docsIndex = JSON.parse(docsIndex) - // create option for each key in docsIndex - for (var key in docsIndex) { - var option = document.createElement("option"); - console.log(key) - console.log(docsIndex[key]) - if (docsIndex[key].name == docsIndex[key].language) { - option.text = docsIndex[key].name + " " + docsIndex[key].version; - option.value = docsIndex[key].name + "/" + ".project" + "/" + docsIndex[key].version + "/"; - select.add(option); - } - else { - option.text = docsIndex[key].name + " " + docsIndex[key].version; - option.value = docsIndex[key].language + "/" + docsIndex[key].name + "/" + docsIndex[key].version + "/"; - select.add(option); - } - } - - + generateOptions()