Skip to content

Commit

Permalink
Adjust roles grid data provider
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Dec 5, 2023
1 parent 8671f65 commit 5b42118
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions lib/galaxy/webapps/galaxy/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,31 +194,32 @@ def apply_query_filter(self, query, **kwargs):
"name": "name",
"is": "is",
}
search_query = kwargs.get("search")
parsed_search = parse_filters_structured(search_query, INDEX_SEARCH_FILTERS)
query = query.filter(self.model_class.type != self.model_class.types.PRIVATE)
deleted = False
for term in parsed_search.terms:
if isinstance(term, FilteredTerm):
key = term.filter
q = term.text
if key == "name":
query = query.filter(text_column_filter(self.model_class.name, term))
if key == "description":
query = query.filter(text_column_filter(self.model_class.description, term))
elif key == "is":
if q == "deleted":
deleted = True
elif isinstance(term, RawTextTerm):
query = query.filter(
raw_text_column_filter(
[
self.model_class.description,
self.model_class.name,
],
term,
query = query.filter(self.model_class.type != self.model_class.types.PRIVATE)
search_query = kwargs.get("search")
if search_query:
parsed_search = parse_filters_structured(search_query, INDEX_SEARCH_FILTERS)
for term in parsed_search.terms:
if isinstance(term, FilteredTerm):
key = term.filter
q = term.text
if key == "name":
query = query.filter(text_column_filter(self.model_class.name, term))
if key == "description":
query = query.filter(text_column_filter(self.model_class.description, term))
elif key == "is":
if q == "deleted":
deleted = True
elif isinstance(term, RawTextTerm):
query = query.filter(
raw_text_column_filter(
[
self.model_class.description,
self.model_class.name,
],
term,
)
)
)
query = query.filter(self.model_class.deleted == (true() if deleted else false()))
return query

Expand Down

0 comments on commit 5b42118

Please sign in to comment.