Copilot commented on code in PR #472:
URL: 
https://github.com/apache/skywalking-booster-ui/pull/472#discussion_r2120049280


##########
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"
       />
     </div>
     <div>
       <div class="label">{{ t("duration") }}</div>
       <Radio class="mb-5" :value="duration" :options="DurationOptions" 
@change="changeDuration" />
+      <div v-if="duration === 'custom'" class="custom-duration">
+        <div class="label">{{ t("customDuration") }} ({{ t("seconds") }})</div>

Review Comment:
   Key `seconds` is used here but not defined in the locale files—add a 
`seconds` entry in each locale to avoid fallback behavior.



##########
src/views/dashboard/related/async-profiling/components/NewTask.vue:
##########
@@ -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");

Review Comment:
   This error message is hard-coded in English. Wrap it in the translation 
function (e.g. `t("invalidDurationRange")`) and add the corresponding i18n key 
for localization.
   ```suggestion
           ElMessage.error(t("invalidDurationRange"));
   ```



##########
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" },

Review Comment:
   [nitpick] Using a fractional minute value (`"0.5"`) could be unclear. 
Consider representing durations in seconds (e.g. `30`) or extracting a named 
constant for clarity.
   ```suggestion
   const DURATION_30_SECONDS = 30;
   const DURATION_1_MINUTE = 60;
   const DURATION_5_MINUTES = 300;
   const DURATION_10_MINUTES = 600;
   const DURATION_15_MINUTES = 900;
   
   export const DurationOptions = [
     { value: DURATION_30_SECONDS.toString(), label: "30 sec" },
     { value: DURATION_1_MINUTE.toString(), label: "1 min" },
     { value: DURATION_5_MINUTES.toString(), label: "5 min" },
     { value: DURATION_10_MINUTES.toString(), label: "10 min" },
     { value: DURATION_15_MINUTES.toString(), label: "15 min" },
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to