Skip to content

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

chore: update checks in task rollout panel (#16728)

boojack16631fcb087b
diff --git a/frontend/src/components/Plan/components/RolloutView/RunTasksButton.vue b/frontend/src/components/Plan/components/RolloutView/RunTasksButton.vue
index dd4ae7b80a..ebeab6bfb7 100644
--- a/frontend/src/components/Plan/components/RolloutView/RunTasksButton.vue
+++ b/frontend/src/components/Plan/components/RolloutView/RunTasksButton.vue
@@ -2,12 +2,13 @@
<NButton
v-if="hasRunnableTasks && canRunTasks"
size="tiny"
+ v-bind="$attrs"
@click="handleRunTasks"
>
<template #icon>
<PlayIcon class="w-4 h-4" />
</template>
- {{ $t("common.rollout") }}
+ {{ $t("common.run") }}
</NButton>
</template>
diff --git a/frontend/src/components/Plan/components/RolloutView/StageCard.vue b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
index 55a1c1a345..f66780e9e3 100644
--- a/frontend/src/components/Plan/components/RolloutView/StageCard.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
@@ -20,8 +20,9 @@
</div>
<div class="flex justify-end items-center">
<RunTasksButton
- v-if="isCreated && canRunTasks"
+ v-if="isCreated"
:stage="stage"
+ :disabled="!canRunTasks || runableTasks.length === 0"
@run-tasks="handleRunAllTasks"
/>
<NPopconfirm
@@ -48,6 +49,7 @@
</div>
</div>
<NVirtualList
+ v-if="filteredTasks.length > 0"
style="max-height: 80vh"
:items="filteredTasks"
:item-size="40"
@@ -76,12 +78,15 @@
</div>
</template>
</NVirtualList>
+ <div v-else class="text-center text-zinc-500 py-2 text-sm leading-6">
+ {{ $t("task.no-tasks") }}
+ </div>
<!-- Task Rollout Action Panel -->
<TaskRolloutActionPanel
- v-if="showRunTasksPanel"
+ :show="showRunTasksPanel"
action="RUN"
- :target="{ type: 'tasks', stage }"
+ :target="{ type: 'tasks', stage, tasks: runableTasks }"
@close="handlePanelClose"
/>
</div>
@@ -107,8 +112,8 @@ import {
import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
import {
Stage,
+ Task_Status,
type Task,
- type Task_Status,
} from "@/types/proto/v1/rollout_service";
import { extractProjectResourceName } from "@/utils";
import { extractSchemaVersionFromTask } from "@/utils";
@@ -149,8 +154,22 @@ const filteredTasks = computed(() => {
);
});
+const runableTasks = computed(() => {
+ return filteredTasks.value.filter(
+ (task) =>
+ task.status === Task_Status.NOT_STARTED ||
+ task.status === Task_Status.PENDING ||
+ task.status === Task_Status.FAILED ||
+ task.status === Task_Status.CANCELED
+ );
+});
+
const canRunTasks = computed(() => {
- return canPerformTaskAction(props.stage.tasks, rollout.value, project.value);
+ return canPerformTaskAction(
+ filteredTasks.value,
+ rollout.value,
+ project.value
+ );
});
const canCreateRollout = computed(() => {
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue b/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
index 78ea5b3ee7..e3ec0ab1cd 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
@@ -38,12 +38,14 @@
</NScrollbar>
<!-- Task Rollout Action Panel -->
- <TaskRolloutActionPanel
- v-if="state.showActionPanel && state.selectedAction && actionTarget"
- :action="state.selectedAction"
- :target="actionTarget"
- @close="handleActionPanelClose"
- />
+ <template v-if="state.selectedAction && actionTarget">
+ <TaskRolloutActionPanel
+ :show="state.showActionPanel"
+ :action="state.selectedAction"
+ :target="actionTarget"
+ @close="handleActionPanelClose"
+ />
+ </template>
</template>
<script lang="ts" setup>
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
index 5c07abd3c3..96f84eb368 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
@@ -1,6 +1,6 @@
<template>
<CommonDrawer
- :show="true"
+ :show="show"
:title="title"
:loading="state.loading"
@show="resetState"
@@ -180,7 +180,7 @@
@click="handleConfirm"
>
<template v-if="action === 'RUN'">{{
- $t("common.rollout")
+ $t("common.run")
}}</template>
<template v-else-if="action === 'SKIP'">{{
$t("common.skip")
@@ -247,6 +247,7 @@ export type TargetType =
| { type: "taskRuns"; taskRuns: TaskRun[]; stage: Stage };
const props = defineProps<{
+ show: boolean;
action: "RUN" | "SKIP" | "CANCEL";
target: TargetType;
}>();
@@ -333,7 +334,7 @@ const targetTaskRuns = computed(() => {
const title = computed(() => {
switch (props.action) {
case "RUN":
- return t("common.rollout");
+ return t("common.run");
case "SKIP":
return t("common.skip");
case "CANCEL":
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue b/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
index 5da2fc40bd..118c4452cd 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
@@ -27,12 +27,14 @@
</div>
<!-- Task Rollout Action Panel -->
- <TaskRolloutActionPanel
- v-if="currentPanelAction && showActionPanel && actionTarget"
- :action="currentPanelAction"
- :target="actionTarget"
- @close="handleActionPanelClose"
- />
+ <template v-if="currentPanelAction && actionTarget">
+ <TaskRolloutActionPanel
+ :show="showActionPanel"
+ :action="currentPanelAction"
+ :target="actionTarget"
+ @close="handleActionPanelClose"
+ />
+ </template>
</div>
</template>
diff --git a/frontend/src/components/Plan/components/RolloutView/context.ts b/frontend/src/components/Plan/components/RolloutView/context.ts
index 49e3158b08..0e020f124d 100644
--- a/frontend/src/components/Plan/components/RolloutView/context.ts
+++ b/frontend/src/components/Plan/components/RolloutView/context.ts
@@ -1,7 +1,7 @@
import { create } from "@bufbuild/protobuf";
import { createContextValues } from "@connectrpc/connect";
import type { ComputedRef, InjectionKey, Ref } from "vue";
-import { computed, inject, provide, ref } from "vue";
+import { computed, inject, provide, ref, onUnmounted } from "vue";
import { rolloutServiceClientConnect } from "@/grpcweb";
import { silentContextKey } from "@/grpcweb/context-key";
import { useCurrentProjectV1 } from "@/store";
@@ -70,6 +70,7 @@ export const provideRolloutViewContext = () => {
// Handle preview errors gracefully
console.error("Failed to fetch rollout preview:", error);
rolloutPreview.value = Rollout.fromPartial({});
+ } finally {
}
};
@@ -77,11 +78,19 @@ export const provideRolloutViewContext = () => {
fetchRolloutPreview();
// Listen for resource refresh completion
- events.on("resource-refresh-completed", async ({ resources }) => {
- // Refresh rollout preview if rollout was refreshed
- if (resources.includes("rollout")) {
- await fetchRolloutPreview();
+ const unsubscribe = events.on(
+ "resource-refresh-completed",
+ async ({ resources }) => {
+ // Refresh rollout preview if rollout was refreshed
+ if (resources.includes("rollout")) {
+ await fetchRolloutPreview();
+ }
}
+ );
+
+ // Clean up event listener when component unmounts.
+ onUnmounted(() => {
+ unsubscribe();
});
const context: RolloutViewContext = {
diff --git a/frontend/src/components/Plan/logic/poller/poller.ts b/frontend/src/components/Plan/logic/poller/poller.ts
index 243b57c329..e45a579f16 100644
--- a/frontend/src/components/Plan/logic/poller/poller.ts
+++ b/frontend/src/components/Plan/logic/poller/poller.ts
@@ -198,12 +198,13 @@ export const useResourcePoller = (options: ResourcePollerOptions = {}) => {
issueCommentsPoller.stop();
rolloutPoller.stop();
- // Reset poller states
+ // Reset poller states and initial refresh flag
pollerStates.plan = false;
pollerStates.planCheckRuns = false;
pollerStates.issue = false;
pollerStates.issueComments = false;
pollerStates.rollout = false;
+ hasInitialRefresh = false;
// Restart active ones (this will reset the progressive intervals)
if (activeResources.includes("plan")) {
@@ -227,18 +228,29 @@ export const useResourcePoller = (options: ResourcePollerOptions = {}) => {
pollerStates.rollout = true;
}
- // Do immediate refresh for the new route
- setTimeout(() => refreshAll(), 100);
+ // Note: No immediate refresh here - let the watchEffect handle it to avoid duplicates
};
- // Watch for route changes and restart pollers to ensure fresh data
+ // Watch for route changes and restart pollers only when resources actually change
watch(
- () => route.name,
- (newRouteName, oldRouteName) => {
- if (newRouteName !== oldRouteName && newRouteName) {
- restartActivePollers();
+ () => resourcesToPolled.value,
+ (newResources, oldResources) => {
+ // Only restart if the resources to be polled have actually changed
+ if (oldResources && newResources.length > 0) {
+ // Create sorted arrays to compare
+ const newSorted = [...newResources].sort();
+ const oldSorted = [...oldResources].sort();
+
+ const resourcesChanged =
+ newSorted.length !== oldSorted.length ||
+ newSorted.some((resource, index) => resource !== oldSorted[index]);
+
+ if (resourcesChanged) {
+ restartActivePollers();
+ }
}
- }
+ },
+ { deep: true }
);
// Set up event listeners
diff --git a/frontend/src/components/Plan/logic/poller/utils.ts b/frontend/src/components/Plan/logic/poller/utils.ts
index 41685c7c42..e834066669 100644
--- a/frontend/src/components/Plan/logic/poller/utils.ts
+++ b/frontend/src/components/Plan/logic/poller/utils.ts
@@ -48,10 +48,6 @@ export const refreshPlan = async (plan: Ref<Plan>): Promise<void> => {
const response = await planServiceClientConnect.getPlan(request);
plan.value = convertNewPlanToOld(response);
lastRefreshTime.plan = Date.now();
- console.debug(
- "Plan refreshed at:",
- new Date(lastRefreshTime.plan).toISOString()
- );
};
export const refreshPlanCheckRuns = async (
@@ -70,10 +66,6 @@ export const refreshPlanCheckRuns = async (
const response = await planServiceClientConnect.listPlanCheckRuns(request);
planCheckRuns.value = response.planCheckRuns.map(convertNewPlanCheckRunToOld);
lastRefreshTime.planCheckRuns = Date.now();
- console.debug(
- "Plan check runs refreshed at:",
- new Date(lastRefreshTime.planCheckRuns).toISOString()
- );
};
export const refreshRollout = async (
@@ -92,10 +84,6 @@ export const refreshRollout = async (
await rolloutServiceClientConnect.getRollout(rolloutRequest);
rollout.value = convertNewRolloutToOld(newRollout);
lastRefreshTime.rollout = Date.now();
- console.debug(
- "Rollout refreshed at:",
- new Date(lastRefreshTime.rollout).toISOString()
- );
};
export const refreshIssue = async (issue: Ref<Issue>): Promise<void> => {
@@ -106,10 +94,6 @@ export const refreshIssue = async (issue: Ref<Issue>): Promise<void> => {
const updatedIssue = convertNewIssueToOld(newIssue);
issue.value = updatedIssue;
lastRefreshTime.issue = Date.now();
- console.debug(
- "Issue refreshed at:",
- new Date(lastRefreshTime.issue).toISOString()
- );
};
export const refreshIssueComments = async (issue: Issue): Promise<void> => {
@@ -121,8 +105,4 @@ export const refreshIssueComments = async (issue: Issue): Promise<void> => {
})
);
lastRefreshTime.issueComments = Date.now();
- console.debug(
- "Issue comments refreshed at:",
- new Date(lastRefreshTime.issueComments).toISOString()
- );
};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 0ead8c9d7d..7ac2dd64f9 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -281,6 +281,7 @@
"created": "Created",
"run-immediately": "Run task immediately | Run tasks immediately",
"selected-n-tasks": "{n} task selected | {n} tasks selected",
+ "no-tasks": "No tasks",
"no-tasks-selected": "No tasks selected",
"no-runnable-tasks": "No runnable tasks",
"no-skippable-tasks": "No skippable tasks",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 9bc0b5c8e6..ece0bc2cec 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -281,6 +281,7 @@
"created": "Creado",
"run-immediately": "Ejecutar tarea inmediatamente",
"selected-n-tasks": "{n} tarea seleccionada | {n} tareas seleccionadas",
+ "no-tasks": "Sin tareas",
"no-tasks-selected": "No hay tareas seleccionadas",
"no-runnable-tasks": "No hay tareas ejecutables",
"no-skippable-tasks": "No hay tareas que se puedan omitir",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index b0c03befd8..33c5be0ce3 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -281,6 +281,7 @@
"created": "内蔵",
"run-immediately": "すぐに実行",
"selected-n-tasks": "{n} 個のタスクが選択されました | {n} 個のタスクが選択されました",
+ "no-tasks": "タスクなし",
"no-tasks-selected": "タスクが選択されていません",
"no-runnable-tasks": "実行可能なタスクはありません",
"no-skippable-tasks": "スキップ可能なタスクはありません",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 07496d938c..f2bc951977 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -281,6 +281,7 @@
"created": "Đã tạo",
"run-immediately": "Chạy nhiệm vụ ngay lập tức",
"selected-n-tasks": "{n} nhiệm vụ đã chọn | {n} nhiệm vụ đã chọn",
+ "no-tasks": "Không có nhiệm vụ",
"no-tasks-selected": "Không có nhiệm vụ nào được chọn",
"no-runnable-tasks": "Không có tác vụ nào có thể chạy được",
"no-skippable-tasks": "Không có nhiệm vụ nào có thể bỏ qua",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 787048cd3e..a128f9aec3 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -281,6 +281,7 @@
"created": "创建于",
"run-immediately": "立即运行任务",
"selected-n-tasks": "已选择 {n} 个任务",
+ "no-tasks": "没有任务",
"no-tasks-selected": "未选择任何任务",
"no-runnable-tasks": "没有可运行的任务",
"no-skippable-tasks": "没有可跳过的任务",
@@ -2816,4 +2817,4 @@
"last-visit": "上次访问",
"changelog-for-version": "{version} 的更新日志"
}
-}
+}
\ No newline at end of file