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(frontend): migrate release detail to react (#20090)
boojacke43791b9ffdf
diff --git a/docs/plans/2026-04-22-project-release-detail-react-migration/definition.md b/docs/plans/2026-04-22-project-release-detail-react-migration/definition.mdnew file mode 100644index 0000000000..2443b5baf6--- /dev/null+++ b/docs/plans/2026-04-22-project-release-detail-react-migration/definition.md@@ -0,0 +1,92 @@+## Background & Context++The frontend is migrating from Vue to React per `docs/plans/2026-04-08-react-migration-playbook.md`. The release surface has been partially migrated: `ProjectReleaseDashboardPage` (`frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsx`) replaces the old Vue releases dashboard and is mounted via `frontend/src/react/ReactPageMount.vue` (see `PROJECT_V1_ROUTE_RELEASES` at `frontend/src/router/dashboard/projectV1.ts:501-511`). The detail page reached by clicking a row on that dashboard is still the Vue implementation rooted at `frontend/src/components/Release/ReleaseDetail/ReleaseDetail.vue`.++Two recent migrations establish the patterns to follow:++- `feat(frontend): migrate project plan detail to react` (#20081, commit `b001f2b9d7`, `docs/plans/2026-04-13-project-plan-detail-react-migration.md`) — full-page, route-mounted React detail page with a scoped `react/pages/project/plan-detail/{components,context,hooks,utils}` subtree. `ReactPageMount.vue` serves as the route component via `props: (route) => ({ page: "ProjectPlanDetailPage", ...route.params })`.+- `refactor(react): migrate auth/setup pages from vue` (#20069, `docs/plans/2026-04-21-auth-setup-react-migration/`) — reinforces the playbook's deletion rule: only drop Vue files whose callers are fully gone; shared components with non-auth Vue callers stay.++One subcomponent of `ReleaseDetail` is imported from outside the subtree: `frontend/src/components/Revision/CreateRevisionDrawer.vue:414` imports `ReleaseFileTable.vue`. Vue `CreateRevisionDrawer.vue` has not been migrated, so `ReleaseFileTable.vue` cannot be deleted by this migration.++## Issue Statement++The Vue component tree at `frontend/src/components/Release/ReleaseDetail/**` is still the live implementation for `PROJECT_V1_ROUTE_RELEASE_DETAIL` (`frontend/src/router/dashboard/projectV1.ts:512-520`). The route mounts `@/components/Release/ReleaseDetail/` directly instead of routing through `ReactPageMount.vue`, which diverges from the convention established by `PROJECT_V1_ROUTE_RELEASES` and `PROJECT_V1_ROUTE_PLAN_DETAIL`. One leaf (`ReleaseFileTable.vue`) has a live Vue caller outside the subtree, coupling the subtree to `CreateRevisionDrawer.vue`.++## Current State++### Route registration++- `frontend/src/router/dashboard/projectV1.ts:34` — `PROJECT_V1_ROUTE_RELEASE_DETAIL` name constant.+- `frontend/src/router/dashboard/projectV1.ts:512-520` — route definition; `component: () => import("@/components/Release/ReleaseDetail/")`, `props: true` (passes `releaseId` and `projectId` route params).+- `frontend/src/router/dashboard/projectV1.ts:500-511` — sibling route `PROJECT_V1_ROUTE_RELEASES` already uses `ReactPageMount.vue` with `page: "ProjectReleaseDashboardPage"`.++### Vue page tree (8 files, ~730 LOC)++| File | LOC | Role |+|---|---|---|+| `frontend/src/components/Release/ReleaseDetail/index.ts` | 3 | Default export of `ReleaseDetail.vue` |+| `frontend/src/components/Release/ReleaseDetail/ReleaseDetail.vue` | 74 | Page root, provides `ReleaseDetailContext`, owns document title + file drawer state |+| `frontend/src/components/Release/ReleaseDetail/context.ts` | 68 | `provideReleaseDetailContext` — fetches project + release via `useProjectV1Store`/`useReleaseStore`, derives `allowApply` from `hasPermissionToCreateChangeDatabaseIssueInProject` |+| `frontend/src/components/Release/ReleaseDetail/BasicInfo.vue` | 50 | Create-time + VCS source row |+| `frontend/src/components/Release/ReleaseDetail/NavBar/index.ts` | 3 | Barrel |+| `frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vue` | 82 | Title, apply button, abandon/restore dropdown, `ArchiveBanner` when deleted |+| `frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabaseButton.vue` | 25 | Opens the apply panel |+| `frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue` | 155 | Drawer with `DatabaseAndGroupSelector`, creates plan + rollout, redirects to `buildPlanDeployRoute` |+| `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/index.ts` | - | Barrel |+| `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileTable.vue` | 155 | `NDataTable` of `Release_File`, emits `row-click` / `update:selected-files` |+| `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileDetailPanel.vue` | 80 | Fetches sheet via `sheetServiceClientConnect.getSheet`, renders in Monaco |++### Page behavior++- Document title reset on route match (`ReleaseDetail.vue:65-73`) — resets via `setDocumentTitle(t("release.releases"), project.title)` only when `route.name === PROJECT_V1_ROUTE_RELEASE_DETAIL`.+- Release fetch is keyed on `projects/{projectId}/releases/{releaseId}` and triggered via `watchEffect` on the name (`context.ts:42-48`).+- NavBar dropdown (`NavBar.vue:47-80`): when `state === ACTIVE`, shows `abandon` → naive-ui `useDialog().warning` confirm → `releaseStore.deleteRelease`; when `state === DELETED`, shows `restore` → `releaseStore.undeleteRelease`. Deleted state also renders `ArchiveBanner` at the top.+- File row click (`ReleaseDetail.vue:8-27`): selected file opens the Vue `Drawer`/`DrawerContent` (`@/components/v2`) at fixed width `75vw`/`max-w-[calc(100vw-8rem)]` with `ReleaseFileDetailPanel`.+- Apply flow (`ApplyToDatabasePanel.vue:103-154`): creates a `Plan` with a single `Plan_ChangeDatabaseConfigSchema` spec wrapping the release, immediately creates a `Rollout` for that plan, then routes via `router.push(buildPlanDeployRoute(...))`.++### Cross-subtree consumers of the Vue tree++- `frontend/src/components/Revision/CreateRevisionDrawer.vue:299,328,414` — imports and renders `ReleaseFileTable.vue` twice (selection + readonly modes). This file is not being migrated in this issue.++### React infrastructure already available++- Page registry — `frontend/src/react/mount.ts:59-77` resolves `page: "ProjectReleaseDetailPage"` by convention from `./pages/project/ProjectReleaseDetailPage.tsx`.+- Stores — `useProjectV1Store`, `useReleaseStore` (`frontend/src/store/modules/release.ts` — `fetchReleaseByName`, `getReleaseByName`, `deleteRelease`, `undeleteRelease`) are Pinia and consumable from React directly per playbook §State and Data Guidance.+- Monaco — `@/react/components/monaco/ReadonlyMonaco` + `MonacoEditor` cover the readonly sheet render used by `ReleaseFileDetailPanel`.+- Sheet / AlertDialog / Button / Table — `frontend/src/react/components/ui/{sheet,alert-dialog,button,table}.tsx`.+- Humanize — `frontend/src/react/components/HumanizeTs.tsx` covers the create-time row in `BasicInfo.vue`.+- `DatabaseAndGroupSelector` — has been re-implemented inline by three callers already: `ProjectPlanDashboardPage.tsx:878-…`, `plan-detail/components/PlanDetailChangesBranch.tsx:1272-…`, `export-center/DataExportPrepSheet.tsx:604-…`. No shared React wrapper exists yet.+- `ArchiveBanner.vue`, `VCSIcon.vue`, `HumanizeDate.vue`, and `@/components/v2` `CopyButton` have no React equivalents; `CopyButton` inline exists in `react/components/revision/RevisionDetailPanel.tsx:46` and `react/components/instance/InfoPanel.tsx:233`.++### i18n++All user-facing strings in the Vue tree resolve against existing keys (`common.version`, `common.type`, `common.apply-to-database`, `common.abandon`, `common.restore`, `common.confirm`, `common.cancel`, `common.create`, `common.statement`, `database.revision.filename`, `database.selected-n-databases`, `issue.title.change-database`, `bbkit.confirm-button.sure-to-abandon`, `bbkit.confirm-button.can-undo`, `release.releases`). React locale files under `frontend/src/react/locales/` currently hold only the keys used by existing React surfaces and do not yet contain all of these.++## Non-Goals++- Deleting `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileTable.vue`. `CreateRevisionDrawer.vue:414` still imports it and is not being migrated here; playbook §Deletion Rule applies.+- Migrating `frontend/src/components/Revision/CreateRevisionDrawer.vue` or any revision surface.+- Porting `ArchiveBanner.vue`, `VCSIcon.vue`, `HumanizeDate.vue`, `EllipsisText.vue`, or `@/components/v2` `CopyButton` / `Drawer` / `DrawerContent` as reusable React primitives for other surfaces. Only the minimum surface consumed by the release detail page is created/reused.+- Extracting a shared React `DatabaseAndGroupSelector` component. The three existing inlined copies stay; this migration may use a fourth inline copy or reuse one of the existing ones, but does not introduce a shared abstraction.+- Changing the apply-to-database RPC sequence (`planServiceClientConnect.createPlan` → `rolloutServiceClientConnect.createRollout` → `buildPlanDeployRoute`).+- Changing the release fetch/store contract. `useReleaseStore()` methods remain the only release I/O.+- Redesigning the page layout, copy, or flow. This is a port, not a redesign.+- Adding new product capabilities beyond Vue parity (file download, diff, etc.).+- Migrating the `release.detail` route name constant or its route-helper call sites.+- Touching `frontend/src/utils/sso.ts`, auth stores, or anything in `frontend/src/router/index.ts`.++## Open Questions++1. Should the route's `component` continue to be a scoped Vue file (an `index.ts` that re-exports a `ReactPageMount.vue`-mounting SFC) or switch to the sibling convention used by `PROJECT_V1_ROUTE_RELEASES` (inline `() => import("@/react/ReactPageMount.vue")` with `page: "ProjectReleaseDetailPage"`)? (default: switch to the sibling convention — it is the pattern used by every migrated route in `projectV1.ts` including `PROJECT_V1_ROUTE_RELEASES` at line 506 and `PROJECT_V1_ROUTE_PLAN_DETAIL`, and lets the `frontend/src/components/Release/ReleaseDetail/index.ts` shim go away in the same PR.)+2. Where should the React page live — `frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx` as a single file, or a `release-detail/` subtree mirroring `plan-detail/`? (default: start single-file given the surface is ~730 LOC with four natural subcomponents; split into a `release-detail/components/` subtree only if the single file crosses ~500 LOC. `revision/RevisionDetailPanel.tsx` is precedent for keeping a similar-size detail page mostly single-file.)+3. Should the apply-to-database drawer use `<Sheet width="wide">` (matches Vue's 75vw) or `standard` (704px, default)? (default: `wide` (832px) — the Vue drawer is explicitly `w-240 lg:w-240 max-w-[calc(100vw-8rem)]`, which is closer to the 832px tier; `DataExportPrepSheet` sets the precedent for wide apply-style sheets.)+4. Should the file detail sheet use `Sheet` or `Dialog`? (default: `Sheet` with `width="wide"` to match the Vue `75vw` drawer — the content is a readonly statement viewer, not a form, but the Vue parity target is drawer-shaped and frontend/AGENTS.md permits `Sheet` for "read-only display sheets" at the `narrow` tier; `wide` is used here because the Monaco viewer dominates the panel.)+5. Should `ReleaseFileTable` be re-implemented inline in React (since the Vue file must stay alive for `CreateRevisionDrawer`), or should the React version live at `frontend/src/react/components/release/ReleaseFileTable.tsx` so it can be reused later? (default: implement at `frontend/src/react/components/release/ReleaseFileTable.tsx` — it will be reused when `CreateRevisionDrawer` migrates, matches the plan-detail convention of extracting leaves under a scoped directory, and keeps the page file focused on layout.)+6. Should the naive-ui `useDialog().warning` abandon-confirm flow become a React `AlertDialog`? (default: yes — `AlertDialog` is the right pick for destructive confirms per frontend/AGENTS.md; the same pattern is used by `ProjectReleaseDashboardPage` for archival actions on siblings.)+7. Should the React page fetch release + project itself, or route through a React context provider analogous to `provideReleaseDetailContext`? (default: fetch directly in the page component — the Vue context only holds three values (`release`, `project`, `allowApply`) and has one consumer tree; React Context is unnecessary at this size, playbook §Route Migration Pattern explicitly calls for self-contained pages.)+8. Should the abandon / restore actions gate behind a permission check (`bb.releases.delete` / `bb.releases.undelete`)? (default: match Vue behavior — Vue does not gate these buttons, so React mirrors that; any permission tightening is out of scope for a parity port.)++## Scope++**L** — eight Vue files totaling ~730 LOC span a route page, a provider pattern, a naive-ui-dialog-driven destructive flow, a MonacoEditor-backed file panel, and a cross-subtree leaf (`ReleaseFileTable.vue`) that must stay alive for `CreateRevisionDrawer.vue`. Multiple viable approaches exist for the file-table sharing strategy, drawer-sheet mapping, and whether to introduce a React context provider. The surface is not novel — the plan detail and release dashboard migrations establish the core patterns — but the deletion-rule coupling and RPC-heavy apply flow justify a design pass before execution.diff --git a/docs/plans/2026-04-22-project-release-detail-react-migration/design.md b/docs/plans/2026-04-22-project-release-detail-react-migration/design.mdnew file mode 100644index 0000000000..a4043df1cc--- /dev/null+++ b/docs/plans/2026-04-22-project-release-detail-react-migration/design.md@@ -0,0 +1,223 @@+## References++- **React — Passing Data Deeply with Context** (https://react.dev/learn/passing-data-deeply-with-context, verified). Context "should not be your first choice"; prefer passing props directly or extracting components. Valid context use cases: theming, current account, routing, global state from distant parts of the tree.+- **React — You Might Not Need an Effect** (https://react.dev/learn/you-might-not-need-an-effect, verified). Data fetching in Effects is a legitimate use, but requires a cleanup flag (`let ignore = false; … return () => { ignore = true; }`) to handle race conditions. Extracting into a custom hook is recommended for ergonomics.+- **Martin Fowler — StranglerFigApplication** (https://martinfowler.com/bliki/StranglerFigApplication.html, verified). Incremental replacement with "seams" between old and new, coexistence through the transition, no big-bang rewrite. Maps to the playbook rule: migrate only what the target needs, leave shared dependencies live until their remaining callers are also migrated.+- **React — Add React to an Existing Project** (https://react.dev/learn/add-react-to-an-existing-project, verified). For partial integration, mount React into host-framework-owned DOM nodes via `createRoot`. This is the primitive behind `frontend/src/react/mount.ts:120` / `ReactPageMount.vue`.+- **Repo playbook** (`docs/plans/2026-04-08-react-migration-playbook.md`, in-repo primary source). Route migration pattern: keep route parsing at router boundary, mount through `ReactPageMount.vue`, pass normalized resource-style props, keep the React page self-contained. Shared component rule: migrate only dependencies on the critical path. Deletion rule: only delete Vue counterparts with no remaining callers.+- **Repo precedent — Plan Detail Migration** (`docs/plans/2026-04-13-project-plan-detail-react-migration.md`, `frontend/src/react/pages/project/ProjectPlanDetailPage.tsx`, in-repo primary source). Scoped subtree at `react/pages/project/plan-detail/{components,context,hooks,utils}`, route re-registered with `component: () => import("@/react/ReactPageMount.vue")`, Vue originals kept during the migration and deleted leaf-by-leaf.++## Industry Baseline++**Strangler Fig modernization** (Fowler) is the generally accepted approach for replacing a legacy UI framework in place of a big-bang rewrite: identify a seam, replace one piece, leave the rest coexisting, iterate. The "seam" for a Vue-to-React migration of a single route is the Vue router entry and the page's data inputs.++**React's own guidance** reinforces two choices that narrow the design:++1. *Context is a last resort* (React — Passing Data Deeply with Context). With a single consumer subtree of three values, direct props or locals outrank `createContext`.+2. *Effect-based data fetching is legitimate at page scope* when paired with a race-guard and cleanup (React — You Might Not Need an Effect). There is no need to introduce TanStack Query for a one-release-plus-one-project fetch. This also matches the playbook's "do not add TanStack Query by default" rule.++The plan-detail precedent (#20081) is the closest in-house baseline: it routes via `ReactPageMount.vue`, fetches from Pinia stores directly from React via `useReleaseStore` / `useProjectV1Store`, uses `useEffect` + `useVueState` where Vue reactivity must be observed, and keeps the Vue tree alive until every leaf's callers are gone. Its trade-off — a ~600-LOC page file plus a `plan-detail/` subtree — is appropriate for its ~4000-LOC surface but heavier than the ~730-LOC release detail surface needs.++## Research Summary++Three patterns from the references directly shape this migration:++- **Route-level seam, page-level swap.** The Strangler Fig "seam" here is exactly the `projectV1.ts:512-520` route entry. Swapping its `component` from `@/components/Release/ReleaseDetail/` to `@/react/ReactPageMount.vue` with `page: "ProjectReleaseDetailPage"` replaces the page atomically while the file-table leaf continues to serve `CreateRevisionDrawer`. This matches how `PROJECT_V1_ROUTE_RELEASES` was cut over (`projectV1.ts:506`).+- **Reject Context; use self-contained page fetch.** The Vue `provideReleaseDetailContext` exists to share three values (`release`, `project`, `allowApply`) across four components. React's context guidance is explicit that this is prop-passing territory, not context. The React page fetches release and project itself, passes them to `NavBar`, `BasicInfo`, `ReleaseFileTable`, and the apply/detail sheets as props.+- **Effect-based fetch with cleanup.** The release fetch keyed on `projects/{projectId}/releases/{releaseId}` is a single resource per route-param change. `useEffect` with an `ignore` flag is sufficient and matches the plan-detail precedent, avoiding a new query library.++The open question on file-table sharing is resolved by the playbook's deletion rule combined with Strangler Fig coexistence: the Vue `ReleaseFileTable.vue` stays live for `CreateRevisionDrawer`, and a new React `ReleaseFileTable.tsx` lives at a location that allows reuse when the revision drawer migrates.++## Design Goals++Ordered by priority. Each is verifiable.++1. **Behavioral parity with the Vue page** at `PROJECT_V1_ROUTE_RELEASE_DETAIL`. Verifiable by manual walkthrough against the Vue tree before and after: archive banner on deleted, apply drawer creates plan+rollout and redirects to `buildPlanDeployRoute`, abandon confirm deletes release, restore undeletes, file row click opens the detail panel showing the Monaco-rendered sheet, document title resets on route match.+2. **No live Vue caller of the swapped Vue files after merge**, except `ReleaseFileTable.vue` (preserved for `CreateRevisionDrawer.vue`). Verifiable with `rg` for imports of `ReleaseDetail.vue`, `BasicInfo.vue`, `NavBar.vue`, `ApplyToDatabaseButton.vue`, `ApplyToDatabasePanel.vue`, `ReleaseFileDetailPanel.vue`, and `context.ts` returning zero hits across the repo.+3. **Route-entry parity with the sibling `PROJECT_V1_ROUTE_RELEASES`.** Verifiable by `grep` showing `PROJECT_V1_ROUTE_RELEASE_DETAIL` registered with `component: () => import("@/react/ReactPageMount.vue")` and `props: (route) => ({ page: "ProjectReleaseDetailPage", ...route.params })`.+4. **No new shared React state abstraction.** Verifiable by the absence of `createContext` / new zustand store / new tanstack/query entry point tied to the release detail surface. Pinia stores are the only release I/O.+5. **Full i18n coverage in React locale files.** Verifiable by `pnpm --dir frontend check` and `check-react-i18n` passing, and by the React page passing all locale keys through `useTranslation()`.+6. **Frontend CI gates pass.** Verifiable by `pnpm --dir frontend fix`, `pnpm --dir frontend check`, `pnpm --dir frontend type-check`, and `pnpm --dir frontend test` all returning zero.++## Non-Goals++Inherited from definition:++- Do not delete `ReleaseFileTable.vue` (still imported by `CreateRevisionDrawer.vue:414`).+- Do not migrate `CreateRevisionDrawer.vue` or any revision surface.+- Do not port `ArchiveBanner.vue`, `VCSIcon.vue`, `HumanizeDate.vue`, `EllipsisText.vue`, or `@/components/v2` `Drawer` / `CopyButton` / `DrawerContent` as reusable React primitives beyond the minimum needed here.+- Do not extract a shared React `DatabaseAndGroupSelector`; reuse an existing inline copy.+- Do not change the apply RPC sequence or `buildPlanDeployRoute` call.+- Do not redesign the page layout, copy, or flow.+- Do not gate abandon/restore behind new permission checks.+- Do not change `PROJECT_V1_ROUTE_RELEASE_DETAIL` name constant or helper call sites.++Discovered during research:++- Do not introduce TanStack Query or zustand for this surface (Playbook §State and Data Guidance; React — You Might Not Need an Effect recommends custom hooks over libraries for single-resource fetches).+- Do not wrap the React page in a `React.createContext` provider for `release` / `project` / `allowApply` (React — Passing Data Deeply with Context).++## Proposed Design++### 1. Route rewrite++`frontend/src/router/dashboard/projectV1.ts:512-520` becomes:++```ts+{+ path: ":releaseId",+ name: PROJECT_V1_ROUTE_RELEASE_DETAIL,+ meta: {+ requiredPermissionList: () => ["bb.releases.get"],+ },+ component: () => import("@/react/ReactPageMount.vue"),+ props: (route: RouteLocationNormalized) => ({+ page: "ProjectReleaseDetailPage",+ ...route.params,+ }),+},+```++This matches the sibling `PROJECT_V1_ROUTE_RELEASES` registration at lines 500-511 and satisfies Design Goal 3.++### 2. React page entry++New file: `frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx`.++Exported function signature:++```ts+export function ProjectReleaseDetailPage({+ projectId,+ releaseId,+}: {+ projectId: string;+ releaseId: string;+}) { ... }+```++`mount.ts:59-77` resolves `page: "ProjectReleaseDetailPage"` against `./pages/project/ProjectReleaseDetailPage.tsx` by convention — no registry edit required.++Responsibilities inside the page:++- Build `releaseName = \`${projectNamePrefix}${projectId}/releases/${releaseId}\`` and `projectName = \`${projectNamePrefix}${projectId}\`` inline (copied verbatim from `context.ts:42-44`).+- Fetch project via `useProjectV1Store().getOrFetchProjectByName(projectName)` inside a `useEffect` with an `ignore` flag (React — You Might Not Need an Effect).+- Fetch release via `useReleaseStore().fetchReleaseByName(releaseName)` in the same effect.+- Observe reactive Vue state via `useVueState(() => releaseStore.getReleaseByName(releaseName) ?? unknownRelease())` and the analogous project getter, so Pinia updates flow into React (matches plan-detail usage).+- Compute `allowApply` from `hasPermissionToCreateChangeDatabaseIssueInProject(project)` — the helper is already pure TS and callable from React.+- Reset the document title exactly when the mounted route name matches `PROJECT_V1_ROUTE_RELEASE_DETAIL`, via `useEffect` observing `project.title` (matches `ReleaseDetail.vue:65-73`).+- Own the `selectedReleaseFile` state with `useState<Release_File | undefined>` to drive the file detail sheet, mirroring `ReleaseDetail.vue:46-53`.++No `React.createContext`. Values are passed to children as props (Design Goal 4, React — Passing Data Deeply with Context).++### 3. Component decomposition inside the page++Keep the file single-file until it crosses ~500 LOC, per the definition's default answer to Open Question 2. Decompose in-file into local components:++| React local component | Replaces | Notes |+|---|---|---|+| `<ReleaseHeader>` | `NavBar.vue` + `ArchiveBanner` conditional | Title, `ApplyToDatabaseButton`, `DropdownMenu` with abandon/restore. Uses `@/react/components/ui/dropdown-menu`, `@/react/components/ui/alert-dialog`, `@/react/components/ui/button`. Abandon flow is an `AlertDialog` (frontend/AGENTS.md §Dialog vs Sheet — destructive confirm). Renders a local archive banner inline (`bg-warning/10 text-warning` etc.), not a new shared component (Non-Goal). |+| `<ReleaseBasicInfo>` | `BasicInfo.vue` | Uses `HumanizeTs` from `@/react/components/HumanizeTs`. VCS source row renders a local `<VCSLinkRow>` that reuses the Vue `VCSIcon.vue` via `<VueComponent>` *only if no React VCS icon equivalent exists*; otherwise port the tiny switch inline. Current state shows no React VCS icon, so inline `<Link2>` from lucide with a label is sufficient for parity at this surface. |+| `<ApplyToDatabaseSheet>` | `ApplyToDatabaseButton.vue` + `ApplyToDatabasePanel.vue` | `<Sheet width="wide">` per Open Question 3 default. Reuses `DatabaseAndGroupSelector` by inlining a fourth copy in this page file (Non-Goal: do not extract a shared one). RPC sequence copied verbatim from `ApplyToDatabasePanel.vue:103-154`. Footer button group uses `gap-x-2` per frontend AGENTS.md. |++### 4. Shared leaf: React ReleaseFileTable++New file: `frontend/src/react/components/release/ReleaseFileTable.tsx`.++Why under `react/components/release/` and not inline in the page file: Open Question 5 default — it will be reused when `CreateRevisionDrawer` migrates; having a React home now avoids reinlining. Matches the plan-detail convention of scoped `components/` directories.++Props mirror the Vue emits model:++```ts+type Props = {+ files: Release_File[];+ releaseType: Release_Type;+ showSelection?: boolean; // default false+ rowClickable?: boolean; // default true+ selectedFiles?: Release_File[]; // default []+ onRowClick?: (file: Release_File) => void;+ onSelectedFilesChange?: (files: Release_File[]) => void;+};+```++Implementation uses `@/react/components/ui/table`. Selection column renders a shadcn `Checkbox`; row click toggles selection in selection mode or calls `onRowClick` otherwise, matching `ReleaseFileTable.vue:104-137`. Type-text helper (`getReleaseFileTypeText`) is ported verbatim as a local function.++The Vue `ReleaseFileTable.vue` is **not deleted** (Non-Goal, playbook §Deletion Rule — `CreateRevisionDrawer.vue:414` still imports it). Two implementations coexist; this is the same coexistence tolerated in the playbook's `BytebaseLogo` / `UserPassword` examples.++### 5. File detail panel++New file: `frontend/src/react/components/release/ReleaseFileDetailPanel.tsx`.++- Matches `ReleaseFileDetailPanel.vue` 1:1.+- Monaco usage: `ReadonlyMonaco` from `@/react/components/monaco/ReadonlyMonaco` (already used elsewhere in React pages; covers `readonly`, `auto-height`).+- Sheet content fetching: `sheetServiceClientConnect.getSheet({ name, raw: true })` inside a `useEffect` with `ignore` cleanup, race-guard semantics per React — You Might Not Need an Effect.+- Copy button: reuse the inline `CopyButton` pattern already present in `frontend/src/react/components/revision/RevisionDetailPanel.tsx:46` (Non-Goal: not extracting a shared React `CopyButton`).++Rendered inside a `<Sheet width="wide">` driven by the page's `selectedReleaseFile` state, per Open Question 4 default.++### 6. Data flow summary++```+Vue router+ └─ ReactPageMount.vue (page="ProjectReleaseDetailPage")+ └─ ProjectReleaseDetailPage (fetch, useState, useVueState)+ ├─ ReleaseHeader (release, project, allowApply, onArchive, onRestore)+ │ ├─ AlertDialog (abandon confirm)+ │ └─ ApplyToDatabaseSheet (release, project)+ ├─ ReleaseBasicInfo (release)+ ├─ ReleaseFileTable (files, releaseType, onRowClick)+ └─ Sheet (selectedReleaseFile)+ └─ ReleaseFileDetailPanel (release, releaseFile)+```++No Context. All values pass through props. Pinia is the single source of truth for release and project state; `useVueState` bridges updates.++### 7. i18n++All keys already exist in `frontend/src/locales/`. Copy the subset consumed by the migrated surface into `frontend/src/react/locales/{en-US,es-ES,ja-JP,vi-VN,zh-CN}.json`:++- `release.releases`+- `common.version`, `common.type`, `common.apply-to-database`, `common.abandon`, `common.restore`, `common.confirm`, `common.cancel`, `common.create`, `common.statement`+- `database.revision.filename`, `database.selected-n-databases`+- `issue.title.change-database`+- `bbkit.confirm-button.sure-to-abandon`, `bbkit.confirm-button.can-undo`++`check-react-i18n` verifies completeness (Design Goal 5).++### 8. Testing++Page-level test at `frontend/src/react/pages/project/ProjectReleaseDetailPage.test.tsx`:++- Render with `projectId` + `releaseId` props, release state `ACTIVE`: assert title, apply button, abandon dropdown entry, no archive banner.+- State `DELETED`: archive banner present, dropdown shows only restore.+- Row click on a file opens the sheet with the release file name.+- Apply flow: mock `planServiceClientConnect.createPlan` + `rolloutServiceClientConnect.createRollout` + `router.push`; assert they are called in order with the expected payloads.++Leaf tests:++- `ReleaseFileTable.test.tsx` — selection, row click, hidden selection column when `showSelection=false`.+- `ReleaseFileDetailPanel.test.tsx` — mock `sheetServiceClientConnect.getSheet`, assert Monaco receives the decoded content, copy button reflects the same content.++Follows playbook §Testing Guidance: test the wrapper's contract, mock repo-owned seams (`*ServiceClientConnect`), not Monaco internals.++### 9. Deletion plan++After the route switches to React and all callers are verified with `rg`, delete in the same PR:++- `frontend/src/components/Release/ReleaseDetail/index.ts`+- `frontend/src/components/Release/ReleaseDetail/ReleaseDetail.vue`+- `frontend/src/components/Release/ReleaseDetail/context.ts`+- `frontend/src/components/Release/ReleaseDetail/BasicInfo.vue`+- `frontend/src/components/Release/ReleaseDetail/NavBar/` (whole directory)+- `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileDetailPanel.vue`++Keep:++- `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileTable.vue`+- `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/index.ts`++Verify with `rg "Release/ReleaseDetail" frontend/src` — only expected hits are the ReleaseFileTable live callers.++### 10. Rollout++One PR, single commit chain, behind no feature flag — consistent with plan-detail (#20081) and release-dashboard precedents. Rollback is a route-entry revert plus leaf restoration, so blast radius stays at the route level.diff --git a/docs/plans/2026-04-22-project-release-detail-react-migration/execution.md b/docs/plans/2026-04-22-project-release-detail-react-migration/execution.mdnew file mode 100644index 0000000000..d04e3ecf71--- /dev/null+++ b/docs/plans/2026-04-22-project-release-detail-react-migration/execution.md@@ -0,0 +1,90 @@+## Execution Log++### T1: React `ReleaseFileTable.tsx`++**Status**: Completed+**Files Changed**: `frontend/src/react/components/release/ReleaseFileTable.tsx` (created)+**Validation**: `pnpm --dir frontend type-check` — PASS+**Path Corrections**: None+**Deviations**: None++### T2: React `ReleaseFileDetailPanel.tsx`++**Status**: Completed+**Files Changed**: `frontend/src/react/components/release/ReleaseFileDetailPanel.tsx` (created)+**Validation**: `pnpm --dir frontend type-check` — PASS+**Path Corrections**: The plan's import `@/react/components/monaco` does not resolve — the monaco directory has no barrel. Imported `ReadonlyMonaco` via its full path `@/react/components/monaco/ReadonlyMonaco`, which matches existing callers in `SchemaEditorLite/Panels/PreviewPane.tsx`.+**Deviations**: None++### T3: `ProjectReleaseDetailPage.tsx`++**Status**: Completed+**Files Changed**: `frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx` (created)+**Validation**: `pnpm --dir frontend type-check` — PASS+**Path Corrections**: Used `?? unknownX()`-free getters — `releaseStore.getReleaseByName` and `projectV1Store.getProjectByName` already return sentinel `unknownRelease()` / `unknownProject()` internally. Inlined `DatabaseAndGroupSelector` + `DatabaseSelector` + `DatabaseGroupSelector` from `ProjectPlanDashboardPage.tsx` as planned; session key changed to `bb.release-apply-db-selector` to avoid colliding with the plan-dashboard instance.+**Deviations**: None++### T4: Add missing React i18n keys++**Status**: Completed+**Files Changed**: `frontend/src/react/locales/{en-US,es-ES,ja-JP,vi-VN,zh-CN}.json` (+45 lines, +9 per file)+**Validation**: `pnpm --dir frontend check` — PASS (`check-react-i18n` + locale sorter both clean)+**Path Corrections**: None+**Deviations**: None++### T5: Switch route entry to React++**Status**: Completed+**Files Changed**: `frontend/src/router/dashboard/projectV1.ts` (route `PROJECT_V1_ROUTE_RELEASE_DETAIL` now mounts `ReactPageMount.vue` with `page: "ProjectReleaseDetailPage"`)+**Validation**: `rg "Release/ReleaseDetail/\"" frontend/src/router` — no output. Type-check clean.+**Path Corrections**: None+**Deviations**: None++### T6: Delete obsolete Vue files++**Status**: Completed+**Files Changed**: deleted `Release/ReleaseDetail/{index.ts,ReleaseDetail.vue,context.ts,BasicInfo.vue}`; deleted `Release/ReleaseDetail/NavBar/{index.ts,NavBar.vue,ApplyToDatabaseButton.vue,ApplyToDatabasePanel.vue}` and removed the now-empty `NavBar/` directory; deleted `Release/ReleaseDetail/ReleaseFileTable/ReleaseFileDetailPanel.vue`. Kept `Release/ReleaseDetail/ReleaseFileTable/{index.ts,ReleaseFileTable.vue}` per design §9.+**Validation**:+- `rg "Release/ReleaseDetail/index" frontend/src` — no hits.+- `rg "Release/ReleaseDetail/ReleaseDetail" frontend/src` — no hits.+- `rg "Release/ReleaseDetail/BasicInfo" frontend/src` — no hits.+- `rg "Release/ReleaseDetail/NavBar" frontend/src` — no hits.+- `rg "Release/ReleaseDetail/context" frontend/src` — no hits.+- `rg "ReleaseFileDetailPanel.vue" frontend/src` — no hits.+- `rg "ReleaseFileTable" frontend/src --files-with-matches` — exactly 4 hits: the kept Vue file + its barrel, `CreateRevisionDrawer.vue` (the live Vue caller), and the new React file.++**Path Corrections**: None+**Deviations**: None++### T7: Leaf test — `ReleaseFileTable.test.tsx`++**Status**: Completed+**Files Changed**: `frontend/src/react/components/release/ReleaseFileTable.test.tsx` (created)+**Validation**: `pnpm exec vitest run src/react/components/release/ReleaseFileTable.test.tsx` — 3/3 PASS+**Path Corrections**: Used `create(Release_FileSchema, ...)` to build valid proto instances rather than plain object literals, matching the test fixtures pattern elsewhere in the repo.+**Deviations**: None++### T8: Frontend CI gates++**Status**: Completed+**Files Changed**: none (auto-fixes applied by `pnpm fix` already committed in prior tasks)+**Validation**:+- `pnpm --dir frontend fix` — clean (1 formatting fix applied in the middle of execution).+- `pnpm --dir frontend check` — PASS (biome ci clean, react-i18n clean, locale sorter clean).+- `pnpm --dir frontend type-check` — PASS.+- `pnpm --dir frontend test` — 114 test files, 1420 tests passed.++**Path Corrections**: None+**Deviations**: None++## Completion Declaration++**All tasks completed successfully.**++Summary:+- React page mounted at `PROJECT_V1_ROUTE_RELEASE_DETAIL` via `ProjectReleaseDetailPage` (`frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx`).+- Two new leaves at `frontend/src/react/components/release/{ReleaseFileTable.tsx,ReleaseFileDetailPanel.tsx}`.+- One new test at `frontend/src/react/components/release/ReleaseFileTable.test.tsx` (3/3 passing).+- Nine Vue files deleted; `ReleaseFileTable.vue` preserved for its live Vue caller in `CreateRevisionDrawer.vue`.+- i18n: 7 keys × 5 locales added to `frontend/src/react/locales/`.+- All frontend CI gates green.diff --git a/docs/plans/2026-04-22-project-release-detail-react-migration/plan.md b/docs/plans/2026-04-22-project-release-detail-react-migration/plan.mdnew file mode 100644index 0000000000..5f64c29170--- /dev/null+++ b/docs/plans/2026-04-22-project-release-detail-react-migration/plan.md@@ -0,0 +1,329 @@+## Task List++**Task Index**: T1: React `ReleaseFileTable.tsx` [M] — T2: React `ReleaseFileDetailPanel.tsx` [M] — T3: `ProjectReleaseDetailPage.tsx` [L] — T4: Add missing React i18n keys [S] — T5: Switch route entry to React [S] — T6: Delete obsolete Vue files [S] — T7: `ReleaseFileTable.test.tsx` leaf test [M] — T8: Frontend CI gates [S]++---++### T1: Create React `ReleaseFileTable.tsx` [M]++**Objective**: Mirror `ReleaseFileTable.vue` as a React leaf so the React page can render it and `CreateRevisionDrawer.vue` can later switch to it. Traces to design §4.++**Size**: M (one new file, ~160 LOC, moderate logic: selection sync, row-click modes).++**Files**:+- Create: `frontend/src/react/components/release/ReleaseFileTable.tsx`++**Implementation**:+1. Port the Vue component verbatim to React using `Table`, `TableHeader`, `TableBody`, `TableRow`, `TableCell`, `TableHead` from `@/react/components/ui/table`.+2. Props contract (matches design §4):+ ```ts+ export interface ReleaseFileTableProps {+ files: Release_File[];+ releaseType: Release_Type;+ showSelection?: boolean; // default false+ rowClickable?: boolean; // default true+ selectedFiles?: Release_File[];// default []+ onRowClick?: (file: Release_File, e: React.MouseEvent) => void;+ onSelectedFilesChange?: (files: Release_File[]) => void;+ }+ ```+3. Selection state: local `useState<Set<string>>` of selected paths, synced from `selectedFiles` prop via `useEffect`.+4. Columns: selection (when `showSelection`), version, type (via ported `getReleaseFileTypeText`), filename. Use `w-*` utility widths to approximate Vue widths (160/64/128).+5. Selection column uses a native `<input type="checkbox">` (no React `Checkbox` primitive exists in `ui/`); wrap in `<td className="px-4 py-3">` with `onClick` stopping propagation. (Per frontend/AGENTS.md: only `Input` is required for text-style inputs; checkboxes are OK as native.)+6. Row click mirrors `ReleaseFileTable.vue:104-137` — in selection mode, toggle; otherwise call `onRowClick`. Cursor style when `rowClickable || showSelection`.+7. `i18n`: use `useTranslation()` for `common.version`, `common.type`, `database.revision.filename`, `issue.title.change-database`.++**Boundaries**:+- Do not delete `ReleaseFileTable.vue`. It still has a live Vue caller at `CreateRevisionDrawer.vue:414`.+- Do not export from a barrel file; import by path. No `index.ts` for the directory.+- Do not re-implement `Release_Type` switch logic differently — port the exact 4-case switch from the Vue file.++**Dependencies**: None.++**Expected Outcome**: New file exists, exports `ReleaseFileTable`, compiles under the React tsconfig.++**Validation**: `pnpm --dir frontend type-check` — zero errors.++---++### T2: Create React `ReleaseFileDetailPanel.tsx` [M]++**Objective**: Mirror `ReleaseFileDetailPanel.vue` for use inside the page's file detail sheet. Traces to design §5.++**Size**: M (one new file, ~90 LOC, moderate logic: async sheet fetch with race-guard).++**Files**:+- Create: `frontend/src/react/components/release/ReleaseFileDetailPanel.tsx`++**Implementation**:+1. Props: `{ release: Release; releaseFile: Release_File }`.+2. State: `statement: string`, `loading: boolean`, both `useState`.+3. Effect: on `releaseFile` change, set `let cancelled = false` guard, call `sheetServiceClientConnect.getSheet({ name: releaseFile.sheet, raw: true })`, `new TextDecoder().decode(sheet.content)` into `statement` if not cancelled. Cleanup sets `cancelled = true`. Matches `RevisionDetailPanel.tsx:92-135` pattern.+4. Render structure (ported from `ReleaseFileDetailPanel.vue`):+ - Header row: `common.version`: `{releaseFile.version}` (bold).+ - Meta row: `database.revision.filename: {releaseFile.path}` + `Hash: {releaseFile.sheetSha256.slice(0,8)}`.+ - Separator (use `<Separator />` from `@/react/components/ui/separator`).+ - Statement section: label + inline `CopyButton` (port the inline `CopyButton` from `revision/RevisionDetailPanel.tsx:46-75` verbatim into this file — do not share).+ - `ReadonlyMonaco` from `@/react/components/monaco`, `className="relative h-auto max-h-[480px] min-h-[120px]"`.+5. Loading indicator: render `Loader2` from lucide with `animate-spin` above Monaco while `loading`.+6. `i18n`: `common.version`, `common.statement`, `database.revision.filename`.++**Boundaries**:+- Do not delete `ReleaseFileDetailPanel.vue` yet — deletion happens in T6.+- Do not export a shared React `CopyButton`. Inline it per the design non-goal.+- Do not call any Vue Drawer/DrawerContent — the sheet wrapper is owned by the page.++**Dependencies**: None.++**Expected Outcome**: New file exists, renders, async fetches on release file changes with cleanup.++**Validation**: `pnpm --dir frontend type-check` — zero errors.++---++### T3: Create `ProjectReleaseDetailPage.tsx` [L]++**Objective**: Self-contained React page that replaces `ReleaseDetail.vue`, `BasicInfo.vue`, `NavBar/*.vue`, and `context.ts`. Traces to design §2, §3, §6.++**Size**: L (one new file, ~500 LOC: page state + header + basic-info + apply-sheet + file detail sheet + inline DatabaseAndGroupSelector).++**Files**:+- Create: `frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx`++**Implementation**:+1. Exported signature:+ ```ts+ export function ProjectReleaseDetailPage({+ projectId,+ releaseId,+ }: {+ projectId: string;+ releaseId: string;+ })+ ```+2. Page-level state:+ - `releaseName = \`${projectNamePrefix}${projectId}/releases/${releaseId}\``+ - `projectName = \`${projectNamePrefix}${projectId}\``+ - `const release = useVueState(() => releaseStore.getReleaseByName(releaseName) ?? unknownRelease())`+ - `const project = useVueState(() => projectV1Store.getProjectByName(projectName) ?? unknownProject())`+ - `useEffect` with `ignore` guard: `projectV1Store.getOrFetchProjectByName(projectName)` and `releaseStore.fetchReleaseByName(releaseName)`.+ - `allowApply = hasPermissionToCreateChangeDatabaseIssueInProject(project)` (computed inline each render).+ - Document title `useEffect` on `project.title`: call `setDocumentTitle(t("release.releases"), project.title)` — the route is always the detail route when this page is mounted, so skip the Vue route-name check.+ - `const [selectedReleaseFile, setSelectedReleaseFile] = useState<Release_File | undefined>()` for the file detail sheet.+ - `const [applyOpen, setApplyOpen] = useState(false)` for the apply-to-database sheet.+ - `const [abandonOpen, setAbandonOpen] = useState(false)` for the abandon confirm.+3. Page layout (mirrors `ReleaseDetail.vue:1-11`):+ - Outer `<div className="flex flex-col items-start gap-y-4 p-4 relative">`.+ - `<ReleaseHeader>` (local), `<ReleaseBasicInfo>` (local), `<ReleaseFileTable>` (from T1) with `onRowClick={(f) => setSelectedReleaseFile(f)}`.+4. `<ReleaseHeader>` local component:+ - If `release.state === State.DELETED`, render a sticky `<div className="h-8 w-full text-base font-medium bg-gray-700 text-white flex justify-center items-center">{t("common.archived")}</div>` (port of `ArchiveBanner.vue`).+ - Title row: `<h1 className="text-xl font-medium truncate p-0.5">{releaseName.split('/').pop()}</h1>`.+ - Right side: `<Button>{t("common.apply-to-database")}</Button>` when `release.state === State.ACTIVE` (opens apply sheet) + `<DropdownMenu>` with `abandon`/`restore` depending on state. Use `@/react/components/ui/dropdown-menu`.+ - Abandon selection opens `AlertDialog` with title `t("bbkit.confirm-button.sure-to-abandon")`, description `t("bbkit.confirm-button.can-undo")`, Cancel / Confirm footer. On confirm: `releaseStore.deleteRelease(release.name)`.+ - Restore selection: directly `releaseStore.undeleteRelease(release.name)` (no confirm, mirrors Vue).+5. `<ReleaseBasicInfo>` local component:+ - Row with `Clock4` icon + `HumanizeTs ts={getTimeForPbTimestampProtoEs(release.createTime)/1000}`.+ - If `release.vcsSource?.vcsType !== VCSType.VCS_TYPE_UNSPECIFIED`: render a small row with `Link2` icon and `<a href={release.vcsSource.url} target="_blank">{beautifyUrl(release.vcsSource.url)}</a>`. Port `beautifyUrl` inline as a local function.+6. `<ApplyToDatabaseSheet>` local component:+ - `<Sheet open={applyOpen} onOpenChange={(o) => !o && setApplyOpen(false)}>` + `<SheetContent width="wide">`.+ - Header: `SheetTitle` `t("common.apply-to-database")`.+ - Body: inline `<DatabaseAndGroupSelector>` ported from `ProjectPlanDashboardPage.tsx:881-949` (copy `DatabaseAndGroupSelector` + `DatabaseSelector` + `DatabaseGroupSelector` into this file, bound to local state). Footer status text uses `t("database.selected-n-databases", { n })`.+ - Footer: Cancel + Create buttons, disabled unless selection is valid.+ - On Create: port the RPC sequence from `ApplyToDatabasePanel.vue:103-154` verbatim — `create(PlanSchema, { title, description, specs: [changeDatabaseConfig with release]})`, `planServiceClientConnect.createPlan`, `rolloutServiceClientConnect.createRollout`, then `router.push(buildPlanDeployRoute({ projectId, planId }))`.+7. File detail sheet:+ - `<Sheet open={!!selectedReleaseFile} onOpenChange={(o) => !o && setSelectedReleaseFile(undefined)}>` + `<SheetContent width="wide">`.+ - `<SheetHeader><SheetTitle>{t("release.file") ?? "Release File"}</SheetTitle></SheetHeader>`. Use the existing key `release.file` if present, otherwise inline literal "Release File" (Vue did literal text).+ - Body: `<ReleaseFileDetailPanel release={release} releaseFile={selectedReleaseFile!} />` from T2.+8. Imports:+ ```ts+ import { create } from "@bufbuild/protobuf";+ import { Clock4, Link2, MoreVertical } from "lucide-react";+ import { v4 as uuidv4 } from "uuid";+ import { useEffect, useMemo, useState } from "react";+ import { useTranslation } from "react-i18next";+ import { planServiceClientConnect, rolloutServiceClientConnect } from "@/connect";+ import { HumanizeTs } from "@/react/components/HumanizeTs";+ import { ReleaseFileDetailPanel } from "@/react/components/release/ReleaseFileDetailPanel";+ import { ReleaseFileTable } from "@/react/components/release/ReleaseFileTable";+ import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogTitle } from "@/react/components/ui/alert-dialog";+ import { Button } from "@/react/components/ui/button";+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/react/components/ui/dropdown-menu";+ import { Sheet, SheetBody, SheetContent, SheetFooter, SheetHeader, SheetTitle } from "@/react/components/ui/sheet";+ import { useVueState } from "@/react/hooks/useVueState";+ import { cn } from "@/react/lib/utils";+ import { router } from "@/router";+ import { buildPlanDeployRoute } from "@/router/dashboard/projectV1RouteHelpers";+ import { useProjectV1Store, useReleaseStore, useDatabaseV1Store, useDBGroupStore } from "@/store";+ import { projectNamePrefix } from "@/store/modules/v1/common";+ import { getTimeForPbTimestampProtoEs, unknownProject, unknownRelease } from "@/types";+ import { State, VCSType } from "@/types/proto-es/v1/common_pb";+ import { CreatePlanRequestSchema, Plan_ChangeDatabaseConfigSchema, PlanSchema } from "@/types/proto-es/v1/plan_service_pb";+ import type { Release, Release_File } from "@/types/proto-es/v1/release_service_pb";+ import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";+ import { hasPermissionToCreateChangeDatabaseIssueInProject, setDocumentTitle } from "@/utils";+ ```+ (Imports actually needed for `DatabaseAndGroupSelector` inline copy will be expanded to match the source in `ProjectPlanDashboardPage.tsx`.)++**Boundaries**:+- Do not introduce `React.createContext` or any new store. Pinia is the only data source.+- Do not extract a shared `DatabaseAndGroupSelector`. Copy the three-function block (`DatabaseAndGroupSelector`, `DatabaseSelector`, `DatabaseGroupSelector`) from `ProjectPlanDashboardPage.tsx` inline.+- Do not introduce `tanstack/query`, `zustand`, or any new state library.+- Do not add a permission gate around abandon/restore beyond what Vue had.+- Do not touch Monaco internals.++**Dependencies**: T1, T2.++**Expected Outcome**: `frontend/src/react/mount.ts` can resolve `page: "ProjectReleaseDetailPage"` automatically via the `./pages/project/*.tsx` glob.++**Validation**: `pnpm --dir frontend type-check` — zero errors.++---++### T4: Add missing React i18n keys [S]++**Objective**: Make the keys consumed by T1/T2/T3 resolve in all five React locale files. Traces to design §7, design goal 5.++**Files**:+- Modify: `frontend/src/react/locales/en-US.json`+- Modify: `frontend/src/react/locales/es-ES.json`+- Modify: `frontend/src/react/locales/ja-JP.json`+- Modify: `frontend/src/react/locales/vi-VN.json`+- Modify: `frontend/src/react/locales/zh-CN.json`++**Implementation**: For each locale file, add the missing keys (copying values verbatim from `frontend/src/locales/<lang>.json`):++| Key | en-US | es-ES | ja-JP | vi-VN | zh-CN |+|---|---|---|---|---|---|+| `common.version` | Version | Versión | バージョン | Phiên bản | 版本 |+| `common.apply-to-database` | Apply to database | Aplicar a la base de datos | データベースに適用 | Áp dụng cho cơ sở dữ liệu | 应用到数据库 |+| `common.abandon` | Abandon | Abandonar | 破棄 | Hủy bỏ | 废弃 |+| `database.revision.filename` | Filename | Nombre del archivo | ファイル名 | Tên tệp | 文件名 |+| `issue.title.change-database` | Change database | Modificar base de datos | データベースの変更 | Thay đổi cơ sở dữ liệu | 变更数据库 |+| `bbkit.confirm-button.sure-to-abandon` | Are you sure to abandon? | ¿Estás seguro de abandonar? | 本当に破棄しますか? | Bạn có chắc chắn muốn hủy bỏ? | 确定要废弃吗? |+| `bbkit.confirm-button.can-undo` | You can undo this action later. | Podrás deshacer esta acción más tarde. | この操作は後で元に戻すことができます。 | Bạn có thể hoàn tác hành động này sau. | 此操作可以撤销。 |++Keep existing alphabetical/group ordering. `common.restore`, `common.cancel`, `common.confirm`, `common.create`, `common.type`, `common.statement`, `common.copy`, `common.copied`, `common.close`, `common.archived`, `release.releases`, `release.files`, `database.selected-n-databases` — already present, do not duplicate.++**Validation**: `pnpm --dir frontend check` — zero errors (runs `check-react-i18n`).++---++### T5: Switch route entry to React [S]++**Objective**: Make `PROJECT_V1_ROUTE_RELEASE_DETAIL` mount the new React page. Traces to design §1, design goal 3.++**Files**:+- Modify: `frontend/src/router/dashboard/projectV1.ts`++**Implementation**: Replace lines 512-520:++```ts+{+ path: ":releaseId",+ name: PROJECT_V1_ROUTE_RELEASE_DETAIL,+ meta: {+ requiredPermissionList: () => ["bb.releases.get"],+ },+ component: () => import("@/react/ReactPageMount.vue"),+ props: (route: RouteLocationNormalized) => ({+ page: "ProjectReleaseDetailPage",+ ...route.params,+ }),+},+```++This matches the sibling `PROJECT_V1_ROUTE_RELEASES` pattern at lines 500-511.++**Validation**: `pnpm --dir frontend type-check` — zero errors. `rg "Release/ReleaseDetail/\"" frontend/src/router` — no output (route no longer imports the Vue tree).++---++### T6: Delete obsolete Vue files [S]++**Objective**: Remove Vue files with no remaining callers. Preserve `ReleaseFileTable.vue` because `CreateRevisionDrawer.vue:414` still imports it. Traces to design §9, design goal 2.++**Files**:+- Delete: `frontend/src/components/Release/ReleaseDetail/index.ts`+- Delete: `frontend/src/components/Release/ReleaseDetail/ReleaseDetail.vue`+- Delete: `frontend/src/components/Release/ReleaseDetail/context.ts`+- Delete: `frontend/src/components/Release/ReleaseDetail/BasicInfo.vue`+- Delete: `frontend/src/components/Release/ReleaseDetail/NavBar/index.ts`+- Delete: `frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vue`+- Delete: `frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabaseButton.vue`+- Delete: `frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue`+- Delete: `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileDetailPanel.vue`++Keep:+- `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/index.ts`+- `frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileTable.vue`++**Implementation**: `rm` each file above. Use `rmdir` on `NavBar/` if it empties out (it will).++**Validation**:+- `rg "Release/ReleaseDetail/index" frontend/src` — no hits.+- `rg "Release/ReleaseDetail/ReleaseDetail" frontend/src` — no hits.+- `rg "Release/ReleaseDetail/BasicInfo" frontend/src` — no hits.+- `rg "Release/ReleaseDetail/NavBar" frontend/src` — no hits.+- `rg "Release/ReleaseDetail/context" frontend/src` — no hits.+- `rg "ReleaseFileDetailPanel.vue" frontend/src` — no hits.+- `rg "ReleaseFileTable" frontend/src` — only hits are `CreateRevisionDrawer.vue:414` (Vue) + T1's new React file + (if present) a test file.++---++### T7: Leaf test — `ReleaseFileTable.test.tsx` [M]++**Objective**: Contract test for the React `ReleaseFileTable`. Traces to design §8 (primary leaf test; page-level and detail-panel tests are out of scope per the plan tail).++**Size**: M (one new file, ~120 LOC, isolated contract test with no RPC mocking).++**Files**:+- Create: `frontend/src/react/components/release/ReleaseFileTable.test.tsx`++**Implementation**:+1. Setup: `IS_REACT_ACT_ENVIRONMENT = true`; import `createElement`, `createRoot`, `act`.+2. Mock `react-i18next` so `useTranslation` returns `{ t: (k) => k }` — no real locale loading.+3. Three tests (each < 30 LOC):+ - renders version/type/filename cells for each `Release_File`.+ - hides the selection column by default; shows when `showSelection=true`.+ - clicking a row in non-selection mode fires `onRowClick` with the file.+4. Use minimal test fixtures: two `Release_File` objects with only `path`, `version`, `sheetSha256`, `sheet` populated; `releaseType = Release_Type.VERSIONED`.++**Boundaries**:+- Do not mock `ui/table` internals — render the real components.+- Do not test selection toggling edge cases beyond hide/show (the Vue version did not have tests either — this is parity plus a minimum guard).++**Dependencies**: T1.++**Expected Outcome**: Test file exists, passes with `pnpm --dir frontend test ReleaseFileTable`.++**Validation**: `pnpm --dir frontend test ReleaseFileTable.test` — 3/3 tests pass.++---++### T8: Frontend CI gates [S]++**Objective**: Confirm `fix`, `check`, `type-check`, `test` all pass. Traces to design goal 6.++**Files**: none modified (fix may auto-edit).++**Implementation**: Run in order:+1. `pnpm --dir frontend fix` — format + lint + organize imports, auto-fixes only.+2. `pnpm --dir frontend check` — CI-mode validation (no modifications).+3. `pnpm --dir frontend type-check` — TypeScript/vue-tsc.+4. `pnpm --dir frontend test` — full vitest suite.++If `fix` edits files, re-run `check` and `type-check` once more.++**Validation**: All four commands exit 0. No new lint errors beyond any pre-existing ones on `main`.++---++## Out-of-Scope Tasks++- **Page-level test (`ProjectReleaseDetailPage.test.tsx`)** — design §8 listed it, but precedent `ProjectReleaseDashboardPage` and `ProjectPlanDashboardPage` ship without page-level tests, and adding one requires mocking `planServiceClientConnect`, `rolloutServiceClientConnect`, `releaseServiceClientConnect`, `useReleaseStore`, `useProjectV1Store`, `router.push`, `Monaco`, and five Vue-reactive getters. Design goal 1 calls for manual walkthrough, and design goal 6 covers CI gates, so the page is verified at those two levels instead. Defer to a follow-up if needed.+- **`ReleaseFileDetailPanel.test.tsx`** — same reasoning; requires mocking `sheetServiceClientConnect.getSheet` and `ReadonlyMonaco`. Covered by design goal 1 walkthrough.+- **Extracting a shared React `DatabaseAndGroupSelector`** — explicit Non-Goal in both definition and design.+- **Extracting a shared React `CopyButton`** — explicit Non-Goal; each page that needs one ports the inline 30 LOC version.+- **Porting `VCSIcon.vue`, `ArchiveBanner.vue`, `HumanizeDate.vue`, `EllipsisText.vue`, `@/components/v2` `Drawer`/`CopyButton`** — explicit Non-Goal.+- **Migrating `frontend/src/components/Revision/CreateRevisionDrawer.vue`** — explicit Non-Goal. This is the reason `ReleaseFileTable.vue` is kept alive in T6.+- **Changing the apply RPC sequence, adding permission gates on abandon/restore, redesigning layout** — explicit Non-Goals.diff --git a/frontend/src/components/Release/ReleaseDetail/BasicInfo.vue b/frontend/src/components/Release/ReleaseDetail/BasicInfo.vuedeleted file mode 100644index 5f069e3de9..0000000000--- a/frontend/src/components/Release/ReleaseDetail/BasicInfo.vue+++ /dev/null@@ -1,49 +0,0 @@-<template>- <div class="flex flex-row items-center pl-4 gap-4">- <div class="flex items-center gap-1">- <Clock4Icon class="w-4 h-auto textinfolabel" />- <HumanizeDate- class="textlabel"- :date="getDateForPbTimestampProtoEs(release.createTime)"- />- </div>- <div- v-if="vcsSource && vcsSource?.vcsType !== VCSType.VCS_TYPE_UNSPECIFIED"- class="flex flex-row items-center gap-1"- >- <VCSIcon custom-class="h-4" :type="vcsSource.vcsType" />- <EllipsisText>- <a :href="vcsSource.url" target="_blank" class="normal-link text-sm!">- {{ beautifyUrl(vcsSource.url) }}- </a>- </EllipsisText>- </div>- </div>-</template>--<script lang="ts" setup>-import { Clock4Icon } from "lucide-vue-next";-import { computed } from "vue";-import EllipsisText from "@/components/EllipsisText.vue";-import HumanizeDate from "@/components/misc/HumanizeDate.vue";-import { getDateForPbTimestampProtoEs } from "@/types";-import { VCSType } from "@/types/proto-es/v1/common_pb";-import VCSIcon from "../VCSIcon.vue";-import { useReleaseDetailContext } from "./context";--const { release } = useReleaseDetailContext();--const vcsSource = computed(() => release.value.vcsSource);--const beautifyUrl = (url: string) => {- // Prevent URL parsing error when url is invalid.- try {- const parsedUrl = new URL(url);- return parsedUrl.pathname.length > 0- ? parsedUrl.pathname.substring(1)- : parsedUrl.pathname;- } catch {- return url;- }-};-</script>diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabaseButton.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabaseButton.vuedeleted file mode 100644index 1409a795c7..0000000000--- a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabaseButton.vue+++ /dev/null@@ -1,24 +0,0 @@-<template>- <NButton @click="state.showApplyToDatabasePanel = true">- {{ $t("common.apply-to-database") }}- </NButton>-- <ApplyToDatabasePanel- :show="state.showApplyToDatabasePanel"- @close="state.showApplyToDatabasePanel = false"- />-</template>--<script setup lang="ts">-import { NButton } from "naive-ui";-import { reactive } from "vue";-import ApplyToDatabasePanel from "./ApplyToDatabasePanel.vue";--interface LocalState {- showApplyToDatabasePanel: boolean;-}--const state = reactive<LocalState>({- showApplyToDatabasePanel: false,-});-</script>diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vuedeleted file mode 100644index bc448839c8..0000000000--- a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue+++ /dev/null@@ -1,155 +0,0 @@-<template>- <Drawer v-bind="$attrs" @close="emit('close')">- <DrawerContent :title="$t('common.apply-to-database')">- <template #default>- <div class="w-[calc(100vw-8rem)] lg:w-240 max-w-[calc(100vw-8rem)]">- <DatabaseAndGroupSelector- :project="project"- v-model:value="state.targetSelectState"- />- </div>- </template>-- <template #footer>- <div class="flex-1 flex items-center justify-between">- <div>- <div- v-if="- state.targetSelectState?.changeSource === 'DATABASE' &&- state.targetSelectState?.selectedDatabaseNameList.length > 0- "- class="textinfolabel"- >- {{- $t("database.selected-n-databases", {- n: state.targetSelectState?.selectedDatabaseNameList.length,- })- }}- </div>- </div>-- <div class="flex items-center justify-end gap-x-3">- <NButton quaternary @click.prevent="emit('close')">- {{ $t("common.cancel") }}- </NButton>- <ErrorTipsButton- style="--n-padding: 0 10px"- :errors="createButtonErrors"- :button-props="{- type: 'primary',- }"- @click="handleCreate"- >- {{ $t("common.create") }}- </ErrorTipsButton>- </div>- </div>- </template>- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { NButton } from "naive-ui";-import { v4 as uuidv4 } from "uuid";-import { computed, reactive } from "vue";-import { useRouter } from "vue-router";-import DatabaseAndGroupSelector, {- type DatabaseSelectState,-} from "@/components/DatabaseAndGroupSelector/";-import { Drawer, DrawerContent, ErrorTipsButton } from "@/components/v2";-import {- planServiceClientConnect,- rolloutServiceClientConnect,-} from "@/connect";-import { buildPlanDeployRoute } from "@/router/dashboard/projectV1RouteHelpers";-import { getProjectNameReleaseId } from "@/store/modules/v1/common";-import {- CreatePlanRequestSchema,- Plan_ChangeDatabaseConfigSchema,- PlanSchema,-} from "@/types/proto-es/v1/plan_service_pb";-import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";-import { useReleaseDetailContext } from "../context";--const emit = defineEmits<{- (event: "close"): void;-}>();--type LocalState = {- targetSelectState?: DatabaseSelectState;-};--const router = useRouter();-const { release, project } = useReleaseDetailContext();--const state = reactive<LocalState>({});--const createButtonErrors = computed(() => {- const errors: string[] = [];- if (- !state.targetSelectState ||- (state.targetSelectState.changeSource === "DATABASE" &&- state.targetSelectState.selectedDatabaseNameList.length === 0) ||- (state.targetSelectState.changeSource === "GROUP" &&- !state.targetSelectState.selectedDatabaseGroup)- ) {- errors.push("Please select at least one database");- }- return errors;-});--const handleCreate = async () => {- if (!state.targetSelectState) {- return;- }-- const parts = release.value.name.split("/");- const releaseName = parts[parts.length - 1] || release.value.name;-- const newPlan = create(PlanSchema, {- title: `Release "${releaseName}"`,- description: `Apply release "${releaseName}" to selected databases.`,- specs: [- {- id: uuidv4(),- config: {- case: "changeDatabaseConfig",- value: create(Plan_ChangeDatabaseConfigSchema, {- targets:- (state.targetSelectState.changeSource === "DATABASE"- ? state.targetSelectState.selectedDatabaseNameList- : [state.targetSelectState.selectedDatabaseGroup!]) || [],- release: release.value.name,- }),- },- },- ],- });-- // Create plan- const planRequest = create(CreatePlanRequestSchema, {- parent: project.value.name,- plan: newPlan,- });- const createdPlan = await planServiceClientConnect.createPlan(planRequest);-- // Create rollout directly without creating an issue- const rolloutRequest = create(CreateRolloutRequestSchema, {- parent: createdPlan.name,- });- await rolloutServiceClientConnect.createRollout(rolloutRequest);-- // Extract planId from plan name (format: projects/{project}/plans/{planId})- const planId = createdPlan.name.split("/").pop();-- // Redirect to rollout view- router.push(- buildPlanDeployRoute({- projectId: getProjectNameReleaseId(release.value.name)[0],- planId: planId || "_",- })- );-};-</script>diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vuedeleted file mode 100644index 75c30d701b..0000000000--- a/frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vue+++ /dev/null@@ -1,81 +0,0 @@-<template>- <ArchiveBanner v-if="release.state === State.DELETED" />- <div class="w-full flex flex-row items-center justify-between gap-x-4">- <div class="flex-1 p-0.5 overflow-hidden">- <h1 class="text-xl font-medium truncate">{{ releaseName }}</h1>- </div>- <div class="flex items-center justify-end gap-x-3">- <ApplyToDatabaseButton v-if="release.state === State.ACTIVE" />- <NDropdown- v-if="dropdownOptions.length > 0"- trigger="click"- :options="dropdownOptions"- @select="handleDropdownSelect"- >- <NButton size="small" quaternary class="px-1!">- <template #icon>- <EllipsisVerticalIcon class="w-4 h-4" />- </template>- </NButton>- </NDropdown>- </div>- </div>-</template>--<script setup lang="ts">-import { EllipsisVerticalIcon } from "lucide-vue-next";-import type { DropdownOption } from "naive-ui";-import { NButton, NDropdown, useDialog } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import ArchiveBanner from "@/components/ArchiveBanner.vue";-import { useReleaseStore } from "@/store";-import { State } from "@/types/proto-es/v1/common_pb";-import { useReleaseDetailContext } from "../context";-import ApplyToDatabaseButton from "./ApplyToDatabaseButton.vue";--const { release } = useReleaseDetailContext();-const { t } = useI18n();-const dialog = useDialog();-const releaseStore = useReleaseStore();--const releaseName = computed(() => {- const parts = release.value.name.split("/");- return parts[parts.length - 1] || release.value.name;-});--const dropdownOptions = computed((): DropdownOption[] => {- if (release.value.state === State.ACTIVE) {- return [- {- key: "abandon",- label: t("common.abandon"),- },- ];- } else if (release.value.state === State.DELETED) {- return [- {- key: "restore",- label: t("common.restore"),- },- ];- }- return [];-});--const handleDropdownSelect = async (key: string) => {- if (key === "abandon") {- dialog.warning({- title: t("bbkit.confirm-button.sure-to-abandon"),- content: t("bbkit.confirm-button.can-undo"),- negativeText: t("common.cancel"),- positiveText: t("common.confirm"),- onPositiveClick: async () => {- await releaseStore.deleteRelease(release.value.name);- },- });- } else if (key === "restore") {- await releaseStore.undeleteRelease(release.value.name);- }-};-</script>diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/index.ts b/frontend/src/components/Release/ReleaseDetail/NavBar/index.tsdeleted file mode 100644index 0a296d688c..0000000000--- a/frontend/src/components/Release/ReleaseDetail/NavBar/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import NavBar from "./NavBar.vue";--export default NavBar;diff --git a/frontend/src/components/Release/ReleaseDetail/ReleaseDetail.vue b/frontend/src/components/Release/ReleaseDetail/ReleaseDetail.vuedeleted file mode 100644index 7c5967ea5f..0000000000--- a/frontend/src/components/Release/ReleaseDetail/ReleaseDetail.vue+++ /dev/null@@ -1,74 +0,0 @@-<template>- <div class="flex flex-col items-start gap-y-4 relative">- <NavBar />- <BasicInfo />- <ReleaseFileTable- :files="release.files"- :release-type="release.type"- :show-selection="false"- @row-click="(_, file) => (state.selectedReleaseFile = file)"- />- </div>-- <Drawer- :show="!!state.selectedReleaseFile"- @close="state.selectedReleaseFile = undefined"- >- <DrawerContent- style="width: 75vw; max-width: calc(100vw - 8rem)"- :title="'Release File'"- >- <ReleaseFileDetailPanel- v-if="state.selectedReleaseFile"- :release="release"- :release-file="state.selectedReleaseFile"- />- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import { computed, reactive, watch } from "vue";-import { useI18n } from "vue-i18n";-import { useRoute } from "vue-router";-import { Drawer, DrawerContent } from "@/components/v2";-import { PROJECT_V1_ROUTE_RELEASE_DETAIL } from "@/router/dashboard/projectV1";-import { useProjectByName } from "@/store";-import { projectNamePrefix } from "@/store/modules/v1/common";-import type { Release_File } from "@/types/proto-es/v1/release_service_pb";-import { setDocumentTitle } from "@/utils";-import BasicInfo from "./BasicInfo.vue";-import { provideReleaseDetailContext } from "./context";-import NavBar from "./NavBar";-import ReleaseFileTable from "./ReleaseFileTable";-import ReleaseFileDetailPanel from "./ReleaseFileTable/ReleaseFileDetailPanel.vue";--interface LocalState {- selectedReleaseFile?: Release_File;-}--const { t } = useI18n();-const route = useRoute();-const { release } = provideReleaseDetailContext();-const state = reactive<LocalState>({});--const projectId = computed(() => {- const parts = release.value.name.split("/");- const idx = parts.indexOf("projects");- return idx >= 0 ? parts[idx + 1] : "";-});-const projectResourceName = computed(- () => `${projectNamePrefix}${projectId.value}`-);-const { project } = useProjectByName(projectResourceName);--watch(- [() => route.name, () => project.value.title],- () => {- if (route.name === PROJECT_V1_ROUTE_RELEASE_DETAIL) {- setDocumentTitle(t("release.releases"), project.value.title);- }- },- { immediate: true }-);-</script>diff --git a/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileDetailPanel.vue b/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileDetailPanel.vuedeleted file mode 100644index 0a093e2d49..0000000000--- a/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileDetailPanel.vue+++ /dev/null@@ -1,79 +0,0 @@-<template>- <div class="w-full">- <div class="flex flex-row items-center gap-2">- <p class="text-lg flex gap-x-1">- <span class="text-control">{{ $t("common.version") }}:</span>- <span class="font-bold text-main">{{ releaseFile.version }}</span>- </p>- </div>- <p class="mt-3 text-control text-sm flex gap-x-4">- <span v-if="releaseFile.path"- >{{ $t("database.revision.filename") }}: {{ releaseFile.path }}</span- >- <span>{{ "Hash" }}: {{ releaseFile.sheetSha256.slice(0, 8) }}</span>- </p>- </div>-- <NDivider />-- <div class="flex flex-col gap-y-2">- <p class="w-auto flex items-center text-base text-main mb-2 gap-x-2">- {{ $t("common.statement") }}- <CopyButton :content="fetchedStatement" />- </p>- <NSpin :show="fetching">- <MonacoEditor- class="h-auto max-h-[480px] min-h-[120px] border rounded-[3px] text-sm overflow-clip relative"- :content="fetchedStatement"- :readonly="true"- :auto-height="{ min: 120, max: 480 }"- />- </NSpin>- </div>-</template>--<script lang="ts" setup>-import { NDivider, NSpin } from "naive-ui";-import { onMounted, ref, watch } from "vue";-import { MonacoEditor } from "@/components/MonacoEditor";-import { CopyButton } from "@/components/v2";-import { sheetServiceClientConnect } from "@/connect";-import type {- Release,- Release_File,-} from "@/types/proto-es/v1/release_service_pb";--const props = defineProps<{- release: Release;- releaseFile: Release_File;-}>();--const fetchedStatement = ref("");-const fetching = ref(false);--const fetchStatement = async () => {- fetching.value = true;- try {- const sheet = await sheetServiceClientConnect.getSheet({- name: props.releaseFile.sheet,- raw: true,- });- if (sheet?.content) {- fetchedStatement.value = new TextDecoder().decode(sheet.content);- }- } catch (error) {- console.error("Failed to fetch statement", error);- } finally {- fetching.value = false;- }-};--onMounted(fetchStatement);--watch(- () => props.releaseFile,- () => {- fetchStatement();- }-);-</script>diff --git a/frontend/src/components/Release/ReleaseDetail/context.ts b/frontend/src/components/Release/ReleaseDetail/context.tsdeleted file mode 100644index ec4bc3435c..0000000000--- a/frontend/src/components/Release/ReleaseDetail/context.ts+++ /dev/null@@ -1,67 +0,0 @@-import { computedAsync } from "@vueuse/core";-import type { InjectionKey, Ref } from "vue";-import { computed, inject, provide, watchEffect } from "vue";-import { useRoute } from "vue-router";-import { useProjectV1Store, useReleaseStore } from "@/store";-import { projectNamePrefix } from "@/store/modules/v1/common";-import { unknownProject, unknownRelease } from "@/types";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import type { Release } from "@/types/proto-es/v1/release_service_pb";-import { hasPermissionToCreateChangeDatabaseIssueInProject } from "@/utils";--export type ReleaseDetailContext = {- release: Ref<Release>;- project: Ref<Project>;- allowApply: Ref<boolean>;-};--export const KEY = Symbol(- "bb.release.detail"-) as InjectionKey<ReleaseDetailContext>;--export const useReleaseDetailContext = () => {- return inject(KEY)!;-};--export const provideReleaseDetailContext = () => {- const route = useRoute();- const projectV1Store = useProjectV1Store();- const releaseStore = useReleaseStore();-- const project = computedAsync(async () => {- const projectId = route.params.projectId as string;- if (!projectId) {- return unknownProject();- }-- return await projectV1Store.getOrFetchProjectByName(- `${projectNamePrefix}${projectId}`- );- }, unknownProject());-- const name = computed(() => {- return `${projectNamePrefix}${route.params.projectId}/releases/${route.params.releaseId}`;- });-- watchEffect(async () => {- await releaseStore.fetchReleaseByName(name.value);- });-- const release = computed(() => {- return releaseStore.getReleaseByName(name.value) ?? unknownRelease();- });-- const allowApply = computed(() => {- return hasPermissionToCreateChangeDatabaseIssueInProject(project.value);- });-- const context: ReleaseDetailContext = {- release,- project,- allowApply,- };-- provide(KEY, context);-- return context;-};diff --git a/frontend/src/components/Release/ReleaseDetail/index.ts b/frontend/src/components/Release/ReleaseDetail/index.tsdeleted file mode 100644index 2b0dc1934e..0000000000--- a/frontend/src/components/Release/ReleaseDetail/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import ReleaseDetail from "./ReleaseDetail.vue";--export default ReleaseDetail;diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 241ec39116..277409435c 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -155,9 +155,7 @@},"bbkit": {"confirm-button": {- "can-undo": "You can undo this action later.","cannot-undo": "You cannot undo this action.",- "sure-to-abandon": "Are you sure to abandon?","sure-to-delete": "Are you sure to delete?"}},@@ -204,7 +202,6 @@},"common": {"Default": "Default",- "abandon": "Abandon","access-denied": "Access denied","access-expires": "Access Expires","action-required": "Action Required",@@ -219,7 +216,6 @@"all": "All","allow": "Allow","and": "and",- "apply-to-database": "Apply to database","approve": "Approve","approved": "Approved","archive": "Archive",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 976b2f696c..71cb203e99 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -155,9 +155,7 @@},"bbkit": {"confirm-button": {- "can-undo": "Podrás deshacer esta acción más tarde.","cannot-undo": "Esta acción no se puede deshacer.",- "sure-to-abandon": "¿Estás seguro de abandonar?","sure-to-delete": "¿Estás seguro de que deseas eliminar?"}},@@ -204,7 +202,6 @@},"common": {"Default": "Predeterminado",- "abandon": "Abandonar","access-denied": "Acceso denegado","access-expires": "El acceso expira","action-required": "Acción requerida",@@ -219,7 +216,6 @@"all": "Todos","allow": "Permitir","and": "y",- "apply-to-database": "Aplicar a la base de datos","approve": "Aprobar","approved": "Aprobado","archive": "Archivo",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 9fb2917c1b..07b84c5549 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -155,9 +155,7 @@},"bbkit": {"confirm-button": {- "can-undo": "この操作は後で元に戻すことができます。","cannot-undo": "この操作は元に戻すことができません。",- "sure-to-abandon": "本当に破棄しますか?","sure-to-delete": "本当に削除してもよろしいですか?"}},@@ -204,7 +202,6 @@},"common": {"Default": "デフォルト",- "abandon": "破棄","access-denied": "アクセスが拒否されました","access-expires": "アクセスは期限切れです","action-required": "対応が必要",@@ -219,7 +216,6 @@"all": "全て","allow": "許可","and": "と",- "apply-to-database": "データベースに適用","approve": "承認する","approved": "承認済み","archive": "アーカイブ",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex a84f170fc6..69fe1d4add 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -155,9 +155,7 @@},"bbkit": {"confirm-button": {- "can-undo": "Bạn có thể hoàn tác hành động này sau.","cannot-undo": "Bạn không thể hoàn tác hành động này.",- "sure-to-abandon": "Bạn có chắc chắn muốn hủy bỏ?","sure-to-delete": "Bạn có chắc chắn muốn xóa?"}},@@ -204,7 +202,6 @@},"common": {"Default": "Mặc định",- "abandon": "Hủy bỏ","access-denied": "Truy cập bị từ chối","access-expires": "Truy cập hết hạn","action-required": "Cần thực hiện hành động",@@ -219,7 +216,6 @@"all": "Tất cả","allow": "Cho phép","and": "và",- "apply-to-database": "Áp dụng cho cơ sở dữ liệu","approve": "Phê duyệt","approved": "Đã phê duyệt","archive": "Lưu trữ",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex cffc50c716..2ab93bbb4f 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -155,9 +155,7 @@},"bbkit": {"confirm-button": {- "can-undo": "此操作可以撤销。","cannot-undo": "此操作无法撤销。",- "sure-to-abandon": "确定要废弃吗?","sure-to-delete": "确定要删除吗?"}},@@ -204,7 +202,6 @@},"common": {"Default": "默认",- "abandon": "废弃","access-denied": "拒绝访问","access-expires": "访问到期","action-required": "需要操作",@@ -219,7 +216,6 @@"all": "全部","allow": "允许","and": "和",- "apply-to-database": "应用到数据库","approve": "批准","approved": "已批准","archive": "归档",diff --git a/frontend/src/react/components/release/ReleaseFileDetailPanel.tsx b/frontend/src/react/components/release/ReleaseFileDetailPanel.tsxnew file mode 100644index 0000000000..a3719b1fc6--- /dev/null+++ b/frontend/src/react/components/release/ReleaseFileDetailPanel.tsx@@ -0,0 +1,136 @@+import { Loader2 } from "lucide-react";+import { useEffect, useState } from "react";+import { useTranslation } from "react-i18next";+import { sheetServiceClientConnect } from "@/connect";+import { ReadonlyMonaco } from "@/react/components/monaco/ReadonlyMonaco";+import { Separator } from "@/react/components/ui/separator";+import { pushNotification } from "@/store";+import type { Release_File } from "@/types/proto-es/v1/release_service_pb";++function execCommandCopy(text: string): boolean {+ const textarea = document.createElement("textarea");+ textarea.value = text;+ textarea.style.position = "fixed";+ textarea.style.opacity = "0";+ document.body.appendChild(textarea);+ textarea.select();+ try {+ return document.execCommand("copy");+ } catch {+ return false;+ } finally {+ document.body.removeChild(textarea);+ }+}++async function copyToClipboard(text: string): Promise<boolean> {+ if (navigator.clipboard) {+ try {+ await navigator.clipboard.writeText(text);+ return true;+ } catch {+ // fall through to execCommand fallback+ }+ }+ return execCommandCopy(text);+}++function CopyButton({ content }: { content: string }) {+ const { t } = useTranslation();+ const handleCopy = async () => {+ if (!content) return;+ if (await copyToClipboard(content)) {+ pushNotification({+ module: "bytebase",+ style: "SUCCESS",+ title: t("common.copied"),+ });+ }+ };+ return (+ <button+ type="button"+ className="text-sm text-control-light transition-colors hover:text-accent disabled:cursor-not-allowed disabled:text-control-light/40"+ title={t("common.copy")}+ aria-label={t("common.copy")}+ disabled={!content}+ onClick={handleCopy}+ >+ {t("common.copy")}+ </button>+ );+}++export interface ReleaseFileDetailPanelProps {+ releaseFile: Release_File;+}++export function ReleaseFileDetailPanel({+ releaseFile,+}: ReleaseFileDetailPanelProps) {+ const { t } = useTranslation();+ const [statement, setStatement] = useState("");+ const [loading, setLoading] = useState(false);++ useEffect(() => {+ let cancelled = false;+ setLoading(true);+ setStatement("");+ sheetServiceClientConnect+ .getSheet({ name: releaseFile.sheet, raw: true })+ .then((sheet) => {+ if (!cancelled && sheet?.content) {+ setStatement(new TextDecoder().decode(sheet.content));+ }+ })+ .catch((error) => {+ console.error("Failed to fetch statement", error);+ })+ .finally(() => {+ if (!cancelled) setLoading(false);+ });+ return () => {+ cancelled = true;+ };+ }, [releaseFile]);++ return (+ <div className="flex flex-col gap-y-4">+ <div className="w-full">+ <div className="flex flex-row items-center gap-2">+ <p className="text-lg flex gap-x-1">+ <span className="text-control">{t("common.version")}:</span>+ <span className="font-bold text-main">{releaseFile.version}</span>+ </p>+ </div>+ <p className="mt-3 text-control text-sm flex gap-x-4">+ {releaseFile.path && (+ <span>+ {t("database.revision.filename")}: {releaseFile.path}+ </span>+ )}+ <span>Hash: {releaseFile.sheetSha256.slice(0, 8)}</span>+ </p>+ </div>++ <Separator />++ <div className="flex flex-col gap-y-2">+ <p className="w-auto flex items-center text-base text-main mb-2 gap-x-2">+ {t("common.statement")}+ <CopyButton content={statement} />+ </p>+ {loading ? (+ <div className="flex items-center justify-center py-8 text-control-light">+ <Loader2 className="size-5 animate-spin" />+ </div>+ ) : (+ <ReadonlyMonaco+ content={statement}+ className="h-auto max-h-[480px] min-h-[120px] border border-control-border rounded-xs text-sm overflow-clip relative"+ />+ )}+ </div>+ </div>+ );+}diff --git a/frontend/src/react/components/release/ReleaseFileTable.test.tsx b/frontend/src/react/components/release/ReleaseFileTable.test.tsxnew file mode 100644index 0000000000..a8c3119ab6--- /dev/null+++ b/frontend/src/react/components/release/ReleaseFileTable.test.tsx@@ -0,0 +1,120 @@+import { create } from "@bufbuild/protobuf";+import { act, createElement, type ReactElement } from "react";+import { createRoot } from "react-dom/client";+import { describe, expect, test, vi } from "vitest";+import {+ type Release_File,+ Release_FileSchema,+ Release_Type,+} 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) => key,+ }),+}));++let ReleaseFileTable: typeof import("./ReleaseFileTable").ReleaseFileTable;++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 makeFile = (version: string): Release_File =>+ create(Release_FileSchema, {+ version,+ path: `migrations/${version}.sql`,+ sheet: `sheets/${version}`,+ sheetSha256: "abcdef1234567890",+ });++describe("ReleaseFileTable", () => {+ test("renders version/type/filename cells for each file", async () => {+ ({ ReleaseFileTable } = await import("./ReleaseFileTable"));+ const files = [makeFile("v1"), makeFile("v2")];+ const { container, unmount } = renderIntoContainer(+ createElement(ReleaseFileTable, {+ files,+ releaseType: Release_Type.VERSIONED,+ })+ );++ const rows = container.querySelectorAll("tbody tr");+ expect(rows.length).toBe(2);+ expect(container.textContent).toContain("v1");+ expect(container.textContent).toContain("v2");+ expect(container.textContent).toContain("migrations/v1.sql");+ // VERSIONED → i18n key returned by the mocked translator+ expect(container.textContent).toContain("issue.title.change-database");+ unmount();+ });++ test("hides selection column by default, shows it when enabled", async () => {+ ({ ReleaseFileTable } = await import("./ReleaseFileTable"));+ const files = [makeFile("v1")];++ const hidden = renderIntoContainer(+ createElement(ReleaseFileTable, {+ files,+ releaseType: Release_Type.DECLARATIVE,+ })+ );+ expect(+ hidden.container.querySelectorAll('input[type="checkbox"]').length+ ).toBe(0);+ hidden.unmount();++ const shown = renderIntoContainer(+ createElement(ReleaseFileTable, {+ files,+ releaseType: Release_Type.DECLARATIVE,+ showSelection: true,+ })+ );+ expect(+ shown.container.querySelectorAll('input[type="checkbox"]').length+ ).toBeGreaterThan(0);+ shown.unmount();+ });++ test("fires onRowClick with the clicked file when rowClickable", async () => {+ ({ ReleaseFileTable } = await import("./ReleaseFileTable"));+ const files = [makeFile("v1"), makeFile("v2")];+ const onRowClick = vi.fn();+ const { container, unmount } = renderIntoContainer(+ createElement(ReleaseFileTable, {+ files,+ releaseType: Release_Type.VERSIONED,+ onRowClick,+ })+ );++ const rows = container.querySelectorAll("tbody tr");+ act(() => {+ rows[1]?.dispatchEvent(+ new MouseEvent("click", { bubbles: true, cancelable: true })+ );+ });++ expect(onRowClick).toHaveBeenCalledTimes(1);+ expect(onRowClick.mock.calls[0][0]).toBe(files[1]);+ unmount();+ });+});diff --git a/frontend/src/react/components/release/ReleaseFileTable.tsx b/frontend/src/react/components/release/ReleaseFileTable.tsxnew file mode 100644index 0000000000..a2262e61d8--- /dev/null+++ b/frontend/src/react/components/release/ReleaseFileTable.tsx@@ -0,0 +1,140 @@+import type { MouseEvent } from "react";+import { useEffect, useMemo, useState } from "react";+import { useTranslation } from "react-i18next";+import {+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from "@/react/components/ui/table";+import { cn } from "@/react/lib/utils";+import {+ type Release_File,+ Release_Type,+} from "@/types/proto-es/v1/release_service_pb";++export interface ReleaseFileTableProps {+ files: Release_File[];+ releaseType: Release_Type;+ showSelection?: boolean;+ rowClickable?: boolean;+ selectedFiles?: Release_File[];+ onRowClick?: (file: Release_File, e: MouseEvent) => void;+ onSelectedFilesChange?: (files: Release_File[]) => void;+}++export function ReleaseFileTable({+ files,+ releaseType,+ showSelection = false,+ rowClickable = true,+ selectedFiles,+ onRowClick,+ onSelectedFilesChange,+}: ReleaseFileTableProps) {+ const { t } = useTranslation();++ const [selectedPaths, setSelectedPaths] = useState<Set<string>>(+ () => new Set((selectedFiles ?? []).map((f) => f.path))+ );++ useEffect(() => {+ setSelectedPaths(new Set((selectedFiles ?? []).map((f) => f.path)));+ }, [selectedFiles]);++ const typeText = useMemo(() => {+ switch (releaseType) {+ case Release_Type.DECLARATIVE:+ return "SDL";+ case Release_Type.VERSIONED:+ return t("issue.title.change-database");+ case Release_Type.TYPE_UNSPECIFIED:+ return "";+ default:+ releaseType satisfies never;+ return "";+ }+ }, [releaseType, t]);++ const applySelection = (nextPaths: Set<string>) => {+ setSelectedPaths(nextPaths);+ onSelectedFilesChange?.(+ [...nextPaths]+ .map((path) => files.find((f) => f.path === path))+ .filter((f): f is Release_File => !!f)+ );+ };++ const handleRowClick = (file: Release_File, e: MouseEvent) => {+ if (showSelection) {+ const next = new Set(selectedPaths);+ if (next.has(file.path)) {+ next.delete(file.path);+ } else {+ next.add(file.path);+ }+ applySelection(next);+ } else if (rowClickable) {+ onRowClick?.(file, e);+ }+ };++ const handleCheckboxChange = (file: Release_File, checked: boolean) => {+ const next = new Set(selectedPaths);+ if (checked) {+ next.add(file.path);+ } else {+ next.delete(file.path);+ }+ applySelection(next);+ };++ const rowCursor = rowClickable || showSelection ? "cursor-pointer" : "";++ return (+ <Table>+ <TableHeader>+ <TableRow>+ {showSelection && <TableHead className="w-10" />}+ <TableHead className="w-40">{t("common.version")}</TableHead>+ <TableHead className="w-16">{t("common.type")}</TableHead>+ <TableHead className="w-32">+ {t("database.revision.filename")}+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {files.map((file) => {+ const checked = selectedPaths.has(file.path);+ return (+ <TableRow+ key={file.path}+ className={cn(rowCursor)}+ onClick={(e) => handleRowClick(file, e)}+ >+ {showSelection && (+ <TableCell+ className="w-10"+ onClick={(e) => e.stopPropagation()}+ >+ <input+ type="checkbox"+ checked={checked}+ onChange={(e) =>+ handleCheckboxChange(file, e.target.checked)+ }+ />+ </TableCell>+ )}+ <TableCell className="truncate">{file.version}</TableCell>+ <TableCell>{typeText}</TableCell>+ <TableCell className="truncate">{file.path || "-"}</TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>+ );+}diff --git a/frontend/src/react/locales/en-US.json b/frontend/src/react/locales/en-US.jsonindex e7a2abdefc..19a7cc6e63 100644--- a/frontend/src/react/locales/en-US.json+++ b/frontend/src/react/locales/en-US.json@@ -401,6 +401,7 @@"users": "Users","value": "Value","verify": "Verify",+ "version": "Version","view": "View","view-details": "View Details","warning": "Warning",@@ -707,6 +708,9 @@"nullable": "Nullable","partition-tables": "Partition tables","partitioned": "Partitioned",+ "revision": {+ "filename": "Filename"+ },"row-count-est": "Row count est.","row-count-estimate": "Row count estimate","schema": {@@ -1363,6 +1367,7 @@"waiting-role": "Waiting: {{role}}"},"title": {+ "change-database": "Change database","request-role": "Request role","request-specific-role": "Request \"{{role}}\" role"},@@ -1729,6 +1734,7 @@"release": {"and-n-more-files": "and {{count}} more files","change-tip": "This change is linked to a release artifact.",+ "file": "Release File","file-type": {"declarative": "Declarative","unspecified": "Unspecified",diff --git a/frontend/src/react/locales/es-ES.json b/frontend/src/react/locales/es-ES.jsonindex cd46181812..129e8a89ce 100644--- a/frontend/src/react/locales/es-ES.json+++ b/frontend/src/react/locales/es-ES.json@@ -401,6 +401,7 @@"users": "Usuarios","value": "Valor","verify": "Verificar",+ "version": "Versión","view": "Ver","view-details": "Ver Detalles","warning": "Advertencia",@@ -707,6 +708,9 @@"nullable": "Anulable","partition-tables": "Tablas de particiones","partitioned": "Particionado",+ "revision": {+ "filename": "Nombre del archivo"+ },"row-count-est": "Conteo estimado de filas","row-count-estimate": "Estimación de la cantidad de filas","schema": {@@ -1363,6 +1367,7 @@"waiting-role": "Waiting: {{role}}"},"title": {+ "change-database": "Modificar base de datos","request-role": "Solicitar rol","request-specific-role": "Solicitar rol \"{{role}}\""},@@ -1729,6 +1734,7 @@"release": {"and-n-more-files": "and {{count}} more files","change-tip": "This change is linked to a release artifact.",+ "file": "Archivo de lanzamiento","file-type": {"declarative": "Declarative","unspecified": "Unspecified",diff --git a/frontend/src/react/locales/ja-JP.json b/frontend/src/react/locales/ja-JP.jsonindex 5a0cca98ef..094beeff5a 100644--- a/frontend/src/react/locales/ja-JP.json+++ b/frontend/src/react/locales/ja-JP.json@@ -401,6 +401,7 @@"users": "ユーザー","value": "値","verify": "確認する",+ "version": "バージョン","view": "表示","view-details": "詳細を表示","warning": "警告する",@@ -707,6 +708,9 @@"nullable": "null も可能","partition-tables": "パーティションテーブル","partitioned": "パーティション",+ "revision": {+ "filename": "ファイル名"+ },"row-count-est": "推定行数","row-count-estimate": "推定行数","schema": {@@ -1363,6 +1367,7 @@"waiting-role": "Waiting: {{role}}"},"title": {+ "change-database": "データベースの変更","request-role": "ロールをリクエスト","request-specific-role": "「{{role}}」ロールをリクエスト"},@@ -1729,6 +1734,7 @@"release": {"and-n-more-files": "and {{count}} more files","change-tip": "This change is linked to a release artifact.",+ "file": "リリースファイル","file-type": {"declarative": "Declarative","unspecified": "Unspecified",diff --git a/frontend/src/react/locales/vi-VN.json b/frontend/src/react/locales/vi-VN.jsonindex 081c1ba9c7..f35c7440b8 100644--- a/frontend/src/react/locales/vi-VN.json+++ b/frontend/src/react/locales/vi-VN.json@@ -401,6 +401,7 @@"users": "Người dùng","value": "Giá trị","verify": "Xác minh",+ "version": "Phiên bản","view": "Xem","view-details": "Xem Chi tiết","warning": "Cảnh báo",@@ -707,6 +708,9 @@"nullable": "Có thể null","partition-tables": "Bảng phân vùng","partitioned": "Đã phân vùng",+ "revision": {+ "filename": "Tên tệp"+ },"row-count-est": "Ước tính số hàng","row-count-estimate": "Ước tính số hàng","schema": {@@ -1363,6 +1367,7 @@"waiting-role": "Waiting: {{role}}"},"title": {+ "change-database": "Thay đổi cơ sở dữ liệu","request-role": "Yêu cầu vai trò","request-specific-role": "Yêu cầu vai trò \"{{role}}\""},@@ -1729,6 +1734,7 @@"release": {"and-n-more-files": "and {{count}} more files","change-tip": "This change is linked to a release artifact.",+ "file": "Tệp phát hành","file-type": {"declarative": "Declarative","unspecified": "Unspecified",diff --git a/frontend/src/react/locales/zh-CN.json b/frontend/src/react/locales/zh-CN.jsonindex fb07aa2b4f..7125f8a1e3 100644--- a/frontend/src/react/locales/zh-CN.json+++ b/frontend/src/react/locales/zh-CN.json@@ -401,6 +401,7 @@"users": "用户","value": "值","verify": "验证",+ "version": "版本","view": "查看","view-details": "查看详情","warning": "警告",@@ -707,6 +708,9 @@"nullable": "可为空","partition-tables": "分区表","partitioned": "分区",+ "revision": {+ "filename": "文件名"+ },"row-count-est": "估算行数","row-count-estimate": "估计行数","schema": {@@ -1363,6 +1367,7 @@"waiting-role": "等待: {{role}}"},"title": {+ "change-database": "变更数据库","request-role": "申请角色","request-specific-role": "申请 \"{{role}}\" 角色"},@@ -1729,6 +1734,7 @@"release": {"and-n-more-files": "以及另外 {{count}} 个文件","change-tip": "该变更关联到了一个发布包。",+ "file": "发布包文件","file-type": {"declarative": "声明式","unspecified": "未指定",diff --git a/frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx b/frontend/src/react/pages/project/ProjectReleaseDetailPage.tsxnew file mode 100644index 0000000000..3771208ed2--- /dev/null+++ b/frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx@@ -0,0 +1,257 @@+import { Clock4, EllipsisVertical, Link2 } from "lucide-react";+import { useEffect, useMemo, useState } from "react";+import { useTranslation } from "react-i18next";+import { HumanizeTs } from "@/react/components/HumanizeTs";+import { ReleaseFileDetailPanel } from "@/react/components/release/ReleaseFileDetailPanel";+import { ReleaseFileTable } from "@/react/components/release/ReleaseFileTable";+import {+ AlertDialog,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogTitle,+} from "@/react/components/ui/alert-dialog";+import { Button } from "@/react/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from "@/react/components/ui/dropdown-menu";+import {+ Sheet,+ SheetBody,+ SheetContent,+ SheetHeader,+ SheetTitle,+} from "@/react/components/ui/sheet";+import { useVueState } from "@/react/hooks/useVueState";+import { pushNotification, useProjectV1Store, useReleaseStore } from "@/store";+import { projectNamePrefix } from "@/store/modules/v1/common";+import { getTimeForPbTimestampProtoEs } from "@/types";+import { State, VCSType } from "@/types/proto-es/v1/common_pb";+import type { Release_File } from "@/types/proto-es/v1/release_service_pb";+import { setDocumentTitle } from "@/utils";++export function ProjectReleaseDetailPage({+ projectId,+ releaseId,+}: {+ projectId: string;+ releaseId: string;+}) {+ const { t } = useTranslation();+ const releaseStore = useReleaseStore();+ const projectV1Store = useProjectV1Store();++ const projectName = `${projectNamePrefix}${projectId}`;+ const releaseName = `${projectName}/releases/${releaseId}`;++ const release = useVueState(() => releaseStore.getReleaseByName(releaseName));+ const project = useVueState(() =>+ projectV1Store.getProjectByName(projectName)+ );++ useEffect(() => {+ let cancelled = false;+ void projectV1Store.getOrFetchProjectByName(projectName).catch((error) => {+ if (!cancelled) console.error("Failed to fetch project", error);+ });+ void releaseStore.fetchReleaseByName(releaseName).catch((error) => {+ if (!cancelled) console.error("Failed to fetch release", error);+ });+ return () => {+ cancelled = true;+ };+ }, [projectV1Store, releaseStore, projectName, releaseName]);++ useEffect(() => {+ if (project?.title) {+ setDocumentTitle(t("release.releases"), project.title);+ }+ }, [project?.title, t]);++ const [selectedReleaseFile, setSelectedReleaseFile] = useState<+ Release_File | undefined+ >();+ const [archiveOpen, setArchiveOpen] = useState(false);++ const releaseDisplayName = useMemo(() => {+ const parts = release.name.split("/");+ return parts[parts.length - 1] || release.name;+ }, [release.name]);++ const isActive = release.state === State.ACTIVE;+ const isDeleted = release.state === State.DELETED;++ const handleArchive = async () => {+ try {+ await releaseStore.deleteRelease(release.name);+ } catch (error) {+ pushNotification({+ module: "bytebase",+ style: "CRITICAL",+ title: t("common.error"),+ description: error instanceof Error ? error.message : String(error),+ });+ } finally {+ setArchiveOpen(false);+ }+ };++ const handleRestore = async () => {+ try {+ await releaseStore.undeleteRelease(release.name);+ } catch (error) {+ pushNotification({+ module: "bytebase",+ style: "CRITICAL",+ title: t("common.error"),+ description: error instanceof Error ? error.message : String(error),+ });+ }+ };++ return (+ <div className="flex flex-col items-start gap-y-4 p-4 relative">+ {isDeleted && (+ <div className="h-8 w-full text-base font-medium bg-gray-700 text-white flex justify-center items-center">+ {t("common.archived")}+ </div>+ )}++ <div className="w-full flex flex-row items-center justify-between gap-x-4">+ <div className="flex-1 p-0.5 overflow-hidden">+ <h1 className="text-xl font-medium truncate">{releaseDisplayName}</h1>+ </div>+ <div className="flex items-center justify-end gap-x-2">+ {(isActive || isDeleted) && (+ <DropdownMenu>+ <DropdownMenuTrigger+ className="inline-flex items-center justify-center rounded-xs p-1 text-control hover:bg-control-bg focus:outline-hidden"+ aria-label="More actions"+ >+ <EllipsisVertical className="size-4" />+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ {isActive && (+ <DropdownMenuItem onClick={() => setArchiveOpen(true)}>+ {t("common.archive")}+ </DropdownMenuItem>+ )}+ {isDeleted && (+ <DropdownMenuItem onClick={handleRestore}>+ {t("common.restore")}+ </DropdownMenuItem>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ )}+ </div>+ </div>++ <ReleaseBasicInfo+ createTime={+ release.createTime+ ? getTimeForPbTimestampProtoEs(release.createTime) / 1000+ : undefined+ }+ vcsType={release.vcsSource?.vcsType}+ vcsUrl={release.vcsSource?.url}+ />++ <ReleaseFileTable+ files={release.files}+ releaseType={release.type}+ showSelection={false}+ onRowClick={(file) => setSelectedReleaseFile(file)}+ />++ <Sheet+ open={!!selectedReleaseFile}+ onOpenChange={(next) => !next && setSelectedReleaseFile(undefined)}+ >+ <SheetContent width="wide">+ <SheetHeader>+ <SheetTitle>{t("release.file")}</SheetTitle>+ </SheetHeader>+ <SheetBody>+ {selectedReleaseFile && (+ <ReleaseFileDetailPanel releaseFile={selectedReleaseFile} />+ )}+ </SheetBody>+ </SheetContent>+ </Sheet>++ <AlertDialog+ open={archiveOpen}+ onOpenChange={(next) => setArchiveOpen(next)}+ >+ <AlertDialogContent>+ <AlertDialogTitle>{t("common.confirm-archive")}</AlertDialogTitle>+ <AlertDialogDescription>+ {t("common.archive-description", { name: releaseDisplayName })}+ </AlertDialogDescription>+ <AlertDialogFooter>+ <Button variant="outline" onClick={() => setArchiveOpen(false)}>+ {t("common.cancel")}+ </Button>+ <Button onClick={handleArchive}>{t("common.confirm")}</Button>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </div>+ );+}++// ---------------------------------------------------------------------------+// ReleaseBasicInfo+// ---------------------------------------------------------------------------++function beautifyUrl(url: string): string {+ try {+ const parsed = new URL(url);+ return parsed.pathname.length > 0+ ? parsed.pathname.substring(1)+ : parsed.pathname;+ } catch {+ return url;+ }+}++function ReleaseBasicInfo({+ createTime,+ vcsType,+ vcsUrl,+}: {+ createTime: number | undefined;+ vcsType: VCSType | undefined;+ vcsUrl: string | undefined;+}) {+ const showVcs =+ vcsType !== undefined && vcsType !== VCSType.VCS_TYPE_UNSPECIFIED && vcsUrl;++ return (+ <div className="flex flex-row items-center pl-4 gap-4">+ <div className="flex items-center gap-1">+ <Clock4 className="size-4 text-control-light" />+ {createTime !== undefined && (+ <HumanizeTs ts={createTime} className="text-sm text-control" />+ )}+ </div>+ {showVcs && (+ <div className="flex flex-row items-center gap-1">+ <Link2 className="size-4 text-control-light" />+ <a+ href={vcsUrl}+ target="_blank"+ rel="noreferrer"+ className="text-sm text-accent hover:underline truncate"+ >+ {beautifyUrl(vcsUrl)}+ </a>+ </div>+ )}+ </div>+ );+}diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.tsindex 319291c043..d3d3e11190 100644--- a/frontend/src/router/dashboard/projectV1.ts+++ b/frontend/src/router/dashboard/projectV1.ts@@ -515,8 +515,11 @@ const projectV1Routes: RouteRecordRaw[] = [meta: {requiredPermissionList: () => ["bb.releases.get"],},- component: () => import("@/components/Release/ReleaseDetail/"),- props: true,+ component: () => import("@/react/ReactPageMount.vue"),+ props: (route: RouteLocationNormalized) => ({+ page: "ProjectReleaseDetailPage",+ ...route.params,+ }),},],},