aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader
diff options
context:
space:
mode:
authorPjotr Prins2020-07-19 09:11:41 +0100
committerPjotr Prins2020-07-19 09:11:41 +0100
commit7b2d388dbed11384c6a388a5437cca0b8f2914fd (patch)
treef2707c6811948b9c6adc63534ff456266508c109 /bh20simplewebuploader
parent0e4cb2c14b62ed4f39271c6006a99cea954fc688 (diff)
downloadbh20-seq-resource-7b2d388dbed11384c6a388a5437cca0b8f2914fd.tar.gz
bh20-seq-resource-7b2d388dbed11384c6a388a5437cca0b8f2914fd.tar.lz
bh20-seq-resource-7b2d388dbed11384c6a388a5437cca0b8f2914fd.zip
Wiring up export function
Diffstat (limited to 'bh20simplewebuploader')
-rw-r--r--bh20simplewebuploader/main.py9
-rw-r--r--bh20simplewebuploader/static/main.js10
-rw-r--r--bh20simplewebuploader/templates/export.html41
-rw-r--r--bh20simplewebuploader/templates/menu.html1
4 files changed, 58 insertions, 3 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 2c360e1..b88055f 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -630,6 +630,10 @@ def validated_page():
validated_table(output, validated)
return render_template('validated.html', table=Markup(output.getvalue()), menu='STATUS')
+@app.route('/export')
+def export_page():
+ return render_template('export.html',menu='EXPORT')
+
@app.route('/demo')
def demo_page():
return render_template('demo.html',menu='DEMO',load_map=True)
@@ -685,6 +689,11 @@ def getCountDB():
# print(result, file=sys.stderr)
return jsonify({'sequences': int(result[0]["num"]["value"])})
+# Execute a 'global search'
+@app.route('/api/search', methods=['GET'])
+def search():
+ return jsonify(["TESTME"])
+
@app.route('/api/getAllaccessions', methods=['GET'])
def getAllaccessions():
query="""SELECT DISTINCT ?fasta ?value WHERE {?fasta ?x[ <http://edamontology.org/data_2091> ?value ]}"""
diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js
index 1633c25..dc0864b 100644
--- a/bh20simplewebuploader/static/main.js
+++ b/bh20simplewebuploader/static/main.js
@@ -21,8 +21,6 @@ function fetchAPI(apiEndPoint) {
.then(data => {
console.log(data);
});
- document.getElementById("map_view").classList.add("invisible");
- document.getElementById("loader").classList.remove("invisible");
}
// Copy from function above but now output HTML table instead of plain json
@@ -51,7 +49,13 @@ function fetchHTMLTable(apiEndPoint) {
}
-let search = () => {
+/* Fetch record info using a 'global search' */
+let searchGlobal = () => {
+ let m = document.getElementById('search-input').value;
+ fetchAPI(scriptRoot + "/api/search?s=" + encodeURIComponent(m));
+}
+
+let searchSeq = () => {
let m = document.getElementById('search-input').value;
fetchAPI(scriptRoot + "/api/getDetailsForSeq?seq=" + encodeURIComponent(m));
}
diff --git a/bh20simplewebuploader/templates/export.html b/bh20simplewebuploader/templates/export.html
new file mode 100644
index 0000000..f105290
--- /dev/null
+++ b/bh20simplewebuploader/templates/export.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+ {% include 'header.html' %}
+ <body>
+ {% include 'banner.html' %}
+ {% include 'menu.html' %}
+
+ <h1>Export Data</h1>
+ <section class="blog">
+
+ COVID-19 PubSeq allows for exporting forms and data for other
+ services.
+
+ <h2>Export EBI/ENA Forms</h2>
+
+ <p>
+ Uploading data to EBI/ENA with PubSeq is described
+ <a href="/blog?id=using-covid-19-pubseq-part6">here</a>.
+ To export, first search for an uploaded entry through its
+ identifier:
+ </p>
+
+ <div class="search">
+ <input id="search-input" type="search" placeholder="e.g. MT246484" required>
+ <button class="button search-button" type="submit" onclick="searchGlobal()">
+ <span class="icon ion-search">
+ <span class="sr-only">Search</span>
+ </span>
+ </button>
+ </div>
+
+ </section>
+
+ {% include 'footer.html' %}
+
+ <script type="text/javascript">
+ let scriptRoot = {{ request.script_root|tojson|safe }}; // examples
+ </script>
+ </body>
+
+</html>
diff --git a/bh20simplewebuploader/templates/menu.html b/bh20simplewebuploader/templates/menu.html
index 0f6003f..d408171 100644
--- a/bh20simplewebuploader/templates/menu.html
+++ b/bh20simplewebuploader/templates/menu.html
@@ -5,6 +5,7 @@
<a href="/upload" class="{{ 'active' if menu=='UPLOAD' }}">UPLOAD</a>
<a href="/status" class="{{ 'active' if menu=='STATUS' }}">STATUS</a>
<a href="/demo" class="{{ 'active' if menu=='DEMO' }}">DEMO</a>
+ <a href="/export" class="{{ 'active' if menu=='EXPORT' }}">EXPORT</a>
<a href="/blog" class="{{ 'active' if menu=='BLOG' }}">BLOG</a>
<a href="/about" class="{{ 'active' if menu=='ABOUT' }}">ABOUT</a>
<a href="javascript:void(0);" class="icon" onclick="myFunction()">