diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 12de6d03..ea77bc16 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -401,5 +401,10 @@ const msg = { recordsTTL: "Records TTL", clusterNodes: "Cluster Nodes", debuggingConfigDump: "Dump Effective Configurations", + customDuration: "Custom Duration", + maxDuration: "Max Duration", + minutes: "Minutes", + invalidProfilingDurationRange: "Please enter a valid duration between 1 and 900 seconds", + taskCreatedSuccessfully: "Task created successfully", }; export default msg; diff --git a/src/locales/lang/es.ts b/src/locales/lang/es.ts index 3a8dc0b2..ba7d7edc 100644 --- a/src/locales/lang/es.ts +++ b/src/locales/lang/es.ts @@ -401,5 +401,10 @@ const msg = { recordsTTL: "Records TTL", clusterNodes: "Cluster Nodes", debuggingConfigDump: "Dump Effective Configurations", + customDuration: "Duración Personalizada", + maxDuration: "Duración Máxima", + minutes: "Minutos", + invalidProfilingDurationRange: "Por favor ingrese una duración válida entre 1 y 900 segundos", + taskCreatedSuccessfully: "Tarea creada exitosamente", }; export default msg; diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 72b548cf..40c21e0e 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -399,5 +399,10 @@ const msg = { recordsTTL: "Records TTL", clusterNodes: "集群节点", debuggingConfigDump: "转储有效配置", + customDuration: "自定义时长", + maxDuration: "最大时长", + minutes: "分钟", + invalidProfilingDurationRange: "请输入1到900秒之间的有效时长", + taskCreatedSuccessfully: "任务创建成功", }; export default msg; diff --git a/src/views/dashboard/related/async-profiling/components/NewTask.vue b/src/views/dashboard/related/async-profiling/components/NewTask.vue index 959d6ebf..e5c9c656 100644 --- a/src/views/dashboard/related/async-profiling/components/NewTask.vue +++ b/src/views/dashboard/related/async-profiling/components/NewTask.vue @@ -25,12 +25,25 @@ limitations under the License. --> :options="asyncProfilingStore.instances" placeholder="Select instances" @change="changeInstances" - :filterable="false" + :filterable="true" />
{{ t("duration") }}
+
+
{{ t("customDuration") }} ({{ t("seconds") }})
+ +
{{ t("maxDuration") }}: 900 {{ t("seconds") }} (15 {{ t("minutes") }})
+
{{ t("profilingEvents") }}
@@ -113,6 +126,7 @@ limitations under the License. --> const execArgs = ref(""); const loading = ref(false); const PartofEvents = [ProfilingEvents[3], ProfilingEvents[4], ProfilingEvents[5]]; + const customDurationSeconds = ref(60); function changeDuration(val: string) { duration.value = val; @@ -138,10 +152,22 @@ limitations under the License. --> } async function createTask() { + let finalDuration: number; + + if (duration.value === DurationOptions[5].value) { + if (!customDurationSeconds.value || customDurationSeconds.value < 1 || customDurationSeconds.value > 900) { + ElMessage.error(t("invalidProfilingDurationRange")); + return; + } + finalDuration = customDurationSeconds.value; + } else { + finalDuration = Number(duration.value); + } + const params = { serviceId: selectorStore.currentService.id, serviceInstanceIds: serviceInstanceIds.value, - duration: Number(duration.value) * 60, + duration: finalDuration, events: asyncEvents.value, execArgs: execArgs.value, }; @@ -158,7 +184,7 @@ limitations under the License. --> return; } emits("close"); - ElMessage.success("Task created successfully"); + ElMessage.success(t("taskCreatedSuccessfully")); } diff --git a/src/views/dashboard/related/async-profiling/components/data.ts b/src/views/dashboard/related/async-profiling/components/data.ts index f315a082..9ff5193b 100644 --- a/src/views/dashboard/related/async-profiling/components/data.ts +++ b/src/views/dashboard/related/async-profiling/components/data.ts @@ -16,9 +16,12 @@ */ export const DurationOptions = [ - { value: "5", label: "5 min" }, - { value: "10", label: "10 min" }, - { value: "15", label: "15 min" }, + { value: "30", label: "30 sec" }, + { value: "60", label: "1 min" }, + { value: "300", label: "5 min" }, + { value: "600", label: "10 min" }, + { value: "900", label: "15 min" }, + { value: "custom", label: "Custom" }, ]; export const ProfilingEvents = ["CPU", "ALLOC", "LOCK", "WALL", "CTIMER", "ITIMER"];