!166 [sync] PR-162: 只执行热补丁的提示只有在点击立即执行的时候会显示,增加了一个任务详情cve过长隐藏

From: @openeuler-sync-bot 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
This commit is contained in:
openeuler-ci-bot 2024-01-17 07:19:11 +00:00 committed by Gitee
commit 746c07f253
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 164 additions and 1 deletions

View File

@ -0,0 +1,158 @@
From a554b248224e1d4ab8030cb3c353eb835ed654ce Mon Sep 17 00:00:00 2001
From: Hu gang <18768366022@163.com>
Date: Tue, 26 Dec 2023 16:54:57 +0800
Subject: [PATCH] fix: hot patch prompts are only executed if executed
immediately
---
.../assests/components/HostChartInfo.vue | 2 +-
src/views/leaks/LeakTaskDetail.vue | 44 +++++++++++++++++--
.../components/CreateRepairTaskDrawer.vue | 7 ++-
3 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/src/views/assests/components/HostChartInfo.vue b/src/views/assests/components/HostChartInfo.vue
index d9e8fe7..8a144d8 100644
--- a/src/views/assests/components/HostChartInfo.vue
+++ b/src/views/assests/components/HostChartInfo.vue
@@ -124,7 +124,7 @@ export default {
getHostMetrics({
query_ip: this.queryIp
}).then((res) => {
- if (res) {
+ if (res.data) {
this.metrics = res.data.results;
if (this.selectedMetrics.length < 1) {
this.selectedMetrics = res.data.results.slice(0, 4);
diff --git a/src/views/leaks/LeakTaskDetail.vue b/src/views/leaks/LeakTaskDetail.vue
index 134a0cb..38bc4f2 100644
--- a/src/views/leaks/LeakTaskDetail.vue
+++ b/src/views/leaks/LeakTaskDetail.vue
@@ -170,7 +170,12 @@
</span>
</div>
<div v-if="['cve fix', 'cve rollback'].includes(taskType)" slot="expandedRowRender" slot-scope="record">
- <a-table rowKey="id" :columns="innerColumns" :data-source="record.rpms || []" :pagination="false">
+ <a-table
+ :rowKey="(innerrecord) => innerrecord.installed_rpm + innerrecord[rpmTypeMap[taskType]]"
+ :columns="innerColumns"
+ :data-source="record.rpms || []"
+ :pagination="false"
+ >
<div slot="status" slot-scope="status">
<span>
<a-badge :status="statusValueMap[status]" />
@@ -184,6 +189,14 @@
<a-icon v-if="statusValueMap[status] === 'processing'" type="loading" class="color-running-circle" />
</span>
</div>
+ <div slot="cves" slot-scope="cves" class="cve-text">
+ <a-popover placement="topLeft">
+ <template slot="content">
+ <p class="cve-text-pop">{{ cves }}</p>
+ </template>
+ {{ cves }}
+ </a-popover>
+ </div>
</a-table>
</div>
</a-table>
@@ -257,6 +270,12 @@ const rowKeyMap = {
'hotpatch remove': 'cve_id'
};
+// rpm类型与任务类型映射关系
+const rpmTypeMap = {
+ 'cve fix': 'available_rpm',
+ 'cve rollback': 'target_rpm'
+};
+
const cveStatusTextMap = {
succeed: '修复成功',
fail: '待修复',
@@ -345,10 +364,12 @@ export default {
taskTypeMap,
rowKeyMap,
statusValueMap,
+ rpmTypeMap,
// rpm列表是否为展开状态
isRpmTableExtend: false,
isRollbackModelvisible: false,
countDown: 0,
+ // 创建的回滚任务id
rollbackTaskId: '',
jumpModalInterval: null,
// 详情页面下要执行任务的所有主机
@@ -467,15 +488,16 @@ export default {
title: taskType === 'cve fix' ? '受影响rpm' : '已安装rpm'
},
{
- dataIndex: taskType === 'cve fix' ? 'available_rpm' : 'target_rpm',
- key: taskType === 'cve fix' ? 'available_rpm' : 'target_rpm',
+ dataIndex: rpmTypeMap[taskType],
+ key: rpmTypeMap[taskType],
title: taskType === 'cve fix' ? '待安装rpm' : '目标rpm',
scopedSlots: {customRender: 'rpm'}
},
{
dataIndex: 'cves',
key: 'cves',
- title: 'CVE'
+ title: 'CVE',
+ scopedSlots: {customRender: 'cves'}
},
{
dataIndex: 'status',
@@ -1166,4 +1188,18 @@ export default {
border-radius: 3px;
padding: 4px 6px 20px;
}
+.cve-text {
+ max-width: 300px;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ &-pop {
+ max-width: 500px;
+ display: -webkit-box;
+ -webkit-line-clamp: 25;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+}
</style>
diff --git a/src/views/leaks/components/CreateRepairTaskDrawer.vue b/src/views/leaks/components/CreateRepairTaskDrawer.vue
index 30efbe5..b7e4424 100644
--- a/src/views/leaks/components/CreateRepairTaskDrawer.vue
+++ b/src/views/leaks/components/CreateRepairTaskDrawer.vue
@@ -207,7 +207,9 @@
>点击跳转到{{ item.fix_way }}{{ taskType === 'cve fix' ? '修复' : '移除' }}任务页面</a
>
</p>
- <p v-if="jumpTaskId.length > 1">只执行热补丁任务,冷补丁任务需手动执行</p>
+ <p v-if="jumpTaskId.length > 1">
+ {{ isExcuteASAP ? '已自动执行热补丁任务,冷补丁任务需手动执行' : '请优先执行热补丁任务' }}
+ </p>
<p>{{ countDown }}秒后回到原页面</p>
</a-col>
</a-row>
@@ -307,6 +309,8 @@ export default {
},
data() {
return {
+ // 是否立即执行
+ isExcuteASAP: false,
hostListparams: [],
fixParams: {},
// 修复任务入参
@@ -788,6 +792,7 @@ export default {
}
},
handleSubmit(excuteASAP = false) {
+ this.isExcuteASAP = excuteASAP;
const _this = this;
this.form.validateFields((err, values) => {
if (!err) {
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: aops-hermes Name: aops-hermes
Version: v1.4.0 Version: v1.4.0
Release: 5 Release: 6
Summary: Web for an intelligent diagnose frame Summary: Web for an intelligent diagnose frame
License: MulanPSL2 License: MulanPSL2
URL: https://gitee.com/openeuler/%{name} URL: https://gitee.com/openeuler/%{name}
@ -16,6 +16,8 @@ Patch005: 005-add-input-text-limit.patch
Patch006: 006-host-status-adaption.patch Patch006: 006-host-status-adaption.patch
Patch007: 007-host-info-and-generate-task.patch Patch007: 007-host-info-and-generate-task.patch
Patch008: 008-fix-diagnosis.patch Patch008: 008-fix-diagnosis.patch
Patch009: 009-fix-hot-patch-prompts-are-only-executed-if-executed.patch
BuildRequires: nodejs node-gyp nodejs-yarn BuildRequires: nodejs node-gyp nodejs-yarn
Requires: nginx Requires: nginx
@ -50,6 +52,9 @@ cp -r deploy/aops-hermes.service %{buildroot}/usr/lib/systemd/system/
%changelog %changelog
* Wed Dec 27 2023 Hu gang<18768366022@163.com> - v1.4.0-6
- Fix hot patch prompts are only executed ifexecuted
* Fri Dec 22 2023 Hu gang<18768366022@163.com> - v1.4.0-5 * Fri Dec 22 2023 Hu gang<18768366022@163.com> - v1.4.0-5
- Fix diagnosis - Fix diagnosis