Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/WP-361: Jobs Search - restrict search to a specific portal #896

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions server/portal/apps/workspace/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ def listing(self, client, request):
return data

def search(self, client, request):

'''
Search using tapis in specific portal with providing query string.
Additonal parameters for search:
limit - limit param from request, otherwise default to 10
offset - offset param from request, otherwise default to 0
'''
query_string = request.GET.get('query_string')

limit = int(request.GET.get('limit', 10))
Expand All @@ -197,10 +202,10 @@ def search(self, client, request):

sql_queries = [
f"(tags IN ('portalName: {portal_name}')) AND",
f"(name like '%{query_string}%') OR",
f"((name like '%{query_string}%') OR",
f"(archiveSystemDir like '%{query_string}%') OR",
f"(appId like '%{query_string}%') OR",
f"(archiveSystemId like '%{query_string}%')",
f"(archiveSystemId like '%{query_string}%'))",
]

data = client.jobs.getJobSearchListByPostSqlStr(
Expand All @@ -212,7 +217,6 @@ def search(self, client, request):
},
select="allAttributes"
)

return data

def delete(self, request, *args, **kwargs):
Expand Down