From 3ecdf5ebd9a908be9dc48ee414758b6e425207ca Mon Sep 17 00:00:00 2001 From: Hu gang <18768366022@163.com> Date: Fri, 22 Dec 2023 10:45:31 +0800 Subject: [PATCH] feat: add host related information (cherry picked from commit bb9a51fbc16fe100a769cbdc121d9ffd030096eb) --- 006-host-status-adaption.patch | 261 ++++++++++++++++++++++++++ 007-host-info-and-generate-task.patch | 146 ++++++++++++++ aops-hermes.spec | 11 +- 3 files changed, 416 insertions(+), 2 deletions(-) create mode 100644 006-host-status-adaption.patch create mode 100644 007-host-info-and-generate-task.patch diff --git a/006-host-status-adaption.patch b/006-host-status-adaption.patch new file mode 100644 index 0000000..195dfa0 --- /dev/null +++ b/006-host-status-adaption.patch @@ -0,0 +1,261 @@ +From 47aaab21d6606f27d6117eb53034f6c2c5f3edf3 Mon Sep 17 00:00:00 2001 +From: Hu gang <18768366022@163.com> +Date: Wed, 20 Dec 2023 19:26:33 +0800 +Subject: [PATCH] fix: host status adaptation + +--- + src/api/leaks.js | 3 +- + src/vendor/ant-design-pro/utils/request.js | 6 ++++ + src/views/assests/HostDetail.vue | 34 +++++++------------ + .../assests/components/HostBasicInfo.vue | 4 +-- + .../assests/components/HostChartInfo.vue | 33 +++++++----------- + src/views/leaks/CVEsDetail.vue | 21 +++++------- + src/views/leaks/LeakTaskDetail.vue | 3 +- + src/views/leaks/components/HostTable.vue | 12 +++---- + 8 files changed, 49 insertions(+), 67 deletions(-) + +diff --git a/src/api/leaks.js b/src/api/leaks.js +index c6f704b..da3fbf8 100644 +--- a/src/api/leaks.js ++++ b/src/api/leaks.js +@@ -347,6 +347,7 @@ export function setCveStatus({cveList, status}) { + } + + export function getHostUnderCVE({tableInfo, ...parameter}) { ++ const repoList = tableInfo.filters.repo ? tableInfo.filters.repo.map((v) => (v === '' ? null : v)) : null; + return request({ + url: api.getHostUnderCVE, + method: 'post', +@@ -358,7 +359,7 @@ export function getHostUnderCVE({tableInfo, ...parameter}) { + fixed: tableInfo.fixed, + host_name: tableInfo.filters.host_name === null ? undefined : tableInfo.filters.host_name, + host_group: tableInfo.filters.host_group === null ? undefined : tableInfo.filters.host_group, +- repo: tableInfo.filters.repo === null ? undefined : tableInfo.filters.repo, ++ repo: repoList === null ? undefined : repoList, + last_scan: tableInfo.filters.last_scan + }, + page: tableInfo.pagination.current, +diff --git a/src/vendor/ant-design-pro/utils/request.js b/src/vendor/ant-design-pro/utils/request.js +index 11be85a..36615ad 100644 +--- a/src/vendor/ant-design-pro/utils/request.js ++++ b/src/vendor/ant-design-pro/utils/request.js +@@ -165,6 +165,12 @@ request.interceptors.response.use((response) => { + }); + }); + return retryRequest; ++ case '1108': ++ notification.error({ ++ message: '暂无指标数据!', ++ description: response.data.message ++ }); ++ break; + default: + notification.error({ + message: response.data.label, +diff --git a/src/views/assests/HostDetail.vue b/src/views/assests/HostDetail.vue +index 6eadb05..ea08cfa 100644 +--- a/src/views/assests/HostDetail.vue ++++ b/src/views/assests/HostDetail.vue +@@ -49,30 +49,20 @@ export default { + }; + }, + methods: { +- fetchHostInfo() { ++ async fetchHostInfo() { + this.basicHostInfoIsLoading = true; +- getHostDetail(Number(this.hostId), true) +- .then((res) => { +- this.basicHostInfo = res.data.host_infos[0]; +- this.scene = this.basicHostInfo.scene; +- }) +- .catch((err) => { +- this.$message.error(err.response.message); +- }) +- .finally(() => { +- this.basicHostInfoIsLoading = false; +- }); + this.basicInfoIsLoading = true; +- getHostDetail(Number(this.hostId), false) +- .then((res) => { +- this.basicInfo = res.data.host_infos[0]; +- }) +- .catch((err) => { +- this.$message.error(err.response.message); +- }) +- .finally(() => { +- this.basicInfoIsLoading = false; +- }); ++ const basicHostRes = await getHostDetail(Number(this.hostId), true); ++ if (basicHostRes) { ++ this.basicHostInfo = basicHostRes.data.host_infos[0]; ++ this.scene = this.basicHostInfo.scene; ++ } ++ const basicRes = await getHostDetail(Number(this.hostId), false); ++ if (basicRes) { ++ this.basicInfo = basicRes.data.host_infos[0]; ++ } ++ this.basicInfoIsLoading = false; ++ this.basicHostInfoIsLoading = false; + }, + reFetchHostInfo() { + this.fetchHostInfo(); +diff --git a/src/views/assests/components/HostBasicInfo.vue b/src/views/assests/components/HostBasicInfo.vue +index bab1074..9909e44 100644 +--- a/src/views/assests/components/HostBasicInfo.vue ++++ b/src/views/assests/components/HostBasicInfo.vue +@@ -235,6 +235,7 @@ export default { + getDetail() { + let data = this.basicInfo; + data = data.host_info; ++ this.basicInfo.status !== null && (this.status = this.basicInfo.status); + for (const member in data.os) { + this.os[member] = data.os[member] || '暂无'; + } +@@ -257,8 +258,7 @@ export default { + this.detailIcon = 'up'; + } + } +- }, +- mounted() {} ++ } + }; + + +diff --git a/vue.config.js b/vue.config.js +index 402e69c..61c5a37 100644 +--- a/vue.config.js ++++ b/vue.config.js +@@ -26,8 +26,8 @@ function getGitHash() { + + const serverMap = { + // serverIpBase: 'http://127.0.0.1' +- // serverIpBase: 'http://172.168.61.81' +- serverIpBase: 'http://172.168.235.132' ++ // serverIpBase: 'http://172.168.235.132' ++ serverIpBase: 'http://172.168.97.229' + }; + + // vue.config.js +-- +Gitee diff --git a/aops-hermes.spec b/aops-hermes.spec index 09344d2..52afd1e 100644 --- a/aops-hermes.spec +++ b/aops-hermes.spec @@ -2,7 +2,7 @@ Name: aops-hermes Version: v1.4.0 -Release: 3 +Release: 4 Summary: Web for an intelligent diagnose frame License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} @@ -13,7 +13,8 @@ Patch002: 002-fix-hotpatch-remove-filter.patch Patch003: 003-change-search-placeholder.patch Patch004: 004-modify-search-key-for-hostlist.patch Patch005: 005-add-input-text-limit.patch - +Patch006: 006-host-status-adaption.patch +Patch007: 007-host-info-and-generate-task.patch BuildRequires: nodejs node-gyp nodejs-yarn Requires: nginx @@ -48,6 +49,12 @@ cp -r deploy/aops-hermes.service %{buildroot}/usr/lib/systemd/system/ %changelog +* Fri Dec 22 2023 Hu gang<18768366022@163.com> - v1.4.0-4 +- Added an interface adaptation for host status +- Added a field to determine whether the kernel changes after the host is restarted +- Added a new hot patch prompt for creating a repair task +- Fix some bug + * Tue Dec 19 2023 Hu gang<18768366022@163.com> - v1.4.0-3 - Add imput text limit