Skip to content

Commit

Permalink
update search() results (#1922)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Aug 8, 2024
1 parent 0e814fa commit 71ce6f0
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions samplesheets/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
ProjectAppPluginPoint,
ProjectModifyPluginMixin,
PluginObjectLink,
PluginSearchResult,
get_backend_api,
)
from projectroles.utils import build_secret
Expand Down Expand Up @@ -448,32 +449,34 @@ def search(self, search_terms, user, search_type=None, keywords=None):
:param user: User object for user initiating the search
:param search_type: String
:param keywords: List (optional)
:return: Dict
:return: List of PluginSearchResult objects
"""
irods_backend = get_backend_api('omics_irods')
results = {}
ret = []
# Materials
if not search_type or search_type in MATERIAL_SEARCH_TYPES:
item_types = ['SOURCE', 'SAMPLE']
if search_type in MATERIAL_SEARCH_TYPES:
item_types = [search_type.upper()]
results['materials'] = {
'title': 'Sources and Samples',
'search_types': ['source', 'sample'],
'items': self._get_search_materials(
r = PluginSearchResult(
category='materials',
title='Sources and Samples',
search_types=['source', 'sample'],
items=self._get_search_materials(
search_terms, user, keywords, item_types
),
}
)
ret.append(r)
# iRODS files
if irods_backend and (not search_type or search_type == 'file'):
results['files'] = {
'title': 'Sample Files in iRODS',
'search_types': ['file'],
'items': self._get_search_files(
search_terms, user, irods_backend
),
}
return results
r = PluginSearchResult(
category='files',
title='Sample Files in iRODS',
search_types=['file'],
items=self._get_search_files(search_terms, user, irods_backend),
)
ret.append(r)
return ret

def get_project_list_value(self, column_id, project, user):
"""
Expand Down

0 comments on commit 71ce6f0

Please sign in to comment.