From 19f7dd6d91b7f13a8e00e338e19c06029f4308dc Mon Sep 17 00:00:00 2001 From: wmh <3303710797@qq.com> Date: Mon, 4 Nov 2024 10:57:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E9=A6=96=E9=A1=B5=E6=8F=90?= =?UTF-8?q?=E5=8D=95=E4=BF=AE=E5=A4=8D=20(#1697)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webfe/package_vue/src/language/lang/en.js | 2 + webfe/package_vue/src/language/lang/zh.js | 2 + .../package_vue/src/store/modules/service.js | 8 ++ .../home/home-content/alarm-records.vue | 87 ++++++++++-- .../home/home-content/idle-app-dashboard.vue | 126 ++++++++++++------ .../dev-center/home/home-content/index.vue | 24 ++-- 6 files changed, 193 insertions(+), 56 deletions(-) diff --git a/webfe/package_vue/src/language/lang/en.js b/webfe/package_vue/src/language/lang/en.js index 7cd2255e00..8d2e504542 100644 --- a/webfe/package_vue/src/language/lang/en.js +++ b/webfe/package_vue/src/language/lang/en.js @@ -2855,4 +2855,6 @@ export default { '太棒了!': 'Awesome!', 慢查询告警数量: 'Number of slow query alerts', 告警内容: 'Alarm content', + 慢查询记录: 'Slow query records', + 'GCS-MySQL 增强服务实例已解绑,无法再查看慢查询记录': 'The GCS-MySQL Add-ons instance has been unbound, and slow query records can no longer be viewed', }; diff --git a/webfe/package_vue/src/language/lang/zh.js b/webfe/package_vue/src/language/lang/zh.js index 86006f2ddb..cfe879d8be 100644 --- a/webfe/package_vue/src/language/lang/zh.js +++ b/webfe/package_vue/src/language/lang/zh.js @@ -2992,4 +2992,6 @@ export default { '太棒了!': '太棒了!', 慢查询告警数量: '慢查询告警数量', 告警内容: '告警内容', + 慢查询记录: '慢查询记录', + 'GCS-MySQL 增强服务实例已解绑,无法再查看慢查询记录': 'GCS-MySQL 增强服务实例已解绑,无法再查看慢查询记录', }; diff --git a/webfe/package_vue/src/store/modules/service.js b/webfe/package_vue/src/store/modules/service.js index 2dbf76e282..005e53d195 100644 --- a/webfe/package_vue/src/store/modules/service.js +++ b/webfe/package_vue/src/store/modules/service.js @@ -145,5 +145,13 @@ export default { const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/services/${service}/`; return http.get(url, {}, config); }, + + /** + * 获取应用增强服务信息 + */ + getServiceInfo({}, { appCode, moduleId }, config = {}) { + const url = `${BACKEND_URL}/api/bkapps/applications/${appCode}/modules/${moduleId}/services/info/`; + return http.get(url, {}, config); + }, }, }; diff --git a/webfe/package_vue/src/views/dev-center/home/home-content/alarm-records.vue b/webfe/package_vue/src/views/dev-center/home/home-content/alarm-records.vue index 3c3fb27319..b4f585a4cd 100644 --- a/webfe/package_vue/src/views/dev-center/home/home-content/alarm-records.vue +++ b/webfe/package_vue/src/views/dev-center/home/home-content/alarm-records.vue @@ -73,16 +73,23 @@ @@ -97,7 +104,10 @@ class="app-name-wrapper" v-bk-overflow-tips="{ content: `${row.application.name}(${row.application.code})` }" > - + - MySQL {{ $t('慢查询告警数量') }}: {{ row.slow_query_count }}/{{ row.count }} + MySQL {{ $t('慢查询告警数量') }}: + {{ row.slow_query_count }} + / + {{ row.count }} @@ -154,8 +167,14 @@ export default { expandRowKeys: [], slowQueryCount: 0, selectionTime: {}, + errorMessage: this.$t('GCS-MySQL 增强服务实例已解绑,无法再查看慢查询记录'), }; }, + computed: { + localLanguage() { + return this.$store.state.localLanguage; + }, + }, created() { dayjs.extend(relativeTime); bus.$on('home-date', (time) => { @@ -247,6 +266,53 @@ export default { handleDetail(row) { window.open(row.detail_link, '_blank'); }, + // 处理慢查询页面跳转 + handleSlowQuery(row, childRow) { + const params = { + appCode: row.application.code, + moduleId: childRow?.module_name || 'default', + }; + this.getServiceInfo(params, childRow.env); + }, + async getServiceInfo(params, env) { + try { + const GCS_MYSQL_NAME = 'gcs_mysql'; + const res = await this.$store.dispatch('service/getServiceInfo', params); + const services = res[env]; + if (!services.length) { + this.$paasMessage({ + theme: 'error', + message: this.errorMessage, + }); + return; + } + // 服务服务id + const serviceId = services?.find((v) => v.name === GCS_MYSQL_NAME)?.service_id; + this.getServiceInstances(params, serviceId); + } catch (e) { + this.catchErrorHandler(e); + } + }, + // 获取服务实例详情 + async getServiceInstances(params, serviceId) { + try { + const res = await this.$store.dispatch('service/getServiceInstances', { + ...params, + service: serviceId, + }); + if (!res.results.length) { + this.$paasMessage({ + theme: 'error', + message: this.errorMessage, + }); + return; + } + const url = `${res.results[0].service_instance?.config?.admin_url}&redirect_url=instance.slow_sql.fingers.list`; + window.open(url, '_blank'); + } catch (e) { + this.catchErrorHandler(e); + } + }, }, }; @@ -274,10 +340,10 @@ export default { color: #3a84ff; } .msg { - color: #63656E; + color: #63656e; } .slow-query { - color: #EA3636; + color: #ea3636; } } } @@ -297,8 +363,13 @@ export default { .bk-table-expand-icon .bk-icon { color: #979ba5; } - .child-module-table-cls .bk-table-header-wrapper { - display: none; + .child-module-table-cls { + .bk-table-header-wrapper { + display: none; + } + .bk-table-body-wrapper { + color: #63656e; + } } .env-column-cls .cell { display: flex; diff --git a/webfe/package_vue/src/views/dev-center/home/home-content/idle-app-dashboard.vue b/webfe/package_vue/src/views/dev-center/home/home-content/idle-app-dashboard.vue index af650fde34..47c6ea8579 100644 --- a/webfe/package_vue/src/views/dev-center/home/home-content/idle-app-dashboard.vue +++ b/webfe/package_vue/src/views/dev-center/home/home-content/idle-app-dashboard.vue @@ -1,5 +1,8 @@