-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/BSC-CNS-EAPM/EAPM-plugins
- Loading branch information
Showing
9 changed files
with
72 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.