mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-10 06:00:56 +08:00
Use url_for to generate URLs
This commit is contained in:
@@ -14,6 +14,7 @@ from cellxgene_gateway.dir_util import (
|
|||||||
make_annotations,
|
make_annotations,
|
||||||
annotations_suffix,
|
annotations_suffix,
|
||||||
)
|
)
|
||||||
|
from flask import url_for
|
||||||
|
|
||||||
|
|
||||||
def recurse_dir(path):
|
def recurse_dir(path):
|
||||||
@@ -44,13 +45,10 @@ def recurse_dir(path):
|
|||||||
"name": x[:-13]
|
"name": x[:-13]
|
||||||
if (len(x) > 13 and x[-13] in ["-", "_"])
|
if (len(x) > 13 and x[-13] in ["-", "_"])
|
||||||
else (x[:-4] if x.endswith(".csv") else x),
|
else (x[:-4] if x.endswith(".csv") else x),
|
||||||
"path": os.path.join(full_path, x).replace(
|
"path": os.path.join(full_path, x).replace(env.cellxgene_data, ""),
|
||||||
env.cellxgene_data, ""
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
for x in sorted(os.listdir(full_path))
|
for x in sorted(os.listdir(full_path))
|
||||||
if x.endswith(".csv")
|
if x.endswith(".csv") and os.path.isfile(os.path.join(full_path, x))
|
||||||
and os.path.isfile(os.path.join(full_path, x))
|
|
||||||
]
|
]
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -91,7 +89,7 @@ def render_entries(entries):
|
|||||||
|
|
||||||
|
|
||||||
def get_url(entry):
|
def get_url(entry):
|
||||||
return f"/view/{ entry['path'].lstrip('/') }/"
|
return url_for("do_view", entry)
|
||||||
|
|
||||||
|
|
||||||
def get_class(entry):
|
def get_class(entry):
|
||||||
|
|||||||
@@ -35,12 +35,12 @@
|
|||||||
Links:
|
Links:
|
||||||
</h1>
|
</h1>
|
||||||
<div class="list-group" style="width:50%;padding-left:65px">
|
<div class="list-group" style="width:50%;padding-left:65px">
|
||||||
<a href="/filecrawl.html" class="list-group-item list-group-item-action">
|
<a href="{{ url_for('filecrawl') }}" class="list-group-item list-group-item-action">
|
||||||
<u>File Crawler: Allows you to view all uploaded data.</u></a>
|
<u>File Crawler: Allows you to view all uploaded data.</u></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="list-group" style="width:50%;padding-left:65px">
|
<div class="list-group" style="width:50%;padding-left:65px">
|
||||||
<a href="/cache_status" class="list-group-item list-group-item-action">
|
<a href="{{ url_for('do_GET_status') }}" class="list-group-item list-group-item-action">
|
||||||
<u>Cache Status: view status of launched cellxgene servers.</u></a>
|
<u>Cache Status: view status of launched cellxgene servers.</u></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user