aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/static/main.js
diff options
context:
space:
mode:
authorLLTommy2020-04-26 11:34:53 +0200
committerGitHub2020-04-26 11:34:53 +0200
commit819fca0c6619e7335b6da151ff786d8939535970 (patch)
tree934a959ab405aa464e9e219c9952f2ebeb2d1b59 /bh20simplewebuploader/static/main.js
parentebd9226e5a561840f6665a76ca50d63274d9d3e5 (diff)
parent8eaa119feef3660a84cf1bccdf3be70fd968e297 (diff)
downloadbh20-seq-resource-819fca0c6619e7335b6da151ff786d8939535970.tar.gz
bh20-seq-resource-819fca0c6619e7335b6da151ff786d8939535970.tar.lz
bh20-seq-resource-819fca0c6619e7335b6da151ff786d8939535970.zip
Merge pull request #39 from BonfaceKilz/feature/display-results-of-api-consumption
Feature/display results of api consumption
Diffstat (limited to 'bh20simplewebuploader/static/main.js')
-rw-r--r--bh20simplewebuploader/static/main.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js
new file mode 100644
index 0000000..0f79fdf
--- /dev/null
+++ b/bh20simplewebuploader/static/main.js
@@ -0,0 +1,47 @@
+function fetchAPI(apiEndPoint) {
+ fetch(scriptRoot + apiEndPoint)
+ .then(response => {
+ return response.json();
+ })
+ .then(data => {
+ document.getElementById("json").textContent = JSON.stringify(data, undefined, 2);
+ document.getElementById("results").classList.remove("invisible");
+ document.getElementById("loader").classList.add("invisible");
+ });
+ document.getElementById("results").classList.add("invisible");
+ document.getElementById("loader").classList.remove("invisible");
+
+}
+
+let search = () => {
+ let m = document.getElementById('search-input').value;
+ fetchAPI(scriptRoot + "/api/getDetailsForSeq?seq=" + encodeURIComponent(m));
+}
+
+let fetchSEQBySpecimen = () => {
+ fetchAPI("/api/getSEQbySpecimenSource");
+}
+
+let fetchSEQByLocation = () => {
+ fetchAPI("/api/getSEQbyLocation");
+}
+
+let fetchSEQByTech = () => {
+ fetchAPI("/api/getSEQbytech");
+}
+
+let fetchAllaccessions = () => {
+ fetchAPI("/api/getAllaccessions");
+};
+
+/**
+ * Show form if checked
+ */
+let fillFormSpot = document.getElementById('metadata_fill_form_spot');
+function displayForm() {
+ if (document.getElementById('metadata_form').checked) {
+ fillFormSpot.classList.remove("invisible");
+ return;
+ }
+ fillFormSpot.classList.add("invisible");
+}