Skip to content

Commit c5cfcde

Browse files
xingzhang-suselsongsuse
authored andcommitted
[Bug] The list style of Security event page is broken (Additional fix on the popups)
1 parent 1b92405 commit c5cfcde

9 files changed

Lines changed: 133 additions & 58 deletions

File tree

pkg/neuvector-ui-ext/components/SecurityEvents/SecurityEventsView.vue

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@
6666
autoCompleteData: null,
6767
},
6868
securityEventsDataCtx: null,
69-
showPacketModal: null,
70-
packet: null,
71-
showHostInfoModal: null,
72-
host: null,
73-
showWorkloadInfoModal: null,
74-
workload: null,
75-
showEnforcerInfoModal: null,
76-
enforcer: null,
77-
showAdvFilterModal: null,
7869
errorRes: null,
7970
};
8071
},
@@ -93,15 +84,6 @@
9384
this.securityEventsDataCtx = secEventVar.dateSliderCtx.value;
9485
prepareContext4TwoWayInfinityScroll(this.securityEventsDataCtx);
9586
console.log('this.securityEventsDataCtx', this.securityEventsDataCtx)
96-
this.showPacketModal = nvVariables.showPacketModal;
97-
this.packet = nvVariables.packet;
98-
this.showHostInfoModal = nvVariables.showHostInfoModal;
99-
this.host = nvVariables.host;
100-
this.showWorkloadInfoModal = nvVariables.showWorkloadInfoModal;
101-
this.workload = nvVariables.workload;
102-
this.showEnforcerInfoModal = nvVariables.showEnforcerInfoModal;
103-
this.enforcer = nvVariables.enforcer;
104-
this.showAdvFilterModal = nvVariables.showAdvFilterModal;
10587
filterSecEvents();
10688
} catch(error) {
10789
console.error(error);
@@ -128,25 +110,49 @@
128110
return e[0].scrollWidth <= e[0].clientWidth;
129111
},
130112
closePacketModal: function() {
131-
this.showPacketModal.value = false;
113+
nvVariables.showPacketModal.value = false;
132114
},
133115
closeHostInfoModal: function() {
134-
this.showHostInfoModal.value = false;
116+
nvVariables.showHostInfoModal.value = false;
135117
},
136118
closeWorkloadInfoModal: function() {
137-
this.showWorkloadInfoModal.value = false;
119+
nvVariables.showWorkloadInfoModal.value = false;
138120
},
139121
closeEnforcerInfoModal: function() {
140-
this.showEnforcerInfoModal.value = false;
122+
nvVariables.showEnforcerInfoModal.value = false;
141123
},
142124
closeAdvFilterModal: function() {
143-
this.showAdvFilterModal.value = false;
125+
nvVariables.showAdvFilterModal.value = false;
144126
}
145127
},
146128
computed: {
147129
isLightTheme: function() {
148130
nvVariables.isLightTheme = sessionStorage.getItem(RANCHER_CONST.R_THEME) !== RANCHER_CONST.THEME.DARK;
149131
return nvVariables.isLightTheme;
132+
},
133+
packetModalVisible: function() {
134+
return nvVariables.showPacketModal.value;
135+
},
136+
packetData: function() {
137+
return nvVariables.packet.value;
138+
},
139+
hostInfoModalVisible: function() {
140+
return nvVariables.showHostInfoModal.value;
141+
},
142+
hostData: function() {
143+
return nvVariables.host.value;
144+
},
145+
workloadInfoModalVisible: function() {
146+
return nvVariables.showWorkloadInfoModal.value;
147+
},
148+
workloadData: function() {
149+
return nvVariables.workload.value;
150+
},
151+
enforcerInfoModalVisible: function() {
152+
return nvVariables.showEnforcerInfoModal.value;
153+
},
154+
enforcerData: function() {
155+
return nvVariables.enforcer.value;
150156
}
151157
},
152158
directives: {
@@ -195,6 +201,7 @@
195201
<TimeSparklingChart
196202
v-if="processedSecEvents.cachedSecurityEvents"
197203
:securityEventsList="processedSecEvents.cachedSecurityEvents"
204+
:height="70"
198205
/>
199206
<TimeSlider
200207
:securityEventsList="processedSecEvents.cachedSecurityEvents"
@@ -251,10 +258,10 @@
251258
</div>
252259
</li>
253260
</ul>
254-
<Packet v-if="showPacketModal && showPacketModal.value" :packet="packet.value" @close="closePacketModal"></Packet>
255-
<NodeInfo v-if="showHostInfoModal && showHostInfoModal.value" :host="host.value" @close="closeHostInfoModal"></NodeInfo>
256-
<PodInfo v-if="showWorkloadInfoModal && showWorkloadInfoModal.value" :workload="workload.value" @close="closeWorkloadInfoModal"></PodInfo>
257-
<EnforcerInfo v-if="showEnforcerInfoModal && showEnforcerInfoModal.value" :enforcer="enforcer.value" @close="closeEnforcerInfoModal"></EnforcerInfo>
261+
<Packet v-if="packetModalVisible" :packet="packetData" @close="closePacketModal"></Packet>
262+
<NodeInfo v-if="hostInfoModalVisible" :host="hostData" @close="closeHostInfoModal"></NodeInfo>
263+
<PodInfo v-if="workloadInfoModalVisible" :workload="workloadData" @close="closeWorkloadInfoModal"></PodInfo>
264+
<EnforcerInfo v-if="enforcerInfoModalVisible" :enforcer="enforcerData" @close="closeEnforcerInfoModal"></EnforcerInfo>
258265
</div>
259266
<div v-else class="text-center mt-5">
260267
{{ t('general.NO_ROWS') }}

pkg/neuvector-ui-ext/components/SecurityEvents/contents/views/DualEndpointsEventBrief.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
showPacket: async function(threatId, event) {
3131
try {
3232
let packetRes = await getPackets(threatId);
33-
nvVariables.packet.value = packetRes.threat.packet;
33+
nvVariables.packet.value = packetRes.data.threat.packet;
3434
nvVariables.showPacketModal.value = true;
3535
} catch(error) {
3636
console.error(error);

pkg/neuvector-ui-ext/components/SecurityEvents/contents/views/SingleEndpointEventBrief.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
showPacket: async function(threatId, event) {
2929
try {
3030
let packetRes = await getPackets(threatId);
31-
nvVariables.packet.value = packetRes.threat.packet;
31+
nvVariables.packet.value = packetRes.data.threat.packet;
3232
nvVariables.showPacketModal.value = true;
3333
} catch(error) {
3434
console.error(error);

pkg/neuvector-ui-ext/components/SecurityEvents/dialogs/Packet.vue

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,48 @@
114114
</Card>
115115
</div>
116116
</div>
117-
</template>
117+
</template>
118+
119+
<style lang="scss" scoped>
120+
@import '../../../styles/neuvector.scss';
121+
122+
.packetContent {
123+
max-width: 1160px;
124+
max-height: 340px;
125+
overflow-y: scroll;
126+
overflow-x: auto;
127+
}
128+
129+
.view {
130+
width: 320px;
131+
float: left;
132+
margin-left: 20px;
133+
}
134+
.view span {
135+
float: left;
136+
width: 20px;
137+
height: 20px;
138+
line-height: 20px;
139+
text-align: center;
140+
font-size: 11px;
141+
cursor: pointer;
142+
}
143+
.view span:hover,
144+
.view span.current {
145+
background: lightblue;
146+
}
147+
.view-char {
148+
width: 160px;
149+
}
150+
.view-char span {
151+
width: 10px;
152+
}
153+
.view-offset {
154+
width: 50px;
155+
}
156+
.view-offset b {
157+
float: left;
158+
font-size: 12px;
159+
line-height: 20px;
160+
}
161+
</style>

pkg/neuvector-ui-ext/components/SecurityEvents/timeSlider/TimeSparklingChart.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="chart-container">
2+
<div class="chart-container" ref="chartWrap">
33
<LineChart
44
:chartData="chartData"
55
:options="chartOptions"
@@ -113,6 +113,13 @@
113113
114114
return { chartData, chartOptions };
115115
},
116+
mounted() {
117+
const canvas = this.$refs.chartWrap?.querySelector('canvas');
118+
if (canvas) {
119+
canvas.style.height = '70px';
120+
canvas.style.maxHeight = '70px';
121+
}
122+
},
116123
});
117124
</script>
118125
@@ -126,4 +133,10 @@
126133
.chart-container :deep(> div) {
127134
width: 100%;
128135
}
136+
137+
.chart-container :deep(canvas) {
138+
width: 100% !important;
139+
height: 70px !important;
140+
max-height: 70px !important;
141+
}
129142
</style>

pkg/neuvector-ui-ext/components/common/dialogs/EnforcerInfo.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,12 @@
103103

104104
<style lang="scss" scoped>
105105
@import '../../../styles/neuvector.scss';
106+
107+
.modal-backdrop ul {
108+
list-style: none;
109+
padding: 0;
110+
margin: 0;
111+
display: flex;
112+
flex-direction: column;
113+
}
106114
</style>

pkg/neuvector-ui-ext/components/common/dialogs/NodeInfo.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,12 @@
219219

220220
<style lang="scss" scoped>
221221
@import '../../../styles/neuvector.scss';
222+
223+
.modal-backdrop ul {
224+
list-style: none;
225+
padding: 0;
226+
margin: 0;
227+
display: flex;
228+
flex-direction: column;
229+
}
222230
</style>

pkg/neuvector-ui-ext/components/common/dialogs/PodInfo.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,4 +345,15 @@
345345

346346
<style lang="scss" scoped>
347347
@import '../../../styles/neuvector.scss';
348+
349+
.modal-backdrop ul {
350+
list-style: none;
351+
padding: 0;
352+
margin: 0;
353+
display: flex;
354+
flex-direction: column;
355+
}
356+
.text-white {
357+
color: #fff !important;
358+
}
348359
</style>

pkg/neuvector-ui-ext/types/neuvector.ts

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { ref } from 'vue';
2+
13
export const NEUVECTOR_PRODUCT_NAME = "neuvector";
24

35
export interface FilterOptions {
@@ -853,32 +855,14 @@ export const nvVariables = {
853855
advFilter: null,
854856
},
855857
isLightTheme: true,
856-
showPacketModal: {
857-
value: false
858-
},
859-
packet: {
860-
value: ''
861-
},
862-
showHostInfoModal: {
863-
value: false
864-
},
865-
host: {
866-
value: {} as any
867-
},
868-
showWorkloadInfoModal: {
869-
value: false
870-
},
871-
workload: {
872-
value: {} as any
873-
},
874-
showEnforcerInfoModal: {
875-
value: false
876-
},
877-
enforcer: {
878-
value: {} as any
879-
},
880-
showAdvFilterModal: {
881-
value: false
882-
},
858+
showPacketModal: ref(false),
859+
packet: ref(''),
860+
showHostInfoModal: ref(false),
861+
host: ref({} as any),
862+
showWorkloadInfoModal: ref(false),
863+
workload: ref({} as any),
864+
showEnforcerInfoModal: ref(false),
865+
enforcer: ref({} as any),
866+
showAdvFilterModal: ref(false),
883867
vulnerabilityAdvFilter: null,
884868
};

0 commit comments

Comments
 (0)