Skip to content

Commit

Permalink
Merge pull request #217 from CybercentreCanada/hotfix/service_versions
Browse files Browse the repository at this point in the history
Show all service versions, not just the first few
  • Loading branch information
cccs-rs authored Jun 24, 2021
2 parents 4bd4def + a59b585 commit 5cd6337
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions assemblyline_ui/api/v4/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ def get_potential_versions(servicename, **_):
"""
service = STORAGE.service_delta.get(servicename)
if service:
return make_api_response([item.version for item in
STORAGE.service.search(f"id:{servicename}*", fl="version")['items']])
return make_api_response(
sorted([item.version for item in STORAGE.service.stream_search(f"id:{servicename}*", fl="version")],
reverse=True))
else:
return make_api_response("", err=f"{servicename} service does not exist", status_code=404)

Expand Down
2 changes: 1 addition & 1 deletion test/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_get_versions(datastore, login_session):

service = random.choice(list(TEMP_SERVICES.keys()))
resp = get_api_data(session, f"{host}/api/v4/service/versions/{service}/")
assert resp == ['3.3.0', '4.0.0']
assert resp == ['4.0.0', '3.3.0']


# noinspection PyUnusedLocal
Expand Down

0 comments on commit 5cd6337

Please sign in to comment.