Skip to content

Commit

Permalink
feat(backend): 仪表盘隐藏 app 选择参数 TencentBlueKing#8332
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Dec 2, 2024
1 parent 4658332 commit a36d717
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions dbm-ui/backend/bk_dataview/dashboards/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,9 @@ cd backend/bk_dataview/dashboards/json
find . -type f -name "*.json" -exec sed -i '' -e 's#"url": "\(.*\)/grafana/\(.*\)orgId=[0-9]*\(.*\)"#"url": "{BK_SAAS_HOST}/grafana/\2orgId=1\3"#' {} \;
```


# 这里按需隐藏变量,不暴露所有变量
templating.list.hide 设置为 2,这里一般把需暴露出来的变量设置为 0,不暴露的设置为 2

# 替换 datasource 为 bkmonitor_timeseries 或者 bklog
templating.list.datasource.uid 设置为 bkmonitor_timeseries 或者 bklog
同步程序会自动把 app 变量隐藏


# 导入监控的方法,还原模板后导入
Expand Down
3 changes: 3 additions & 0 deletions dbm-ui/backend/bk_dataview/grafana/provisioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def replace_dashboard(cls, dashboard: dict, used_index_name: list, index_name_id
datasource_type, tpl_uid = cls.get_obj_datasource_type_uid(tpl)
if datasource_type:
dashboard["templating"]["list"][tpl_index]["datasource"]["uid"] = tpl_uid
# 隐藏掉 app(业务)选择器
if tpl["name"] == "app":
dashboard["templating"]["list"][tpl_index]["hide"] = 2

return dashboard

Expand Down

0 comments on commit a36d717

Please sign in to comment.