Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertCS committed Jul 11, 2024
2 parents cf0cfe2 + f0dfec8 commit a10a47f
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 19 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ deps/
# .DS_Store files
**/.DS_Store


# Include bioprospecting
Include/bioprospecting/*
EAPM/Include/bioprospecting*
EAPM/Include/bioprospecting*

# Plugin configs
EAPM/config
package-lock.json

3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"--line-length",
"98"
],
"python.analysis.typeCheckingMode": "off",
"python.analysis.extraPaths": [
"EAPM/deps/",
"EAPM/Include/",
Expand All @@ -21,4 +20,4 @@
"hmmer",
"mafft"
]
}
}
4 changes: 4 additions & 0 deletions EAPM/EAPM.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def create_plugin():

eapm_plugin.addConfig(hmmerExecutableConfig)

from Pages.load_tables import load_page

eapm_plugin.addPage(load_page)

# pylint: enable=import-outside-toplevel

# Return the plugin
Expand Down
31 changes: 31 additions & 0 deletions EAPM/Include/Pages/load_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import urllib.parse
import flask
import urllib
import os
import HorusAPI

load_page = HorusAPI.PluginPage(
id="load_tables",
name="Load tables",
description="Load tables",
html="index.html",
hidden=True,
)


def load_html():

path = flask.request.args.get("path")

# The path was safely encoded in the uri
path = urllib.parse.unquote(path)

if path is None or not os.path.exists(path):
return flask.jsonify({"error": "Path does not exist"}, 404)

return flask.send_file(path)


load_page.addEndpoint(
HorusAPI.PluginEndpoint(url="/load_table", methods=["GET"], function=load_html)
)
29 changes: 29 additions & 0 deletions EAPM/Pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Load HTML</title>
</head>
<body>
<a id="load" href="/plugins/pages/eapm.load_tables/load_table"
>Loading...</a
>
<script>
function loadData() {
const data = parent.extensionData;
if (data) {
const pathToLoad = encodeURIComponent(data.path);
const aElement = document.getElementById("load");
const url = new URL(window.location.href + "load_table");
url.searchParams.set("path", pathToLoad);
const urlToGet = url.toString();
aElement.href = urlToGet;
aElement.click();
}
}

document.addEventListener("DOMContentLoaded", loadData);
</script>
</body>
</html>
4 changes: 0 additions & 4 deletions EAPM/config/eapm.json

This file was deleted.

4 changes: 0 additions & 4 deletions EAPM/config/eapm_Local.json

This file was deleted.

4 changes: 0 additions & 4 deletions EAPM/config/eapm_acc.json

This file was deleted.

4 changes: 0 additions & 4 deletions EAPM/config/eapm_nord3_test.json

This file was deleted.

0 comments on commit a10a47f

Please sign in to comment.