From 7c3a9407c2e9c2ebc278f505da1762743b206d57 Mon Sep 17 00:00:00 2001 From: Fine Date: Mon, 28 Nov 2022 16:51:14 +0800 Subject: [PATCH] add multiple conditions --- .../components/NewConditions.vue | 7 ++- .../network-profiling/components/NewTask.vue | 56 +++++++++++++++---- .../network-profiling/components/Tasks.vue | 17 +++--- 3 files changed, 59 insertions(+), 21 deletions(-) diff --git a/src/views/dashboard/related/network-profiling/components/NewConditions.vue b/src/views/dashboard/related/network-profiling/components/NewConditions.vue index 6a717245..388e8ac6 100644 --- a/src/views/dashboard/related/network-profiling/components/NewConditions.vue +++ b/src/views/dashboard/related/network-profiling/components/NewConditions.vue @@ -35,7 +35,7 @@ limitations under the License. --> class="mb-5" :value="states.when4xx" :options="InitTaskField.Whenxx" - @change="changeConfig({ when4xx: $event })" + @change="changeConfig({ when4xx: states.when4xx })" />
@@ -44,7 +44,7 @@ limitations under the License. --> class="mb-5" :value="states.when5xx" :options="InitTaskField.Whenxx" - @change="changeConfig({ when5xx: $event })" + @change="changeConfig({ when5xx: states.when5xx })" />
@@ -56,6 +56,8 @@ import type { PropType } from "vue"; import { InitTaskField } from "./data"; import { NetworkProfilingRequest } from "@/types/ebpf"; +/* global defineEmits */ +const emits = defineEmits(["change"]); const props = defineProps({ condition: { type: Object as PropType, @@ -72,6 +74,7 @@ const states = reactive(props.condition); function changeConfig(params: { [key: string]: number | string }) { const key: string = Object.keys(params)[0]; (states as any)[key] = params[key]; + emits("change", states, props.key); } diff --git a/src/views/dashboard/related/network-profiling/components/Tasks.vue b/src/views/dashboard/related/network-profiling/components/Tasks.vue index 87cd724e..1844b236 100644 --- a/src/views/dashboard/related/network-profiling/components/Tasks.vue +++ b/src/views/dashboard/related/network-profiling/components/Tasks.vue @@ -168,16 +168,19 @@ function createTask() { } newTask.value = true; } -async function saveNewTask(params: { - uriRegex: string; - when4xx: string; - when5xx: string; - minDuration: number; -}) { +async function saveNewTask( + params: { + uriRegex: string; + when4xx: string; + when5xx: string; + minDuration: number; + }[] +) { + console.log(params); newTask.value = false; const instanceId = (selectorStore.currentPod && selectorStore.currentPod.id) || ""; - if (!instanceId) { + if (instanceId) { return ElMessage.error("No Instance ID"); } const res = await networkProfilingStore.createNetworkTask(instanceId, params);