Commit 6d046e33 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Standalone mode: only show valid jobs on results menu

parent a0a173ec
...@@ -257,11 +257,25 @@ class Functions: ...@@ -257,11 +257,25 @@ class Functions:
return False return False
return False return False
@staticmethod
def _get_jobs_list():
all_jobs = os.listdir(Functions.config.app_data)
print(all_jobs)
valid_jobs = []
for job in all_jobs:
job_path = os.path.join(Functions.config.app_data, job)
if os.path.isfile(os.path.join(job_path, "map.paf")) and \
os.path.isfile(os.path.join(job_path, "target.idx")) and \
os.path.isfile(os.path.join(job_path, "query.idx")) and \
os.path.isfile(os.path.join(job_path, ".valid")):
valid_jobs.append(job)
return valid_jobs
@staticmethod @staticmethod
def get_list_all_jobs(mode="webserver"): def get_list_all_jobs(mode="webserver"):
if mode == "webserver": if mode == "webserver":
return [] # Don't give the list in webserver as it's multi-user return [] # Don't give the list in webserver as it's multi-user
all_jobs = os.listdir(Functions.config.app_data) all_jobs = Functions._get_jobs_list()
if "gallery" in all_jobs: if "gallery" in all_jobs:
all_jobs.remove("gallery") all_jobs.remove("gallery")
return sorted(all_jobs, key=lambda x: x.lower()) return sorted(all_jobs, key=lambda x: x.lower())
......
...@@ -428,6 +428,9 @@ def get_graph(): ...@@ -428,6 +428,9 @@ def get_graph():
paf = Paf(paf, idx1, idx2) paf = Paf(paf, idx1, idx2)
if paf.parsed: if paf.parsed:
valid = os.path.join(APP_DATA, id_f, ".valid")
if not os.path.exists(valid):
Path(valid).touch()
res = paf.get_d3js_data() res = paf.get_d3js_data()
res["success"] = True res["success"] = True
return jsonify(res) return jsonify(res)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment