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