Skip to content

Commit

Permalink
Merge branch 'main' into task/WP-271--django-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
rstijerina authored Nov 15, 2023
2 parents e42301d + 1af7c8f commit ab25428
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 14 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [3.3.2] - 2023-11-09: workspace search fails on frontera portal
- WP-380: Remove id prefix filter on workspace search (#898)

## [3.3.1] - 2023-11-07: Search related bug fixes and App Icon fix
- WP-355: Fixing issue with icons on dev/prod sites (#892)
- WP-354: Workspace search - filter results visible to user (#893)
- WP-356: Site Search: For files, use home dir to isolate the search (#897)
- WP-361: Jobs Search - restrict search to a specific portal (#896)

## [3.3.0] - 2023-10-27: V3 integration improvements; bug fixes

Expand Down Expand Up @@ -983,7 +991,9 @@ WP-306: Fix target path regression (#871)
## [1.0.0] - 2020-02-28
v1.0.0 Production release as of Feb 28, 2020.

[unreleased]: https://github.com/TACC/Core-Portal/compare/v3.3.0...HEAD
[unreleased]: https://github.com/TACC/Core-Portal/compare/v3.3.2...HEAD
[3.3.2]: https://github.com/TACC/Core-Portal/releases/tag/v3.3.2
[3.3.1]: https://github.com/TACC/Core-Portal/releases/tag/v3.3.1
[3.3.0]: https://github.com/TACC/Core-Portal/releases/tag/v3.3.0
[3.2.1]: https://github.com/TACC/Core-Portal/releases/tag/v3.2.1
[3.2.0]: https://github.com/TACC/Core-Portal/releases/tag/v3.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ const AllocationsTeamViewModal = ({ isOpen, toggle }) => {
const handleTabChange = (e, newValue) => {
setSelectedTab(newValue);
};

let selectedUser = null;
if (removingUserOperation && removingUserOperation.username) {
selectedUser = removingUserOperation.username;
}
if (card && card.username === selectedUser) {
setCard(null);
}

return (
<Modal isOpen={isOpen} toggle={toggle} size="lg" onClosed={resetCard}>
<ModalHeader className="has-MuiTabs" toggle={toggle} charCode="&#xe912;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ const DataFilesProjectsList = ({ modal }) => {
Header: 'ID',
headerStyle: { textAlign: 'left' },
accessor: 'name',
Cell: (el) => <span>{el.value.split('-').slice(-1)[0]}</span>,
Cell: (el) => (
<span>{el.value ? el.value.split('-').slice(-1)[0] : ''}</span>
),
},
];

Expand Down
10 changes: 8 additions & 2 deletions server/portal/apps/projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ def get(self, request):
search = search.extra(from_=int(offset), size=int(limit))

res = search.execute()
hits = [hit.to_dict() for hit in res]
listing = hits
hits = [hit.id for hit in res if hasattr(hit, 'id') and hit.id is not None]
listing = []
# Filter search results to projects specific to user
if hits:
client = request.user.tapis_oauth.client
listing = list_projects(client)
filtered_list = filter(lambda prj: prj['id'] in hits, listing)
listing = list(filtered_list)
else:
client = request.user.tapis_oauth.client
listing = list_projects(client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,12 @@ def list_projects(client):

fields = "id,host,description,notes,updated,owner,rootDir"
query = f"id.like.{settings.PORTAL_PROJECTS_SYSTEM_PREFIX}.*"
# use limit as -1 to allow search to corelate with
# all projects available to the api user
listing = client.systems.getSystems(listType='ALL',
search=query,
select=fields)
select=fields,
limit=-1)

serialized_listing = map(lambda prj: {
"id": prj.id,
Expand Down
2 changes: 1 addition & 1 deletion server/portal/apps/site_search/api/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_file_search_util(mock_file_search, regular_user):
[{'name': 'testfile',
'path': '/path/to/testfile'}]}
client = regular_user.tapis_oauth.client
res = files_search(client, 'test_query', 'test_system')
res = files_search(client, 'test_query', 'test_system', '/',)

mock_file_search.assert_called_with(client, 'test_system', '/',
query_string='test_query',
Expand Down
8 changes: 4 additions & 4 deletions server/portal/apps/site_search/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def cms_search(query_string, offset=0, limit=10):
return total, results


def files_search(client, query_string, system, filter=None, offset=0, limit=10):
res = search_operation(client, system, '/', offset=offset, limit=limit,
def files_search(client, query_string, system, path, filter=None, offset=0, limit=10):
res = search_operation(client, system, path, offset=offset, limit=limit,
query_string=query_string, filter=filter)
return (res['count'], res['listing'])

Expand Down Expand Up @@ -65,7 +65,7 @@ def get(self, request, *args, **kwargs):
and ('siteSearchPriority' in conf and conf['siteSearchPriority'] is not None))
client = request.user.tapis_oauth.client if (request.user.is_authenticated and request.user.profile.setup_complete) else service_account()
(public_total, public_results) = \
files_search(client, qs, public_conf['system'], filter=filter,
files_search(client, qs, public_conf['system'], public_conf.get("homeDir", "/"), filter=filter,
offset=offset, limit=limit)
response['public'] = {'count': public_total,
'listing': public_results,
Expand All @@ -84,7 +84,7 @@ def get(self, request, *args, **kwargs):
and ('siteSearchPriority' in conf and conf['siteSearchPriority'] is not None))
client = request.user.tapis_oauth.client
(community_total, community_results) = \
files_search(client, qs, community_conf['system'], filter=filter,
files_search(client, qs, community_conf['system'], community_conf.get("homeDir", "/"), filter=filter,
offset=offset,
limit=limit)
response['community'] = {'count': community_total,
Expand Down
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

0 comments on commit ab25428

Please sign in to comment.