fix: UPF抓包走脚本执行方式

This commit is contained in:
TsMask
2023-10-17 19:21:14 +08:00
parent f57b2bccfb
commit b92e225fd4

View File

@@ -62,8 +62,12 @@ function fnNeChange(_: any, item: any) {
const modalStateFrom = Form.useForm(
modalState.from,
reactive({
cmd: [{ required: true, message: t('views.traceManage.pcap.capArgPlease') }],
timeout: [{ required: true, message: t('views.traceManage.pcap.capTimePlease') }],
cmd: [
{ required: true, message: t('views.traceManage.pcap.capArgPlease') },
],
timeout: [
{ required: true, message: t('views.traceManage.pcap.capTimePlease') },
],
upfStart: [
{ required: true, message: t('views.traceManage.pcap.capArgUPFPlease') },
],
@@ -188,12 +192,8 @@ function fnDownPCAP() {
/**UPF抓包执行 */
function fnUPF(runType: 'start' | 'stop') {
let validateArr = ['upfStop'];
if (runType === 'start') {
validateArr = ['upfStart'];
}
modalStateFrom
.validate(validateArr)
.validate([runType === 'start' ? 'upfStart' : 'upfStop'])
.then(() => {
modalState.confirmLoading = true;
const from = toRaw(modalState.from);
@@ -201,8 +201,8 @@ function fnUPF(runType: 'start' | 'stop') {
tcpdumpNeUPFTask({
neType: modalState.neType[0],
neId: modalState.neType[1],
runType: runType,
cmd: from.upfStart,
runType: runType === 'start' ? 'start_str' : 'stop_str',
cmd: runType === 'start' ? from.upfStart : from.upfStop,
})
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
@@ -288,7 +288,10 @@ onMounted(() => {
:label-col="{ span: 5 }"
labelWrap
>
<a-form-item :label="t('views.traceManage.pcap.neType')" name="neType">
<a-form-item
:label="t('views.traceManage.pcap.neType')"
name="neType"
>
<a-cascader
v-model:value="modalState.neType"
:options="useNeInfoStore().getNeCascaderOtions"
@@ -385,7 +388,9 @@ onMounted(() => {
<template #icon><ApiOutlined /></template>
{{
runTime != 0
? t('views.traceManage.pcap.runTimeText', { s: runTime })
? t('views.traceManage.pcap.runTimeText', {
s: runTime,
})
: t('views.traceManage.pcap.runText')
}}
</a-button>