Update public source
This commit is contained in:
@@ -21,6 +21,7 @@ from cracklab.server.services.job_issuance import (
|
||||
JobIssuanceError,
|
||||
JobIssuanceService,
|
||||
)
|
||||
from cracklab.server.services.search_context import SearchContextService
|
||||
from cracklab.server.services.job_result import (
|
||||
JobResultError,
|
||||
JobResultService,
|
||||
@@ -88,6 +89,13 @@ def dashboard():
|
||||
def jobs_page():
|
||||
error = request.args.get("error")
|
||||
created_job_id = request.args.get("created")
|
||||
search_context_token = request.values.get(
|
||||
"search_context_token",
|
||||
"",
|
||||
).strip()
|
||||
|
||||
search_context = None
|
||||
search_statistics = None
|
||||
|
||||
conn = connect_database()
|
||||
|
||||
@@ -138,6 +146,25 @@ def jobs_page():
|
||||
except ValueError:
|
||||
selected_version = None
|
||||
|
||||
if search_context_token:
|
||||
search_context = SearchContextService(conn).get_context(
|
||||
search_context_token,
|
||||
)
|
||||
|
||||
if (
|
||||
search_context is not None
|
||||
and not search_context["expired"]
|
||||
and selected_method_id
|
||||
and selected_version is not None
|
||||
):
|
||||
search_statistics = (
|
||||
issuance_service.get_search_context_statistics(
|
||||
search_context["token_hash"],
|
||||
selected_method_id,
|
||||
selected_version,
|
||||
)
|
||||
)
|
||||
|
||||
if request.method == "POST":
|
||||
if not selected_method_id:
|
||||
raise JobIssuanceError(
|
||||
@@ -186,6 +213,7 @@ def jobs_page():
|
||||
method_id=selected_method_id,
|
||||
method_version=selected_version,
|
||||
created=issued_job.job_id,
|
||||
search_context_token=search_context_token or None,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -231,6 +259,9 @@ def jobs_page():
|
||||
method_names=method_names,
|
||||
created_job_id=created_job_id,
|
||||
error=error,
|
||||
search_context_token=search_context_token,
|
||||
search_context=search_context,
|
||||
search_statistics=search_statistics,
|
||||
)
|
||||
|
||||
except (JobIssuanceError, ValueError) as exc:
|
||||
@@ -278,6 +309,9 @@ def jobs_page():
|
||||
method_names=method_names,
|
||||
created_job_id=created_job_id,
|
||||
error=error,
|
||||
search_context_token=search_context_token,
|
||||
search_context=search_context,
|
||||
search_statistics=search_statistics,
|
||||
)
|
||||
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user