Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: tweak execution time section in task rollout (#16950)

boojack9c63a911b8a5
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
index d8eb996f38..3a5b81671e 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
@@ -56,8 +56,10 @@
class="flex flex-col gap-y-1 shrink overflow-y-hidden justify-start"
>
<div class="flex items-center justify-between">
- <label class="font-medium text-control">
- {{ $t("common.task", eligibleTasks.length) }}
+ <label class="text-control">
+ <span class="font-medium">{{
+ $t("common.task", eligibleTasks.length)
+ }}</span>
<span class="opacity-80" v-if="eligibleTasks.length > 1">
({{
eligibleTasks.length === target.stage.tasks.length
@@ -120,27 +122,39 @@
</div>
</div>
- <div
- v-if="showScheduledTimePicker"
- class="flex flex-col gap-y-3 shrink-0"
- >
- <div class="flex items-center">
- <NCheckbox
- :checked="runTimeInMS === undefined"
- @update:checked="
- (checked) =>
- (runTimeInMS = checked
- ? undefined
- : Date.now() + DEFAULT_RUN_DELAY_MS)
- "
- >
- {{ $t("task.run-immediately") }}
- </NCheckbox>
+ <div v-if="showScheduledTimePicker" class="flex flex-col">
+ <h3 class="font-medium text-control mb-1">
+ {{ $t("task.execution-time") }}
+ </h3>
+ <NRadioGroup
+ :size="'large'"
+ :value="runTimeInMS === undefined ? 'immediate' : 'scheduled'"
+ @update:value="handleExecutionModeChange"
+ class="!flex flex-row gap-x-4"
+ >
+ <!-- Run Immediately Option -->
+ <NRadio value="immediate">
+ <span>{{ $t("task.run-immediately.self") }}</span>
+ </NRadio>
+
+ <!-- Schedule for Later Option -->
+ <NRadio value="scheduled">
+ <span>{{ $t("task.schedule-for-later.self") }}</span>
+ </NRadio>
+ </NRadioGroup>
+
+ <!-- Description based on selection -->
+ <div class="mt-1 text-sm text-control-light">
+ <span v-if="runTimeInMS === undefined">
+ {{ $t("task.run-immediately.description") }}
+ </span>
+ <span v-else>
+ {{ $t("task.schedule-for-later.description") }}
+ </span>
</div>
- <div v-if="runTimeInMS !== undefined" class="flex flex-col gap-y-1">
- <p class="font-medium text-control">
- {{ $t("task.scheduled-time", { count: runnableTasks.length }) }}
- </p>
+
+ <!-- Scheduled Time Options -->
+ <div v-if="runTimeInMS !== undefined" class="flex flex-col">
<NDatePicker
v-model:value="runTimeInMS"
type="datetime"
@@ -151,12 +165,17 @@
format="yyyy-MM-dd HH:mm:ss"
:actions="['clear', 'confirm']"
clearable
+ class="mt-2"
/>
</div>
</div>
- <div class="flex flex-col gap-y-1 shrink-0">
- <p class="font-medium text-control">
+ <!-- Only show reason/comment input if issue is available -->
+ <div
+ v-if="shouldShowComment"
+ class="flex flex-col gap-y-1 shrink-0 border-t pt-2"
+ >
+ <p class="text-control">
{{ $t("common.comment") }}
</p>
<NInput
@@ -229,6 +248,8 @@ import {
NTooltip,
NVirtualList,
NCheckbox,
+ NRadio,
+ NRadioGroup,
} from "naive-ui";
import { computed, reactive, ref } from "vue";
import { useI18n } from "vue-i18n";
@@ -251,14 +272,15 @@ import {
} from "@/types/proto-es/v1/rollout_service_pb";
import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { hasWorkspacePermissionV2 } from "@/utils";
+import { hasWorkspacePermissionV2, isNullOrUndefined } from "@/utils";
import { usePlanContextWithRollout } from "../../logic";
import { useIssueReviewContext } from "../../logic/issue-review";
import TaskDatabaseName from "./TaskDatabaseName.vue";
import { useTaskActionPermissions } from "./taskPermissions";
// Default delay for running tasks if not scheduled immediately.
-const DEFAULT_RUN_DELAY_MS = 60000;
+// 1 hour in milliseconds
+const DEFAULT_RUN_DELAY_MS = 60 * 60 * 1000;
type LocalState = {
loading: boolean;
@@ -355,6 +377,8 @@ const previousStagesStatus = computed(() => {
return { allComplete: true, hasIncomplete: false };
});
+const shouldShowComment = computed(() => !isNullOrUndefined(issue?.value));
+
const shouldShowForceRollout = computed(() => {
// Show force rollout checkbox for RUN action when:
// 1. Issue approval is not complete, OR
@@ -446,6 +470,15 @@ const showScheduledTimePicker = computed(() => {
return props.action === "RUN";
});
+// Handle execution mode change (immediate vs scheduled)
+const handleExecutionModeChange = (value: string) => {
+ if (value === "immediate") {
+ runTimeInMS.value = undefined;
+ } else {
+ runTimeInMS.value = Date.now() + DEFAULT_RUN_DELAY_MS;
+ }
+};
+
const confirmErrors = computed(() => {
const errors: string[] = [];
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index b84c9090b6..edf9e6f880 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -283,7 +283,14 @@
"action-all-tasks-in-current-stage": "{action} all tasks in current stage",
"cancel-task": "Cancel task | Cancel tasks",
"created": "Created",
- "run-immediately": "Run task immediately | Run tasks immediately",
+ "run-immediately": {
+ "self": "Run immediately",
+ "description": "Tasks will start executing as soon as you click Run. No delay or scheduling required."
+ },
+ "schedule-for-later": {
+ "self": "Schedule for later",
+ "description": "Set a specific date and time for tasks to automatically start running. Useful for maintenance windows or off-peak hours."
+ },
"select-task": "Select task | Select tasks",
"selected-n-tasks": "{n} task selected | {n} tasks selected",
"no-tasks-selected": "No tasks selected",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index ca3e60f9bd..287a892224 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -283,7 +283,14 @@
"action-all-tasks-in-current-stage": "{action} todas las tareas en la etapa actual",
"cancel-task": "Cancelar tarea | Cancelar tareas",
"created": "Creado",
- "run-immediately": "Ejecutar tarea inmediatamente",
+ "run-immediately": {
+ "self": "Corre inmediatamente",
+ "description": "Las tareas comenzarán a ejecutarse en cuanto haga clic en \"Ejecutar\". No requiere demora ni programación."
+ },
+ "schedule-for-later": {
+ "self": "Programar para más tarde",
+ "description": "Establezca una fecha y hora específicas para que las tareas comiencen a ejecutarse automáticamente. Útil para periodos de mantenimiento o horas de baja demanda."
+ },
"select-task": "Seleccionar tarea | Seleccionar tareas",
"selected-n-tasks": "{n} tarea seleccionada | {n} tareas seleccionadas",
"no-tasks-selected": "No hay tareas seleccionadas",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 2999ef9a25..ea99c6875d 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -283,7 +283,14 @@
"action-all-tasks-in-current-stage": "{action}現在のステージのすべてのタスク",
"cancel-task": "タスクをキャンセルする",
"created": "内蔵",
- "run-immediately": "すぐに実行",
+ "run-immediately": {
+ "self": "すぐに実行",
+ "description": "「実行」をクリックするとすぐにタスクの実行が開始されます。遅延やスケジュール設定は必要ありません。"
+ },
+ "schedule-for-later": {
+ "self": "後でスケジュールする",
+ "description": "タスクを自動的に実行開始する日時を指定します。メンテナンス期間やオフピーク時に便利です。"
+ },
"select-task": "タスクを選択 | タスクを選択",
"selected-n-tasks": "{n} 個のタスクが選択されました | {n} 個のタスクが選択されました",
"no-tasks-selected": "タスクが選択されていません",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 46a90d6dcd..6fad2590b2 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -283,7 +283,14 @@
"action-all-tasks-in-current-stage": "{action} tất cả các tác vụ trong giai đoạn hiện tại",
"cancel-task": "Hủy tác vụ | Hủy các tác vụ",
"created": "Đã tạo",
- "run-immediately": "Chạy nhiệm vụ ngay lập tức",
+ "run-immediately": {
+ "self": "Chạy ngay lập tức",
+ "description": "Các tác vụ sẽ bắt đầu thực thi ngay khi bạn nhấp vào Chạy. Không cần trì hoãn hay lên lịch."
+ },
+ "schedule-for-later": {
+ "self": "Lên lịch cho sau",
+ "description": "Đặt ngày và giờ cụ thể để các tác vụ tự động bắt đầu chạy. Hữu ích cho các khung giờ bảo trì hoặc ngoài giờ cao điểm."
+ },
"select-task": "Chọn nhiệm vụ | Chọn nhiệm vụ",
"selected-n-tasks": "{n} nhiệm vụ đã chọn | {n} nhiệm vụ đã chọn",
"no-tasks-selected": "Không có nhiệm vụ nào được chọn",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 6e09f2eec8..1439764115 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -283,7 +283,14 @@
"action-all-tasks-in-current-stage": "{action}当前阶段的所有任务",
"cancel-task": "取消任务",
"created": "创建于",
- "run-immediately": "立即运行任务",
+ "run-immediately": {
+ "self": "立即运行",
+ "description": "点击“运行”后,任务将立即开始执行。"
+ },
+ "schedule-for-later": {
+ "self": "定时运行",
+ "description": "设置任务自动开始运行的特定时间。"
+ },
"select-task": "选择任务 | 选择任务",
"selected-n-tasks": "已选择 {n} 个任务",
"no-tasks-selected": "未选择任何任务",