Skip to content

Commit

Permalink
Merge pull request #1415 from b1ngsha/develop
Browse files Browse the repository at this point in the history
 feat: IAM反向查询项目资源支持按名称查询 --story=119726965
  • Loading branch information
benero authored Sep 29, 2024
2 parents bc34885 + 508c155 commit 4f651ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions itsm/auth_iam/resources/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ def fetch_instance_info(self, filter, **options):

def search_instance(self, filter, page, **options):
"""
项目暂时不支持任何搜索
根据项目名称进行搜索,同时匹配 key 和 name 字段
"""
queryset = self.queryset.filter(key__contains=filter.keyword)
queryset = self.queryset.filter(
Q(name__icontains=filter.keyword) | Q(key__icontains=filter.keyword)
)
count = queryset.count()
results = [
{"id": project.key, "display_name": project.name}
Expand Down

0 comments on commit 4f651ab

Please sign in to comment.