diff --git a/src/store/modules/network-profiling.ts b/src/store/modules/network-profiling.ts index 3f62a1a9..f6c4bc25 100644 --- a/src/store/modules/network-profiling.ts +++ b/src/store/modules/network-profiling.ts @@ -117,20 +117,14 @@ export const networkProfilingStore = defineStore({ when4xx: string; when5xx: string; minDuration: number; - } + }[] ) { const res: AxiosResponse = await graphql .query("newNetworkProfiling") .params({ request: { instanceId, - samplings: { - ...params, - settings: { - requireCompleteRequest: true, - requireCompleteResponse: true, - }, - }, + samplings: params, }, }); diff --git a/src/views/dashboard/related/network-profiling/components/NewConditions.vue b/src/views/dashboard/related/network-profiling/components/NewConditions.vue index 388e8ac6..1ed8ac66 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: states.when4xx })" + @change="changeWhen4xx" />
@@ -44,7 +44,7 @@ limitations under the License. --> class="mb-5" :value="states.when5xx" :options="InitTaskField.Whenxx" - @change="changeConfig({ when5xx: states.when5xx })" + @change="changeWhen5xx" />
@@ -71,9 +71,12 @@ const props = defineProps({ const { t } = useI18n(); 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]; +function changeWhen5xx(value: string) { + states.when5xx = value; + emits("change", states, props.key); +} +function changeWhen4xx(value: string) { + states.when4xx = value; emits("change", states, props.key); } diff --git a/src/views/dashboard/related/network-profiling/components/NewTask.vue b/src/views/dashboard/related/network-profiling/components/NewTask.vue index f6f4ee35..5d45ef73 100644 --- a/src/views/dashboard/related/network-profiling/components/NewTask.vue +++ b/src/views/dashboard/related/network-profiling/components/NewTask.vue @@ -91,6 +91,10 @@ function createTask() { minDuration: isNaN(Number(d.minDuration)) ? undefined : Number(d.minDuration), + settings: { + requireCompleteRequest: true, + requireCompleteResponse: true, + }, }; }); emits("create", list); diff --git a/src/views/dashboard/related/network-profiling/components/Tasks.vue b/src/views/dashboard/related/network-profiling/components/Tasks.vue index 1844b236..71b5e752 100644 --- a/src/views/dashboard/related/network-profiling/components/Tasks.vue +++ b/src/views/dashboard/related/network-profiling/components/Tasks.vue @@ -176,11 +176,10 @@ async function saveNewTask( 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);