Skip to content

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

feat: show release info in rollout UI for release-based tasks (#18740)

Danny Xuc95bc809292c
diff --git a/frontend/src/components/RolloutV1/components/TaskItem.vue b/frontend/src/components/RolloutV1/components/TaskItem.vue
index 294008cd77..e253007639 100644
--- a/frontend/src/components/RolloutV1/components/TaskItem.vue
+++ b/frontend/src/components/RolloutV1/components/TaskItem.vue
@@ -148,7 +148,7 @@
</div>
<!-- SQL Statement section -->
- <div>
+ <div v-if="!isReleaseTask">
<div class="flex items-center justify-between mb-1">
<span class="text-sm font-medium text-gray-700">{{ t("common.statement") }}</span>
<RouterLink
@@ -240,6 +240,7 @@ import {
extractStageNameFromTaskName,
extractStageUID,
extractTaskUID,
+ isReleaseBasedTask,
sheetNameOfTaskV1,
} from "@/utils";
import { useTaskActions } from "./composables/useTaskActions";
@@ -315,6 +316,8 @@ const taskDetailRoute = computed(() => {
};
});
+const isReleaseTask = computed(() => isReleaseBasedTask(props.task));
+
const { loading, displayedStatement, isStatementTruncated } = useTaskStatement(
() => props.task,
() => props.isExpanded
diff --git a/frontend/src/components/RolloutV1/components/TaskView.vue b/frontend/src/components/RolloutV1/components/TaskView.vue
index b1f366d3e5..995622f8c3 100644
--- a/frontend/src/components/RolloutV1/components/TaskView.vue
+++ b/frontend/src/components/RolloutV1/components/TaskView.vue
@@ -84,7 +84,7 @@
</div>
<!-- Sheet Statement -->
- <div class="w-full flex-1 min-h-0">
+ <div v-if="!isReleaseTask" class="w-full flex-1 min-h-0">
<div class="flex items-center justify-between mb-2">
<span class="text-base font-medium">{{ $t("common.statement") }}</span>
<div>
@@ -161,6 +161,7 @@ import {
extractProjectResourceName,
extractSchemaVersionFromTask,
getSheetStatement,
+ isReleaseBasedTask,
sheetNameOfTaskV1,
} from "@/utils";
import TaskRollbackButton from "./TaskRollbackButton.vue";
@@ -212,6 +213,8 @@ const task = computed(() => {
);
});
+const isReleaseTask = computed(() => isReleaseBasedTask(task.value));
+
const taskRuns = computed(() => {
return allTaskRuns.value.filter((run) =>
run.name.startsWith(`${task.value.name}/${taskRunNamePrefix}`)
diff --git a/frontend/src/utils/v1/index.ts b/frontend/src/utils/v1/index.ts
index ea6b612d87..8d2fb7bcae 100644
--- a/frontend/src/utils/v1/index.ts
+++ b/frontend/src/utils/v1/index.ts
@@ -16,3 +16,4 @@ export * from "./cel";
export * from "./advanced-search";
export * from "./iam";
export * from "./dbSchema";
+export * from "./release";
diff --git a/frontend/src/utils/v1/issue/rollout.ts b/frontend/src/utils/v1/issue/rollout.ts
index 4e2727fb4a..bd694b9f07 100644
--- a/frontend/src/utils/v1/issue/rollout.ts
+++ b/frontend/src/utils/v1/issue/rollout.ts
@@ -15,6 +15,7 @@ import {
unknownStage,
unknownTask,
} from "@/types";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
import type { Project } from "@/types/proto-es/v1/project_service_pb";
import {
type Rollout,
@@ -306,3 +307,23 @@ export const databaseForTask = (project: Project, task: Task) => {
return unknownDatabase();
}
};
+
+export const isReleaseBasedTask = (task: Task): boolean => {
+ if (task.payload?.case === "databaseUpdate") {
+ return task.payload.value.source?.case === "release";
+ }
+
+ return false;
+};
+
+export const releaseNameOfPlan = (plan: Plan): string | undefined => {
+ for (const spec of plan.specs) {
+ if (spec.config.case === "changeDatabaseConfig") {
+ const release = spec.config.value.release;
+ if (release) {
+ return release;
+ }
+ }
+ }
+ return undefined;
+};
diff --git a/frontend/src/utils/v1/release.ts b/frontend/src/utils/v1/release.ts
new file mode 100644
index 0000000000..efc54dd039
--- /dev/null
+++ b/frontend/src/utils/v1/release.ts
@@ -0,0 +1,5 @@
+export const extractReleaseUID = (name: string) => {
+ const pattern = /(?:^|\/)releases\/([^/]+)(?:$|\/)/;
+ const matches = name.match(pattern);
+ return matches?.[1] ?? "";
+};
diff --git a/frontend/src/views/project/RolloutLayout.vue b/frontend/src/views/project/RolloutLayout.vue
index 852dfa4dfe..9fa4bb4e54 100644
--- a/frontend/src/views/project/RolloutLayout.vue
+++ b/frontend/src/views/project/RolloutLayout.vue
@@ -12,6 +12,16 @@
{{ title }}
</h1>
+ <div v-if="releaseRoute" class="px-3 sm:px-4 pb-2">
+ <router-link
+ :to="releaseRoute"
+ class="inline-flex items-center gap-x-2 text-sm text-accent hover:underline"
+ >
+ <span>{{ $t("release.title") }}: {{ release.title }}</span>
+ <ExternalLinkIcon class="w-4 h-4" />
+ </router-link>
+ </div>
+
<router-view v-slot="{ Component }">
<keep-alive :max="3">
<component :is="Component" />
@@ -28,6 +38,7 @@
<script lang="ts" setup>
import { useTitle } from "@vueuse/core";
+import { ExternalLinkIcon } from "lucide-vue-next";
import { NSpin } from "naive-ui";
import { computed, ref, toRef, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
@@ -41,8 +52,10 @@ import { provideSidebarContext } from "@/components/Plan/logic/sidebar";
import PollerProvider from "@/components/Plan/PollerProvider.vue";
import RolloutBreadcrumb from "@/components/RolloutV1/components/RolloutBreadcrumb.vue";
import { useBodyLayoutContext } from "@/layouts/common";
-import { usePolicyV1Store } from "@/store";
+import { PROJECT_V1_ROUTE_RELEASE_DETAIL } from "@/router/dashboard/projectV1";
+import { usePolicyV1Store, useReleaseByName } from "@/store";
import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";
+import { extractReleaseUID, releaseNameOfPlan } from "@/utils";
const props = defineProps<{
projectId: string;
@@ -85,6 +98,25 @@ watchEffect(() => {
});
const title = computed(() => issue.value?.title || plan.value?.title || "");
+const releaseName = computed(() => {
+ if (!plan.value) return undefined;
+ return releaseNameOfPlan(plan.value);
+});
+
+const { release } = useReleaseByName(computed(() => releaseName.value || ""));
+
+const releaseRoute = computed(() => {
+ if (!releaseName.value) return undefined;
+
+ return {
+ name: PROJECT_V1_ROUTE_RELEASE_DETAIL,
+ params: {
+ projectId: props.projectId,
+ releaseId: extractReleaseUID(releaseName.value),
+ },
+ };
+});
+
providePlanContext({
isCreating,
plan,