Skip to content

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

fix(export): add task actions and fix skip/download for export data issues (#19118)

boojack7f2fdd0bba7f
diff --git a/backend/api/v1/rollout_service_converter.go b/backend/api/v1/rollout_service_converter.go
index 6c7c9a12c3..1d82fc6b02 100644
--- a/backend/api/v1/rollout_service_converter.go
+++ b/backend/api/v1/rollout_service_converter.go
@@ -312,12 +312,13 @@ func convertToTaskFromDatabaseDataExport(project *store.ProjectMessage, task *st
}
stageID := common.FormatStageID(task.Environment)
v1pbTask := &v1pb.Task{
- Name: common.FormatTask(project.ResourceID, task.PlanID, stageID, task.ID),
- SpecId: task.Payload.GetSpecId(),
- Type: convertToTaskType(task),
- Status: convertToTaskStatus(task.LatestTaskRunStatus, false),
- Target: targetDatabaseName,
- Payload: &v1pbTaskPayload,
+ Name: common.FormatTask(project.ResourceID, task.PlanID, stageID, task.ID),
+ SpecId: task.Payload.GetSpecId(),
+ Type: convertToTaskType(task),
+ Status: convertToTaskStatus(task.LatestTaskRunStatus, task.Payload.GetSkipped()),
+ SkippedReason: task.Payload.GetSkippedReason(),
+ Target: targetDatabaseName,
+ Payload: &v1pbTaskPayload,
}
if task.UpdatedAt != nil {
v1pbTask.UpdateTime = timestamppb.New(*task.UpdatedAt)
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index 2e0bac4b00..7f93c16e36 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -918,6 +918,11 @@ func (s *SQLService) doExportFromIssue(ctx context.Context, requestName string)
targetTaskRunStatus := []storepb.TaskRun_Status{storepb.TaskRun_DONE}
for _, task := range tasks {
+ // Skip tasks that are marked as skipped (they don't have archives)
+ if task.Payload.GetSkipped() {
+ continue
+ }
+
taskRuns, err := s.store.ListTaskRuns(ctx, &store.FindTaskRunMessage{
TaskUID: &task.ID,
Status: &targetTaskRunStatus,
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts
index 08ce1f91ae..fea0691dfd 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/context.ts
@@ -106,7 +106,17 @@ function computeExportArchiveReady(
return false;
}
- const exportTaskRuns = exportTasks
+ // Only consider DONE tasks for archive readiness (skipped tasks don't have archives)
+ const doneTasks = exportTasks.filter(
+ (task) => task.status === Task_Status.DONE
+ );
+
+ // Need at least one DONE task to have an archive to download
+ if (doneTasks.length === 0) {
+ return false;
+ }
+
+ const exportTaskRuns = doneTasks
.map((task) => {
const taskRunsForTask = taskRuns.filter(
(taskRun) => extractTaskUID(taskRun.name) === extractTaskUID(task.name)
diff --git a/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/TasksSection.vue b/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/TasksSection.vue
index 8dbf78a86b..21b171f3bd 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/TasksSection.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/TasksSection.vue
@@ -17,6 +17,13 @@
size="medium"
class="flex-1 min-w-0"
/>
+ <TaskStatusActions
+ :task="task"
+ :task-runs="getTaskRunsForTask(task)"
+ :rollout="rollout"
+ :size="'tiny'"
+ @action-confirmed="handleActionConfirmed"
+ />
</div>
</div>
</template>
@@ -30,10 +37,12 @@
import { computed, watchEffect } from "vue";
import DatabaseDisplay from "@/components/Plan/components/common/DatabaseDisplay.vue";
import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
-import { useDatabaseV1Store } from "@/store";
+import TaskStatusActions from "@/components/RolloutV1/components/TaskStatusActions.vue";
+import { taskRunNamePrefix, useDatabaseV1Store } from "@/store";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { usePlanContextWithRollout } from "../../../logic";
-const { plan, rollout } = usePlanContextWithRollout();
+const { plan, rollout, taskRuns, events } = usePlanContextWithRollout();
const dbStore = useDatabaseV1Store();
const tasks = computed(() => {
@@ -47,6 +56,18 @@ const tasks = computed(() => {
.filter((task) => task.specId === exportDataSpec.id);
});
+// Get task runs for a specific task
+const getTaskRunsForTask = (task: Task) => {
+ return taskRuns.value.filter((run) =>
+ run.name.startsWith(`${task.name}/${taskRunNamePrefix}`)
+ );
+};
+
+// Handle action confirmed - trigger data refresh
+const handleActionConfirmed = () => {
+ events.emit("status-changed", { eager: true });
+};
+
// Fetch task target databases
watchEffect(() => {
const targets = tasks.value.map((task) => task.target);
diff --git a/frontend/src/components/RolloutV1/components/TaskStatusActions.vue b/frontend/src/components/RolloutV1/components/TaskStatusActions.vue
index 39fa65afff..9d6a98cd84 100644
--- a/frontend/src/components/RolloutV1/components/TaskStatusActions.vue
+++ b/frontend/src/components/RolloutV1/components/TaskStatusActions.vue
@@ -4,7 +4,7 @@
v-if="!readonly && (primaryAction || dropdownOptions.length > 0)"
class="flex flex-row justify-end items-center gap-x-2"
>
- <NButton v-if="primaryAction" size="small" @click="handlePrimaryAction">
+ <NButton v-if="primaryAction" :size="size" @click="handlePrimaryAction">
{{ actionDisplayTitle(primaryAction) }}
</NButton>
<NDropdown
@@ -13,7 +13,7 @@
:options="dropdownOptions"
@select="handleDropdownSelect"
>
- <NButton size="small" class="px-1!" quaternary>
+ <NButton :size="size" class="px-1!" quaternary>
<template #icon>
<EllipsisVerticalIcon class="w-4 h-4" />
</template>
@@ -63,11 +63,17 @@ type TaskStatusAction =
// * -> SKIPPED
| "SKIP";
-const props = defineProps<{
- task: Task;
- taskRuns: TaskRun[];
- rollout?: Rollout;
-}>();
+const props = withDefaults(
+ defineProps<{
+ task: Task;
+ taskRuns: TaskRun[];
+ rollout?: Rollout;
+ size?: "tiny" | "small" | "medium" | "large";
+ }>(),
+ {
+ size: "small",
+ }
+);
const emit = defineEmits<{
"action-confirmed": [];