This commit is contained in:
Fine 2022-11-28 17:01:05 +08:00
parent 7c3a9407c2
commit 699057b6ed
4 changed files with 15 additions and 15 deletions

View File

@ -117,20 +117,14 @@ export const networkProfilingStore = defineStore({
when4xx: string; when4xx: string;
when5xx: string; when5xx: string;
minDuration: number; minDuration: number;
} }[]
) { ) {
const res: AxiosResponse = await graphql const res: AxiosResponse = await graphql
.query("newNetworkProfiling") .query("newNetworkProfiling")
.params({ .params({
request: { request: {
instanceId, instanceId,
samplings: { samplings: params,
...params,
settings: {
requireCompleteRequest: true,
requireCompleteResponse: true,
},
},
}, },
}); });

View File

@ -35,7 +35,7 @@ limitations under the License. -->
class="mb-5" class="mb-5"
:value="states.when4xx" :value="states.when4xx"
:options="InitTaskField.Whenxx" :options="InitTaskField.Whenxx"
@change="changeConfig({ when4xx: states.when4xx })" @change="changeWhen4xx"
/> />
</div> </div>
<div> <div>
@ -44,7 +44,7 @@ limitations under the License. -->
class="mb-5" class="mb-5"
:value="states.when5xx" :value="states.when5xx"
:options="InitTaskField.Whenxx" :options="InitTaskField.Whenxx"
@change="changeConfig({ when5xx: states.when5xx })" @change="changeWhen5xx"
/> />
</div> </div>
</div> </div>
@ -71,9 +71,12 @@ const props = defineProps({
const { t } = useI18n(); const { t } = useI18n();
const states = reactive<NetworkProfilingRequest>(props.condition); const states = reactive<NetworkProfilingRequest>(props.condition);
function changeConfig(params: { [key: string]: number | string }) { function changeWhen5xx(value: string) {
const key: string = Object.keys(params)[0]; states.when5xx = value;
(states as any)[key] = params[key]; emits("change", states, props.key);
}
function changeWhen4xx(value: string) {
states.when4xx = value;
emits("change", states, props.key); emits("change", states, props.key);
} }
</script> </script>

View File

@ -91,6 +91,10 @@ function createTask() {
minDuration: isNaN(Number(d.minDuration)) minDuration: isNaN(Number(d.minDuration))
? undefined ? undefined
: Number(d.minDuration), : Number(d.minDuration),
settings: {
requireCompleteRequest: true,
requireCompleteResponse: true,
},
}; };
}); });
emits("create", list); emits("create", list);

View File

@ -176,11 +176,10 @@ async function saveNewTask(
minDuration: number; minDuration: number;
}[] }[]
) { ) {
console.log(params);
newTask.value = false; newTask.value = false;
const instanceId = const instanceId =
(selectorStore.currentPod && selectorStore.currentPod.id) || ""; (selectorStore.currentPod && selectorStore.currentPod.id) || "";
if (instanceId) { if (!instanceId) {
return ElMessage.error("No Instance ID"); return ElMessage.error("No Instance ID");
} }
const res = await networkProfilingStore.createNetworkTask(instanceId, params); const res = await networkProfilingStore.createNetworkTask(instanceId, params);