diff --git a/src/views/dashboard/related/async-profiling/components/NewTask.vue b/src/views/dashboard/related/async-profiling/components/NewTask.vue index 959d6ebf..a0ee1c9e 100644 --- a/src/views/dashboard/related/async-profiling/components/NewTask.vue +++ b/src/views/dashboard/related/async-profiling/components/NewTask.vue @@ -31,6 +31,19 @@ limitations under the License. -->
{{ 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 === "custom") { + if (!customDurationSeconds.value || customDurationSeconds.value < 1 || customDurationSeconds.value > 900) { + ElMessage.error("Please enter a valid duration between 1 and 900 seconds"); + return; + } + finalDuration = customDurationSeconds.value; + } else { + finalDuration = Number(duration.value) * 60; + } + const params = { serviceId: selectorStore.currentService.id, serviceInstanceIds: serviceInstanceIds.value, - duration: Number(duration.value) * 60, + duration: finalDuration, events: asyncEvents.value, execArgs: execArgs.value, }; @@ -184,4 +210,13 @@ limitations under the License. --> width: 600px; margin-top: 50px; } + + .custom-duration { + margin-top: 10px; + } + + .hint { + font-size: $font-size-smaller; + color: var(--text-color-placeholder); + } diff --git a/src/views/dashboard/related/async-profiling/components/data.ts b/src/views/dashboard/related/async-profiling/components/data.ts index f315a082..c7b5f8d4 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: "0.5", label: "30 sec" }, + { value: "1", label: "1 min" }, { value: "5", label: "5 min" }, { value: "10", label: "10 min" }, { value: "15", label: "15 min" }, + { value: "custom", label: "Custom" }, ]; export const ProfilingEvents = ["CPU", "ALLOC", "LOCK", "WALL", "CTIMER", "ITIMER"];