Skip to content

Commit

Permalink
task/WP-647: Remove portal name filter for jobs by default (#1394)
Browse files Browse the repository at this point in the history
* remove portalname filter by default for jobs

* remove old test description from setfacl job

---------

Co-authored-by: Garrett Edmonds <[email protected]>
  • Loading branch information
rstijerina and edmondsgarrett authored Aug 14, 2024
1 parent e60c42d commit 0b306fe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def submit_workspace_acls_job(
"name": f"setfacl-project-{project_uuid.split('-')[0]}-{username}-{action}",
"appId": "setfacl-corral-tg458981",
"appVersion": "0.0.1",
"description": "test app setfacl-corral-tg458981",
"description": "Add/Remove ACLs on a directory",
"fileInputs": [],
"parameterSet": {
"appArgs": [],
Expand Down
17 changes: 14 additions & 3 deletions designsafe/apps/workspace/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,14 +627,21 @@ def listing(self, client, request):

limit = int(request.GET.get("limit", 10))
skip = int(request.GET.get("skip", 0))
filter_by_portal = request.GET.get("filterByPortal", False)
portal_name = settings.PORTAL_NAMESPACE

kwargs = {}
if filter_by_portal:
kwargs["_tapis_query_parameters"] = {
"tags.contains": f"portalName: {portal_name}"
}

data = client.jobs.getJobSearchList(
limit=limit,
skip=skip,
orderBy="lastUpdated(desc),name(asc)",
_tapis_query_parameters={"tags.contains": f"portalName: {portal_name}"},
select="allAttributes",
**kwargs,
)
if isinstance(data, list):
for index, job in enumerate(data):
Expand All @@ -656,10 +663,14 @@ def search(self, client, request):

limit = int(request.GET.get("limit", 10))
skip = int(request.GET.get("skip", 0))
filter_by_portal = request.GET.get("filterByPortal", False)
portal_name = settings.PORTAL_NAMESPACE

sql_queries = [
f"(tags IN ('portalName: {portal_name}')) AND",
sql_queries = []
if filter_by_portal:
sql_queries.append(f"(tags IN ('portalName: {portal_name}')) AND")

sql_queries += [
f"((name like '%{query_string}%') OR",
f"(archiveSystemDir like '%{query_string}%') OR",
f"(appId like '%{query_string}%') OR",
Expand Down

0 comments on commit 0b306fe

Please sign in to comment.