From a1050672a8da2a37740ab3fafc75b539dc396589 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 21 Jun 2022 11:13:14 +0200 Subject: [PATCH 1/6] Add API test for search tag ignoring case --- lib/galaxy_test/api/test_datasets.py | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/galaxy_test/api/test_datasets.py b/lib/galaxy_test/api/test_datasets.py index 2597c3fee8b1..4bac8be03208 100644 --- a/lib/galaxy_test/api/test_datasets.py +++ b/lib/galaxy_test/api/test_datasets.py @@ -131,6 +131,43 @@ def test_search_by_tag(self): index_response = self._get("datasets", payload).json() assert len(index_response) == 0 + def test_search_by_tag_case_insensitive(self): + history_id = self.dataset_populator.new_history() + hda_id = self.dataset_populator.new_dataset(history_id)["id"] + update_payload = { + "tags": ["name:new_TAG", "cool:another_TAG"], + } + updated_hda = self._put(f"histories/{history_id}/contents/{hda_id}", update_payload, json=True).json() + assert "name:new_TAG" in updated_hda["tags"] + assert "cool:another_TAG" in updated_hda["tags"] + payload = { + "limit": 10, + "offset": 0, + "q": ["history_content_type", "tag"], + "qv": ["dataset", "name:new_tag"], + "history_id": history_id, + } + index_response = self._get("datasets", payload).json() + assert len(index_response) == 1 + payload = { + "limit": 10, + "offset": 0, + "q": ["history_content_type", "tag-contains"], + "qv": ["dataset", "new_tag"], + "history_id": history_id, + } + index_response = self._get("datasets", payload).json() + assert len(index_response) == 1 + payload = { + "limit": 10, + "offset": 0, + "q": ["history_content_type", "tag-contains"], + "qv": ["dataset", "notag"], + "history_id": history_id, + } + index_response = self._get("datasets", payload).json() + assert len(index_response) == 0 + def test_search_by_tool_id(self): self.dataset_populator.new_dataset(self.history_id) payload = { From 59de798d984b0c1020638b6a49b68e84c9a942a7 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 21 Jun 2022 11:14:19 +0200 Subject: [PATCH 2/6] Make tag equals filter case insensitive --- lib/galaxy/managers/taggable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/managers/taggable.py b/lib/galaxy/managers/taggable.py index 9a6377ecf2b7..f2fb8a66675e 100644 --- a/lib/galaxy/managers/taggable.py +++ b/lib/galaxy/managers/taggable.py @@ -122,9 +122,9 @@ def _create_tag_filter(model_class=None): if ":" not in val: # We require an exact match and the tag to look for has no user_value, # so we can't just concatenate user_tname, ':' and user_vale - cond = target_model.table.c.user_tname == val + cond = target_model.table.c.user_tname.ilike(val) else: - cond = column == val + cond = column.ilike(val) else: cond = column.contains(val, autoescape=True) return sql.expression.and_(model_class.table.c.id == getattr(target_model.table.c, id_column), cond) From d08aa07751159e5fbefc8a7d40d971f873ec8b3d Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 21 Jun 2022 13:43:53 +0200 Subject: [PATCH 3/6] Replace `ilike` with `lower` Co-authored-by: Marius van den Beek --- lib/galaxy/managers/taggable.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/managers/taggable.py b/lib/galaxy/managers/taggable.py index f2fb8a66675e..196f1df7ac93 100644 --- a/lib/galaxy/managers/taggable.py +++ b/lib/galaxy/managers/taggable.py @@ -7,7 +7,10 @@ import logging from typing import Type -from sqlalchemy import sql +from sqlalchemy import ( + func, + sql, +) from galaxy import model from galaxy.model.tags import GalaxyTagHandler @@ -118,15 +121,16 @@ def _create_tag_filter(model_class=None): target_model = getattr(model, f"{class_name}TagAssociation") id_column = f"{target_model.table.name.rsplit('_tag_association')[0]}_id" column = target_model.table.c.user_tname + ":" + target_model.table.c.user_value + lower_val = val.lower() # Ignore case if op == "eq": - if ":" not in val: + if ":" not in lower_val: # We require an exact match and the tag to look for has no user_value, # so we can't just concatenate user_tname, ':' and user_vale - cond = target_model.table.c.user_tname.ilike(val) + cond = func.lower(target_model.table.c.user_tname) == lower_val else: - cond = column.ilike(val) + cond = func.lower(column) == lower_val else: - cond = column.contains(val, autoescape=True) + cond = func.lower(column).contains(lower_val, autoescape=True) return sql.expression.and_(model_class.table.c.id == getattr(target_model.table.c, id_column), cond) return _create_tag_filter From 130b17427f013a779ee0afe39087108a600c9840 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 21 Jun 2022 10:49:17 -0400 Subject: [PATCH 4/6] Place progressbar below collection name, allow full width --- .../src/components/History/Content/ContentItem.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/components/History/Content/ContentItem.vue b/client/src/components/History/Content/ContentItem.vue index f591ea45468d..2d74c56d2312 100644 --- a/client/src/components/History/Content/ContentItem.vue +++ b/client/src/components/History/Content/ContentItem.vue @@ -46,12 +46,6 @@ {{ id }} : {{ name }} - + Date: Tue, 21 Jun 2022 12:18:47 -0400 Subject: [PATCH 5/6] Start counting collection elements at 1 not 0 --- .../components/History/CurrentCollection/CollectionPanel.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/History/CurrentCollection/CollectionPanel.vue b/client/src/components/History/CurrentCollection/CollectionPanel.vue index fdda4fd5dcdf..3977d89036f9 100644 --- a/client/src/components/History/CurrentCollection/CollectionPanel.vue +++ b/client/src/components/History/CurrentCollection/CollectionPanel.vue @@ -23,7 +23,7 @@