Skip to content

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

feat(plan): streamline release-backed plan UX (#20376)

Danny Xuc6765bf2ab00
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 9e7d46cc6f..ab3fcad7dc 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1324,7 +1324,6 @@
"deploy-checks-optional": "Failed checks won't block manual rollout in this project.",
"deploy-checks-ready": "Checks are ready for automatic rollout creation.",
"deploy-checks-running": "Wait for running checks to finish before automatic rollout can proceed.",
- "deploy-description": "Bytebase will automatically create the rollout when all checks pass and the issue is approved.",
"deploy-manual-create-description": "Based on the current project settings, you can also create the rollout manually.",
"deploy-manual-create-description-readonly": "User with Create Rollout permission can create the rollout manually.",
"hide-details": "Hide details ↑",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 4239f63ee8..29c80f9ab5 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1324,7 +1324,6 @@
"deploy-checks-optional": "Las verificaciones fallidas no bloquearán el rollout manual en este proyecto.",
"deploy-checks-ready": "Las verificaciones ya permiten la creación automática del rollout.",
"deploy-checks-running": "Espera a que terminen las verificaciones en ejecución antes de que el rollout automático pueda continuar.",
- "deploy-description": "Bytebase creará automáticamente el rollout cuando todas las comprobaciones pasen y el issue esté aprobado.",
"deploy-manual-create-description": "Según la configuración actual del proyecto, también puede crear el rollout manualmente.",
"deploy-manual-create-description-readonly": "Un usuario con el permiso Create Rollout puede crear el rollout manualmente.",
"hide-details": "Ocultar detalles ↑",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index e4fc095b49..10332c4164 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1324,7 +1324,6 @@
"deploy-checks-optional": "このプロジェクトでは、チェック失敗は手動ロールアウトを妨げません。",
"deploy-checks-ready": "チェックはロールアウトの自動作成が可能な状態です。",
"deploy-checks-running": "実行中のチェックが終わるまで、ロールアウトの自動作成は続行されません。",
- "deploy-description": "すべてのチェックが通過し、Issue が承認されると、Bytebase は自動的にロールアウトを作成します。",
"deploy-manual-create-description": "現在のプロジェクト設定に応じて、ロールアウトを手動で作成することもできます。",
"deploy-manual-create-description-readonly": "Create Rollout 権限を持つユーザーがロールアウトを手動で作成できます。",
"hide-details": "詳細を非表示 ↑",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 4c0a01b617..c9a98c1042 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1324,7 +1324,6 @@
"deploy-checks-optional": "Các kiểm tra lỗi sẽ không chặn rollout thủ công trong dự án này.",
"deploy-checks-ready": "Các kiểm tra đã sẵn sàng để tạo rollout tự động.",
"deploy-checks-running": "Hãy chờ các kiểm tra đang chạy hoàn tất trước khi rollout tự động có thể tiếp tục.",
- "deploy-description": "Bytebase sẽ tự động tạo rollout khi tất cả kiểm tra đều đạt và issue đã được phê duyệt.",
"deploy-manual-create-description": "Dựa trên cài đặt dự án hiện tại, bạn cũng có thể tạo rollout thủ công.",
"deploy-manual-create-description-readonly": "Người dùng có quyền Create Rollout có thể tạo rollout thủ công.",
"hide-details": "Ẩn chi tiết ↑",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 487ab97e66..5d305324f2 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1324,7 +1324,6 @@
"deploy-checks-optional": "在当前项目中,未通过的检查不会阻止手动创建发布。",
"deploy-checks-ready": "检查结果已满足系统自动创建发布的条件。",
"deploy-checks-running": "请等待运行中的检查完成,系统才能继续自动创建发布。",
- "deploy-description": "当所有检查都通过且工单审批完成后,Bytebase 会自动创建发布。",
"deploy-manual-create-description": "根据当前项目设置,你也可以手动创建发布。",
"deploy-manual-create-description-readonly": "拥有“创建发布”权限的用户可以手动创建发布。",
"hide-details": "收起详情 ↑",
diff --git a/frontend/src/react/components/release/ReleaseInfoCard.test.tsx b/frontend/src/react/components/release/ReleaseInfoCard.test.tsx
new file mode 100644
index 0000000000..69e69540ef
--- /dev/null
+++ b/frontend/src/react/components/release/ReleaseInfoCard.test.tsx
@@ -0,0 +1,133 @@
+import { create } from "@bufbuild/protobuf";
+import { TimestampSchema } from "@bufbuild/protobuf/wkt";
+import { act, createElement, type ReactElement } from "react";
+import { createRoot } from "react-dom/client";
+import { describe, expect, test, vi } from "vitest";
+import {
+ type Release,
+ Release_FileSchema,
+ Release_Type,
+ ReleaseSchema,
+} from "@/types/proto-es/v1/release_service_pb";
+
+(
+ globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }
+).IS_REACT_ACT_ENVIRONMENT = true;
+
+vi.mock("react-i18next", () => ({
+ useTranslation: () => ({
+ t: (key: string, options?: Record<string, unknown>) =>
+ options && "count" in options ? `${key}:${options.count}` : key,
+ }),
+}));
+
+let ReleaseInfoCard: typeof import("./ReleaseInfoCard").ReleaseInfoCard;
+
+const renderIntoContainer = (element: ReactElement) => {
+ const container = document.createElement("div");
+ document.body.appendChild(container);
+ const root = createRoot(container);
+ act(() => {
+ root.render(element);
+ });
+ return {
+ container,
+ unmount: () =>
+ act(() => {
+ root.unmount();
+ container.remove();
+ }),
+ };
+};
+
+const buildRelease = (fileCount: number): Release =>
+ create(ReleaseSchema, {
+ name: "projects/p/releases/r1",
+ type: Release_Type.VERSIONED,
+ createTime: create(TimestampSchema, { seconds: BigInt(0) }),
+ files: Array.from({ length: fileCount }, (_, i) =>
+ create(Release_FileSchema, {
+ version: String(i + 1).padStart(4, "0"),
+ path: `V${String(i + 1).padStart(4, "0")}.sql`,
+ sheet: `sheet-${i}`,
+ })
+ ),
+ });
+
+describe("ReleaseInfoCard", () => {
+ test("renders all files without a truncation tile when count is at the cap", async () => {
+ ({ ReleaseInfoCard } = await import("./ReleaseInfoCard"));
+ const { container, unmount } = renderIntoContainer(
+ createElement(ReleaseInfoCard, {
+ release: buildRelease(4),
+ releaseName: "projects/p/releases/r1",
+ })
+ );
+
+ expect(container.textContent).toContain("V0001.sql");
+ expect(container.textContent).toContain("V0004.sql");
+ expect(container.textContent).not.toContain("release.and-n-more-files");
+ unmount();
+ });
+
+ test("renders the +N tile when the file list exceeds the display cap", async () => {
+ ({ ReleaseInfoCard } = await import("./ReleaseInfoCard"));
+ const { container, unmount } = renderIntoContainer(
+ createElement(ReleaseInfoCard, {
+ release: buildRelease(100),
+ releaseName: "projects/p/releases/r1",
+ })
+ );
+
+ expect(container.textContent).toContain("V0001.sql");
+ expect(container.textContent).toContain("V0004.sql");
+ expect(container.textContent).not.toContain("V0005.sql");
+ expect(container.textContent).toContain("release.and-n-more-files:96");
+ unmount();
+ });
+
+ test("renders the loading state when isLoading is true", async () => {
+ ({ ReleaseInfoCard } = await import("./ReleaseInfoCard"));
+ const { container, unmount } = renderIntoContainer(
+ createElement(ReleaseInfoCard, {
+ isLoading: true,
+ releaseName: "projects/p/releases/r1",
+ })
+ );
+
+ expect(container.textContent).toContain("common.loading");
+ unmount();
+ });
+
+ test("renders the not-found state when release is missing", async () => {
+ ({ ReleaseInfoCard } = await import("./ReleaseInfoCard"));
+ const { container, unmount } = renderIntoContainer(
+ createElement(ReleaseInfoCard, {
+ releaseName: "projects/p/releases/r1",
+ })
+ );
+
+ expect(container.textContent).toContain("release.not-found");
+ unmount();
+ });
+
+ test("renders the not-found state when release is the unknown sentinel", async () => {
+ ({ ReleaseInfoCard } = await import("./ReleaseInfoCard"));
+ // useReleaseByName returns an unknownRelease() sentinel on miss; its
+ // name is the placeholder "projects/-1/releases/-1" which fails
+ // isValidReleaseName. The component must treat that as not-found.
+ const sentinel = create(ReleaseSchema, {
+ name: "projects/-1/releases/-1",
+ });
+ const { container, unmount } = renderIntoContainer(
+ createElement(ReleaseInfoCard, {
+ release: sentinel,
+ releaseName: "projects/p/releases/r1",
+ })
+ );
+
+ expect(container.textContent).toContain("release.not-found");
+ expect(container.textContent).not.toContain("release.files");
+ unmount();
+ });
+});
diff --git a/frontend/src/react/components/release/ReleaseInfoCard.tsx b/frontend/src/react/components/release/ReleaseInfoCard.tsx
new file mode 100644
index 0000000000..788b17a024
--- /dev/null
+++ b/frontend/src/react/components/release/ReleaseInfoCard.tsx
@@ -0,0 +1,206 @@
+import dayjs from "dayjs";
+import type { TFunction } from "i18next";
+import { ExternalLink, Loader2, Package } from "lucide-react";
+import type { ReactNode } from "react";
+import { useMemo } from "react";
+import { useTranslation } from "react-i18next";
+import { cn } from "@/react/lib/utils";
+import { State, VCSType } from "@/types/proto-es/v1/common_pb";
+import type { Release } from "@/types/proto-es/v1/release_service_pb";
+import { Release_Type } from "@/types/proto-es/v1/release_service_pb";
+import { isValidReleaseName } from "@/types/release";
+import { getDateForPbTimestampProtoEs } from "@/types/timestamp";
+
+const MAX_DISPLAYED_RELEASE_FILES = 4;
+
+export function ReleaseInfoCard({
+ className,
+ isLoading = false,
+ release,
+ releaseName,
+}: Readonly<{
+ className?: string;
+ isLoading?: boolean;
+ release?: Release;
+ releaseName: string;
+}>) {
+ const { t } = useTranslation();
+ // useReleaseByName returns a sentinel unknownRelease() when the release
+ // can't be found, so `release` is truthy even on a miss. Treat it as
+ // missing when the name doesn't parse as a real release resource name.
+ const effectiveRelease =
+ release && isValidReleaseName(release.name) ? release : undefined;
+ const releaseTitle = useMemo(() => {
+ const name = effectiveRelease?.name || releaseName;
+ const parts = name.split("/");
+ return parts[parts.length - 1] || name;
+ }, [effectiveRelease?.name, releaseName]);
+ const isDeleted = effectiveRelease?.state === State.DELETED;
+
+ let body: ReactNode;
+ if (isLoading) {
+ body = <LoadingBlock />;
+ } else if (effectiveRelease) {
+ body = <ReleaseBlock release={effectiveRelease} />;
+ } else {
+ body = <NotFoundBlock />;
+ }
+
+ return (
+ <div className={cn("flex flex-col gap-y-2", className)}>
+ <div className="flex items-center justify-between gap-x-2">
+ <div className="flex items-center gap-x-1 text-base font-medium">
+ <Package className="h-4 w-4" />
+ <span className={cn(isDeleted && "text-control-light line-through")}>
+ {releaseTitle}
+ </span>
+ </div>
+ {effectiveRelease && (
+ <a
+ className="inline-flex items-center gap-x-1 text-sm text-accent hover:underline"
+ href={`/${effectiveRelease.name}`}
+ rel="noreferrer"
+ target="_blank"
+ >
+ <span>{t("common.view")}</span>
+ <ExternalLink className="h-4 w-4" />
+ </a>
+ )}
+ </div>
+ {body}
+ </div>
+ );
+}
+
+function LoadingBlock() {
+ const { t } = useTranslation();
+ return (
+ <div className="rounded-md border border-control-border bg-gray-50 px-4 py-3 text-sm text-control-light">
+ <div className="flex items-center gap-x-2">
+ <Loader2 className="h-4 w-4 animate-spin" />
+ <span>{t("common.loading")}</span>
+ </div>
+ </div>
+ );
+}
+
+function NotFoundBlock() {
+ const { t } = useTranslation();
+ return (
+ <div className="rounded-md border border-error/30 bg-error/5 px-4 py-3 text-sm text-error">
+ {t("release.not-found")}
+ </div>
+ );
+}
+
+function ReleaseBlock({ release }: Readonly<{ release: Release }>) {
+ const { t } = useTranslation();
+ const displayedFiles = release.files.slice(0, MAX_DISPLAYED_RELEASE_FILES);
+ const createdTime = release.createTime
+ ? dayjs(getDateForPbTimestampProtoEs(release.createTime)).format(
+ "YYYY-MM-DD HH:mm:ss"
+ )
+ : undefined;
+
+ return (
+ <div className="rounded-md border border-control-border bg-gray-50 px-4 py-3">
+ <div className="flex flex-col gap-y-3">
+ {release.files.length > 0 && (
+ <div className="flex flex-col gap-y-2">
+ <div className="flex items-center justify-between">
+ <div className="text-sm font-medium text-control">
+ {t("release.files")} ({release.files.length})
+ </div>
+ {release.files.length > MAX_DISPLAYED_RELEASE_FILES && (
+ <a
+ className="text-sm text-accent hover:underline"
+ href={`/${release.name}`}
+ rel="noreferrer"
+ target="_blank"
+ >
+ {t("release.view-all-files")}
+ </a>
+ )}
+ </div>
+ <div className="grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3">
+ {displayedFiles.map((file) => (
+ <div
+ key={file.path}
+ className="flex items-center justify-between rounded-sm bg-white p-2 text-xs"
+ >
+ <div className="mr-2 min-w-0 flex-1">
+ <div className="truncate font-medium">{file.path}</div>
+ <div className="text-control-light">{file.version}</div>
+ </div>
+ <div className="shrink-0 rounded-sm bg-blue-100 px-1.5 py-0.5 text-xs text-blue-800">
+ {getReleaseFileTypeText(release.type, t)}
+ </div>
+ </div>
+ ))}
+ {release.files.length > MAX_DISPLAYED_RELEASE_FILES && (
+ <div className="flex items-center justify-center rounded-sm border border-dashed border-control-border bg-white p-2 text-xs text-control-light">
+ {t("release.and-n-more-files", {
+ count: release.files.length - MAX_DISPLAYED_RELEASE_FILES,
+ })}
+ </div>
+ )}
+ </div>
+ </div>
+ )}
+
+ {release.vcsSource && (
+ <div className="flex flex-col gap-y-1">
+ <div className="text-sm font-medium text-control">
+ {t("release.vcs-source")}
+ </div>
+ <div className="text-xs">
+ <span className="text-control-light">
+ {getVCSTypeText(release.vcsSource.vcsType, t)}:
+ </span>
+ {release.vcsSource.url && (
+ <a
+ className="ml-1 text-accent hover:underline"
+ href={release.vcsSource.url}
+ rel="noreferrer"
+ target="_blank"
+ >
+ {release.vcsSource.url}
+ </a>
+ )}
+ </div>
+ </div>
+ )}
+
+ {createdTime && (
+ <div className="text-xs text-control-light">{createdTime}</div>
+ )}
+ </div>
+ </div>
+ );
+}
+
+function getReleaseFileTypeText(fileType: Release_Type, t: TFunction) {
+ switch (fileType) {
+ case Release_Type.VERSIONED:
+ return t("release.file-type.versioned");
+ case Release_Type.DECLARATIVE:
+ return t("release.file-type.declarative");
+ default:
+ return t("release.file-type.unspecified");
+ }
+}
+
+function getVCSTypeText(vcsType: VCSType, t: TFunction) {
+ switch (vcsType) {
+ case VCSType.GITHUB:
+ return "GitHub";
+ case VCSType.GITLAB:
+ return "GitLab";
+ case VCSType.BITBUCKET:
+ return "Bitbucket";
+ case VCSType.AZURE_DEVOPS:
+ return "Azure DevOps";
+ default:
+ return t("release.vcs-type.unspecified");
+ }
+}
diff --git a/frontend/src/react/locales/en-US.json b/frontend/src/react/locales/en-US.json
index a792399e9d..7c41ef0d05 100644
--- a/frontend/src/react/locales/en-US.json
+++ b/frontend/src/react/locales/en-US.json
@@ -1627,6 +1627,7 @@
"plan.phase.deploy-checks-ready": "Checks are ready for automatic rollout creation.",
"plan.phase.deploy-checks-running": "Wait for running checks to finish before automatic rollout can proceed.",
"plan.phase.deploy-description": "Bytebase will automatically create the rollout when all checks pass and the issue is approved.",
+ "plan.phase.deploy-description-gitops": "This plan is ready to roll out. Create a rollout to deploy the linked release.",
"plan.phase.deploy-manual-create-description": "Based on the current project settings, you can also create the rollout manually.",
"plan.phase.deploy-manual-create-description-readonly": "User with Create Rollout permission can create the rollout manually.",
"plan.phase.hide-details": "Hide details",
diff --git a/frontend/src/react/locales/es-ES.json b/frontend/src/react/locales/es-ES.json
index 6571d387f5..65b53d69ef 100644
--- a/frontend/src/react/locales/es-ES.json
+++ b/frontend/src/react/locales/es-ES.json
@@ -1619,6 +1619,7 @@
"plan.phase.deploy-checks-ready": "Las verificaciones ya permiten la creación automática del rollout.",
"plan.phase.deploy-checks-running": "Espera a que terminen las verificaciones en ejecución antes de que el rollout automático pueda continuar.",
"plan.phase.deploy-description": "Bytebase creará automáticamente el rollout cuando todas las comprobaciones pasen y el issue esté aprobado.",
+ "plan.phase.deploy-description-gitops": "Este plan está listo para implementarse. Crea un rollout para desplegar la versión vinculada.",
"plan.phase.deploy-manual-create-description": "Según la configuración actual del proyecto, también puede crear el rollout manualmente.",
"plan.phase.deploy-manual-create-description-readonly": "Un usuario con el permiso Create Rollout puede crear el rollout manualmente.",
"plan.phase.hide-details": "Ocultar detalles",
diff --git a/frontend/src/react/locales/ja-JP.json b/frontend/src/react/locales/ja-JP.json
index 39578c7459..3bdef956aa 100644
--- a/frontend/src/react/locales/ja-JP.json
+++ b/frontend/src/react/locales/ja-JP.json
@@ -1619,6 +1619,7 @@
"plan.phase.deploy-checks-ready": "チェックはロールアウトの自動作成が可能な状態です。",
"plan.phase.deploy-checks-running": "実行中のチェックが終わるまで、ロールアウトの自動作成は続行されません。",
"plan.phase.deploy-description": "すべてのチェックが通過し、Issue が承認されると、Bytebase は自動的にロールアウトを作成します。",
+ "plan.phase.deploy-description-gitops": "このプランはロールアウトの準備ができています。リンクされたリリースをデプロイするにはロールアウトを作成してください。",
"plan.phase.deploy-manual-create-description": "現在のプロジェクト設定に応じて、ロールアウトを手動で作成することもできます。",
"plan.phase.deploy-manual-create-description-readonly": "Create Rollout 権限を持つユーザーがロールアウトを手動で作成できます。",
"plan.phase.hide-details": "詳細を隠す",
diff --git a/frontend/src/react/locales/vi-VN.json b/frontend/src/react/locales/vi-VN.json
index d9bc265614..4715d1d263 100644
--- a/frontend/src/react/locales/vi-VN.json
+++ b/frontend/src/react/locales/vi-VN.json
@@ -1619,6 +1619,7 @@
"plan.phase.deploy-checks-ready": "Các kiểm tra đã sẵn sàng để tạo rollout tự động.",
"plan.phase.deploy-checks-running": "Hãy chờ các kiểm tra đang chạy hoàn tất trước khi rollout tự động có thể tiếp tục.",
"plan.phase.deploy-description": "Bytebase sẽ tự động tạo rollout khi tất cả kiểm tra đều đạt và issue đã được phê duyệt.",
+ "plan.phase.deploy-description-gitops": "Kế hoạch này đã sẵn sàng để triển khai. Tạo một rollout để triển khai bản phát hành được liên kết.",
"plan.phase.deploy-manual-create-description": "Dựa trên cài đặt dự án hiện tại, bạn cũng có thể tạo rollout thủ công.",
"plan.phase.deploy-manual-create-description-readonly": "Người dùng có quyền Create Rollout có thể tạo rollout thủ công.",
"plan.phase.hide-details": "Ẩn chi tiết",
diff --git a/frontend/src/react/locales/zh-CN.json b/frontend/src/react/locales/zh-CN.json
index 1523716da3..953da1fb4f 100644
--- a/frontend/src/react/locales/zh-CN.json
+++ b/frontend/src/react/locales/zh-CN.json
@@ -1619,6 +1619,7 @@
"plan.phase.deploy-checks-ready": "检查结果已满足系统自动创建发布的条件。",
"plan.phase.deploy-checks-running": "请等待运行中的检查完成,系统才能继续自动创建发布。",
"plan.phase.deploy-description": "当所有检查都通过且工单审批完成后,Bytebase 会自动创建发布。",
+ "plan.phase.deploy-description-gitops": "此计划已就绪,可以发布。创建一个发布以部署关联的 Release。",
"plan.phase.deploy-manual-create-description": "根据当前项目设置,你也可以手动创建发布。",
"plan.phase.deploy-manual-create-description-readonly": "拥有“创建发布”权限的用户可以手动创建发布。",
"plan.phase.hide-details": "隐藏详情",
diff --git a/frontend/src/react/pages/project/issue-detail/components/IssueDetailStatementSection.tsx b/frontend/src/react/pages/project/issue-detail/components/IssueDetailStatementSection.tsx
index 30465d3511..59f897cfad 100644
--- a/frontend/src/react/pages/project/issue-detail/components/IssueDetailStatementSection.tsx
+++ b/frontend/src/react/pages/project/issue-detail/components/IssueDetailStatementSection.tsx
@@ -1,10 +1,10 @@
import { clone, create } from "@bufbuild/protobuf";
-import dayjs from "dayjs";
-import { ExternalLink, Loader2, Package, Upload } from "lucide-react";
+import { Loader2, Upload } from "lucide-react";
import { type ChangeEvent, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { planServiceClientConnect, sheetServiceClientConnect } from "@/connect";
import { MonacoEditor, ReadonlyMonaco } from "@/react/components/monaco";
+import { ReleaseInfoCard } from "@/react/components/release/ReleaseInfoCard";
import { Alert } from "@/react/components/ui/alert";
import { Button } from "@/react/components/ui/button";
import { useVueState } from "@/react/hooks/useVueState";
@@ -20,22 +20,17 @@ import {
} from "@/store";
import { extractUserEmail } from "@/store/modules/v1/common";
import {
- getDateForPbTimestampProtoEs,
isValidDatabaseName,
isValidReleaseName,
languageOfEngineV1,
} from "@/types";
-import { VCSType } from "@/types/proto-es/v1/common_pb";
import {
type Plan,
type Plan_Spec,
PlanSchema,
UpdatePlanRequestSchema,
} from "@/types/proto-es/v1/plan_service_pb";
-import {
- type Release,
- Release_Type,
-} from "@/types/proto-es/v1/release_service_pb";
+import { type Release } from "@/types/proto-es/v1/release_service_pb";
import { GetSheetRequestSchema } from "@/types/proto-es/v1/sheet_service_pb";
import { extractDatabaseResourceName, hasProjectPermissionV2 } from "@/utils";
import { getStatementSize, MAX_UPLOAD_FILE_SIZE_MB } from "@/utils/sheet";
@@ -53,8 +48,6 @@ import {
removeLocalSheet,
} from "../utils/localSheet";
-const MAX_DISPLAYED_RELEASE_FILES = 4;
-
export function IssueDetailStatementSection({
className,
forceReadonly = false,
@@ -504,169 +497,14 @@ function IssueDetailReleaseStatement({
releaseName: string;
}) {
const { t } = useTranslation();
- const releaseTitle = useMemo(() => {
- const name = release?.name || releaseName;
- const parts = name.split("/");
- return parts[parts.length - 1] || name;
- }, [release?.name, releaseName]);
- const displayedFiles =
- release?.files.slice(0, MAX_DISPLAYED_RELEASE_FILES) ?? [];
- const createdTime = release?.createTime
- ? dayjs(getDateForPbTimestampProtoEs(release.createTime)).format(
- "YYYY-MM-DD HH:mm:ss"
- )
- : undefined;
-
return (
<div className={cn("flex h-full flex-col gap-y-2", className)}>
<Alert variant="info" description={t("release.change-tip")} />
-
- <div className="flex items-center justify-between gap-x-2">
- <div className="flex items-center gap-x-1 text-base font-medium">
- <Package className="h-4 w-4" />
- <span>{releaseTitle}</span>
- </div>
- {isValidReleaseName(release?.name ?? "") && (
- <a
- className="inline-flex items-center gap-x-1 text-sm text-accent hover:underline"
- href={`/${release?.name}`}
- rel="noreferrer"
- target="_blank"
- >
- <span>{t("common.view")}</span>
- <ExternalLink className="h-4 w-4" />
- </a>
- )}
- </div>
-
- {isLoading ? (
- <div className="rounded-md border border-control-border bg-control-bg px-4 py-3 text-sm text-control-light">
- {t("common.loading")}
- </div>
- ) : release ? (
- <div className="rounded-md border border-control-border bg-control-bg px-4 py-3">
- <div className="flex flex-col gap-y-3">
- <div>
- <div className="text-sm font-medium text-main">
- {releaseTitle}
- </div>
- <div className="mt-1 text-xs text-control-light">
- {release.name}
- </div>
- </div>
-
- {release.files.length > 0 && (
- <div className="flex flex-col gap-y-2">
- <div className="flex items-center justify-between">
- <div className="text-sm font-medium text-control">
- {t("release.files")} ({release.files.length})
- </div>
- {release.files.length > MAX_DISPLAYED_RELEASE_FILES &&
- isValidReleaseName(release.name) && (
- <a
- className="text-sm text-accent hover:underline"
- href={`/${release.name}`}
- rel="noreferrer"
- target="_blank"
- >
- {t("release.view-all-files")}
- </a>
- )}
- </div>
- <div className="grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3">
- {displayedFiles.map((file) => (
- <div
- key={file.path}
- className="flex items-center justify-between rounded-sm bg-white p-2 text-xs"
- >
- <div className="mr-2 min-w-0 flex-1">
- <div className="truncate font-medium">{file.path}</div>
- <div className="text-control-light">{file.version}</div>
- </div>
- <div className="shrink-0 rounded-sm bg-blue-100 px-1.5 py-0.5 text-xs text-blue-800">
- {getReleaseFileTypeText(release.type, t)}
- </div>
- </div>
- ))}
- {release.files.length > MAX_DISPLAYED_RELEASE_FILES && (
- <div className="py-1 text-center text-xs text-control-light">
- {t("release.and-n-more-files", {
- count:
- release.files.length - MAX_DISPLAYED_RELEASE_FILES,
- })}
- </div>
- )}
- </div>
- </div>
- )}
-
- {release.vcsSource && (
- <div className="flex flex-col gap-y-1">
- <div className="text-sm font-medium text-control">
- {t("release.vcs-source")}
- </div>
- <div className="text-xs">
- <span className="text-control-light">
- {getVCSTypeText(release.vcsSource.vcsType, t)}:
- </span>
- {release.vcsSource.url && (
- <a
- className="ml-1 text-accent hover:underline"
- href={release.vcsSource.url}
- rel="noreferrer"
- target="_blank"
- >
- {release.vcsSource.url}
- </a>
- )}
- </div>
- </div>
- )}
-
- {createdTime && (
- <div className="text-xs text-control-light">{createdTime}</div>
- )}
- </div>
- </div>
- ) : (
- <div className="rounded-md border border-error/30 bg-error/5 px-4 py-3 text-sm text-error">
- {t("release.not-found")}
- </div>
- )}
+ <ReleaseInfoCard
+ isLoading={isLoading}
+ release={release}
+ releaseName={releaseName}
+ />
</div>
);
}
-
-const getReleaseFileTypeText = (
- fileType: Release_Type,
- t: (key: string, options?: Record<string, unknown>) => string
-) => {
- switch (fileType) {
- case Release_Type.VERSIONED:
- return t("release.file-type.versioned");
- case Release_Type.DECLARATIVE:
- return t("release.file-type.declarative");
- case Release_Type.TYPE_UNSPECIFIED:
- return t("release.file-type.unspecified");
- default:
- return t("release.file-type.unspecified");
- }
-};
-
-const getVCSTypeText = (
- vcsType: VCSType,
- t: (key: string, options?: Record<string, unknown>) => string
-) => {
- switch (vcsType) {
- case VCSType.GITHUB:
- return "GitHub";
- case VCSType.GITLAB:
- return "GitLab";
- case VCSType.BITBUCKET:
- return "Bitbucket";
- case VCSType.AZURE_DEVOPS:
- return "Azure DevOps";
- default:
- return t("release.vcs-type.unspecified");
- }
-};
diff --git a/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.test.tsx b/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.test.tsx
index 03560d5768..e8c14ebd1d 100644
--- a/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.test.tsx
+++ b/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.test.tsx
@@ -212,4 +212,53 @@ describe("ProjectPlanDetailPage", () => {
expect(selectedSpecIdText()).toBe("spec-2");
});
+
+ it("renders the review phase for sheet-backed plans", async () => {
+ mocks.usePlanDetailPage.mockReturnValue(buildPage());
+
+ await act(async () => {
+ root.render(
+ <ProjectPlanDetailPage
+ planId="create"
+ projectId="foo"
+ specId="spec-1"
+ />
+ );
+ await Promise.resolve();
+ });
+
+ expect(container.textContent).toContain("plan.navigator.review");
+ });
+
+ it("hides the review phase for GitOps plans with release-backed specs", async () => {
+ const page = buildPage();
+ page.plan.specs = [
+ {
+ id: "spec-1",
+ config: {
+ case: "changeDatabaseConfig",
+ value: {
+ release: "projects/foo/releases/abc",
+ sheet: "",
+ targets: [],
+ enablePriorBackup: false,
+ },
+ },
+ },
+ ] as unknown as PlanDetailPageState["plan"]["specs"];
+ mocks.usePlanDetailPage.mockReturnValue(page);
+
+ await act(async () => {
+ root.render(
+ <ProjectPlanDetailPage
+ planId="create"
+ projectId="foo"
+ specId="spec-1"
+ />
+ );
+ await Promise.resolve();
+ });
+
+ expect(container.textContent).not.toContain("plan.navigator.review");
+ });
});
diff --git a/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.tsx b/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.tsx
index 8efe679047..edaa3de286 100644
--- a/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.tsx
+++ b/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.tsx
@@ -39,6 +39,7 @@ import {
buildDeploySummary,
buildReviewSummary,
} from "./utils/phaseSummary";
+import { isReleaseBackedPlan } from "./utils/spec";
export function ProjectPlanDetailPage(props: {
projectId: string;
@@ -113,6 +114,11 @@ function ProjectPlanDetailPageInner({
return baseStyle;
}, [showDesktopDetail]);
+ const isGitOpsPlan = useMemo(
+ () => isReleaseBackedPlan(page.plan.specs),
+ [page.plan.specs]
+ );
+
const phaseConfigs = useMemo(() => {
const hasIssue = !!page.issue;
const hasRollout = !!page.rollout;
@@ -138,7 +144,9 @@ function ProjectPlanDetailPageInner({
}
const changesStatus: "completed" | "closed" | "active" | "future" =
- page.isCreating || (!hasIssue && !hasRollout) ? "active" : "completed";
+ page.isCreating || (!isGitOpsPlan && !hasIssue && !hasRollout)
+ ? "active"
+ : "completed";
const deployStatus: "completed" | "closed" | "active" | "future" =
hasRollout ? (allDone ? "completed" : "active") : "future";
@@ -202,7 +210,10 @@ function ProjectPlanDetailPageInner({
changes: {
status: changesStatus,
badge: changesBadge,
- lineClass: lineClass(changesStatus, review),
+ lineClass: lineClass(
+ changesStatus,
+ isGitOpsPlan ? deployStatus : review
+ ),
},
review: {
status: review,
@@ -215,7 +226,7 @@ function ProjectPlanDetailPageInner({
lineClass: "",
},
};
- }, [page.isCreating, page.issue, page.rollout, t]);
+ }, [isGitOpsPlan, page.isCreating, page.issue, page.rollout, t]);
// Mirror the URL specId into local state. We deliberately don't include
// selectedSpecId in the deps — children (e.g. PlanDetailChangesBranch) may
@@ -273,24 +284,26 @@ function ProjectPlanDetailPageInner({
/>
</PhaseSection>
- <PhaseSection
- badge={phaseConfigs.review.badge}
- expanded={page.activePhases.has("review")}
- icon={<MessageSquareMore className="h-4 w-4 text-white" />}
- lineClass={phaseConfigs.review.lineClass}
- label={t("plan.navigator.review")}
- onSelect={() => page.expandPhase("review")}
- status={phaseConfigs.review.status}
- onToggle={() => page.togglePhase("review")}
- summary={buildReviewSummary(page.issue, t)}
- future={
- <p className="mt-0.5 text-sm text-control-placeholder">
- {t("plan.phase.review-description")}
- </p>
- }
- >
- <ReviewBranch />
- </PhaseSection>
+ {!isGitOpsPlan && (
+ <PhaseSection
+ badge={phaseConfigs.review.badge}
+ expanded={page.activePhases.has("review")}
+ icon={<MessageSquareMore className="h-4 w-4 text-white" />}
+ lineClass={phaseConfigs.review.lineClass}
+ label={t("plan.navigator.review")}
+ onSelect={() => page.expandPhase("review")}
+ status={phaseConfigs.review.status}
+ onToggle={() => page.togglePhase("review")}
+ summary={buildReviewSummary(page.issue, t)}
+ future={
+ <p className="mt-0.5 text-sm text-control-placeholder">
+ {t("plan.phase.review-description")}
+ </p>
+ }
+ >
+ <ReviewBranch />
+ </PhaseSection>
+ )}
<PhaseSection
badge={phaseConfigs.deploy.badge}
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
index fc87154ee2..1209a4c81c 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
@@ -124,7 +124,11 @@ import {
planCheckRunListForSpec,
transformReleaseCheckResultsToPlanCheckRuns,
} from "../utils/planCheck";
-import { getSelectedSpec, getSpecTitle } from "../utils/spec";
+import {
+ getSelectedSpec,
+ getSpecTitle,
+ isReleaseBackedPlan,
+} from "../utils/spec";
import { updateSpecSheetWithStatement } from "../utils/specMutation";
import {
filterPlanTargets,
@@ -215,6 +219,9 @@ export function PlanDetailChangesBranch({
const canModifySpecs = useMemo(() => {
if (page.plan.state === State.DELETED) return false;
if (page.readonly) return false;
+ // Release-backed plans are locked to the release artifact — neither the
+ // spec list nor the targets can be edited after the plan exists.
+ if (isReleaseBackedPlan(page.plan.specs)) return false;
if (page.isCreating) return true;
return (
!page.plan.hasRollout &&
@@ -226,6 +233,7 @@ export function PlanDetailChangesBranch({
page.isCreating,
page.plan.creator,
page.plan.hasRollout,
+ page.plan.specs,
page.plan.state,
page.readonly,
project,
@@ -589,7 +597,7 @@ export function PlanDetailChangesBranch({
</div>
</div>
- {!page.isCreating && <PlanDetailAggregateChecks />}
+ {!page.isCreating && !specHasRelease && <PlanDetailAggregateChecks />}
<TargetSelectorSheet
currentTargets={currentTargets}
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailDeployFuture.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailDeployFuture.tsx
index 7326e85d50..f1531e0c21 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailDeployFuture.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailDeployFuture.tsx
@@ -29,6 +29,7 @@ import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_
import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
import { isApprovalCompleted } from "../../issue-detail/utils/approval";
import { usePlanDetailContext } from "../shell/PlanDetailContext";
+import { isReleaseBackedPlan } from "../utils/spec";
export function PlanDetailDeployFuture() {
const { t } = useTranslation();
@@ -49,22 +50,26 @@ export function PlanDetailDeployFuture() {
return (counts.RUNNING ?? 0) > 0;
}, [page.plan.planCheckRunStatusCount]);
const issueApproved = isApprovalCompleted(page.issue);
+ const isGitOpsPlan = useMemo(
+ () => isReleaseBackedPlan(page.plan.specs),
+ [page.plan.specs]
+ );
+ // GitOps (release-backed) plans never get an issue, so allow rollout
+ // creation as soon as the plan is active.
+ const planReadyForManualRollout =
+ !page.plan.hasRollout &&
+ page.plan.state === State.ACTIVE &&
+ (isGitOpsPlan || (!!page.issue && page.issue.status === IssueStatus.OPEN));
const canCreateRollout = Boolean(
- page.issue &&
- !page.plan.hasRollout &&
- page.plan.state === State.ACTIVE &&
- page.issue.status === IssueStatus.OPEN &&
- page.projectCanCreateRollout
+ planReadyForManualRollout && page.projectCanCreateRollout
);
const showManualCreateRolloutHint = Boolean(
- page.issue &&
- !page.plan.hasRollout &&
- page.plan.state === State.ACTIVE &&
- page.issue.status === IssueStatus.OPEN &&
- !(page.projectRequireIssueApproval && !issueApproved) &&
- !(page.projectRequirePlanCheckNoError && planChecksFailed) &&
- (!page.projectRequireIssueApproval ||
- !page.projectRequirePlanCheckNoError)
+ planReadyForManualRollout &&
+ (isGitOpsPlan ||
+ (!(page.projectRequireIssueApproval && !issueApproved) &&
+ !(page.projectRequirePlanCheckNoError && planChecksFailed) &&
+ (!page.projectRequireIssueApproval ||
+ !page.projectRequirePlanCheckNoError)))
);
const manualCreateRolloutDescription = canCreateRollout
? t("plan.phase.deploy-manual-create-description")
@@ -78,7 +83,7 @@ export function PlanDetailDeployFuture() {
})
);
}
- if (page.projectRequireIssueApproval && !issueApproved) {
+ if (!isGitOpsPlan && page.projectRequireIssueApproval && !issueApproved) {
messages.push(
t("project.settings.issue-related.require-issue-approval.description")
);
@@ -92,6 +97,7 @@ export function PlanDetailDeployFuture() {
}
return messages;
}, [
+ isGitOpsPlan,
issueApproved,
page.projectCanCreateRollout,
page.projectRequireIssueApproval,
@@ -101,7 +107,7 @@ export function PlanDetailDeployFuture() {
]);
const warningMessages = useMemo(() => {
const messages: string[] = [];
- if (!page.projectRequireIssueApproval && !issueApproved) {
+ if (!isGitOpsPlan && !page.projectRequireIssueApproval && !issueApproved) {
messages.push(
t("project.settings.issue-related.require-issue-approval.description")
);
@@ -121,6 +127,7 @@ export function PlanDetailDeployFuture() {
}
return messages;
}, [
+ isGitOpsPlan,
issueApproved,
page.projectRequireIssueApproval,
page.projectRequirePlanCheckNoError,
@@ -245,7 +252,9 @@ export function PlanDetailDeployFuture() {
return (
<div className="mt-1.5">
<p className="text-sm text-control-placeholder">
- {t("plan.phase.deploy-description")}
+ {isGitOpsPlan
+ ? t("plan.phase.deploy-description-gitops")
+ : t("plan.phase.deploy-description")}
</p>
{page.issue && (
@@ -285,23 +294,36 @@ export function PlanDetailDeployFuture() {
</ul>
)}
- {showManualCreateRolloutHint && (
- <div className="mt-3 flex max-w-[28rem] flex-col items-start gap-y-2">
- <p className="text-xs text-control-placeholder">
- {manualCreateRolloutDescription}
- </p>
- {canCreateRollout && (
- <Button
- disabled={creatingRollout}
- onClick={() => setRolloutConfirmOpen(true)}
- size="sm"
- variant="outline"
- >
- {t("plan.phase.create-rollout-action")}
- </Button>
- )}
- </div>
- )}
+ {showManualCreateRolloutHint &&
+ (isGitOpsPlan ? canCreateRollout : true) && (
+ <div className="mt-3 flex max-w-[28rem] flex-col items-start gap-y-2">
+ {!isGitOpsPlan && (
+ <p className="text-xs text-control-placeholder">
+ {manualCreateRolloutDescription}
+ </p>
+ )}
+ {canCreateRollout && (
+ <Button
+ disabled={creatingRollout}
+ onClick={() => {
+ // GitOps plans skip the confirm sheet — there's no issue or
+ // approval context to display, and the user already has
+ // bb.rollouts.create at this point. Note this also bypasses
+ // soft warnings (running checks, optional approval) by design.
+ if (isGitOpsPlan) {
+ void createRollout();
+ return;
+ }
+ setRolloutConfirmOpen(true);
+ }}
+ size="sm"
+ variant="outline"
+ >
+ {t("plan.phase.create-rollout-action")}
+ </Button>
+ )}
+ </div>
+ )}
<Sheet
onOpenChange={(open) => {
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailHeader.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailHeader.tsx
index 22858954f4..264234468f 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailHeader.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailHeader.tsx
@@ -52,6 +52,7 @@ import {
shouldStayOnPlanDetailPage,
} from "../utils/header";
import { getLocalSheetByName, removeLocalSheet } from "../utils/localSheet";
+import { isReleaseBackedPlan } from "../utils/spec";
import { PlanDetailMeta } from "./PlanDetailMeta";
export function PlanDetailHeader() {
@@ -139,10 +140,15 @@ export function PlanDetailHeader() {
titleInputRef.current?.focus();
}, [page.isCreating, page.ready]);
+ const isGitOpsPlan = useMemo(
+ () => isReleaseBackedPlan(page.plan.specs),
+ [page.plan.specs]
+ );
const showSubmitForReview =
!!page.plan.name &&
!page.isCreating &&
!page.plan.issue &&
+ !isGitOpsPlan &&
page.plan.state === State.ACTIVE;
const showClosePlan =
!page.isCreating &&
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailStatementSection.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailStatementSection.tsx
index b1cf28e150..0e8b3e248b 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailStatementSection.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailStatementSection.tsx
@@ -1,6 +1,5 @@
import { clone, create } from "@bufbuild/protobuf";
-import dayjs from "dayjs";
-import { ExternalLink, Loader2, Package, Table, Upload } from "lucide-react";
+import { Loader2, Table, Upload } from "lucide-react";
import { type ChangeEvent, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import {
@@ -9,18 +8,17 @@ import {
sheetServiceClientConnect,
} from "@/connect";
import { MonacoEditor, ReadonlyMonaco } from "@/react/components/monaco";
+import { ReleaseInfoCard } from "@/react/components/release/ReleaseInfoCard";
import { Alert } from "@/react/components/ui/alert";
import { Button } from "@/react/components/ui/button";
import { useVueState } from "@/react/hooks/useVueState";
import { cn } from "@/react/lib/utils";
import { pushNotification, useDatabaseV1Store, useSheetV1Store } from "@/store";
import {
- getDateForPbTimestampProtoEs,
isValidDatabaseName,
isValidReleaseName,
languageOfEngineV1,
} from "@/types";
-import { VCSType } from "@/types/proto-es/v1/common_pb";
import {
type Plan_Spec,
Plan_SpecSchema,
@@ -31,7 +29,6 @@ import {
import {
GetReleaseRequestSchema,
type Release,
- Release_Type,
} from "@/types/proto-es/v1/release_service_pb";
import { GetSheetRequestSchema } from "@/types/proto-es/v1/sheet_service_pb";
import { extractDatabaseResourceName, hasProjectPermissionV2 } from "@/utils";
@@ -53,8 +50,6 @@ import {
import { getSQLAdviceMarkers } from "../utils/sqlAdvice";
import { SchemaEditorSheet } from "./SchemaEditorSheet";
-const MAX_DISPLAYED_RELEASE_FILES = 4;
-
export function PlanDetailStatementSection({
className,
planCheckRuns = [],
@@ -587,162 +582,12 @@ function PlanDetailReleaseStatement({
release?: Release;
releaseName: string;
}) {
- const { t } = useTranslation();
- const releaseTitle = useMemo(() => {
- const name = release?.name || releaseName;
- const parts = name.split("/");
- return parts[parts.length - 1] || name;
- }, [release?.name, releaseName]);
- const displayedFiles =
- release?.files.slice(0, MAX_DISPLAYED_RELEASE_FILES) ?? [];
- const createdTime = release?.createTime
- ? dayjs(getDateForPbTimestampProtoEs(release.createTime)).format(
- "YYYY-MM-DD HH:mm:ss"
- )
- : undefined;
-
return (
- <div className={cn("flex h-full flex-col gap-y-2", className)}>
- <Alert
- className="border-0"
- variant="info"
- description={t("release.change-tip")}
- />
- <div className="flex items-center justify-between gap-x-2">
- <div className="flex items-center gap-x-1 text-base font-medium">
- <Package className="h-4 w-4" />
- <span>{releaseTitle}</span>
- </div>
- {isValidReleaseName(release?.name ?? "") && (
- <a
- className="inline-flex items-center gap-x-1 text-sm text-accent hover:underline"
- href={`/${release?.name}`}
- rel="noreferrer"
- target="_blank"
- >
- <span>{t("common.view")}</span>
- <ExternalLink className="h-4 w-4" />
- </a>
- )}
- </div>
- {isLoading ? (
- <div className="rounded-md border border-control-border bg-gray-50 p-4">
- <div className="flex items-center gap-x-2 text-sm text-gray-600">
- <Loader2 className="h-4 w-4 animate-spin" />
- <span>{t("common.loading")}</span>
- </div>
- </div>
- ) : release ? (
- <div className="rounded-md border border-control-border bg-gray-50 px-4 py-3">
- <div className="flex flex-col gap-y-3">
- <div>
- <div className="text-sm font-medium text-main">
- {releaseTitle}
- </div>
- <div className="mt-1 text-xs text-control-light">
- {release.name}
- </div>
- </div>
- {release.files.length > 0 && (
- <div className="flex flex-col gap-y-2">
- <div className="flex items-center justify-between">
- <div className="text-sm font-medium text-control">
- {t("release.files")} ({release.files.length})
- </div>
- {release.files.length > MAX_DISPLAYED_RELEASE_FILES &&
- isValidReleaseName(release.name) && (
- <a
- className="text-sm text-accent hover:underline"
- href={`/${release.name}`}
- rel="noreferrer"
- target="_blank"
- >
- {t("release.view-all-files")}
- </a>
- )}
- </div>
- <div className="grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3">
- {displayedFiles.map((file) => (
- <div
- key={file.path}
- className="flex items-center justify-between rounded-sm bg-white p-2 text-xs"
- >
- <div className="mr-2 min-w-0 flex-1">
- <div className="truncate font-medium">{file.path}</div>
- <div className="text-control-light">{file.version}</div>
- </div>
- <div className="shrink-0 rounded-sm bg-blue-100 px-1.5 py-0.5 text-xs text-blue-800">
- {getReleaseFileTypeText(release.type, t)}
- </div>
- </div>
- ))}
- </div>
- </div>
- )}
- {release.vcsSource && (
- <div className="flex flex-col gap-y-1">
- <div className="text-sm font-medium text-control">
- {t("release.vcs-source")}
- </div>
- <div className="text-xs">
- <span className="text-control-light">
- {getVCSTypeText(release.vcsSource.vcsType, t)}:
- </span>
- {release.vcsSource.url && (
- <a
- className="ml-1 text-accent hover:underline"
- href={release.vcsSource.url}
- rel="noreferrer"
- target="_blank"
- >
- {release.vcsSource.url}
- </a>
- )}
- </div>
- </div>
- )}
- {createdTime && (
- <div className="text-xs text-control-light">{createdTime}</div>
- )}
- </div>
- </div>
- ) : (
- <div className="rounded-md border border-error/20 bg-red-50/20 p-4">
- <div className="text-sm text-red-600">{t("release.not-found")}</div>
- </div>
- )}
- </div>
+ <ReleaseInfoCard
+ className={cn("h-full", className)}
+ isLoading={isLoading}
+ release={release}
+ releaseName={releaseName}
+ />
);
}
-
-function getReleaseFileTypeText(
- fileType: Release_Type,
- t: (key: string, options?: Record<string, unknown>) => string
-) {
- switch (fileType) {
- case Release_Type.VERSIONED:
- return t("release.file-type.versioned");
- case Release_Type.DECLARATIVE:
- return t("release.file-type.declarative");
- default:
- return t("release.file-type.unspecified");
- }
-}
-
-function getVCSTypeText(
- vcsType: VCSType,
- t: (key: string, options?: Record<string, unknown>) => string
-) {
- switch (vcsType) {
- case VCSType.GITHUB:
- return "GitHub";
- case VCSType.GITLAB:
- return "GitLab";
- case VCSType.BITBUCKET:
- return "Bitbucket";
- case VCSType.AZURE_DEVOPS:
- return "Azure DevOps";
- default:
- return t("release.vcs-type.unspecified");
- }
-}
diff --git a/frontend/src/react/pages/project/plan-detail/components/deploy/DeployReleaseInfoCard.tsx b/frontend/src/react/pages/project/plan-detail/components/deploy/DeployReleaseInfoCard.tsx
index 3e1de132b2..a765fbe88d 100644
--- a/frontend/src/react/pages/project/plan-detail/components/deploy/DeployReleaseInfoCard.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/deploy/DeployReleaseInfoCard.tsx
@@ -1,210 +1,20 @@
-import dayjs from "dayjs";
-import { ExternalLink, Loader2, Package } from "lucide-react";
-import { useMemo } from "react";
-import { useTranslation } from "react-i18next";
-import { cn } from "@/react/lib/utils";
+import { ReleaseInfoCard } from "@/react/components/release/ReleaseInfoCard";
import { useReleaseByName } from "@/store/modules/release";
-import { getDateForPbTimestampProtoEs, isValidReleaseName } from "@/types";
-import { State, VCSType } from "@/types/proto-es/v1/common_pb";
-import { Release_Type } from "@/types/proto-es/v1/release_service_pb";
export function DeployReleaseInfoCard({
className,
- compact = true,
releaseName,
}: {
className?: string;
- compact?: boolean;
releaseName: string;
}) {
- const { t } = useTranslation();
const { release, ready } = useReleaseByName(releaseName);
- const releaseValue = release.value;
- const isDeleted = releaseValue?.state === State.DELETED;
- const maxDisplayedFiles = compact ? 4 : 6;
- const releaseTitle = useMemo(() => {
- const name = releaseValue?.name || releaseName;
- const parts = name.split("/");
- return parts[parts.length - 1] || name;
- }, [releaseName, releaseValue?.name]);
- const displayedFiles = releaseValue?.files?.slice(0, maxDisplayedFiles) ?? [];
-
- if (!ready.value) {
- return (
- <div className={cn("flex flex-col gap-y-2", className)}>
- <div className="rounded-md border bg-gray-50 p-2">
- <div className="flex items-center gap-x-2">
- <Loader2 className="h-4 w-4 animate-spin" />
- <span className="text-xs text-gray-600">{t("common.loading")}</span>
- </div>
- </div>
- </div>
- );
- }
-
- if (!isValidReleaseName(releaseValue?.name ?? "")) {
- return (
- <div className={cn("flex flex-col gap-y-2", className)}>
- <div className="rounded-md border bg-red-50 p-2">
- <div className="text-xs text-red-600">{t("release.not-found")}</div>
- </div>
- </div>
- );
- }
-
return (
- <div className={cn("flex flex-col gap-y-2", className)}>
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-x-2 text-sm font-medium">
- <Package className="h-4 w-4" />
- <span
- className={cn(
- !compact && "text-base",
- isDeleted && "text-control-light line-through"
- )}
- >
- {releaseTitle}
- </span>
- </div>
- <a
- className="inline-flex items-center gap-x-1 text-xs text-accent hover:underline"
- href={`/${releaseValue.name}`}
- rel="noreferrer"
- target="_blank"
- >
- {t("common.view")}
- <ExternalLink className="h-3 w-3" />
- </a>
- </div>
-
- <div
- className={cn(
- "rounded-md border bg-gray-50",
- compact ? "px-3 py-2" : "px-4 py-3"
- )}
- >
- <div className={cn("flex flex-col", compact ? "gap-y-2" : "gap-y-3")}>
- <div className="flex items-start justify-between">
- <div>
- <h3 className="text-sm font-medium text-gray-900">
- {releaseTitle}
- </h3>
- </div>
- </div>
-
- {releaseValue.files && releaseValue.files.length > 0 && (
- <div className="flex flex-col gap-y-1">
- <div className="flex items-center justify-between">
- <h4 className="text-xs font-medium text-gray-700">
- {t("release.files")} ({releaseValue.files.length})
- </h4>
- {releaseValue.files.length > maxDisplayedFiles && (
- <a
- className="text-xs text-accent hover:underline"
- href={`/${releaseValue.name}`}
- rel="noreferrer"
- target="_blank"
- >
- {t("release.view-all-files")}
- </a>
- )}
- </div>
- <div
- className={cn(
- "grid w-full gap-1",
- compact
- ? "grid-cols-1 sm:grid-cols-2"
- : "grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3"
- )}
- >
- {displayedFiles.map((file) => (
- <div
- key={file.path}
- className={cn(
- "flex w-full items-center justify-between rounded-sm bg-white text-xs",
- compact ? "p-1.5" : "p-2"
- )}
- >
- <div className="mr-2 min-w-0 flex-1">
- <div className="truncate font-medium">{file.path}</div>
- <div className="text-gray-500">{file.version}</div>
- </div>
- <div
- className={cn(
- "inline-flex shrink-0 items-center rounded-sm bg-blue-100 text-xs text-blue-800",
- compact ? "px-1 py-0.5" : "px-1.5 py-0.5"
- )}
- >
- {getReleaseFileTypeText(releaseValue.type, t)}
- </div>
- </div>
- ))}
- </div>
- </div>
- )}
-
- {releaseValue.vcsSource && (
- <div className="flex flex-col gap-y-0.5">
- <h4 className="text-xs font-medium text-gray-700">
- {t("release.vcs-source")}
- </h4>
- <div className="text-xs">
- <span className="text-gray-500">
- {getVCSTypeText(releaseValue.vcsSource.vcsType, t)}:
- </span>
- {releaseValue.vcsSource.url && (
- <a
- className="ml-1 text-blue-600 hover:text-blue-800"
- href={releaseValue.vcsSource.url}
- rel="noreferrer"
- target="_blank"
- >
- {releaseValue.vcsSource.url}
- </a>
- )}
- </div>
- </div>
- )}
-
- <div className="text-xs text-gray-500">
- {dayjs(
- getDateForPbTimestampProtoEs(releaseValue.createTime)
- ).format("YYYY-MM-DD HH:mm:ss")}
- </div>
- </div>
- </div>
- </div>
+ <ReleaseInfoCard
+ className={className}
+ isLoading={!ready.value}
+ release={release.value ?? undefined}
+ releaseName={releaseName}
+ />
);
}
-
-function getReleaseFileTypeText(
- fileType: Release_Type,
- t: (key: string, options?: Record<string, unknown>) => string
-) {
- switch (fileType) {
- case Release_Type.VERSIONED:
- return t("release.file-type.versioned");
- case Release_Type.DECLARATIVE:
- return t("release.file-type.declarative");
- default:
- return t("release.file-type.unspecified");
- }
-}
-
-function getVCSTypeText(
- vcsType: VCSType,
- t: (key: string, options?: Record<string, unknown>) => string
-) {
- switch (vcsType) {
- case VCSType.GITHUB:
- return "GitHub";
- case VCSType.GITLAB:
- return "GitLab";
- case VCSType.BITBUCKET:
- return "Bitbucket";
- case VCSType.AZURE_DEVOPS:
- return "Azure DevOps";
- default:
- return t("release.vcs-type.unspecified");
- }
-}
diff --git a/frontend/src/react/pages/project/plan-detail/components/deploy/DeployTaskDetailPanel.tsx b/frontend/src/react/pages/project/plan-detail/components/deploy/DeployTaskDetailPanel.tsx
index 69f099914e..f4e7acc03b 100644
--- a/frontend/src/react/pages/project/plan-detail/components/deploy/DeployTaskDetailPanel.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/deploy/DeployTaskDetailPanel.tsx
@@ -242,11 +242,7 @@ export function DeployTaskDetailPanel({ task }: { task: Task }) {
)}
{isReleaseTask && releaseName && (
- <DeployReleaseInfoCard
- className="w-full"
- compact
- releaseName={releaseName}
- />
+ <DeployReleaseInfoCard className="w-full" releaseName={releaseName} />
)}
{stage && taskAction && (
diff --git a/frontend/src/react/pages/project/plan-detail/components/deploy/DeployTaskItem.tsx b/frontend/src/react/pages/project/plan-detail/components/deploy/DeployTaskItem.tsx
index a115971bb6..5e1a96d4af 100644
--- a/frontend/src/react/pages/project/plan-detail/components/deploy/DeployTaskItem.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/deploy/DeployTaskItem.tsx
@@ -319,7 +319,7 @@ export function DeployTaskItem({
)}
</div>
) : releaseName ? (
- <DeployReleaseInfoCard compact releaseName={releaseName} />
+ <DeployReleaseInfoCard releaseName={releaseName} />
) : null}
{latestTaskRun && (
diff --git a/frontend/src/react/pages/project/plan-detail/utils/spec.ts b/frontend/src/react/pages/project/plan-detail/utils/spec.ts
index e8d03d53e6..7d9924445d 100644
--- a/frontend/src/react/pages/project/plan-detail/utils/spec.ts
+++ b/frontend/src/react/pages/project/plan-detail/utils/spec.ts
@@ -11,6 +11,16 @@ export const getSelectedSpec = ({
return specs.find((spec) => spec.id === selectedSpecId) ?? specs[0];
};
+// A plan is GitOps-style when any spec references a release artifact instead
+// of an inline sheet. These plans bypass the review/issue workflow.
+export const isReleaseBackedPlan = (specs: Plan_Spec[]): boolean => {
+ return specs.some(
+ (spec) =>
+ spec.config?.case === "changeDatabaseConfig" &&
+ !!spec.config.value.release
+ );
+};
+
export const getSpecTitle = (spec: Plan_Spec, t: TFunction): string => {
if (spec.config.case === "createDatabaseConfig") {
return t("common.database");