Skip to content

Commit

Permalink
feat(backend): 全局检索接口优化 #2827
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Dec 26, 2023
1 parent 2a5cf9a commit b21f86c
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 14 deletions.
20 changes: 13 additions & 7 deletions dbm-ui/backend/bk_dataview/datasources/bk_monitor_datasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ datasources:
keepCookies:
- bk_uid
baseUrl: ${BKMONITOR_URL}/rest/v2/grafana/
# - name: 日志平台
# type: bk_log_datasource
# access: direct
# isDefault: false
# url: ""
# jsonData:
# baseUrl: ${BKMONITOR_URL}/rest/v2/grafana/bk_log_search/
- name: 日志平台
type: bk_log_datasource
access: proxy
isDefault: false
url: ""
secureJsonData:
token: ${BKM_DBM_TOKEN}
jsonData:
bizId: ${DBA_APP_BK_BIZ_ID}
useToken: true
keepCookies:
- bk_uid
baseUrl: ${BKMONITOR_URL}/rest/v2/grafana/bk_log_search/
1 change: 1 addition & 0 deletions dbm-ui/backend/db_services/quick_search/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ResourceType(str, StructuredEnum):
TICKET = EnumField("ticket", _("单号"))
TASK = EnumField("task", _("任务"))
MACHINE = EnumField("machine", _("主机"))
RESOURCE_POOL = EnumField("resource_pool", _("资源池主机"))


class FilterType(str, StructuredEnum):
Expand Down
4 changes: 4 additions & 0 deletions dbm-ui/backend/db_services/quick_search/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from django.db.models import F, Q
from django.forms import model_to_dict

from backend.components.dbresource.client import DBResourceApi
from backend.db_meta.enums import ClusterType
from backend.db_meta.models import Cluster, Machine, ProxyInstance, StorageInstance
from backend.db_services.quick_search.constants import FilterType, ResourceType
Expand Down Expand Up @@ -205,3 +206,6 @@ def filter_ticket(self, keyword_list: list):
"id", "creator", "create_at", "bk_biz_id", "ticket_type", "group", "status", "is_reviewed"
)
)

def filter_resource_pool(self, keyword_list: list):
return DBResourceApi.resource_list({"hosts": keyword_list, "limit": self.limit, "offset": 0})["details"]
3 changes: 2 additions & 1 deletion dbm-ui/backend/utils/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ def response(cls, wb: Workbook, excel_name: str) -> HttpResponse:
# 设置response格式并写入bytes
response = HttpResponse(
content=save_virtual_workbook(wb),
content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
content_type="application/octet-stream",
)
response["Content-Disposition"] = f"attachment;filename={excel_name}"
response["Access-Control-Expose-Headers"] = "content-disposition"
return response

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/bk-dbm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ dependencies:
description: A Helm chart for bk-dbm
name: bk-dbm
type: application
version: 1.3.0-alpha.30
appVersion: 1.3.0-alpha.30
version: 1.3.0-alpha.31
appVersion: 1.3.0-alpha.31
2 changes: 1 addition & 1 deletion helm-charts/bk-dbm/charts/backup-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 0.0.1-alpha.46
appVersion: 0.0.1-alpha.47
description: A Helm chart for backup-server
name: backup-server
type: application
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/bk-dbm/charts/db-resource/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 0.0.1-alpha.80
appVersion: 0.0.1-alpha.81
description: A Helm chart for Kubernetes
name: db-resource
type: application
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/bk-dbm/charts/dbm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 1.3.0-alpha.231
appVersion: 1.3.0-alpha.237
description: A Helm chart for dbm
name: dbm
type: application
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/bk-dbm/charts/hadb-api/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ name: hadb-api
description: A Helm chart for Kubernetes
type: application
version: 0.0.11
appVersion: 0.0.1-alpha.25
appVersion: 0.0.1-alpha.26

0 comments on commit b21f86c

Please sign in to comment.