Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: set run time in task rollout panel (#16201)
boojack0684eda9b76b
diff --git a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vueindex 670dd25605..cc2d9ec8f9 100644--- a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue+++ b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue@@ -22,16 +22,16 @@type="warning"/><div- class="flex flex-col gap-y-1 shrink-0 overflow-y-hidden justify-start"+ class="flex flex-row gap-x-2 shrink-0 overflow-y-hidden justify-start items-center"><label class="font-medium text-control">{{ $t("common.stage") }}</label>- <div class="textinfolabel break-all">+ <span class="break-all">{{environmentStore.getEnvironmentByName(stage.environment).title}}- </div>+ </span></div></template><div@@ -42,9 +42,12 @@{{ $t("common.task") }}</template><template v-else>{{ $t("common.tasks") }}</template>+ <span class="font-mono opacity-80" v-if="taskList.length > 1"+ >({{ taskList.length }})</span+ ></label><div class="flex-1 overflow-y-auto">- <NScrollbar>+ <NScrollbar class="max-h-64"><ul class="text-sm space-y-2"><liv-for="task in taskList"@@ -104,6 +107,38 @@}"/></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>+ <div v-if="runTimeInMS !== undefined" class="flex flex-col gap-y-1">+ <p class="font-medium text-control">+ {{ $t("task.scheduled-time", taskList.length) }}+ </p>+ <NDatePicker+ v-model:value="runTimeInMS"+ type="datetime"+ :placeholder="$t('task.select-scheduled-time')"+ :is-date-disabled="(ts: number) => ts < Date.now()"+ format="yyyy-MM-dd HH:mm:ss"+ clearable+ />+ </div>+ </div></div></template><template #footer>@@ -134,7 +169,7 @@<NButton:disabled="confirmErrors.length > 0"v-bind="taskRolloutActionButtonProps(action)"- @click="handleConfirm(action!, comment)"+ @click="handleConfirm(action!)">{{ taskRolloutActionDialogButtonName(action, taskList) }}</NButton>@@ -151,10 +186,12 @@<script setup lang="ts">import { head, uniqBy } from "lodash-es";+import Long from "long";import {NAlert,NButton,NCheckbox,+ NDatePicker,NInput,NScrollbar,NTag,@@ -177,12 +214,19 @@ import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/coimport { databaseForTask } from "@/components/Rollout/RolloutDetail";import { rolloutServiceClient } from "@/grpcweb";import { pushNotification, useEnvironmentV1Store } from "@/store";-import type { Task, TaskRun } from "@/types/proto/v1/rollout_service";+import type {+ BatchRunTasksRequest,+ Task,+ TaskRun,+} from "@/types/proto/v1/rollout_service";import { Task_Status, TaskRun_Status } from "@/types/proto/v1/rollout_service";import { ErrorList } from "../common";import CommonDrawer from "./CommonDrawer.vue";import RolloutTaskDatabaseName from "./RolloutTaskDatabaseName.vue";+// Default delay for running tasks if not scheduled immediately.+const DEFAULT_RUN_DELAY_MS = 60000;+type LocalState = {loading: boolean;};@@ -203,6 +247,7 @@ const { issue, selectedTask, events, getPlanCheckRunsForTask } =useIssueContext();const environmentStore = useEnvironmentV1Store();const comment = ref("");+const runTimeInMS = ref<number | undefined>(undefined);const performActionAnyway = ref(false);const title = computed(() => {@@ -225,6 +270,14 @@ const stage = computed(() => {return stageForTask(issue.value, firstTask);});+const showScheduledTimePicker = computed(() => {+ return (+ props.action === "ROLLOUT" ||+ props.action === "RETRY" ||+ props.action === "RESTART"+ );+});+const hasPreviousUnrolledStages = computed(() => {if (!stage.value) return false;const stages = issue.value.rolloutEntity?.stages;@@ -283,28 +336,44 @@ const confirmErrors = computed(() => {);}}++ // Validate scheduled time if not running immediately+ if (runTimeInMS.value !== undefined) {+ if (runTimeInMS.value <= Date.now()) {+ errors.push(t("task.error.scheduled-time-must-be-in-the-future"));+ }+ }+return errors;});-const handleConfirm = async (- action: TaskRolloutAction,- comment: string | undefined-) => {+const handleConfirm = async (action: TaskRolloutAction) => {state.loading = true;try {const stage = stageForTask(issue.value, props.taskList[0]);if (!stage) return;if (action === "ROLLOUT" || action === "RETRY" || action === "RESTART") {- await rolloutServiceClient.batchRunTasks({+ // Prepare the request parameters+ const requestParams: BatchRunTasksRequest = {parent: stage.name,tasks: props.taskList.map((task) => task.name),- reason: comment,- });+ reason: comment.value,+ };+ if (runTimeInMS.value !== undefined) {+ // Convert timestamp to protobuf Timestamp format+ const runTimeSeconds = Math.floor(runTimeInMS.value / 1000);+ const runTimeNanos = (runTimeInMS.value % 1000) * 1000000;+ requestParams.runTime = {+ seconds: Long.fromNumber(runTimeSeconds),+ nanos: runTimeNanos,+ };+ }+ await rolloutServiceClient.batchRunTasks(requestParams);} else if (action === "SKIP") {await rolloutServiceClient.batchSkipTasks({parent: stage.name,tasks: props.taskList.map((task) => task.name),- reason: comment,+ reason: comment.value,});} else if (action === "CANCEL") {const taskRunListToCancel = props.taskList@@ -322,7 +391,7 @@ const handleConfirm = async (await rolloutServiceClient.batchCancelTaskRuns({parent: `${stage.name}/tasks/-`,taskRuns: taskRunListToCancel.map((taskRun) => taskRun.name),- reason: comment,+ reason: comment.value,});}}@@ -342,6 +411,7 @@ const handleConfirm = async (const resetState = () => {comment.value = "";+ runTimeInMS.value = undefined;performActionAnyway.value = false;};</script>diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex ccf249979e..dd23add4ea 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -269,6 +269,12 @@"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",+ "scheduled-time": "Scheduled time",+ "select-scheduled-time": "Select scheduled time",+ "error": {+ "scheduled-time-must-be-in-the-future": "Scheduled time must be in the future"+ },"online-migration": {"self": "Online migration","configure-ghost-parameters": "Configure gh-ost parameters",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 58c552255b..2833478057 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -269,6 +269,12 @@"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",+ "scheduled-time": "Hora programada",+ "select-scheduled-time": "Seleccionar hora programada",+ "error": {+ "scheduled-time-must-be-in-the-future": "La hora programada debe ser en el futuro"+ },"online-migration": {"self": "Migración en línea","configure-ghost-parameters": "Configurar los parámetros de gh-ost",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 182709e9b2..b62f4eaa51 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -269,6 +269,12 @@"action-all-tasks-in-current-stage": "{action}現在のステージのすべてのタスク","cancel-task": "タスクをキャンセルする","created": "内蔵",+ "run-immediately": "すぐに実行",+ "scheduled-time": "予定時刻",+ "select-scheduled-time": "予定時刻を選択してください",+ "error": {+ "scheduled-time-must-be-in-the-future": "スケジュール時間は将来の時間である必要があります"+ },"online-migration": {"self": "オンラインでの大規模なテーブル変更","configure-ghost-parameters": "gh-ost パラメータを設定する",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 8b3a09f03e..ec1bf3b102 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -269,6 +269,12 @@"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",+ "scheduled-time": "Thời gian đã lên lịch",+ "select-scheduled-time": "Chọn thời gian đã lên lịch",+ "error": {+ "scheduled-time-must-be-in-the-future": "Thời gian dự kiến phải ở trong tương lai"+ },"online-migration": {"self": "Di chuyển trực tuyến","configure-ghost-parameters": "Cấu hình tham số gh-ost",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex a024f45c13..50a40b6801 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -269,6 +269,12 @@"action-all-tasks-in-current-stage": "{action}当前阶段的所有任务","cancel-task": "取消任务","created": "创建于",+ "run-immediately": "立即运行任务",+ "scheduled-time": "计划时间",+ "select-scheduled-time": "选择计划时间",+ "error": {+ "scheduled-time-must-be-in-the-future": "计划时间必须是将来的时间"+ },"online-migration": {"self": "在线大表变更","configure-ghost-parameters": "配置 gh-ost 参数",@@ -2601,4 +2607,4 @@"last-visit": "上次访问","changelog-for-version": "{version} 的更新日志"}-}\ No newline at end of file+}