Skip to content

Commit

Permalink
feat: support config name search (#1430)
Browse files Browse the repository at this point in the history
* feat: support config name search

* feat: support config name search

* :wq
  • Loading branch information
DokiDoki1103 authored Jan 17, 2024
1 parent faf7262 commit 7b59e98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions console/services/app_config/mnt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def get_service_mnt_details(self, tenant, service, volume_types, page=1, page_si
})
return mounted_dependencies, total

def get_service_unmount_volume_list(self, tenant, service, service_ids, page, page_size, is_config, dep_app_group):
def get_service_unmount_volume_list(self, tenant, service, service_ids, page, page_size, is_config, dep_app_group,
config_name):
"""
1. 获取租户下其他所有组件列表,方便后续进行名称的冗余
2. 获取其他组件的所有可共享的存储
Expand Down Expand Up @@ -98,7 +99,8 @@ def get_service_unmount_volume_list(self, tenant, service, service_ids, page, pa
gs_rel = group_service_relation_repo.get_group_by_service_id(volume.service_id)
group = group_repo.get_group_by_pk(tenant.tenant_id, service.service_region, gs_rel.group_id)
group_name = group.group_name if group else '未分组'
if dep_app_group == "" or dep_app_group == group_name:
if (dep_app_group == "" or dep_app_group == group_name) and (config_name == "" or config_name in volume.volume_name
or config_name in volume.volume_path):
un_mount_dependencies.append({
"dep_app_name": services.get(service_id=volume.service_id).service_cname,
"dep_app_group": group_name,
Expand Down
3 changes: 2 additions & 1 deletion console/views/app_config/app_mnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def get(self, request, *args, **kwargs):
dep_app_group = request.GET.get("dep_app_group", "")
if dep_app_group == "undefined":
dep_app_group = ""
config_name = request.GET.get("config_name", "")
query_type = request.GET.get("type", "mnt")
page = request.GET.get("page", 1)
page_size = request.GET.get("page_size", 10)
Expand All @@ -72,7 +73,7 @@ def get(self, request, *args, **kwargs):
services = app_service.get_app_list(self.tenant.tenant_id, self.service.service_region, dep_app_name)
services_ids = [s.service_id for s in services]
mnt_list, total = mnt_service.get_service_unmount_volume_list(self.tenant, self.service, services_ids, page,
page_size, is_config, dep_app_group)
page_size, is_config, dep_app_group, config_name)
else:
return Response(general_message(400, "param error", "参数错误"), status=400)
result = general_message(200, "success", "查询成功", list=mnt_list, total=total)
Expand Down

0 comments on commit 7b59e98

Please sign in to comment.