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()