Skip to content

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

chore(frontend): drop 21 orphan Vue primitives + add React→Vue import guard (#20321)

boojack107635b4c623
diff --git a/docs/plans/2026-05-12-phase-a-legacy-primitives-design.md b/docs/plans/2026-05-12-phase-a-legacy-primitives-design.md
new file mode 100644
index 0000000000..d284986513
--- /dev/null
+++ b/docs/plans/2026-05-12-phase-a-legacy-primitives-design.md
@@ -0,0 +1,111 @@
+# Phase A — Strip Legacy Primitives: Design
+
+**Date:** 2026-05-12
+**Parent doc:** [2026-05-12-react-migration-status-and-plan.md](./2026-05-12-react-migration-status-and-plan.md)
+**Playbook:** [2026-04-08-react-migration-playbook.md](./2026-04-08-react-migration-playbook.md)
+
+---
+
+## Goal
+
+**No `.tsx` file imports any `.vue` file.**
+
+After Phase A, every remaining `.vue` file in `frontend/src/components/` is imported only by other `.vue` files. The Vue and React layers are cleanly separated. Phase B (app shell, router, state) can then delete whole subtrees of Vue at a time without cross-framework concerns.
+
+## Strategy: defer-until-callers-die
+
+Each `.vue` file in `frontend/src/components/` is classified by who imports it:
+
+| Bucket | Vue callers | React callers | Phase A action |
+|---|---|---|---|
+| **DEAD** | 0 | 0 | Delete. No migration. |
+| **REACT-ONLY** | 0 | ≥1 | Swap React callers to a React equivalent; delete the Vue file in the same change. |
+| **MIXED** | ≥1 | ≥1 | Out of scope — handled opportunistically. The Vue file stays for its Vue callers. |
+| **VUE-ONLY** | ≥1 | 0 | Out of scope — defer to Phase B (will retire with its Vue callers). |
+
+Phase A acts on DEAD and REACT-ONLY only. MIXED files become eligible the moment their React callers drop to zero — those are handled as one-off cleanup PRs as engineers touch the area, not as part of Phase A.
+
+## Scope: one PR
+
+A single PR — "Phase A: drop React→Vue cross-framework imports" — covering:
+
+### 1. Dead-code deletion (4 files)
+
+`git rm` only, no replacements:
+
+- `frontend/src/components/RequiredStar.vue`
+- `frontend/src/components/EditEnvironmentDrawer.vue`
+- `frontend/src/components/Permission/NoPermissionPlaceholder.vue`
+- `frontend/src/components/misc/MaskSpinner.vue`
+
+### 2. REACT-ONLY swaps (~20 files)
+
+For each, update every React caller to import the existing React equivalent (or remove the obsolete re-export), then delete the Vue file. All replacements already exist in `frontend/src/react/components/` or `frontend/src/react/components/ui/`.
+
+| Vue file(s) to delete | React callers | Replacement |
+|---|---|---|
+| `EllipsisText.vue` | 13 | `react/components/ui/ellipsis-text.tsx` |
+| `FeatureGuard/FeatureAttention.vue` | 20 | `react/components/FeatureAttention.tsx` |
+| `AdvancedSearch/*` (5 files) | 21 (re-exports) | `react/components/AdvancedSearch.tsx` |
+| `DatabaseInfo.vue` | 4 | React component / inline call sites |
+| `Instance/InstanceSyncButton.vue` | 3 | `react/components/instance/InstanceSyncButton.tsx` |
+| `DatabaseDetail/SyncDatabaseButton.vue` | 1 | React equivalent in `sql-editor/ResultView` |
+| `RoleGrantPanel/MaxRowCountSelect.vue` | 2 | `react/components/MaxRowCountSelect.tsx` |
+| `misc/SQLUploadButton.vue` | 2 | `react/components/sql-editor/StandardPanel/SQLUploadButton.tsx` |
+| `v2/Container/*` (2 files) | 4 | Sheet / drawer primitives in `react/components/ui/` |
+| `v2/TabFilter.vue` | 3 | React equivalent / re-export cleanup |
+| `SQLReview/RuleConfigComponents/*` (5 files) | 2 (re-exports) | Re-export cleanup |
+
+**Total: ~24 Vue files deleted.**
+
+### 3. CI guard
+
+Extend `no-legacy-vue-deps.test.ts` (or add a sibling test) to fail on any `.tsx` file that imports a `.vue` file. This locks in the win and prevents regression while MIXED files are picked off opportunistically.
+
+The guard's allowlist starts empty — every MIXED file (`LearnMoreLink`, `FeatureBadge`, `FeatureModal`, `UserAvatar`, `MonacoEditor/*`, `Icon/*`, `v2/Button/*`, `v2/Form/*`, `v2/Select/*`, `v2/Model/*`, plus the long tail) needs an explicit entry until its React callers are migrated off. As each MIXED file becomes REACT-ONLY (or DEAD), its allowlist entry is removed and the file deleted.
+
+## Out of scope for Phase A
+
+These stay; each is its own future PR or waits for Phase B:
+
+**MIXED — opportunistic cleanup PRs** (one per primitive when an engineer touches the area):
+
+- `LearnMoreLink.vue` (17 React callers)
+- `FeatureGuard/FeatureModal.vue` (12), `FeatureBadge.vue` (29)
+- `UserAvatar.vue` (9)
+- `FileContentPreviewModal.vue` (2), `HighlightCodeBlock.vue` (1)
+- `MonacoEditor/*` (21 — many likely re-exports; verify when picked up)
+- `Icon/*` (81 — likely many re-exports; verify when picked up)
+- `v2/Button/*` (232 — count includes transitive matches; needs filtering)
+- `v2/Form/*` (44), `v2/Select/*` (85), `v2/Model/*` (4)
+- Long tail: `PermissionGuardWrapper`, `InputWithTemplate`, `SpannerQueryPlan/*`, `ErrorList`, `YouTag`
+
+**VUE-ONLY — defer to Phase B** (no React callers; retires when its Vue caller dies):
+
+- `ReleaseRemindModal.vue` (called from `BodyLayout.vue`)
+- `misc/OverlayStackManager.vue` (called from `App.vue`, `BBModal.vue`)
+- `misc/AccountTag.vue`
+- `User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue`
+- `Member/MemberDataTable/cells/RoleCell.vue`, `UserRolesCell.vue`
+- `InputWithTemplate/AutoWidthInput.vue`
+
+## Validation
+
+Per the playbook:
+
+1. `pnpm --dir frontend fix`
+2. `pnpm --dir frontend check`
+3. `pnpm --dir frontend type-check`
+4. `pnpm --dir frontend test` — includes the new `.tsx`→`.vue` guard
+5. Manual smoke: open every page whose React caller list was touched (settings pages, project pages, instance detail) and verify nothing renders broken.
+
+## Done when
+
+- `rg -l '\.vue["\x27]' frontend/src/**/*.tsx` returns only the MIXED files listed in the guard's allowlist.
+- The four DEAD files are gone.
+- The ~20 REACT-ONLY files are gone and their callers reference the React replacement.
+- The CI guard exists and passes.
+
+## Rough cost
+
+One PR, touching ~24 `.vue` deletions + ~80 React caller updates (mostly mechanical import path swaps) + 1 test file. Estimated 1–2 days of focused work, including manual smoke verification.
diff --git a/docs/plans/2026-05-12-phase-a-legacy-primitives-plan.md b/docs/plans/2026-05-12-phase-a-legacy-primitives-plan.md
new file mode 100644
index 0000000000..c7a6641541
--- /dev/null
+++ b/docs/plans/2026-05-12-phase-a-legacy-primitives-plan.md
@@ -0,0 +1,568 @@
+# Phase A — Strip Legacy Primitives: Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Delete 21 orphan `.vue` files in `frontend/src/components/` and add a CI guard preventing any future `.vue` import from React-side code under `frontend/src/react/`.
+
+**Architecture:** Single PR. Every targeted Vue file has zero remaining React-side callers (audit verified) and either zero callers anywhere or only sibling `index.ts` re-exports. The CI guard is a new vitest test that globs `frontend/src/react/**/*.{ts,tsx}` and asserts no source contains a `.vue` import, with a small explicit allowlist for mount-bridges (deferred to Phase B). The plan is "delete + verify + commit" repeated by group; no behavioral changes.
+
+**Tech Stack:** Vitest, TypeScript, ripgrep, pnpm.
+
+**Spec:** [`docs/plans/2026-05-12-phase-a-legacy-primitives-design.md`](./2026-05-12-phase-a-legacy-primitives-design.md)
+
+---
+
+## Pre-work: Confirm baseline
+
+Before starting any task, confirm the working tree is clean and the baseline checks pass.
+
+- [ ] **Step 0.1:** `git status` — confirm clean tree (or only untracked plan docs).
+- [ ] **Step 0.2:** `pnpm --dir frontend type-check` — confirm passes.
+- [ ] **Step 0.3:** `pnpm --dir frontend test` — confirm passes (existing tests, including `no-legacy-vue-deps.test.ts`).
+
+If any baseline check fails, stop and report — do not start deletions.
+
+---
+
+## Task 1: Add the React→Vue import guard
+
+**Goal:** New vitest test that fails if any file under `frontend/src/react/**/*.{ts,tsx}` contains a `.vue` import, except a small allowlist of mount-bridges deferred to Phase B.
+
+**Files:**
+- Create: `frontend/src/react/no-react-to-vue-imports.test.ts`
+
+- [ ] **Step 1.1: Write the test**
+
+Create `frontend/src/react/no-react-to-vue-imports.test.ts`:
+
+```typescript
+import { describe, expect, test } from "vitest";
+
+// Every file under frontend/src/react/ that is *.ts or *.tsx (the React layer).
+// .vue files are skipped: by definition .vue is Vue-side and is allowed to import
+// other .vue files.
+const sources = import.meta.glob("./**/*.{ts,tsx}", {
+ query: "?raw",
+ import: "default",
+ eager: true,
+}) as Record<string, string>;
+
+// Mount-bridge Vue files that React code is permitted to import until Phase B
+// retires the Vue app shell. Adding new entries here requires explicit review.
+const allowedVueImports = new Set([
+ "@/components/SessionExpiredSurfaceMount.vue",
+ "@/components/AgentWindowMount.vue",
+]);
+
+const vueImportPattern = /from\s+["']([^"']+\.vue)["']/g;
+
+describe("React layer must not import .vue files", () => {
+ test("no .tsx or .ts file under frontend/src/react/ imports a .vue file", () => {
+ const violations: string[] = [];
+ for (const [file, source] of Object.entries(sources)) {
+ // Don't scan this guard itself (it contains .vue strings as test data
+ // in the allowlist above).
+ if (file.endsWith("/no-react-to-vue-imports.test.ts")) continue;
+ // Don't scan the sibling guard (same reason — it has .vue strings as
+ // banned-import test data).
+ if (file.endsWith("/no-legacy-vue-deps.test.ts")) continue;
+
+ let match: RegExpExecArray | null;
+ vueImportPattern.lastIndex = 0;
+ while ((match = vueImportPattern.exec(source)) !== null) {
+ const importPath = match[1];
+ if (!allowedVueImports.has(importPath)) {
+ violations.push(`${file}: ${importPath}`);
+ }
+ }
+ }
+ expect(violations).toEqual([]);
+ });
+});
+```
+
+- [ ] **Step 1.2: Run the test — verify it passes on the current tree**
+
+Run: `pnpm --dir frontend exec vitest run src/react/no-react-to-vue-imports.test.ts`
+
+Expected: 1 test passing. The only legitimate Vue import in the React layer is `SessionExpiredSurfaceMount.vue` from `SessionExpiredSurface.test.tsx`, which is allowlisted.
+
+**If the test fails** with violations: stop. The audit missed a real React→Vue import. Report which file and import; do not proceed to deletions.
+
+- [ ] **Step 1.3: Commit**
+
+```bash
+git add frontend/src/react/no-react-to-vue-imports.test.ts
+git commit -m "test(frontend): add CI guard blocking React-layer imports of .vue files
+
+Mount-bridges (SessionExpiredSurfaceMount, AgentWindowMount) are
+allowlisted until Phase B retires the Vue app shell.
+"
+```
+
+---
+
+## Task 2: Delete files with zero callers anywhere
+
+**Goal:** Delete 9 Vue files that have zero importers (no Vue callers, no React callers, no `index.ts` re-exports).
+
+**Files to delete:**
+- `frontend/src/components/RequiredStar.vue`
+- `frontend/src/components/EditEnvironmentDrawer.vue`
+- `frontend/src/components/Permission/NoPermissionPlaceholder.vue`
+- `frontend/src/components/misc/MaskSpinner.vue`
+- `frontend/src/components/DatabaseInfo.vue`
+- `frontend/src/components/Instance/InstanceSyncButton.vue`
+- `frontend/src/components/DatabaseDetail/SyncDatabaseButton.vue`
+- `frontend/src/components/RoleGrantPanel/MaxRowCountSelect.vue`
+- `frontend/src/components/misc/SQLUploadButton.vue`
+
+- [ ] **Step 2.1: Re-verify each file has zero callers**
+
+For each file in the list, run:
+
+```bash
+for f in RequiredStar EditEnvironmentDrawer NoPermissionPlaceholder MaskSpinner DatabaseInfo InstanceSyncButton SyncDatabaseButton MaxRowCountSelect SQLUploadButton; do
+ echo "=== $f.vue ==="
+ rg -l --type-add 'tsx:*.tsx' --type-add 'vue:*.vue' -tts -tvue -ttsx "${f}\.vue" frontend/src/ 2>/dev/null \
+ | grep -v "^frontend/src/components/.*${f}\.vue$"
+done
+```
+
+Expected: each file shows zero callers (lines may appear only in `.tsx` files that contain the basename in a code comment like `// Inline replacement for SyncDatabaseButton.vue` — manually verify these are comments, not imports).
+
+The two known comment-only hits are:
+- `frontend/src/react/components/sql-editor/ResultView/ResultView.tsx` references `SyncDatabaseButton.vue` in a comment
+- `frontend/src/react/components/sql-editor/StandardPanel/SQLUploadButton.tsx` references `SQLUploadButton.vue` in a comment
+
+If any file shows a real `import ... from "...<file>.vue"` line, stop and report — that file belongs in a different bucket.
+
+- [ ] **Step 2.2: Delete the files**
+
+```bash
+git rm \
+ frontend/src/components/RequiredStar.vue \
+ frontend/src/components/EditEnvironmentDrawer.vue \
+ frontend/src/components/Permission/NoPermissionPlaceholder.vue \
+ frontend/src/components/misc/MaskSpinner.vue \
+ frontend/src/components/DatabaseInfo.vue \
+ frontend/src/components/Instance/InstanceSyncButton.vue \
+ frontend/src/components/DatabaseDetail/SyncDatabaseButton.vue \
+ frontend/src/components/RoleGrantPanel/MaxRowCountSelect.vue \
+ frontend/src/components/misc/SQLUploadButton.vue
+```
+
+- [ ] **Step 2.3: Check if any now-empty parent directories should be removed**
+
+After deletion, check directories that might be empty:
+
+```bash
+for dir in frontend/src/components/Permission frontend/src/components/Instance frontend/src/components/DatabaseDetail frontend/src/components/RoleGrantPanel; do
+ if [ -d "$dir" ]; then
+ contents=$(ls "$dir" 2>/dev/null)
+ if [ -z "$contents" ]; then
+ echo "EMPTY: $dir — remove"
+ rmdir "$dir"
+ else
+ echo "$dir has: $contents"
+ fi
+ fi
+done
+```
+
+For each remaining directory: if every file in it is also being deleted in this PR or has zero callers, plan to delete in a later task. Otherwise leave alone.
+
+Expected as of audit:
+- `Permission/` — `PermissionGuardWrapper.vue` remains (has callers); leave dir.
+- `Instance/` — should be empty after deletion; `rmdir`.
+- `DatabaseDetail/` — should be empty; `rmdir`.
+- `RoleGrantPanel/` — should be empty; `rmdir`.
+
+- [ ] **Step 2.4: Verify build & guard still pass**
+
+```bash
+pnpm --dir frontend type-check
+pnpm --dir frontend exec vitest run src/react/no-react-to-vue-imports.test.ts src/react/no-legacy-vue-deps.test.ts
+```
+
+Expected: both pass.
+
+- [ ] **Step 2.5: Commit**
+
+```bash
+git add -A frontend/src/components/
+git commit -m "chore(frontend): drop orphan Vue files with zero callers
+
+Removes 9 .vue files whose call sites already migrated to React or
+were never used. Empty parent directories cleaned up.
+"
+```
+
+---
+
+## Task 3: Delete the v2/TabFilter directory
+
+**Goal:** Remove `v2/TabFilter/TabFilter.vue` and its `index.ts` re-export plumbing. Update `v2/index.ts` to stop re-exporting from `./TabFilter`.
+
+**Files:**
+- Delete: `frontend/src/components/v2/TabFilter/TabFilter.vue`
+- Delete: `frontend/src/components/v2/TabFilter/index.ts`
+- Delete: `frontend/src/components/v2/TabFilter/types.ts` (if no external callers — verify in step 3.1)
+- Modify: `frontend/src/components/v2/index.ts` — remove `export * from "./TabFilter";`
+
+- [ ] **Step 3.1: Verify no external caller imports TabFilter or its types**
+
+```bash
+echo "=== Imports of TabFilter (outside the dir itself) ==="
+rg -n --type-add 'tsx:*.tsx' --type-add 'vue:*.vue' -tts -tvue -ttsx 'TabFilter' frontend/src/ 2>/dev/null \
+ | grep -v '^frontend/src/components/v2/TabFilter/'
+
+echo ""
+echo "=== Imports of v2/TabFilter/types ==="
+rg -n --type-add 'tsx:*.tsx' --type-add 'vue:*.vue' -tts -tvue -ttsx 'v2/TabFilter/types' frontend/src/ 2>/dev/null
+```
+
+Expected: only `frontend/src/components/v2/index.ts:2:export * from "./TabFilter";` (which we will remove) and zero types imports.
+
+If any other file imports `TabFilter` (e.g., `from "@/components/v2"`), stop and report — TabFilter has hidden consumers and cannot be deleted in this PR.
+
+- [ ] **Step 3.2: Remove the export line from v2/index.ts**
+
+Edit `frontend/src/components/v2/index.ts`:
+
+```typescript
+// Before
+export * from "./Select";
+export * from "./TabFilter";
+export * from "./Model";
+export * from "./Form";
+export * from "./Button";
+export * from "./Container";
+
+// After
+export * from "./Select";
+export * from "./Model";
+export * from "./Form";
+export * from "./Button";
+export * from "./Container";
+```
+
+- [ ] **Step 3.3: Delete the directory**
+
+```bash
+git rm -r frontend/src/components/v2/TabFilter/
+```
+
+- [ ] **Step 3.4: Verify build still passes**
+
+```bash
+pnpm --dir frontend type-check
+```
+
+Expected: pass.
+
+- [ ] **Step 3.5: Commit**
+
+```bash
+git add frontend/src/components/v2/index.ts
+git commit -m "chore(frontend): drop unused v2/TabFilter
+
+TabFilter had no callers outside its own re-export plumbing in v2/index.ts.
+"
+```
+
+---
+
+## Task 4: Delete FeatureGuard/FeatureAttention.vue
+
+**Goal:** Delete the orphan `FeatureAttention.vue` (React callers already use `@/react/components/FeatureAttention`). Update `FeatureGuard/index.ts` to stop re-exporting it. `FeatureBadge.vue` and `FeatureModal.vue` stay — they have Vue callers (`RoleSelect.vue`, `DatabaseView.vue`).
+
+**Files:**
+- Delete: `frontend/src/components/FeatureGuard/FeatureAttention.vue`
+- Modify: `frontend/src/components/FeatureGuard/index.ts`
+
+- [ ] **Step 4.1: Verify FeatureAttention has no callers**
+
+```bash
+rg -n --type-add 'tsx:*.tsx' --type-add 'vue:*.vue' -tts -tvue -ttsx 'FeatureAttention' frontend/src/ 2>/dev/null \
+ | grep -v '^frontend/src/components/FeatureGuard/FeatureAttention\.vue:' \
+ | grep -v '^frontend/src/react/components/FeatureAttention\.tsx:'
+```
+
+Expected: only `frontend/src/components/FeatureGuard/index.ts` matches (the re-export we will remove) and React-side files importing `@/react/components/FeatureAttention` (the React replacement, not the Vue file).
+
+If a Vue file (`.vue`) other than `index.ts` matches, stop and report.
+
+- [ ] **Step 4.2: Update FeatureGuard/index.ts**
+
+Edit `frontend/src/components/FeatureGuard/index.ts`:
+
+```typescript
+// Before
+import FeatureAttention from "./FeatureAttention.vue";
+import FeatureBadge from "./FeatureBadge.vue";
+import FeatureModal from "./FeatureModal.vue";
+
+export { FeatureAttention, FeatureBadge, FeatureModal };
+
+// After
+import FeatureBadge from "./FeatureBadge.vue";
+import FeatureModal from "./FeatureModal.vue";
+
+export { FeatureBadge, FeatureModal };
+```
+
+- [ ] **Step 4.3: Delete the Vue file**
+
+```bash
+git rm frontend/src/components/FeatureGuard/FeatureAttention.vue
+```
+
+- [ ] **Step 4.4: Verify build still passes**
+
+```bash
+pnpm --dir frontend type-check
+```
+
+Expected: pass.
+
+- [ ] **Step 4.5: Commit**
+
+```bash
+git add frontend/src/components/FeatureGuard/index.ts
+git commit -m "chore(frontend): drop orphan FeatureAttention.vue
+
+React callers already use @/react/components/FeatureAttention.
+FeatureBadge/FeatureModal stay — Vue callers remain.
+"
+```
+
+---
+
+## Task 5: Delete SQLReview RuleConfigComponents
+
+**Goal:** The five `*Component.vue` files plus the `index.ts` that re-exports them have zero callers. Delete the whole set. `types.ts` and `utils.ts` in the same dir may also be orphaned — verify and delete if so.
+
+**Files:**
+- Delete: `frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue`
+- Delete: `frontend/src/components/SQLReview/components/RuleConfigComponents/NumberComponent.vue`
+- Delete: `frontend/src/components/SQLReview/components/RuleConfigComponents/StringArrayComponent.vue`
+- Delete: `frontend/src/components/SQLReview/components/RuleConfigComponents/StringComponent.vue`
+- Delete: `frontend/src/components/SQLReview/components/RuleConfigComponents/TemplateComponent.vue`
+- Delete: `frontend/src/components/SQLReview/components/RuleConfigComponents/index.ts`
+- Conditionally delete: `types.ts` and `utils.ts` in same dir (verify in step 5.1)
+
+- [ ] **Step 5.1: Verify the whole directory is orphaned**
+
+```bash
+echo "=== Any imports of RuleConfigComponents (subpath) ==="
+rg -n --type-add 'tsx:*.tsx' --type-add 'vue:*.vue' -tts -tvue -ttsx 'RuleConfigComponents' frontend/src/ 2>/dev/null \
+ | grep -v '^frontend/src/components/SQLReview/components/RuleConfigComponents/'
+
+echo ""
+echo "=== Imports of the dir's types.ts or utils.ts (by path) ==="
+rg -n --type-add 'tsx:*.tsx' --type-add 'vue:*.vue' -tts -tvue -ttsx '(RuleConfigComponents/types|RuleConfigComponents/utils)' frontend/src/ 2>/dev/null
+```
+
+Expected: zero results for both. If anything matches outside the dir, only delete the `.vue` files + `index.ts` and leave `types.ts`/`utils.ts`.
+
+- [ ] **Step 5.2: Delete the directory if fully orphaned, else partial delete**
+
+If step 5.1 returned **zero external imports**:
+
+```bash
+git rm -r frontend/src/components/SQLReview/components/RuleConfigComponents/
+```
+
+Otherwise, delete only the Vue files + index.ts:
+
+```bash
+git rm \
+ frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue \
+ frontend/src/components/SQLReview/components/RuleConfigComponents/NumberComponent.vue \
+ frontend/src/components/SQLReview/components/RuleConfigComponents/StringArrayComponent.vue \
+ frontend/src/components/SQLReview/components/RuleConfigComponents/StringComponent.vue \
+ frontend/src/components/SQLReview/components/RuleConfigComponents/TemplateComponent.vue \
+ frontend/src/components/SQLReview/components/RuleConfigComponents/index.ts
+```
+
+- [ ] **Step 5.3: Verify build still passes**
+
+```bash
+pnpm --dir frontend type-check
+```
+
+Expected: pass.
+
+- [ ] **Step 5.4: Commit**
+
+```bash
+git add -A frontend/src/components/SQLReview/
+git commit -m "chore(frontend): drop unused SQLReview RuleConfigComponents
+
+Whole subtree had no callers. SQL review UI is fully React-side."
+```
+
+---
+
+## Task 6: Delete AdvancedSearch Vue files
+
+**Goal:** Delete the five `.vue` files and the `index.ts` that re-exports them. Keep `types.ts` and `useCommonSearchScopeOptions.ts` — `frontend/src/utils/accessGrant.ts` imports from `@/components/AdvancedSearch/types`.
+
+**Files:**
+- Delete: `frontend/src/components/AdvancedSearch/AdvancedSearch.vue`
+- Delete: `frontend/src/components/AdvancedSearch/ScopeMenu.vue`
+- Delete: `frontend/src/components/AdvancedSearch/ScopeTags.vue`
+- Delete: `frontend/src/components/AdvancedSearch/TimeRange.vue`
+- Delete: `frontend/src/components/AdvancedSearch/ValueMenu.vue`
+- Delete: `frontend/src/components/AdvancedSearch/index.ts`
+- Keep: `types.ts`, `useCommonSearchScopeOptions.ts`
+
+- [ ] **Step 6.1: Verify the Vue files have no callers outside the directory itself**
+
+```bash
+echo "=== Imports of @/components/AdvancedSearch (any subpath) ==="
+rg -n --type-add 'tsx:*.tsx' --type-add 'vue:*.vue' -tts -tvue -ttsx '@/components/AdvancedSearch' frontend/src/ 2>/dev/null
+```
+
+Expected output (this is the only allowed external import):
+```
+frontend/src/utils/accessGrant.ts: ... } from "@/components/AdvancedSearch/types";
+```
+
+If anything else matches (e.g., a default import of `@/components/AdvancedSearch`), stop and report.
+
+- [ ] **Step 6.2: Delete the Vue files and index.ts**
+
+```bash
+git rm \
+ frontend/src/components/AdvancedSearch/AdvancedSearch.vue \
+ frontend/src/components/AdvancedSearch/ScopeMenu.vue \
+ frontend/src/components/AdvancedSearch/ScopeTags.vue \
+ frontend/src/components/AdvancedSearch/TimeRange.vue \
+ frontend/src/components/AdvancedSearch/ValueMenu.vue \
+ frontend/src/components/AdvancedSearch/index.ts
+```
+
+- [ ] **Step 6.3: Verify `types.ts` is still importable**
+
+```bash
+rg -n 'AdvancedSearch/types' frontend/src/utils/accessGrant.ts
+pnpm --dir frontend type-check
+```
+
+Expected: the import line shows; type-check passes.
+
+- [ ] **Step 6.4: Verify `useCommonSearchScopeOptions.ts` is still used**
+
+```bash
+rg -n 'useCommonSearchScopeOptions' frontend/src/ 2>/dev/null \
+ | grep -v '^frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions\.ts:'
+```
+
+If zero results: the file is now orphaned — flag for the next opportunistic cleanup PR but leave it in this PR (deleting Vue-helper TS files that *might* still be referenced via dynamic patterns is risky for a delete-driven PR).
+
+- [ ] **Step 6.5: Commit**
+
+```bash
+git add -A frontend/src/components/AdvancedSearch/
+git commit -m "chore(frontend): drop Vue AdvancedSearch components
+
+All consumers now use @/react/components/AdvancedSearch.
+types.ts kept (still imported by utils/accessGrant.ts).
+"
+```
+
+---
+
+## Task 7: Final validation
+
+**Goal:** Confirm the full PR is clean: builds, lints, type-checks, all tests including the new guard, no regressions.
+
+- [ ] **Step 7.1: Run the full frontend check chain**
+
+```bash
+pnpm --dir frontend fix
+pnpm --dir frontend check
+pnpm --dir frontend type-check
+pnpm --dir frontend test
+```
+
+Expected: every command exits 0.
+
+If `fix` modifies any files (e.g., auto-formats remaining files after the deletions changed imports), stage and amend those into the most recent relevant commit — or land a small follow-up `style:` commit. Do not skip this step.
+
+- [ ] **Step 7.2: Build sanity check**
+
+```bash
+pnpm --dir frontend build
+```
+
+Expected: build succeeds. (Heavy step — only required if any of the earlier steps modified `.ts`/`.tsx` files in `frontend/src/components/v2/index.ts` or `FeatureGuard/index.ts`. If only `.vue` files were deleted, type-check is sufficient.)
+
+- [ ] **Step 7.3: Verify file count delta**
+
+```bash
+echo "Vue files remaining outside frontend/src/react/:"
+fd -e vue . frontend/src 2>/dev/null | grep -v '/react/' | wc -l
+```
+
+Expected: **133** (was 154, minus 21 deleted in this PR).
+
+- [ ] **Step 7.4: Spot manual smoke**
+
+The deleted files have no live callers, but as a final safety check, start the dev server and click through 3–4 high-traffic React pages that previously referenced near-neighbors of these files:
+
+```bash
+PG_URL=postgresql://bbdev@localhost/bbdev pnpm --dir frontend dev
+```
+
+Visit and verify no broken UI/console errors on:
+- A project issue list (uses `AdvancedSearch.tsx` — confirm search filters still work)
+- A workspace settings page with subscription gating (uses `FeatureAttention.tsx` — confirm gating renders)
+- Instance detail page (used `InstanceSyncButton` — confirm sync button renders)
+- SQL Editor home (uses `MaxRowCountSelect`, `SQLUploadButton` — confirm both controls work)
+
+Report any console errors before proceeding to PR.
+
+---
+
+## Task 8: PR preparation
+
+- [ ] **Step 8.1: Review commit log**
+
+```bash
+git log --oneline main..HEAD
+```
+
+Expected: 6 commits (one per task 1–6).
+
+- [ ] **Step 8.2: Push & open PR**
+
+```bash
+git push -u origin <branch>
+gh pr create --title "chore(frontend): drop 21 orphan Vue primitives + add React→Vue import guard" --body "$(cat <<'EOF'
+## Summary
+Phase A of the Vue→React migration ([status doc](docs/plans/2026-05-12-react-migration-status-and-plan.md), [design](docs/plans/2026-05-12-phase-a-legacy-primitives-design.md)).
+
+- Deletes 21 `.vue` files in `frontend/src/components/` whose call sites already migrated to React or were never used.
+- Adds a new vitest guard (`no-react-to-vue-imports.test.ts`) that fails CI if any `frontend/src/react/**/*.{ts,tsx}` file imports a `.vue` file, with a small explicit allowlist for mount-bridges (`SessionExpiredSurfaceMount`, `AgentWindowMount`) deferred to Phase B.
+
+## Test plan
+- [ ] `pnpm --dir frontend type-check` passes
+- [ ] `pnpm --dir frontend test` passes (includes new guard)
+- [ ] `pnpm --dir frontend check` passes
+- [ ] `pnpm --dir frontend build` succeeds
+- [ ] Manual smoke: AdvancedSearch, FeatureAttention, InstanceSyncButton, MaxRowCountSelect, SQLUploadButton call sites render without errors
+EOF
+)"
+```
+
+---
+
+## Self-review notes
+
+- **Spec coverage:** Task 1 implements the CI guard requirement. Tasks 2–6 cover all 21 files listed in the spec's "Easy-delete sweep" section. Task 7 covers the spec's "Validation" subsection. The spec's "Out of scope" list (MIXED files and VUE-ONLY files) is honored — no plan task touches `LearnMoreLink`, `FeatureBadge`, `FeatureModal`, `UserAvatar`, `MonacoEditor/*`, `Icon/*`, `v2/Button|Form|Select|Model`, `ReleaseRemindModal`, `OverlayStackManager`, etc.
+- **EllipsisText.vue deviation:** The spec listed `EllipsisText.vue` in the easy-delete sweep (13 React callers). Re-verification during planning revealed those 13 callers already import the React `ellipsis-text.tsx`; the only remaining caller is `frontend/src/components/v2/Select/RemoteResourceSelector/utils.tsx`, which is a Vue-JSX file (not React — Vue 3 supports `.tsx` via `@vitejs/plugin-vue-jsx`). EllipsisText.vue is therefore VUE-ONLY and deferred to Phase B. The CI guard's scope to `frontend/src/react/**` correctly excludes the Vue-JSX caller.
+- **v2/Container/Drawer** deviation: The spec listed `v2/Container/*` in the easy-delete sweep. The audit found `frontend/src/plugins/ai/components/HistoryPanel/HistoryPanel.vue` still imports it. Deferred to Phase B. Not included in this plan.
+- **Final delete count:** 21 `.vue` files + 4 `index.ts` edits (delete or modify) + 1 new test file. Matches the spec's "~24 Vue files" target.
diff --git a/docs/plans/2026-05-12-react-migration-status-and-plan.md b/docs/plans/2026-05-12-react-migration-status-and-plan.md
new file mode 100644
index 0000000000..73de143afb
--- /dev/null
+++ b/docs/plans/2026-05-12-react-migration-status-and-plan.md
@@ -0,0 +1,152 @@
+# Vue → React Migration: Status & Remaining Plan
+
+**Date:** 2026-05-12
+**Goal:** Full Vue removal — every `.vue` file deleted, `pnpm remove vue vue-router pinia` ships, single-framework codebase.
+**Companion doc:** [2026-04-08-react-migration-playbook.md](./2026-04-08-react-migration-playbook.md) (process rules, deletion safety, state preferences).
+
+---
+
+## Part 1 — Current State
+
+### Counts
+
+- **`.tsx` files:** 681
+- **`.vue` files:** 154 (outside `frontend/src/react/`)
+- **React pages:** 167 (auth 11, project 100, settings 53, workspace 3)
+- **Shared React UI primitives:** 46 in `frontend/src/react/components/ui/`
+- **React SQL Editor surface:** 223 `.tsx` files under `frontend/src/react/components/sql-editor/`
+
+### Routing — fully bridged
+
+Every route file under `frontend/src/router/` already delegates to React via `ReactPageMount.vue` or `ReactRouteShellBridge.vue`:
+
+- `auth.ts` — all auth/consent routes
+- `setup.ts` — first-run setup
+- `dashboard/index.ts`, `dashboard/workspace.ts`, `dashboard/instance.ts`, `dashboard/workspaceSetting.ts`, `dashboard/projectV1.ts` — every leaf
+- `sqlEditor.ts` — parent is a one-line Vue render-only shim that mounts `<ReactPageMount page="SQLEditorLayout" />`; children are `NoopRouteComponent` (the React layout reads `useCurrentRoute()` and decides what to show). All panel content is React.
+
+### Cross-layer bridges
+
+- `frontend/src/react/hooks/useVueState.ts` — React subscribes to Vue reactive state (Pinia stores, refs, computed) via `useSyncExternalStore`.
+- `frontend/src/react/shell-bridge.ts` — custom events for `bb.react-locale-change`, `bb.react-notification`, `bb.react-quickstart-reset`.
+- `frontend/src/react/router/` — `useCurrentRoute()` / `useNavigate()` wrap vue-router for React consumers.
+
+### What's migrated
+
+| Area | Status |
+|---|---|
+| Auth (signin, signup, OAuth/OIDC, password reset, 2FA, profile setup, consent) | ✅ React |
+| Workspace dashboard (Projects, Instances, Databases, Environments, MyIssues, 403/404) | ✅ React |
+| Workspace settings (53 pages: members, roles, users, instances, environments, groups, IDPs, approvals, SQL review, semantic types, classifications, masking, risk, audit logs, subscription, general, profile, service accounts, workload identities, MCP) | ✅ React |
+| Project pages (100 pages: issue detail, plan detail, release detail, database detail, changelog, revisions, data export, webhooks, audit logs, database groups, GitOps, masking exemptions, access grants) | ✅ React |
+| **SQL Editor (all panels: editor, results, schema, connection, tabs, worksheets, history, diagram, terminal, access, masking, request drawers, save/upload, compact editor)** | **✅ React** |
+| Shared UI primitives (46 Base UI wrappers: input, button, dialog, sheet, popover, dropdown, table, tabs, tree, select, combobox, switch, tooltip, …) | ✅ React |
+
+### What's left
+
+**1. `frontend/src/components/` — 154 `.vue` files:**
+
+| Subdirectory | Files | Notes |
+|---|---|---|
+| `v2/` | 52 | Button, Container, Form, Model, Select, TabFilter — foundational primitives; React equivalents already exist in `react/components/ui/` |
+| `Icon/` | 18 | Thin wrappers over icon libs |
+| `misc/` | 6 | |
+| `MonacoEditor/` | 5 | |
+| `SQLReview/` | 5 | |
+| `AdvancedSearch/` | 5 | |
+| `FeatureGuard/` | 3 | |
+| `User/`, `Member/`, `Permission/`, `InputWithTemplate/`, `SpannerQueryPlan/` | 2 each (10 total) | |
+| `DatabaseDetail/`, `Instance/`, `RoleGrantPanel/` | 1 each | |
+| Top-level singletons (`DatabaseInfo`, `SessionExpiredSurfaceMount`, `LearnMoreLink`, `ReleaseRemindModal`, `RequiredStar`, `HighlightCodeBlock`, `FileContentPreviewModal`, `EditEnvironmentDrawer`, `EllipsisText`, `AgentWindowMount`) | 10 | |
+
+**2. App shell & framework:**
+
+- `frontend/src/App.vue`, `AuthContext.vue`, `NotificationContext.vue`
+- `frontend/src/layouts/BodyLayout.vue`, `DashboardLayout.vue`
+- `frontend/src/mountSidebar.ts`, `mountProjectSidebar.ts`
+- `frontend/src/router/` — vue-router driving the URL
+- `frontend/src/store/` — Pinia stores (still the source of truth for some domains; read from React via `useVueState`)
+- `frontend/src/main.ts`, `init.ts` — Vue bootstrap
+- The one-line `SQLEditorLayoutComponent` Vue shim in `router/sqlEditor.ts` (retires when Vue Router is replaced)
+
+**3. React-native stores already in place:** `frontend/src/react/stores/app/` contains 10 stores (auth, workspace, project, preferences, notification, iam, …). Future store migrations land here.
+
+### Rough completion read
+
+- **Routed page surface:** 100% React (only the SQL Editor parent route remains a thin Vue shim that mounts React)
+- **Feature components:** ~78% React (~681 `.tsx` vs 154 `.vue`)
+- **Foundation (shell + router + state):** 0% — still entirely Vue
+
+---
+
+## Part 2 — Migration Plan
+
+Two phases, sequenced **user-value first**: visible improvements first, foundation last. (Previous "Phase A — finish SQL Editor" is complete and folded into Phase B's layout retirement.)
+
+### Phase A — Strip legacy primitives & one-offs
+
+**Strategy:** delete-driven. Each PR migrates a primitive *and* updates all its callers in the same change. No long-lived dual implementations. Most React replacements already exist in `react/components/ui/` (46 components) — this is largely find-and-replace.
+
+**Order (cheap → load-bearing):**
+
+1. **Top-level singletons (1–2 PRs)** — `RequiredStar`, `LearnMoreLink`, `EllipsisText`, `HighlightCodeBlock`, `FileContentPreviewModal`, `ReleaseRemindModal`, `DatabaseInfo`, `EditEnvironmentDrawer`. Defer `SessionExpiredSurfaceMount` and `AgentWindowMount` to Phase B (they are mount-bridges that disappear with the shell).
+2. **`Icon/` (1 PR)** — 18 wrappers; bulk replace with React icon equivalents.
+3. **Small feature dirs (5 PRs)** — `MonacoEditor/`, `SQLReview/`, `AdvancedSearch/`, `FeatureGuard/`, `misc/`. One PR per dir.
+4. **`components/v2/` (6–7 PRs)** — Button, Container, Form, Model, Select, TabFilter. One PR per subdir; final cleanup PR deletes the `v2/` tree.
+5. **Other small dirs (1–2 PRs)** — User, Permission, Member, Instance, InputWithTemplate, RoleGrantPanel, DatabaseDetail, SpannerQueryPlan.
+
+**Done when:** `frontend/src/components/` contains only files that will be deleted alongside their layouts in Phase B.
+
+**Estimated:** 10–15 PRs.
+
+### Phase B — App shell, router, Vue extraction
+
+The longest and riskiest phase. Each step forces a decision that the bridge has so far deferred.
+
+#### B1. Router migration (vue-router → React Router DOM)
+
+The hardest single piece. Introduce React Router DOM at the *root* and have it own the URL. Port routes from `frontend/src/router/{auth,setup,sqlEditor,dashboard/*}.ts` into React route trees.
+
+The `useCurrentRoute()` / `useNavigate()` hooks already abstract route access — swap their *implementation* (vue-router refs → RR DOM hooks) without touching consumers.
+
+**Risk:** param/query/hash semantics differ between vue-router and RR DOM (trailing slashes, optional params, `RouteLocationNormalized` shape). Plan for a careful dev-verification window before merge. Hard cutover; no feature flag (router cannot meaningfully dual-stack at runtime).
+
+#### B2. App shell + layouts
+
+Convert `App.vue`, `AuthContext.vue`, `NotificationContext.vue`, `layouts/BodyLayout.vue`, `layouts/DashboardLayout.vue`, `mountSidebar.ts`, `mountProjectSidebar.ts`, and `shell-bridge.ts` event consumers.
+
+The shell currently *hosts* React pages; after this step React hosts everything. `useVueState`, `shell-bridge.ts`, and `ReactPageMount.vue` retire — once no reactive state is Vue-owned, the bridges have no consumers. `SessionExpiredSurfaceMount.vue` and `AgentWindowMount.vue` disappear here. The `SQLEditorLayoutComponent` Vue shim in `router/sqlEditor.ts` also retires.
+
+#### B3. State migration (Pinia → React state)
+
+Per the playbook, deferred until concrete problem. After B2, Pinia stores have no Vue component consumers — only React via `useVueState`. Options:
+
+- **Keep Pinia** as a pure data layer. `createPinia()` works without Vue components.
+- **Port store-by-store** to the existing pattern in `react/stores/app/` (already 10 stores in place).
+
+Recommendation: port. Pinia stays a transitive dep of `vue` and blocks B4 otherwise. Use the same delete-driven pattern as Phase A — one store per PR, update all `useVueState` callers in the same change.
+
+#### B4. Final extraction
+
+- `pnpm remove vue vue-router pinia @vue/* vue-i18n vue-tsc @vitejs/plugin-vue`
+- Delete `frontend/src/{App.vue,AuthContext.vue,NotificationContext.vue,init.ts,mount.ts,layouts,store,router}` and Vue shims (`shims-vue-*.d.ts`)
+- Move `frontend/src/react/*` up one level (drop the `react/` namespace prefix)
+- Switch Vite plugins: drop `@vitejs/plugin-vue`; promote `react-tsx-transform` to the standard React plugin
+- Collapse `tsconfig.json` + `tsconfig.react.json` into one
+- Retire `no-legacy-vue-deps.test.ts` enforcement
+- Merge `frontend/src/react/locales/` into a single locales tree; drop `vue-i18n` callers
+- Move framework-neutral `frontend/src/views/sql-editor/` utilities (events, hooks, types — no `.vue` files remain) to wherever they best fit in the unified layout
+
+**Estimated Phase B:** 8–12 PRs, sequenced B1 → B2 → B3 → B4. B1 is the riskiest single PR in the entire migration.
+
+---
+
+## Part 3 — Cross-Cutting Rules
+
+- **One PR, one replacement.** Every migration PR deletes the Vue file(s) it replaces. No dual-stack components.
+- **Locales.** New strings land in `frontend/src/react/locales/`. Each phase opportunistically removes unused keys from `frontend/src/locales/`. Final merge happens in B4.
+- **i18n compatibility.** `vue-i18n` and `react-i18next` stay parallel until B4.
+- **State.** Stick with Pinia + `useVueState` until B3. Don't introduce new Zustand stores during Phase A unless a concrete problem demands it (playbook rule).
+- **Shared UI.** Always check `frontend/src/react/components/ui/` before hand-rolling a control (AGENTS.md rule).
+- **Composite-PK tests.** Backend tests are out of scope for this migration; no expected impact.
+- **Testing.** Existing unit tests + manual QA per surface. No new E2E gate is proposed unless coverage gaps surface during Phase B1.
diff --git a/frontend/src/components/AdvancedSearch/AdvancedSearch.vue b/frontend/src/components/AdvancedSearch/AdvancedSearch.vue
deleted file mode 100644
index d14d54ebb4..0000000000
--- a/frontend/src/components/AdvancedSearch/AdvancedSearch.vue
+++ /dev/null
@@ -1,734 +0,0 @@
-<template>
- <div ref="containerRef" class="w-full min-w-0 relative">
- <NInput
- ref="inputRef"
- v-bind="$attrs"
- v-model:value="inputText"
- :placeholder="placeholder ?? $t('issue.advanced-search.self')"
- style="--n-padding-left: 8px; --n-padding-right: 4px"
- @click="handleInputClick"
- @keyup="handleKeyUp"
- @keydown="handleKeyDown"
- >
- <template #prefix>
- <div
- class="flex flex-row items-center justify-start gap-x-2"
- >
- <div class="flex items-center gap-x-2">
- <FilterIcon class="w-4 h-4 text-control-placeholder" />
- <span v-if="isMdOrAbove" class="textinfolabel">
- {{ $t("issue.advanced-search.filter") }}
- </span>
- </div>
- <div
- ref="tagsContainerRef"
- class="flex-1 flex flex-row items-center flex-nowrap gap-1 overflow-auto hide-scrollbar"
- >
- <ScopeTags
- :params="params"
- :scope-options="scopeOptions"
- :focused-tag-index="focusedTagIndex"
- @select-scope="selectScopeFromTag"
- @remove-scope="removeScope"
- />
- </div>
- </div>
- </template>
- <template #suffix>
- <NButton
- v-show="clearable"
- quaternary
- circle
- size="tiny"
- @click.stop.prevent="handleClear"
- >
- <template #icon>
- <XIcon class="w-3 h-3" />
- </template>
- </NButton>
- </template>
- </NInput>
-
- <Transition name="fade-slide-up" :appear="true">
- <div
- v-show="showMenu"
- v-zindexable="{ enabled: true }"
- class="absolute top-9 w-full bg-gray-100 shadow-xl origin-top-left rounded-[3px] overflow-clip"
- >
- <ScopeMenu
- :show="state.menuView === 'scope'"
- :options="visibleScopeOptions"
- :menu-index="menuIndex"
- @select-scope="selectScope"
- @hover-item="menuIndex = $event"
- />
- <ValueMenu
- :show="state.menuView === 'value'"
- :scope-option="currentScopeOption"
- :value-options="visibleValueOptions"
- :menu-index="menuIndex"
- :fetch-state="currentFetchState"
- :show-empty-placeholder="
- (currentScopeOption?.options ?? []).length > 0
- "
- @select-value="selectValue"
- @hover-item="menuIndex = $event"
- @fetch-next-page="() => handleSearch(currentValueForScope)"
- />
- </div>
- </Transition>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { onClickOutside, useDebounceFn } from "@vueuse/core";
-import { cloneDeep, last } from "lodash-es";
-import { FilterIcon, XIcon } from "lucide-vue-next";
-import { type InputInst, NButton, NInput } from "naive-ui";
-import scrollIntoView from "scroll-into-view-if-needed";
-import { zindexable as vZindexable } from "vdirs";
-import { computed, nextTick, onMounted, reactive, ref, watch } from "vue";
-import { useRouter } from "vue-router";
-import { useWideScreen } from "@/composables/useWideScreen";
-import { useCurrentUserV1 } from "@/store";
-import { DEBOUNCE_SEARCH_DELAY } from "@/types";
-import type { SearchParams, SearchScope, SearchScopeId } from "@/utils";
-import {
- buildSearchParamsBySearchText,
- buildSearchTextBySearchParams,
- emptySearchParams,
- getValueFromSearchParams,
- getValuesFromSearchParams,
- minmax,
- storageKeySearch,
- upsertScope,
- useDynamicLocalStorage,
-} from "@/utils";
-import ScopeMenu from "./ScopeMenu.vue";
-import ScopeTags from "./ScopeTags.vue";
-import type { ScopeOption } from "./types";
-import ValueMenu from "./ValueMenu.vue";
-
-const props = withDefaults(
- defineProps<{
- params: SearchParams;
- scopeOptions?: ScopeOption[];
- placeholder?: string | undefined;
- autofocus?: boolean;
- cacheQuery?: boolean;
- // Fallback params when no URL params and no cache.
- // Precedence: URL params > cache > defaultParams.
- // Readonly scopes from props.params are always preserved.
- defaultParams?: SearchParams;
- }>(),
- {
- scopeOptions: () => [],
- autofocus: false,
- placeholder: undefined,
- cacheQuery: true,
- defaultParams: undefined,
- }
-);
-
-const emit = defineEmits<{
- (event: "keyup:enter"): void;
- (event: "update:params", params: SearchParams): void;
- (event: "select-unsupported-scope", id: SearchScopeId): void;
-}>();
-
-interface LocalState {
- currentScope?: SearchScopeId;
- menuView?: "value" | "scope";
- scopeOptions: ScopeOption[];
- fetchDataStateMap: Map<
- SearchScopeId,
- {
- loading: boolean;
- nextPageToken?: string;
- }
- >;
-}
-
-const router = useRouter();
-const me = useCurrentUserV1();
-const isMdOrAbove = useWideScreen();
-
-const cachedQuery = useDynamicLocalStorage<string>(
- computed(() =>
- storageKeySearch(router.currentRoute.value.path, me.value.email)
- ),
- ""
-);
-
-const defaultSearchParams = () => {
- const params = emptySearchParams();
- for (const scope of props.params.scopes) {
- if (scope.readonly) {
- params.scopes.push({ ...scope });
- }
- }
- return params;
-};
-
-const state = reactive<LocalState>({
- scopeOptions: [],
- fetchDataStateMap: new Map(),
-});
-
-watch(
- () => props.scopeOptions,
- () => {
- state.scopeOptions = cloneDeep(props.scopeOptions);
- },
- { deep: true, immediate: true }
-);
-
-const containerRef = ref<HTMLElement>();
-const tagsContainerRef = ref<HTMLElement>();
-const inputText = ref(props.params.query);
-const inputRef = ref<InputInst>();
-const menuIndex = ref(0);
-const focusedTagIndex = ref<number>();
-let incompleteValueVersion = 0;
-
-const invalidatePendingIncompleteValue = () => {
- incompleteValueVersion += 1;
-};
-
-const isEditingScopedValue = () => {
- return (
- !!state.currentScope && inputText.value.startsWith(`${state.currentScope}:`)
- );
-};
-
-const editableScopes = computed(() => {
- return props.params.scopes.filter((s) => !s.readonly);
-});
-
-const valueOptions = computed(() => {
- if (state.menuView === "value" && currentScopeOption.value) {
- return currentScopeOption.value.options ?? [];
- }
- return [];
-});
-
-const currentScopeOption = computed(() => {
- if (state.currentScope) {
- return state.scopeOptions.find((opt) => opt.id === state.currentScope);
- }
- return undefined;
-});
-
-const currentValueForScope = computed(() => {
- if (!state.currentScope) return "";
- const scopePrefix = `${state.currentScope}:`;
- return inputText.value.trim().toLowerCase().substring(scopePrefix.length);
-});
-
-const currentFetchState = computed(() => {
- return state.currentScope
- ? (state.fetchDataStateMap.get(state.currentScope) ?? {
- loading: false,
- })
- : { loading: false };
-});
-
-const handleSearch = useDebounceFn(async (search: string) => {
- if (!currentScopeOption.value?.search) {
- return;
- }
-
- const fetchState = { ...currentFetchState.value };
- if (fetchState.loading) {
- return;
- }
- fetchState.loading = true;
-
- try {
- const { options, nextPageToken } = await currentScopeOption.value.search({
- keyword: search,
- nextPageToken: fetchState.nextPageToken,
- });
- if (!currentScopeOption.value.options) {
- currentScopeOption.value.options = [];
- }
- if (!fetchState.nextPageToken) {
- currentScopeOption.value.options = [...options];
- } else {
- currentScopeOption.value.options.push(...options);
- }
- fetchState.nextPageToken = nextPageToken;
- } finally {
- fetchState.loading = false;
- state.fetchDataStateMap.set(currentScopeOption.value.id, fetchState);
- }
-}, DEBOUNCE_SEARCH_DELAY);
-
-watch(
- [() => currentScopeOption.value, () => currentValueForScope.value],
- async ([scopeOption, valueForScope]) => {
- if (!scopeOption || !scopeOption.search) {
- return;
- }
-
- state.fetchDataStateMap.set(scopeOption.id, {
- loading: false,
- nextPageToken: "",
- });
- await handleSearch(valueForScope);
- },
- { immediate: true }
-);
-
-// availableScopeOptions will hide chosen search scope.
-// For example, if uses already select the instance, we should NOT show the instance scope in the dropdown.
-const availableScopeOptions = computed((): ScopeOption[] => {
- const existedScopes = new Set<SearchScopeId>(
- props.params.scopes.map((scope) => scope.id)
- );
-
- return state.scopeOptions.filter((scope) => {
- if (existedScopes.has(scope.id) && !scope.allowMultiple) {
- return false;
- }
- return true;
- });
-});
-
-const visibleScopeOptions = computed(() => {
- if (currentScopeOption.value) {
- return [currentScopeOption.value];
- }
-
- const keyword = inputText.value.trim().replace(/:.*$/, "").toLowerCase();
- if (!keyword) return availableScopeOptions.value;
-
- return availableScopeOptions.value.filter(
- (option) =>
- option.id.toLowerCase().includes(keyword) ||
- option.title.toLowerCase().includes(keyword)
- );
-});
-
-const visibleValueOptions = computed(() => {
- if (!state.currentScope) return [];
-
- const selectedValues = new Set(
- getValuesFromSearchParams(props.params, state.currentScope)
- );
- const options = valueOptions.value.filter(
- (option) => !selectedValues.has(option.value)
- );
-
- const keyword = currentValueForScope.value
- .trim()
- .replace(/:.*$/, "")
- .toLowerCase();
- if (!keyword || currentScopeOption.value?.search) {
- return options;
- }
-
- return options.filter(
- (option) =>
- option.value.toLowerCase().includes(keyword) ||
- option.keywords.some((key) => key.includes(keyword))
- );
-});
-
-const visibleOptions = computed(() => {
- return state.menuView === "scope"
- ? visibleScopeOptions.value
- : state.menuView === "value"
- ? visibleValueOptions.value
- : ([] as unknown[]);
-});
-
-const showMenu = computed(() => {
- if (state.menuView === "scope") {
- return visibleScopeOptions.value.length > 0;
- }
- if (state.menuView === "value") {
- return true;
- }
- return false;
-});
-
-const clearable = computed(() => {
- return (
- props.params.query.trim().length > 0 || editableScopes.value.length > 0
- );
-});
-
-const hideMenu = () => {
- nextTick(() => {
- state.menuView = undefined;
- focusedTagIndex.value = undefined;
- });
-};
-
-onClickOutside(containerRef, hideMenu);
-
-const moveMenuIndex = (delta: -1 | 1) => {
- const options = visibleOptions.value;
- if (options.length === 0) return;
-
- const target = minmax(menuIndex.value + delta, 0, options.length - 1);
- menuIndex.value = target;
-};
-
-const removeScope = (index: number) => {
- emit("update:params", {
- ...props.params,
- scopes: props.params.scopes.filter((_, i) => i !== index),
- });
-};
-
-const selectScope = (
- id: SearchScopeId | undefined,
- value: string | undefined = undefined
-) => {
- invalidatePendingIncompleteValue();
- state.currentScope = id;
- if (id) {
- state.menuView = "value";
- // Fill-in the scope prefix if needed
- if (!inputText.value.startsWith(`${id}:`)) {
- inputText.value = `${id}:${value ?? ""}`;
- }
- scrollScopeTagIntoViewIfNeeded(id);
- } else {
- state.menuView = "scope";
- }
-};
-
-const extractValue = () => {
- const id = state.currentScope;
- if (!id) {
- return;
- }
- const text = inputText.value;
- if (!text.startsWith(`${id}:`)) {
- return;
- }
- return text.slice(`${id}:`.length);
-};
-
-const selectValue = (value: string) => {
- const id = state.currentScope;
- if (!id || !currentScopeOption.value) {
- state.menuView = undefined;
- return;
- }
- invalidatePendingIncompleteValue();
- const { allowMultiple } = currentScopeOption.value;
- const updated = upsertScope({
- params: props.params,
- scopes: {
- id,
- value,
- },
- allowMultiple,
- });
- updated.query = "";
- inputText.value = "";
- selectScope(undefined);
- emit("update:params", updated);
-
- scrollScopeTagIntoViewIfNeeded(id);
- hideMenu();
-};
-
-const selectScopeFromTag = (scope: SearchScope) => {
- if (state.scopeOptions.some((opt) => opt.id === scope.id)) {
- // For AdvancedSearch supported scopes
- selectScope(scope.id);
- return;
- }
-
- // Unsupported scope for AdvancedSearch
- // emit an event and wish the parent UI can handle this
- emit("select-unsupported-scope", scope.id);
- hideMenu();
-};
-
-const maybeSelectMatchedScope = () => {
- if (!state.menuView || state.menuView === "scope") {
- const matchedScope = visibleScopeOptions.value.find((opt) =>
- inputText.value.startsWith(`${opt.id}:`)
- );
- if (matchedScope) {
- // select the scope if the inputText matches its prefix
- selectScope(matchedScope.id);
- return true;
- }
- if (!state.menuView) {
- // Show scope menu if none of the menus are shown
- state.menuView = "scope";
- return true;
- }
- }
- return false;
-};
-
-const maybeDeselectMismatchedScope = () => {
- if (state.menuView === "value" && state.currentScope) {
- if (!inputText.value.startsWith(`${state.currentScope}:`)) {
- // de-select current scope since the inputText doesn't match its prefix.
- state.menuView = "scope";
- selectScope(undefined);
- return true;
- }
- }
- return false;
-};
-
-const emitIncompleteValueIfStillValid = (version: number) => {
- if (version !== incompleteValueVersion) {
- return;
- }
- if (isEditingScopedValue() || props.params.query === inputText.value) {
- return;
- }
- const updated = cloneDeep(props.params);
- updated.query = inputText.value;
- emit("update:params", updated);
-};
-
-const maybeEmitIncompleteValue = () => {
- if (isEditingScopedValue() || props.params.query === inputText.value) {
- return;
- }
- updateParams(incompleteValueVersion);
-};
-
-const updateParams = useDebounceFn((version: number) => {
- emitIncompleteValueIfStillValid(version);
-}, DEBOUNCE_SEARCH_DELAY);
-
-const handleInputClick = () => {
- maybeSelectMatchedScope();
- maybeDeselectMismatchedScope();
-};
-
-const handleKeyDown = (e: KeyboardEvent) => {
- if (e.isComposing) return;
- if (e.defaultPrevented) return;
- const { key } = e;
- if (key === "Backspace" && inputText.value === "") {
- e.stopPropagation();
- e.preventDefault();
- // Pressing "backspace" when the input box is empty
- if (focusedTagIndex.value !== undefined) {
- // Delete the focusedTag if it exists
- const index = focusedTagIndex.value;
- focusedTagIndex.value = undefined;
- removeScope(index);
- } else {
- // Otherwise mark the last editable scope as focused.
- const scope = last(editableScopes.value);
- if (scope) {
- focusedTagIndex.value = editableScopes.value.length - 1;
- scrollScopeTagIntoViewIfNeeded(scope.id);
- }
- }
- return;
- }
- focusedTagIndex.value = undefined;
-
- if (key === "ArrowUp") {
- moveMenuIndex(-1);
- e.preventDefault();
- return;
- }
- if (key === "ArrowDown") {
- moveMenuIndex(1);
- e.preventDefault();
- return;
- }
-};
-
-const handleKeyUp = (e: KeyboardEvent) => {
- if (e.isComposing) return;
- if (e.defaultPrevented) return;
- const { key } = e;
- if (key === "Escape") {
- maybeEmitIncompleteValue();
- state.menuView = undefined;
- return;
- }
- if (key === "Backspace" && inputText.value === "") {
- // backspace key might be processed by KeyDown
- if (focusedTagIndex.value !== undefined) {
- return;
- }
- }
- if (key === "Enter") {
- // Press enter to select scope (dive into the next step)
- // or select value
- const index = menuIndex.value;
- if (state.menuView === "scope") {
- const option = visibleScopeOptions.value[index];
- if (option) {
- selectScope(option.id);
- return maybeEmitIncompleteValue();
- }
- }
- if (state.menuView === "value") {
- if (visibleValueOptions.value.length === 0) {
- const val = extractValue();
- if (val) {
- return selectValue(val);
- }
- } else if (visibleValueOptions.value[index]) {
- return selectValue(visibleValueOptions.value[index].value);
- }
- }
- return emit("keyup:enter");
- }
-
- if (maybeSelectMatchedScope()) {
- return maybeEmitIncompleteValue();
- }
- if (maybeDeselectMismatchedScope()) {
- return maybeEmitIncompleteValue();
- }
-
- maybeEmitIncompleteValue();
-};
-
-const handleClear = () => {
- invalidatePendingIncompleteValue();
- const params = defaultSearchParams();
- emit("update:params", params);
- hideMenu();
-};
-
-const scrollScopeTagIntoViewIfNeeded = (id: SearchScopeId) => {
- nextTick(() => {
- const tagsContainerEl = tagsContainerRef.value;
- if (!tagsContainerEl) return;
- const tagEl = tagsContainerEl.querySelector(
- `[data-search-scope-id="${id}"]`
- );
- if (tagEl) {
- scrollIntoView(tagEl, {
- scrollMode: "if-needed",
- });
- }
- });
-};
-
-// Check if params has meaningful content (non-empty, excluding readonly scopes)
-const hasParams = (params: SearchParams): boolean => {
- if (params.query.trim().length > 0) return true;
- // Readonly scopes don't count as "URL params" - they're set by parent
- return params.scopes.some((s) => !s.readonly);
-};
-
-onMounted(() => {
- if (props.autofocus) {
- inputRef.value?.inputElRef?.focus();
- }
-
- // Precedence: URL params > cache > defaultParams
- // Parent passes non-empty params only when URL has ?q=...
- if (hasParams(props.params)) {
- // URL had params - use as-is
- return;
- }
-
- // Preserve readonly scopes from props.params (e.g., project=xx in ProjectDatabasesPanel)
- const readonlyScopes = props.params.scopes.filter((s) => s.readonly);
-
- // No URL params - check cache
- const qs = cachedQuery.value;
- if (qs.length > 0) {
- // Cache exists: restore from cache
- const params = buildSearchParamsBySearchText(qs);
- // Filter to only include scopes that are valid for this search context
- // and not already covered by readonly scopes
- const readonlyScopeIds = new Set(readonlyScopes.map((s) => s.id));
- params.scopes = params.scopes.filter((scope) => {
- if (readonlyScopeIds.has(scope.id)) return false;
- return props.scopeOptions.find((op) => op.id === scope.id);
- });
- // Prepend readonly scopes
- params.scopes = [...readonlyScopes, ...params.scopes];
- emit("update:params", params);
- return;
- }
-
- // No cache: use defaults if provided
- if (props.defaultParams) {
- const params = cloneDeep(props.defaultParams);
- // Prepend readonly scopes
- const readonlyScopeIds = new Set(readonlyScopes.map((s) => s.id));
- params.scopes = params.scopes.filter((s) => !readonlyScopeIds.has(s.id));
- params.scopes = [...readonlyScopes, ...params.scopes];
- emit("update:params", params);
- }
-});
-
-watch(
- () => state.menuView,
- () => {
- focusedTagIndex.value = undefined;
- menuIndex.value = 0;
- if (state.menuView === "value" && state.currentScope) {
- const value = getValueFromSearchParams(props.params, state.currentScope);
- if (value) {
- const index = valueOptions.value.findIndex(
- (option) => option.value === value
- );
- if (index >= 0) {
- menuIndex.value = index;
- }
- }
- }
- }
-);
-
-watch(visibleScopeOptions, (newOptions, oldOptions) => {
- if (state.menuView !== "scope") return;
- const highlightedScope = oldOptions[menuIndex.value]?.id;
- if (highlightedScope) {
- const index = newOptions.findIndex((opt) => opt.id === highlightedScope);
- if (index >= 0) {
- menuIndex.value = index;
- return;
- }
- }
-});
-
-watch(visibleValueOptions, (newOptions, oldOptions) => {
- if (state.menuView !== "value") return;
- const highlightedValue = oldOptions[menuIndex.value]?.value;
- if (highlightedValue) {
- const index = newOptions.findIndex((opt) => opt.value === highlightedValue);
- if (index >= 0) {
- menuIndex.value = index;
- return;
- }
- }
- menuIndex.value = minmax(menuIndex.value, 0, newOptions.length - 1);
-});
-
-watch(
- () => props.params.query,
- (query) => {
- if (query !== inputText.value) {
- inputText.value = query;
- }
- }
-);
-
-watch(
- () => props.params,
- (params) => {
- if (props.cacheQuery) {
- cachedQuery.value = buildSearchTextBySearchParams(params);
- }
- },
- { deep: true }
-);
-</script>
diff --git a/frontend/src/components/AdvancedSearch/ScopeMenu.vue b/frontend/src/components/AdvancedSearch/ScopeMenu.vue
deleted file mode 100644
index 2380a96488..0000000000
--- a/frontend/src/components/AdvancedSearch/ScopeMenu.vue
+++ /dev/null
@@ -1,97 +0,0 @@
-<template>
- <div v-if="options.length > 0" ref="scrollbarContainerRef" v-show="show">
- <NScrollbar
- ref="scrollbarRef"
- :style="{
- 'max-height': `${maxListHeight}px`,
- }"
- >
- <div
- v-for="option, index in options"
- :key="`${option.id}-${index}`"
- class="flex gap-x-2 gap-y-0.5 px-3 py-2 cursor-pointer border-t text-sm"
- :class="[
- index === menuIndex && 'bg-gray-200/75',
- index === 0 ? 'border-transparent' : 'border-block-border',
- compactSize ? 'flex-col items-start' : 'flex-row items-center'
- ]"
- :data-index="index"
- :data-id="option.id"
- @mouseenter.prevent.stop="$emit('hover-item', index)"
- @mousedown.prevent.stop="$emit('select-scope', option.id)"
- >
- <span class="text-accent">
- {{ option.id }}
- </span>
- <NEllipsis>
- <span class="text-control-light">{{ option.description }}</span>
- </NEllipsis>
- </div>
- </NScrollbar>
- </div>
-</template>
-
-<script setup lang="ts">
-import {
- useElementBounding,
- useElementSize,
- useWindowSize,
-} from "@vueuse/core";
-import { NEllipsis, NScrollbar } from "naive-ui";
-import { computed, nextTick, ref, watch } from "vue";
-import type { SearchScopeId } from "@/utils";
-import type { ScopeOption } from "./types";
-
-const props = defineProps<{
- show: boolean;
- options: ScopeOption[];
- menuIndex: number;
-}>();
-
-defineEmits<{
- (event: "select-scope", id: SearchScopeId): void;
- (event: "hover-item", index: number): void;
-}>();
-
-const scrollbarRef = ref<InstanceType<typeof NScrollbar>>();
-const scrollbarContainerRef = ref<HTMLElement>();
-const { top: containerTop } = useElementBounding(scrollbarContainerRef);
-const { height: windowHeight } = useWindowSize();
-const { width: scrollbarWidth } = useElementSize(scrollbarContainerRef);
-
-const compactSize = computed(() => scrollbarWidth.value <= 550);
-
-const maxListHeight = computed(() => {
- const MAX_HEIGHT = 480;
- const PADDING_BOTTOM = 16;
-
- return Math.min(
- MAX_HEIGHT,
- windowHeight.value - containerTop.value - PADDING_BOTTOM
- );
-});
-
-const highlightedIndex = computed(() => {
- if (!props.show) return undefined;
- const { options, menuIndex } = props;
- if (options[menuIndex]) {
- return menuIndex;
- }
- return undefined;
-});
-
-watch(
- [highlightedIndex, () => props.show],
- ([index, show]) => {
- if (!show) return;
- if (index === undefined) return;
- nextTick(() => {
- scrollbarRef.value?.scrollTo({
- top: index * (compactSize.value ? 59 : 38),
- behavior: "auto",
- });
- });
- },
- { immediate: true }
-);
-</script>
diff --git a/frontend/src/components/AdvancedSearch/ScopeTags.vue b/frontend/src/components/AdvancedSearch/ScopeTags.vue
deleted file mode 100644
index 4bc8dd08f9..0000000000
--- a/frontend/src/components/AdvancedSearch/ScopeTags.vue
+++ /dev/null
@@ -1,82 +0,0 @@
-<template>
- <NTag
- v-for="({ scope, originalIndex }, visibleIndex) in visibleScopes"
- :key="`${originalIndex}-${scope.id}`"
- closable
- :data-search-scope-id="scope.id"
- :bordered="false"
- size="small"
- style="--n-icon-size: 12px"
- v-bind="tagProps(visibleIndex)"
- @close="$emit('remove-scope', originalIndex)"
- @click.stop.prevent="$emit('select-scope', scope)"
- >
- <div class="flex items-center gap-1">
- <span class="text-control">{{ scope.id }}:</span>
- <component :is="() => renderValue(scope)" />
- </div>
- </NTag>
-</template>
-
-<script setup lang="tsx">
-import dayjs from "dayjs";
-import type { TagProps } from "naive-ui";
-import { NTag } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { UNKNOWN_ID } from "@/types";
-import type { SearchParams, SearchScope } from "@/utils";
-import { callCssVariable, extractDatabaseResourceName } from "@/utils";
-import type { ScopeOption } from "./types";
-
-const props = defineProps<{
- params: SearchParams;
- scopeOptions: ScopeOption[];
- focusedTagIndex?: number;
-}>();
-
-defineEmits<{
- (event: "remove-scope", index: number): void;
- (event: "select-scope", scope: SearchScope): void;
-}>();
-
-const { t } = useI18n();
-
-const visibleScopes = computed(() => {
- return props.params.scopes
- .map((scope, originalIndex) => ({ scope, originalIndex }))
- .filter(({ scope }) => !scope.readonly);
-});
-
-const tagProps = (index: number): TagProps => {
- if (props.focusedTagIndex !== index) {
- return {};
- }
- return {
- bordered: true,
- color: {
- borderColor: callCssVariable("--color-accent"),
- },
- };
-};
-
-const renderValue = (scope: SearchScope) => {
- const scopeOption = props.scopeOptions
- .find((option) => option.id === scope.id)
- ?.options?.find((option) => option.value === scope.value);
- if (scopeOption && scopeOption.render) {
- return scopeOption.render();
- }
- if (scope.id === "created" || scope.id === "updated") {
- const [begin, end] = scope.value.split(",").map((ts) => parseInt(ts, 10));
- return [dayjs(begin).format("L"), dayjs(end).format("L")].join("-");
- } else if (scope.id === "database") {
- const { databaseName } = extractDatabaseResourceName(scope.value);
- return <span>{databaseName}</span>;
- }
- if (scope.value === `${UNKNOWN_ID}`) {
- return <span>{t("common.all").toLocaleLowerCase()}</span>;
- }
- return <span>{scope.value}</span>;
-};
-</script>
diff --git a/frontend/src/components/AdvancedSearch/TimeRange.vue b/frontend/src/components/AdvancedSearch/TimeRange.vue
deleted file mode 100644
index f9d293d043..0000000000
--- a/frontend/src/components/AdvancedSearch/TimeRange.vue
+++ /dev/null
@@ -1,96 +0,0 @@
-<template>
- <NDatePicker
- v-if="isMdOrAbove"
- :key="timeRange ? 'filled' : 'empty'"
- :value="timeRange"
- :is-date-disabled="isDateDisabled"
- type="datetimerange"
- clearable
- class="time-range-picker min-w-0"
- @update:value="emitUpdate"
- />
- <NPopover
- v-else
- trigger="click"
- placement="bottom-end"
- :show="showPopover"
- @update:show="showPopover = $event"
- >
- <template #trigger>
- <NButton quaternary size="small" :type="timeRange ? 'primary' : 'default'">
- <template #icon>
- <CalendarIcon class="w-4 h-4" />
- </template>
- </NButton>
- </template>
- <NDatePicker
- :key="timeRange ? 'filled-sm' : 'empty-sm'"
- :value="timeRange"
- :is-date-disabled="isDateDisabled"
- type="datetimerange"
- clearable
- panel
- @update:value="handleSmallScreenUpdate"
- />
- </NPopover>
-</template>
-
-<script setup lang="ts">
-import dayjs from "dayjs";
-import { CalendarIcon } from "lucide-vue-next";
-import { NButton, NDatePicker, NPopover } from "naive-ui";
-import { computed, ref } from "vue";
-import { useWideScreen } from "@/composables/useWideScreen";
-import type { SearchParams } from "@/utils";
-import { getTsRangeFromSearchParams, upsertScope } from "@/utils";
-
-const props = withDefaults(
- defineProps<{
- params: SearchParams;
- scope?: "created" | "updated";
- }>(),
- {
- scope: "created",
- }
-);
-
-const emit = defineEmits<{
- (event: "update:params", params: SearchParams): void;
-}>();
-
-const isMdOrAbove = useWideScreen();
-const showPopover = ref(false);
-
-const timeRange = computed(() => {
- return getTsRangeFromSearchParams(props.params, props.scope);
-});
-
-const isDateDisabled = (ts: number) => {
- return ts > dayjs().add(1, "day").endOf("day").valueOf();
-};
-
-const emitUpdate = (values: [number, number] | null) => {
- const from = values ? dayjs(values[0]).startOf("day") : null;
- const to = values ? dayjs(values[1]).endOf("day") : null;
- const updated = upsertScope({
- params: props.params,
- scopes: {
- id: props.scope,
- value: from && to ? `${from.valueOf()},${to.valueOf()}` : "",
- },
- });
- emit("update:params", updated);
-};
-
-const handleSmallScreenUpdate = (values: [number, number] | null) => {
- emitUpdate(values);
- showPopover.value = false;
-};
-</script>
-
-<style lang="postcss" scoped>
-.time-range-picker :deep(.n-input) {
- --n-padding-left: 6px !important;
- --n-padding-right: 6px !important;
-}
-</style>
diff --git a/frontend/src/components/AdvancedSearch/ValueMenu.vue b/frontend/src/components/AdvancedSearch/ValueMenu.vue
deleted file mode 100644
index 4c13285422..0000000000
--- a/frontend/src/components/AdvancedSearch/ValueMenu.vue
+++ /dev/null
@@ -1,159 +0,0 @@
-<template>
- <div
- v-if="scopeOption"
- v-show="show"
- ref="containerRef"
- class="flex flex-col overflow-hidden"
- :data-top="containerTop"
- >
- <div class="px-3 py-2">
- <div
- ref="titleRef"
- class="text-sm text-control font-semibold"
- :data-height="titleHeight"
- >
- {{ scopeOption.title }}
- </div>
- <div v-if="scopeOption.search" class="textinfolabel">
- {{ $t("issue.advanced-search.search") }}
- </div>
- <div v-else class="textinfolabel">{{ scopeOption.description }}</div>
- </div>
- <div v-if="valueOptions.length > 0">
- <NVirtualList
- ref="virtualListRef"
- :items="valueOptions"
- :key-field="`value`"
- :item-resizable="false"
- :item-size="38"
- :style="{
- 'max-height': `${maxListHeight}px`,
- }"
- >
- <template
- #default="{
- item: option,
- index,
- }: {
- item: ValueOption;
- index: number;
- }"
- >
- <div class="border-t border-block-border">
- <div
- class="h-9.5 flex gap-x-2 px-3 items-center cursor-pointer overflow-hidden"
- :class="[index === menuIndex && 'bg-gray-200/75']"
- :data-index="index"
- :data-value="option.value"
- @mouseenter.prevent.stop="$emit('hover-item', index)"
- @mousedown.prevent.stop="$emit('select-value', option.value)"
- >
- <template v-if="option.render">
- <component :is="option.render" class="text-control text-sm" />
- </template>
- <span v-if="!option.custom" class="text-control-light text-sm">
- {{ option.value }}
- </span>
- </div>
-
- <div
- v-if="
- !!fetchState?.nextPageToken && index === valueOptions.length - 1
- "
- class="py-2 px-1 border-t border-block-border"
- >
- <NButton
- quaternary
- :size="'small'"
- :loading="fetchState?.loading"
- @click="() => $emit('fetch-next-page')"
- >
- <span class="textinfolabel">
- {{ $t("common.load-more") }}
- </span>
- </NButton>
- </div>
- </div>
- </template>
- </NVirtualList>
- </div>
- <div v-else-if="showEmptyPlaceholder" class="pb-2">
- <NEmpty />
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import {
- useElementBounding,
- useElementSize,
- useWindowSize,
-} from "@vueuse/core";
-import { NButton, NEmpty, NVirtualList } from "naive-ui";
-import { computed, nextTick, ref, watch } from "vue";
-import type { ScopeOption, ValueOption } from "./types";
-
-const props = defineProps<{
- show: boolean;
- scopeOption?: ScopeOption;
- valueOptions: ValueOption[];
- menuIndex: number;
- showEmptyPlaceholder?: boolean;
- fetchState?: {
- loading: boolean;
- nextPageToken?: string;
- };
-}>();
-
-defineEmits<{
- (event: "select-value", value: string): void;
- (event: "hover-item", index: number): void;
- (event: "fetch-next-page"): void;
-}>();
-
-const containerRef = ref<HTMLElement>();
-const titleRef = ref<HTMLElement>();
-const virtualListRef = ref<InstanceType<typeof NVirtualList>>();
-const { height: titleHeight } = useElementSize(titleRef, undefined, {
- box: "border-box",
-});
-const { top: containerTop } = useElementBounding(containerRef);
-const { height: windowHeight } = useWindowSize();
-
-const maxListHeight = computed(() => {
- const MAX_HEIGHT = 240;
- const PADDING_BOTTOM = 16;
-
- return Math.min(
- MAX_HEIGHT,
- windowHeight.value - titleHeight.value - containerTop.value - PADDING_BOTTOM
- );
-});
-
-const highlightedItem = computed(() => {
- if (!props.show) return undefined;
- const options = props.valueOptions;
- const index = props.menuIndex;
- const item = options[index];
- if (item) {
- return { item, index };
- }
- return undefined;
-});
-
-watch(
- [highlightedItem, () => props.show],
- ([item, show]) => {
- if (!show) return;
- if (!item) return;
- nextTick(() => {
- const virtualList = virtualListRef.value;
- if (!virtualList) return;
- virtualList.scrollTo({
- index: item.index,
- });
- });
- },
- { immediate: true }
-);
-</script>
diff --git a/frontend/src/components/AdvancedSearch/index.ts b/frontend/src/components/AdvancedSearch/index.ts
deleted file mode 100644
index dd74943a1e..0000000000
--- a/frontend/src/components/AdvancedSearch/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import AdvancedSearch from "./AdvancedSearch.vue";
-import TimeRange from "./TimeRange.vue";
-import { useCommonSearchScopeOptions } from "./useCommonSearchScopeOptions";
-
-export default AdvancedSearch;
-
-export { TimeRange, useCommonSearchScopeOptions };
diff --git a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts
deleted file mode 100644
index 2916a0eb4f..0000000000
--- a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts
+++ /dev/null
@@ -1,219 +0,0 @@
-import type { VNode } from "vue";
-import { computed, h, unref } from "vue";
-import {
- EnvironmentV1Name,
- InstanceV1Name,
- ProjectV1Name,
- RichEngineName,
-} from "@/components/v2";
-import { t } from "@/plugins/i18n";
-import {
- environmentNamePrefix,
- useEnvironmentV1Store,
- useInstanceV1Store,
- useProjectV1Store,
-} from "@/store";
-import type { MaybeRef } from "@/types";
-import { UNKNOWN_ENVIRONMENT_NAME, unknownEnvironment } from "@/types";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import type { SearchScopeId } from "@/utils";
-import {
- extractEnvironmentResourceName,
- extractInstanceResourceName,
- extractProjectResourceName,
- getDefaultPagination,
- supportedEngineV1List,
-} from "@/utils";
-import type { ScopeOption, ValueOption } from "./types";
-
-export const useCommonSearchScopeOptions = (
- supportOptionIdList: MaybeRef<SearchScopeId[]>
-) => {
- const projectStore = useProjectV1Store();
- const instanceStore = useInstanceV1Store();
- const environmentStore = useEnvironmentV1Store();
-
- // fullScopeOptions provides full search scopes and options.
- // we need this as the source of truth.
- const fullScopeOptions = computed((): ScopeOption[] => {
- const scopeCreators = {
- project: () => ({
- id: "project",
- title: t("issue.advanced-search.scope.project.title"),
- description: t("issue.advanced-search.scope.project.description"),
- search: ({
- keyword,
- nextPageToken,
- }: {
- keyword: string;
- nextPageToken?: string;
- }) => {
- return projectStore
- .fetchProjectList({
- pageToken: nextPageToken,
- pageSize: getDefaultPagination(),
- filter: {
- query: keyword,
- },
- })
- .then((resp) => ({
- nextPageToken: resp.nextPageToken,
- options: resp.projects.map<ValueOption>((project) => {
- const name = extractProjectResourceName(project.name);
- return {
- value: name,
- keywords: [
- name,
- project.title,
- extractProjectResourceName(project.name),
- ],
- render: () => {
- const children: VNode[] = [
- h(ProjectV1Name, { project: project, link: false }),
- ];
- return h(
- "div",
- { class: "flex items-center gap-x-2" },
- children
- );
- },
- };
- }),
- }));
- },
- }),
- instance: () => ({
- id: "instance",
- title: t("issue.advanced-search.scope.instance.title"),
- description: t("issue.advanced-search.scope.instance.description"),
- search: ({
- keyword,
- nextPageToken,
- }: {
- keyword: string;
- nextPageToken?: string;
- }) => {
- return instanceStore
- .fetchInstanceList({
- pageToken: nextPageToken,
- pageSize: getDefaultPagination(),
- filter: {
- query: keyword,
- },
- silent: true,
- })
- .then((resp) => ({
- nextPageToken: resp.nextPageToken,
- options: resp.instances.map((ins) => {
- const name = extractInstanceResourceName(ins.name);
- return {
- value: name,
- keywords: [
- name,
- ins.title,
- String(ins.engine),
- extractEnvironmentResourceName(ins.environment ?? ""),
- ],
- render: () => {
- return h("div", { class: "flex items-center gap-x-1" }, [
- h(InstanceV1Name, {
- instance: ins,
- link: false,
- tooltip: false,
- }),
- h(EnvironmentV1Name, {
- environment: environmentStore.getEnvironmentByName(
- ins.environment ?? ""
- ),
- link: false,
- }),
- ]);
- },
- };
- }),
- }));
- },
- }),
- environment: () => ({
- id: "environment",
- title: t("issue.advanced-search.scope.environment.title"),
- description: t("issue.advanced-search.scope.environment.description"),
- options: [
- unknownEnvironment(),
- ...environmentStore.environmentList,
- ].map((env) => {
- return {
- value: env.id,
- keywords: [`${environmentNamePrefix}${env.id}`, env.title],
- custom: env.name === UNKNOWN_ENVIRONMENT_NAME,
- render: () =>
- h(EnvironmentV1Name, {
- environment: env,
- link: false,
- }),
- };
- }),
- }),
- label: () => ({
- id: "label",
- title: t("common.labels"),
- description: t("issue.advanced-search.scope.label.description"),
- allowMultiple: true,
- }),
- table: () => ({
- id: "table",
- title: t("issue.advanced-search.scope.table.title"),
- description: t("issue.advanced-search.scope.table.description"),
- allowMultiple: false,
- }),
- engine: () => ({
- id: "engine",
- title: t("issue.advanced-search.scope.engine.title"),
- description: t("issue.advanced-search.scope.engine.description"),
- options: supportedEngineV1List().map((engine) => {
- return {
- value: Engine[engine],
- keywords: [Engine[engine].toLowerCase()],
- render: () => h(RichEngineName, { engine, tag: "p" }),
- };
- }),
- allowMultiple: true,
- }),
- state: () => ({
- id: "state",
- title: t("common.state"),
- description: t("issue.advanced-search.scope.state.description"),
- options: [
- {
- value: "ACTIVE",
- keywords: ["active", "ACTIVE"],
- render: () => t("common.active"),
- },
- {
- value: "DELETED",
- keywords: ["archived", "ARCHIVED", "deleted", "DELETED"],
- render: () => t("common.archived"),
- },
- {
- value: "ALL",
- keywords: ["all", "ALL"],
- render: () => t("common.all"),
- },
- ],
- allowMultiple: false,
- }),
- } as Partial<Record<SearchScopeId, () => ScopeOption>>;
-
- const scopes: ScopeOption[] = [];
- for (const id of unref(supportOptionIdList)) {
- const create = scopeCreators[id];
- if (create) {
- scopes.push(create());
- }
- }
-
- return scopes;
- });
-
- return fullScopeOptions;
-};
diff --git a/frontend/src/components/DatabaseDetail/SyncDatabaseButton.vue b/frontend/src/components/DatabaseDetail/SyncDatabaseButton.vue
deleted file mode 100644
index 09899c8bb3..0000000000
--- a/frontend/src/components/DatabaseDetail/SyncDatabaseButton.vue
+++ /dev/null
@@ -1,88 +0,0 @@
-<template>
- <PermissionGuardWrapper
- v-if="available"
- v-slot="slotProps"
- :project="getDatabaseProject(database)"
- :permissions="['bb.databases.sync']"
- >
- <NButton
- :text="text"
- :type="type"
- :disabled="slotProps.disabled"
- :loading="syncingSchema"
- @click="syncDatabaseSchema"
- >
- {{ $t("database.sync-database") }}
- </NButton>
- </PermissionGuardWrapper>
-</template>
-
-<script setup lang="ts">
-import { ConnectError } from "@connectrpc/connect";
-import { NButton } from "naive-ui";
-import { computed, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";
-import {
- pushNotification,
- useDatabaseV1Store,
- useDBSchemaV1Store,
-} from "@/store";
-import { isValidDatabaseName } from "@/types";
-import type { Database } from "@/types/proto-es/v1/database_service_pb";
-import { extractDatabaseResourceName, getDatabaseProject } from "@/utils";
-
-const props = defineProps<{
- text: boolean;
- type: "default" | "primary";
- database: Database;
-}>();
-
-const emit = defineEmits<{
- (event: "finish"): void;
-}>();
-
-const syncingSchema = ref(false);
-const { t } = useI18n();
-const databaseV1Store = useDatabaseV1Store();
-const dbSchemaStore = useDBSchemaV1Store();
-
-const available = computed(() => {
- return isValidDatabaseName(props.database.name);
-});
-
-const syncDatabaseSchema = async () => {
- syncingSchema.value = true;
-
- try {
- await databaseV1Store.syncDatabase(props.database.name);
-
- await dbSchemaStore.getOrFetchDatabaseMetadata({
- database: props.database.name,
- skipCache: true,
- });
- const { databaseName } = extractDatabaseResourceName(props.database.name);
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t(
- "db.successfully-synced-schema-for-database-database-value-name",
- [databaseName]
- ),
- });
- emit("finish");
- } catch (error) {
- const { databaseName } = extractDatabaseResourceName(props.database.name);
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("db.failed-to-sync-schema-for-database-database-value-name", [
- databaseName,
- ]),
- description: (error as ConnectError).message,
- });
- } finally {
- syncingSchema.value = false;
- }
-};
-</script>
diff --git a/frontend/src/components/DatabaseInfo.vue b/frontend/src/components/DatabaseInfo.vue
deleted file mode 100644
index 788a5c78ec..0000000000
--- a/frontend/src/components/DatabaseInfo.vue
+++ /dev/null
@@ -1,83 +0,0 @@
-<template>
- <div class="flex items-center flex-wrap gap-1">
- <InstanceV1Name
- :instance="instanceResource"
- :plain="true"
- :link="link"
- :text-class="link ? 'hover:underline' : ''"
- >
- <template
- v-if="
- instanceResource.environment !==
- database.effectiveEnvironment
- "
- #prefix
- >
- <EnvironmentV1Name
- :environment="instanceEnvironment"
- :plain="true"
- :show-icon="false"
- :link="link"
- :text-class="`text-control-light ${link ? 'hover:underline' : ''}`"
- />
- </template>
- </InstanceV1Name>
-
- <ChevronRight class="text-control-light" />
-
- <div class="flex items-center gap-x-1">
- <Database />
-
- <template v-if="database">
- <EnvironmentV1Name
- :environment="effectiveEnvironment"
- :plain="true"
- :show-icon="false"
- :link="link"
- :text-class="`text-control-light ${link ? 'hover:underline' : ''}`"
- />
-
- <DatabaseV1Name
- :database="database"
- :plain="true"
- :link="link"
- :text-class="link ? 'hover:underline' : ''"
- />
- </template>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { ChevronRight, Database } from "lucide-vue-next";
-import { computed } from "vue";
-import {
- DatabaseV1Name,
- EnvironmentV1Name,
- InstanceV1Name,
-} from "@/components/v2";
-import { useEnvironmentV1Store } from "@/store";
-import type { Database as DatabaseProto } from "@/types/proto-es/v1/database_service_pb";
-import { getDatabaseEnvironment, getInstanceResource } from "@/utils";
-
-const props = withDefaults(
- defineProps<{
- database: DatabaseProto;
- link?: boolean;
- }>(),
- {
- link: true,
- }
-);
-
-const instanceResource = computed(() => getInstanceResource(props.database));
-const effectiveEnvironment = computed(() =>
- getDatabaseEnvironment(props.database)
-);
-
-const instanceEnvironment = computed(() => {
- return useEnvironmentV1Store().getEnvironmentByName(
- instanceResource.value.environment ?? ""
- );
-});
-</script>
diff --git a/frontend/src/components/EditEnvironmentDrawer.vue b/frontend/src/components/EditEnvironmentDrawer.vue
deleted file mode 100644
index 1746dd5f68..0000000000
--- a/frontend/src/components/EditEnvironmentDrawer.vue
+++ /dev/null
@@ -1,58 +0,0 @@
-<template>
- <Drawer :show="show" @close="$emit('dismiss')">
- <DrawerContent
- :title="t('database.edit-environment')"
- class="w-96 max-w-[100vw]"
- >
- <EnvironmentSelect
- v-model:value="environment"
- class="mt-1"
- required
- name="environment"
- />
- <template #footer>
- <div class="w-full flex justify-between items-center">
- <div class="w-full flex justify-end items-center gap-x-3">
- <NButton @click.prevent="$emit('dismiss')">
- {{ t("common.cancel") }}
- </NButton>
- <NButton :disabled="!allowSave" type="primary" @click="onSave">
- {{ t("common.save") }}
- </NButton>
- </div>
- </div>
- </template>
- </DrawerContent>
- </Drawer>
-</template>
-
-<script lang="ts" setup>
-import { NButton } from "naive-ui";
-import { computed, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import { Drawer, DrawerContent, EnvironmentSelect } from "@/components/v2";
-
-const { t } = useI18n();
-
-defineProps<{
- show: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "dismiss"): void;
- (event: "update", environment: string): void;
-}>();
-
-const environment = ref<string>();
-
-const allowSave = computed(() => {
- return environment.value !== undefined;
-});
-
-const onSave = () => {
- if (environment.value) {
- emit("update", environment.value);
- }
- emit("dismiss");
-};
-</script>
diff --git a/frontend/src/components/FeatureGuard/FeatureAttention.vue b/frontend/src/components/FeatureGuard/FeatureAttention.vue
deleted file mode 100644
index 89ae475983..0000000000
--- a/frontend/src/components/FeatureGuard/FeatureAttention.vue
+++ /dev/null
@@ -1,167 +0,0 @@
-<template>
- <BBAttention
- v-if="show"
- v-bind="$attrs"
- :type="hasFeature ? type : 'warning'"
- :title="$t(`dynamic.subscription.features.${featureKey}.title`)"
- :description="descriptionText"
- :action-text="actionText"
- @click="onClick"
- />
-
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { BBAttention } from "@/bbkit";
-import { INSTANCE_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";
-import { useActuatorV1Store, useSubscriptionV1Store } from "@/store";
-import { ENTERPRISE_INQUIRE_LINK, instanceLimitFeature } from "@/types";
-import type {
- Instance,
- InstanceResource,
-} from "@/types/proto-es/v1/instance_service_pb";
-import {
- PlanFeature,
- PlanType,
-} from "@/types/proto-es/v1/subscription_service_pb";
-import { autoSubscriptionRoute, hasWorkspacePermissionV2 } from "@/utils";
-
-const props = withDefaults(
- defineProps<{
- feature: PlanFeature;
- description?: string;
- type?: "info" | "warning" | "error";
- instance?: Instance | InstanceResource;
- }>(),
- {
- type: "info",
- description: "",
- instance: undefined,
- }
-);
-
-const router = useRouter();
-const { t } = useI18n();
-const actuatorStore = useActuatorV1Store();
-const subscriptionStore = useSubscriptionV1Store();
-
-const hasPermission = computed(() =>
- hasWorkspacePermissionV2("bb.settings.set")
-);
-
-const canManageInstanceLicense = computed((): boolean => {
- return hasWorkspacePermissionV2("bb.instances.update");
-});
-
-const hasFeature = computed(() => {
- return subscriptionStore.hasInstanceFeature(props.feature);
-});
-
-const instanceMissingLicense = computed(() => {
- return subscriptionStore.instanceMissingLicense(
- props.feature,
- props.instance
- );
-});
-
-const existInstanceWithoutLicense = computed(() => {
- return (
- actuatorStore.totalInstanceCount > actuatorStore.activatedInstanceCount &&
- instanceLimitFeature.has(props.feature)
- );
-});
-
-const show = computed(() => {
- if (!hasFeature.value) {
- // show missing feature attention.
- return true;
- }
- if (instanceMissingLicense.value) {
- // show missing instance license attention.
- return true;
- }
- if (!props.instance && existInstanceWithoutLicense.value) {
- return true;
- }
- return false;
-});
-
-const actionText = computed(() => {
- if (!hasPermission.value) {
- return "";
- }
-
- if (!hasFeature.value) {
- return t("subscription.request-n-days-trial", {
- days: subscriptionStore.trialingDays,
- });
- }
-
- if (!canManageInstanceLicense.value) {
- return "";
- }
- return t("subscription.instance-assignment.assign-license");
-});
-
-const featureKey = PlanFeature[props.feature].split(".").join("-");
-
-const descriptionText = computed(() => {
- let description = props.description;
- if (!description) {
- description = t(`dynamic.subscription.features.${featureKey}.desc`);
- }
-
- if (!hasFeature.value) {
- const startTrial = subscriptionStore.isTrialing
- ? ""
- : t("subscription.trial-for-days", {
- days: subscriptionStore.trialingDays,
- });
- // Check if feature is available in any plan
- // TODO(d): simplify the check.
- const requiredPlan = subscriptionStore.getMinimumRequiredPlan(
- props.feature
- );
- if (
- requiredPlan === PlanType.FREE &&
- subscriptionStore.hasFeature(props.feature)
- ) {
- return `${description}\n${startTrial}`;
- }
- const trialText = t("subscription.required-plan-with-trial", {
- requiredPlan: t(
- `subscription.plan.${PlanType[requiredPlan].toLowerCase()}.title`
- ),
- startTrial: startTrial,
- });
-
- return `${description}\n${trialText}`;
- }
-
- const attention = t(
- "subscription.instance-assignment.missing-license-attention"
- );
- return `${description}\n${attention}`;
-});
-
-const onClick = () => {
- if (!hasFeature.value) {
- window.open(ENTERPRISE_INQUIRE_LINK, "_blank");
- return;
- }
- if (instanceMissingLicense.value || existInstanceWithoutLicense.value) {
- router.push({
- name: INSTANCE_ROUTE_DASHBOARD,
- query: {
- assignLicense: "1",
- instances: props.instance?.name,
- },
- });
- return;
- }
- router.push(autoSubscriptionRoute());
-};
-</script>
diff --git a/frontend/src/components/FeatureGuard/index.ts b/frontend/src/components/FeatureGuard/index.ts
index aacc1175bc..180817061d 100644
--- a/frontend/src/components/FeatureGuard/index.ts
+++ b/frontend/src/components/FeatureGuard/index.ts
@@ -1,5 +1,4 @@
-import FeatureAttention from "./FeatureAttention.vue";
import FeatureBadge from "./FeatureBadge.vue";
import FeatureModal from "./FeatureModal.vue";
-export { FeatureAttention, FeatureBadge, FeatureModal };
+export { FeatureBadge, FeatureModal };
diff --git a/frontend/src/components/FileContentPreviewModal.vue b/frontend/src/components/FileContentPreviewModal.vue
deleted file mode 100644
index dc41232bcf..0000000000
--- a/frontend/src/components/FileContentPreviewModal.vue
+++ /dev/null
@@ -1,100 +0,0 @@
-<template>
- <BBModal :title="$t('common.preview')" @close="$emit('cancel')">
- <div class="w-144 py-1 flex flex-col justify-start items-start gap-2">
- <div class="w-full flex flex-row justify-between items-center gap-4">
- <p class="font-medium textlabel text-nowrap">
- {{ $t("sql-editor.select-encoding") }}
- </p>
- <NSelect
- v-model:value="state.encoding"
- class="w-auto!"
- filterable
- :options="encodingOptions"
- />
- </div>
- <div class="w-full overflow-hidden relative h-80 shrink-0">
- <MonacoEditor
- class="border w-full h-full"
- :content="decodedText"
- :readonly="true"
- />
- <NSpin v-if="isLoading" class="absolute inset-0" />
- </div>
- <div class="w-full flex justify-end gap-x-2">
- <NButton @click="$emit('cancel')">
- {{ $t("common.cancel") }}
- </NButton>
- <NButton
- type="primary"
- :disabled="!allowConfirm"
- :loading="isLoading"
- @click="$emit('confirm', decodedText)"
- >
- {{ $t("common.confirm") }}
- </NButton>
- </div>
- </div>
- </BBModal>
-</template>
-
-<script lang="ts" setup>
-import { NButton, NSelect, NSpin } from "naive-ui";
-import { computed, reactive, ref, watch } from "vue";
-import { BBModal } from "@/bbkit";
-import { MonacoEditor } from "@/components/MonacoEditor";
-import { pushNotification } from "@/store";
-import { ENCODINGS, type Encoding, readFileAsArrayBuffer } from "@/utils";
-
-interface LocalState {
- encoding: Encoding;
-}
-
-const props = defineProps<{
- file: File;
-}>();
-
-defineEmits<{
- (event: "cancel"): void;
- (event: "confirm", text: string): void;
-}>();
-
-const state = reactive<LocalState>({
- encoding: "utf-8",
-});
-const isLoading = ref(true);
-const decodedText = ref<string>("");
-
-const allowConfirm = computed(() => {
- return !isLoading.value;
-});
-
-const encodingOptions = computed(() =>
- ENCODINGS.map((encoding) => ({
- label: encoding,
- value: encoding,
- }))
-);
-
-watch(
- [() => props.file, state],
- async () => {
- isLoading.value = true;
- try {
- const { arrayBuffer } = await readFileAsArrayBuffer(props.file);
- const text = new TextDecoder(state.encoding).decode(arrayBuffer);
- decodedText.value = text;
- } catch (error) {
- console.error(error);
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: "Failed to read file",
- });
- }
- isLoading.value = false;
- },
- {
- immediate: true,
- }
-);
-</script>
diff --git a/frontend/src/components/Instance/InstanceSyncButton.vue b/frontend/src/components/Instance/InstanceSyncButton.vue
deleted file mode 100644
index 7dcf89cfb0..0000000000
--- a/frontend/src/components/Instance/InstanceSyncButton.vue
+++ /dev/null
@@ -1,204 +0,0 @@
-<template>
- <div>
- <NDropdown
- :trigger="'click'"
- :options="syncInstnceOptions"
- :render-label="renderDropdownLabel"
- :disabled="disabled || syncingSchema"
- @select="syncSchema"
- >
- <PermissionGuardWrapper
- v-slot="slotProps"
- :permissions="['bb.instances.sync']"
- >
- <NButton
- icon-placement="right"
- :loading="syncingSchema"
- :quaternary="quaternary"
- :disabled="slotProps.disabled || disabled"
- :size="size"
- :type="type"
- >
- <template #icon>
- <ChevronDownIcon class="w-4" />
- </template>
- <template v-if="syncingSchema">
- {{ $t("instance.syncing") }}
- </template>
- <template v-else>
- {{ $t("instance.sync.self") }}
- </template>
- </NButton>
- </PermissionGuardWrapper>
- </NDropdown>
- </div>
-</template>
-
-<script lang="tsx" setup>
-import type { ConnectError } from "@connectrpc/connect";
-import { ChevronDownIcon } from "lucide-vue-next";
-import type { DropdownOption } from "naive-ui";
-import { NButton, NDropdown, NTooltip } from "naive-ui";
-import { computed, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";
-import { pushNotification, useDatabaseV1Store } from "@/store";
-import { SyncStatus } from "@/types/proto-es/v1/database_service_pb";
-
-const props = withDefaults(
- defineProps<{
- type?: "default" | "primary";
- size?: "small" | "medium";
- disabled?: boolean;
- quaternary?: boolean;
- instanceName?: string;
- instanceTitle?: string;
- }>(),
- {
- type: "default",
- size: "medium",
- disabled: false,
- quaternary: false,
- instanceName: "",
- instanceTitle: "",
- }
-);
-
-const emit = defineEmits<{
- (name: "sync-schema", enableFullSync: boolean): void;
-}>();
-
-const { t } = useI18n();
-const syncingSchema = ref<boolean>(false);
-
-type SyncInstanceOption = "sync-all" | "sync-new";
-
-const renderDropdownLabel = (option: DropdownOption) => {
- if (option.key === "sync-new") {
- return <span>{option.label}</span>;
- }
- return (
- <NTooltip placement="top-start">
- {{
- trigger: () => option.label,
- default: () => (
- <span class="text-sm text-nowrap">
- {t("instance.sync.sync-all-tip")}
- </span>
- ),
- }}
- </NTooltip>
- );
-};
-
-const syncInstnceOptions = computed((): DropdownOption[] => {
- return [
- {
- key: "sync-all",
- label: t("instance.sync.sync-all"),
- },
- {
- key: "sync-new",
- label: t("instance.sync.sync-new"),
- },
- ];
-});
-
-const syncSchema = async (option: SyncInstanceOption) => {
- try {
- syncingSchema.value = true;
-
- // Show immediate "syncing" notification (honest - not claiming success yet)
- const displayName = props.instanceTitle || props.instanceName || "";
- if (displayName) {
- pushNotification({
- module: "bytebase",
- style: "INFO",
- title: t("db.syncing-databases-for-instance", [displayName]),
- });
- } else {
- // Fallback for batch sync or when instance info not provided
- pushNotification({
- module: "bytebase",
- style: "INFO",
- title: t("db.start-to-sync-schema"),
- });
- }
-
- emit("sync-schema", option === "sync-all" /* enable full sync */);
-
- // Two-phase delayed check for sync status
- if (props.instanceName) {
- const displayName = props.instanceTitle || props.instanceName;
- let notificationShown = false;
-
- const checkSyncStatus = async (): Promise<"complete" | "syncing"> => {
- const databaseStore = useDatabaseV1Store();
- const { databases } = await databaseStore.fetchDatabases({
- parent: props.instanceName,
- pageSize: 1000,
- silent: true,
- });
-
- const stillSyncing = databases.filter(
- (db) => db.syncStatus === SyncStatus.SYNC_STATUS_UNSPECIFIED
- );
- const failed = databases.filter(
- (db) => db.syncStatus === SyncStatus.FAILED
- );
-
- // If any databases still syncing, don't notify yet
- if (stillSyncing.length > 0) {
- return "syncing";
- }
-
- // All syncs complete - show appropriate notification
- if (failed.length > 0) {
- pushNotification({
- module: "bytebase",
- style: "WARN",
- title: t("db.n-databases-had-sync-errors", [failed.length]),
- });
- } else {
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("database.sync-complete-for-instance", [displayName]),
- });
- }
- notificationShown = true;
- return "complete";
- };
-
- // First check at 15 seconds (fast feedback for small instances)
- setTimeout(async () => {
- try {
- await checkSyncStatus();
- } catch {
- // Silently ignore - will retry at 30s
- }
- }, 15000);
-
- // Second check at 30 seconds (for larger instances)
- setTimeout(async () => {
- if (notificationShown) return;
- try {
- await checkSyncStatus();
- // If still syncing at 30s, don't notify - user can check database list
- } catch {
- // Silently ignore - user can check database list
- }
- }, 30000);
- }
- } catch (error) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("db.failed-to-sync-schema"),
- description: (error as ConnectError).message,
- });
- } finally {
- syncingSchema.value = false;
- }
-};
-</script>
diff --git a/frontend/src/components/Permission/NoPermissionPlaceholder.vue b/frontend/src/components/Permission/NoPermissionPlaceholder.vue
deleted file mode 100644
index b92888acb4..0000000000
--- a/frontend/src/components/Permission/NoPermissionPlaceholder.vue
+++ /dev/null
@@ -1,51 +0,0 @@
-<template>
- <div>
- <NAlert
- type="error"
- :title="description ?? $t('common.missing-required-permission')"
- >
- <template #icon>
- <ShieldAlertIcon />
- </template>
- <div class="flex flex-col gap-2">
- <div v-if="path">
- Path: {{ path }}
- </div>
- <div v-if="api">
- API: {{ api }}
- </div>
- <div v-if="resources && resources.length > 0">
- {{ $t("common.resources") }}
- <ul class="list-disc pl-4">
- <li v-for="resource in resources" :key="resource">
- {{ resource }}
- </li>
- </ul>
- </div>
- <div v-if="permissions && permissions.length > 0">
- {{ $t("common.required-permission") }}
- <ul class="list-disc pl-4">
- <li v-for="permission in permissions" :key="permission">
- {{ permission }}
- </li>
- </ul>
- </div>
- <slot name="action" />
- </div>
- </NAlert>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { ShieldAlertIcon } from "lucide-vue-next";
-import { NAlert } from "naive-ui";
-import type { Permission } from "@/types";
-
-defineProps<{
- description?: string;
- path?: string;
- api?: string;
- resources?: string[];
- permissions?: Permission[];
-}>();
-</script>
diff --git a/frontend/src/components/Permission/PermissionGuardWrapper.vue b/frontend/src/components/Permission/PermissionGuardWrapper.vue
deleted file mode 100644
index 9ac218b1c0..0000000000
--- a/frontend/src/components/Permission/PermissionGuardWrapper.vue
+++ /dev/null
@@ -1,39 +0,0 @@
-<template>
- <div>
- <NTooltip :disabled="missedPermissions.length === 0">
- <template #trigger>
- <slot :disabled="missedPermissions.length > 0" />
- </template>
- <div class="flex flex-col gap-1">
- {{ project ? $t("common.missing-required-permission-for-resource", { resource: project.name }) : $t("common.missing-required-permission") }}
- <ul class="list-disc pl-4">
- <li v-for="permission in missedPermissions" :key="permission">
- {{ permission }}
- </li>
- </ul>
- </div>
- </NTooltip>
- </div>
-</template>
-
-<script lang="tsx" setup>
-import { NTooltip } from "naive-ui";
-import { computed } from "vue";
-import type { Permission } from "@/types";
-import type { Project } from "@/types/proto-es/v1/project_service_pb";
-import { hasProjectPermissionV2, hasWorkspacePermissionV2 } from "@/utils";
-
-const props = defineProps<{
- project?: Project;
- permissions: Permission[];
-}>();
-
-const missedPermissions = computed(() => {
- if (props.project) {
- return props.permissions.filter(
- (p) => !hasProjectPermissionV2(props.project!, p)
- );
- }
- return props.permissions.filter((p) => !hasWorkspacePermissionV2(p));
-});
-</script>
\ No newline at end of file
diff --git a/frontend/src/components/RequiredStar.vue b/frontend/src/components/RequiredStar.vue
deleted file mode 100644
index 31df5af669..0000000000
--- a/frontend/src/components/RequiredStar.vue
+++ /dev/null
@@ -1,3 +0,0 @@
-<template>
- <span class="text-red-500">*</span>
-</template>
diff --git a/frontend/src/components/RoleGrantPanel/MaxRowCountSelect.vue b/frontend/src/components/RoleGrantPanel/MaxRowCountSelect.vue
deleted file mode 100644
index 286112a680..0000000000
--- a/frontend/src/components/RoleGrantPanel/MaxRowCountSelect.vue
+++ /dev/null
@@ -1,91 +0,0 @@
-<template>
- <NPopselect
- :value="value"
- :options="options"
- trigger="click"
- placement="bottom-start"
- scrollable
- @update:value="handleUpdateValue"
- >
- <NButton
- icon-placement="right"
- :quaternary="quaternary"
- class="bb-overlay-stack-ignore-esc"
- style="justify-content: start; --n-padding: 0 8px;"
- >
- {{ $t("sql-editor.result-limit.self") }}
- {{ $t("common.rows.n-rows", { n: value }) }}
- <template #icon>
- <ChevronRight />
- </template>
- </NButton>
- <template #action>
- <div class="flex items-center justify-between gap-1">
- <NInputNumber
- :value="value"
- :show-button="false"
- :min="0"
- :max="rowCountOptions[rowCountOptions.length - 1]"
- style="width: 5rem"
- @update:value="handleInput"
- />
- <span>{{ $t("common.rows.self") }}</span>
- </div>
- </template>
- </NPopselect>
-</template>
-
-<script setup lang="ts">
-import { first, last } from "lodash-es";
-import { ChevronRight } from "lucide-vue-next";
-import { NButton, NInputNumber, NPopselect, type SelectOption } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { minmax } from "@/utils";
-
-const props = defineProps<{
- value: number;
- quaternary?: boolean;
- maximum: number;
-}>();
-
-const emit = defineEmits<{
- (event: "update:value", value: number): void;
-}>();
-
-const { t } = useI18n();
-
-const rowCountOptions = computed(() => {
- const list = [1, 100, 500, 1000, 5000, 10000, 100000].filter(
- (num) => num <= props.maximum
- );
- if (props.maximum !== Number.MAX_VALUE && !list.includes(props.maximum)) {
- list.push(props.maximum);
- }
- return list;
-});
-
-const options = computed((): SelectOption[] => {
- return rowCountOptions.value.map((n) => ({
- label: t("common.rows.n-rows", { n }),
- value: n,
- }));
-});
-
-const handleUpdateValue = (value: number) => {
- emit("update:value", value);
-};
-
-const handleInput = (value: number | null) => {
- const normalizedValue = minmax(
- value ?? 0,
- first(rowCountOptions.value)!,
- last(rowCountOptions.value)!
- );
- emit("update:value", normalizedValue);
-};
-
-defineExpose({
- maximum: computed(() => rowCountOptions.value.slice(-1)[0]),
-});
-</script>
diff --git a/frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue b/frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue
deleted file mode 100644
index c3d73dc1b3..0000000000
--- a/frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue
+++ /dev/null
@@ -1,37 +0,0 @@
-<template>
- <NCheckbox
- :checked="value"
- :disabled="disabled"
- @update:checked="$emit('update:value', $event)"
- >
- <div class="flex items-center gap-x-1">
- <p class="font-medium">
- {{ title }}
- </p>
- <NTooltip v-if="tooltip">
- <template #trigger>
- <CircleHelpIcon class="w-4" />
- </template>
- <span>{{ tooltip }}</span>
- </NTooltip>
- </div>
- </NCheckbox>
-</template>
-
-<script lang="ts" setup>
-import { CircleHelpIcon } from "lucide-vue-next";
-import { NCheckbox, NTooltip } from "naive-ui";
-import type { RuleConfigComponent } from "@/types";
-
-defineProps<{
- title: string;
- tooltip?: string;
- config: RuleConfigComponent;
- value: boolean;
- disabled: boolean;
-}>();
-
-defineEmits<{
- (event: "update:value", value: boolean): void;
-}>();
-</script>
diff --git a/frontend/src/components/SQLReview/components/RuleConfigComponents/NumberComponent.vue b/frontend/src/components/SQLReview/components/RuleConfigComponents/NumberComponent.vue
deleted file mode 100644
index 010c430f5c..0000000000
--- a/frontend/src/components/SQLReview/components/RuleConfigComponents/NumberComponent.vue
+++ /dev/null
@@ -1,23 +0,0 @@
-<template>
- <NInputNumber
- :value="value"
- :disabled="disabled"
- :placeholder="`${config.payload.default}`"
- @update:value="$emit('update:value', $event as number)"
- />
-</template>
-
-<script lang="ts" setup>
-import { NInputNumber } from "naive-ui";
-import type { RuleConfigComponent } from "@/types";
-
-defineProps<{
- config: RuleConfigComponent;
- value: number;
- disabled: boolean;
-}>();
-
-defineEmits<{
- (event: "update:value", value: number): void;
-}>();
-</script>
diff --git a/frontend/src/components/SQLReview/components/RuleConfigComponents/StringArrayComponent.vue b/frontend/src/components/SQLReview/components/RuleConfigComponents/StringArrayComponent.vue
deleted file mode 100644
index e9664b257e..0000000000
--- a/frontend/src/components/SQLReview/components/RuleConfigComponents/StringArrayComponent.vue
+++ /dev/null
@@ -1,39 +0,0 @@
-<template>
- <div>
- <div v-if="!disabled" class="textinfolabel mb-1">
- {{ $t('sql-review.input-then-press-enter') }}
- </div>
- <NDynamicTags
- :size="'large'"
- :disabled="disabled"
- :value="value"
- :input-props="{
- clearable: true,
- }"
- :input-style="'min-width: 20rem;'"
- @update:value="onUpdate"
- />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { NDynamicTags } from "naive-ui";
-import type { RuleConfigComponent } from "@/types";
-
-defineProps<{
- config: RuleConfigComponent;
- value: string[];
- disabled: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "update:value", value: string[]): void;
-}>();
-
-const onUpdate = (arr: string[]) => {
- emit(
- "update:value",
- arr.map((v) => v.trim()).filter((v) => v)
- );
-};
-</script>
diff --git a/frontend/src/components/SQLReview/components/RuleConfigComponents/StringComponent.vue b/frontend/src/components/SQLReview/components/RuleConfigComponents/StringComponent.vue
deleted file mode 100644
index 5a75bfc44d..0000000000
--- a/frontend/src/components/SQLReview/components/RuleConfigComponents/StringComponent.vue
+++ /dev/null
@@ -1,23 +0,0 @@
-<template>
- <BBTextField
- :value="value"
- :disabled="disabled"
- :placeholder="`${config.payload.default}`"
- @update:value="$emit('update:value', $event)"
- />
-</template>
-
-<script lang="ts" setup>
-import { BBTextField } from "@/bbkit";
-import type { RuleConfigComponent } from "@/types";
-
-defineProps<{
- config: RuleConfigComponent;
- value: string;
- disabled: boolean;
-}>();
-
-defineEmits<{
- (event: "update:value", value: string): void;
-}>();
-</script>
diff --git a/frontend/src/components/SQLReview/components/RuleConfigComponents/TemplateComponent.vue b/frontend/src/components/SQLReview/components/RuleConfigComponents/TemplateComponent.vue
deleted file mode 100644
index 5622746069..0000000000
--- a/frontend/src/components/SQLReview/components/RuleConfigComponents/TemplateComponent.vue
+++ /dev/null
@@ -1,45 +0,0 @@
-<template>
- <InputWithTemplate
- :template-list="templateList"
- :value="value"
- :disabled="disabled"
- @change="$emit('update:value', $event)"
- />
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import {
- InputWithTemplate,
- type Template,
-} from "@/components/InputWithTemplate";
-import type { RuleConfigComponent, TemplatePayload } from "@/types";
-import { getRuleLocalizationKey } from "@/types";
-
-const props = defineProps<{
- ruleType: string;
- config: RuleConfigComponent;
- value: string;
- disabled: boolean;
-}>();
-
-defineEmits<{
- (event: "update:value", value: string): void;
-}>();
-
-const { t } = useI18n();
-
-const templateList = computed(() => {
- const { ruleType, config } = props;
- const payload = config.payload as TemplatePayload;
- return payload.templateList.map<Template>((id) => ({
- id,
- description: t(
- `sql-review.rule.${getRuleLocalizationKey(ruleType)}.component.${
- config.key
- }.template.${id}`
- ),
- }));
-});
-</script>
diff --git a/frontend/src/components/SQLReview/components/RuleConfigComponents/index.ts b/frontend/src/components/SQLReview/components/RuleConfigComponents/index.ts
index 9876e57227..eea524d655 100644
--- a/frontend/src/components/SQLReview/components/RuleConfigComponents/index.ts
+++ b/frontend/src/components/SQLReview/components/RuleConfigComponents/index.ts
@@ -1,14 +1 @@
-import BooleanComponent from "./BooleanComponent.vue";
-import NumberComponent from "./NumberComponent.vue";
-import StringArrayComponent from "./StringArrayComponent.vue";
-import StringComponent from "./StringComponent.vue";
-import TemplateComponent from "./TemplateComponent.vue";
-
-export {
- StringComponent,
- NumberComponent,
- BooleanComponent,
- StringArrayComponent,
- TemplateComponent,
-};
export * from "./types";
diff --git a/frontend/src/components/misc/MaskSpinner.vue b/frontend/src/components/misc/MaskSpinner.vue
deleted file mode 100644
index 041e98f68b..0000000000
--- a/frontend/src/components/misc/MaskSpinner.vue
+++ /dev/null
@@ -1,23 +0,0 @@
-<template>
- <div
- v-zindexable="{ enabled: zindexable }"
- class="absolute inset-0 bg-white/50 flex flex-col items-center justify-center gap-y-2"
- >
- <NSpin v-bind="spinProps" />
- <slot name="default"></slot>
- </div>
-</template>
-
-<script lang="ts" setup>
-import type { SpinProps } from "naive-ui";
-import { NSpin } from "naive-ui";
-import { zindexable as vZindexable } from "vdirs";
-
-withDefaults(
- defineProps<{
- spinProps?: SpinProps;
- zindexable?: boolean;
- }>(),
- { spinProps: undefined, zindexable: true }
-);
-</script>
diff --git a/frontend/src/components/misc/SQLUploadButton.vue b/frontend/src/components/misc/SQLUploadButton.vue
deleted file mode 100644
index 819aedce20..0000000000
--- a/frontend/src/components/misc/SQLUploadButton.vue
+++ /dev/null
@@ -1,98 +0,0 @@
-<template>
- <NButton tag="div" v-bind="$attrs" @click="handleClick">
- <template #icon>
- <slot name="icon">
- <UploadIcon class="w-4 h-4" />
- </slot>
-
- <input
- ref="inputRef"
- type="file"
- accept=".sql,.txt,application/sql,text/plain"
- class="hidden"
- @change="handleUpload"
- />
-
- <FileContentPreviewModal
- v-if="selectedFile"
- :file="selectedFile"
- @cancel="cleanup"
- @confirm="handleStatementConfirm"
- />
- </template>
-
- <span v-if="!iconOnly">
- <slot />
- </span>
- </NButton>
-</template>
-
-<script lang="ts" setup>
-import { UploadIcon } from "lucide-vue-next";
-import { NButton } from "naive-ui";
-import { ref } from "vue";
-import { useI18n } from "vue-i18n";
-import FileContentPreviewModal from "@/components/FileContentPreviewModal.vue";
-import { pushNotification } from "@/store";
-import { MAX_UPLOAD_FILE_SIZE_MB } from "@/utils";
-
-defineProps<{
- iconOnly?: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "update:sql", text: string, filename: string): void;
-}>();
-
-const { t } = useI18n();
-const inputRef = ref<HTMLInputElement>();
-const selectedFile = ref<File | null>(null);
-
-const handleClick = () => {
- inputRef.value?.click();
-};
-
-const cleanup = () => {
- selectedFile.value = null;
- if (!inputRef.value) {
- return;
- }
- inputRef.value.files = null;
- inputRef.value.value = "";
-};
-
-const handleUpload = async (e: Event) => {
- const target = e.target as HTMLInputElement;
- const file = (target.files || [])[0];
- const cleanup = () => {
- // Note that once selected a file, selecting the same file again will not
- // trigger <input type="file">'s change event.
- // So we need to do some cleanup stuff here.
- target.files = null;
- target.value = "";
- };
-
- if (!file) {
- return cleanup();
- }
- if (file.size > MAX_UPLOAD_FILE_SIZE_MB * 1024 * 1024) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("issue.upload-sql-file-max-size-exceeded", {
- size: `${MAX_UPLOAD_FILE_SIZE_MB}MB`,
- }),
- });
- return cleanup();
- }
-
- selectedFile.value = file;
-
- cleanup();
-};
-
-const handleStatementConfirm = (statement: string) => {
- emit("update:sql", statement, selectedFile.value!.name);
- cleanup();
-};
-</script>
diff --git a/frontend/src/components/v2/TabFilter/TabFilter.vue b/frontend/src/components/v2/TabFilter/TabFilter.vue
deleted file mode 100644
index be11a5e599..0000000000
--- a/frontend/src/components/v2/TabFilter/TabFilter.vue
+++ /dev/null
@@ -1,74 +0,0 @@
-<template>
- <div>
- <div v-if="responsive" class="block sm:hidden">
- <label for="tabs" class="sr-only">Select a tab</label>
- <NSelect
- :disabled="disabled"
- :options="items"
- :value="value"
- :consistent-menu-width="false"
- @update:value="
- (value: ValueType, option: TabFilterItem<ValueType>) =>
- $emit('update:value', value, option)
- "
- />
- </div>
- <div
- class="gap-x-1 w-full overflow-x-auto hide-scrollbar whitespace-nowrap py-[3px]"
- aria-label="Tabs"
- :class="responsive ? 'hidden sm:flex' : 'flex'"
- >
- <button
- v-for="item in items"
- :key="item.value"
- :disabled="disabled"
- class="rounded-md text-sm px-3 py-1 flex items-center disabled:cursor-not-allowed transition-colors duration-150"
- :class="[
- value === item.value
- ? 'bg-gray-200 text-gray-800'
- : 'text-gray-500 hover:text-gray-700 hover:bg-gray-100 disabled:text-gray-300 disabled:bg-transparent',
- ]"
- @click.prevent="update(item.value)"
- >
- <slot name="label" :item="item">
- {{ item.label }}
- </slot>
- </button>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { NSelect } from "naive-ui";
-import type { TabFilterItem } from "./types";
-
-type ValueType = string | number; // Use generic typed component in the future
-
-const props = withDefaults(
- defineProps<{
- value?: ValueType;
- items: TabFilterItem<ValueType>[];
- disabled?: boolean;
- responsive?: boolean;
- }>(),
- {
- value: undefined,
- disabled: false,
- responsive: true,
- }
-);
-
-const emit = defineEmits<{
- (
- event: "update:value",
- value: ValueType,
- item: TabFilterItem<ValueType>
- ): void;
-}>();
-
-const update = (value: ValueType) => {
- const item = props.items.find((item) => item.value === value);
- if (!item) return;
- emit("update:value", value, item);
-};
-</script>
diff --git a/frontend/src/components/v2/TabFilter/index.ts b/frontend/src/components/v2/TabFilter/index.ts
deleted file mode 100644
index 408fdd9c60..0000000000
--- a/frontend/src/components/v2/TabFilter/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import TabFilter from "./TabFilter.vue";
-
-export * from "./types";
-export { TabFilter };
diff --git a/frontend/src/components/v2/TabFilter/types.ts b/frontend/src/components/v2/TabFilter/types.ts
deleted file mode 100644
index 58c3cde307..0000000000
--- a/frontend/src/components/v2/TabFilter/types.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export type TabFilterItem<T extends string | number> = {
- label: string;
- value: T;
-};
diff --git a/frontend/src/components/v2/index.ts b/frontend/src/components/v2/index.ts
index 4970cd0ce3..f792fd5f66 100644
--- a/frontend/src/components/v2/index.ts
+++ b/frontend/src/components/v2/index.ts
@@ -1,5 +1,4 @@
export * from "./Select";
-export * from "./TabFilter";
export * from "./Model";
export * from "./Form";
export * from "./Button";
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index a37d017270..a7e58a0953 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1115,8 +1115,7 @@
"description": "Input the \"key:value\" pair then press Enter"
},
"project": {
- "description": "Filter by project",
- "title": "Project"
+ "description": "Filter by project"
},
"state": {
"description": "Filter by state"
@@ -1128,9 +1127,7 @@
"description": "Input the value then press Enter",
"title": "Table"
}
- },
- "search": "Input title or id to search",
- "self": "Advanced search"
+ }
},
"approval-flow": {
"self": "Approval flow"
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index ef253748a4..1bc0094e7c 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1115,8 +1115,7 @@
"description": "Ingrese el par \"clave:valor\" y luego presione Enter"
},
"project": {
- "description": "Filtrar por proyecto",
- "title": "Proyecto"
+ "description": "Filtrar por proyecto"
},
"state": {
"description": "Filtrar por estado"
@@ -1128,9 +1127,7 @@
"description": "Ingrese el valor y luego presione Enter",
"title": "Tabla"
}
- },
- "search": "Ingrese título o id para buscar",
- "self": "Búsqueda Avanzada"
+ }
},
"approval-flow": {
"self": "Flujo de aprobación"
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index c17cab86e0..5706e18813 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1115,8 +1115,7 @@
"description": "「キー:値」のペアを入力し、Enterを押します"
},
"project": {
- "description": "プロジェクトでフィルターする",
- "title": "プロジェクト"
+ "description": "プロジェクトでフィルターする"
},
"state": {
"description": "状態でフィルタ"
@@ -1128,9 +1127,7 @@
"description": "値を入力してEnterを押します",
"title": "テーブル"
}
- },
- "search": "検索するにはタイトルまたはIDを入力してください",
- "self": "高度な検索"
+ }
},
"approval-flow": {
"self": "承認の流れ"
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index ecc16ff5e2..11790a4fd7 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1115,8 +1115,7 @@
"description": "Nhập cặp \"key:value\" rồi nhấn Enter"
},
"project": {
- "description": "Lọc theo dự án",
- "title": "Dự án"
+ "description": "Lọc theo dự án"
},
"state": {
"description": "Lọc theo trạng thái"
@@ -1128,9 +1127,7 @@
"description": "Nhập giá trị sau đó nhấn Enter",
"title": "Bảng"
}
- },
- "search": "Nhập tiêu đề hoặc id để tìm kiếm",
- "self": "Tìm kiếm nâng cao"
+ }
},
"approval-flow": {
"self": "Quy trình phê duyệt"
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 4bbbadd2b8..9c6cf4fee6 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1115,8 +1115,7 @@
"description": "输入 \"key:value\" 后按下回车"
},
"project": {
- "description": "根据项目过滤",
- "title": "项目"
+ "description": "根据项目过滤"
},
"state": {
"description": "按状态过滤"
@@ -1128,9 +1127,7 @@
"description": "输入值然后按 Enter",
"title": "表"
}
- },
- "search": "输入名称或 ID 来搜索",
- "self": "高级搜索"
+ }
},
"approval-flow": {
"self": "审批流"
diff --git a/frontend/src/react/no-react-to-vue-imports.test.ts b/frontend/src/react/no-react-to-vue-imports.test.ts
new file mode 100644
index 0000000000..a3de898f33
--- /dev/null
+++ b/frontend/src/react/no-react-to-vue-imports.test.ts
@@ -0,0 +1,43 @@
+import { describe, expect, test } from "vitest";
+
+// Every file under frontend/src/react/ that is *.ts or *.tsx (the React layer).
+// .vue files are skipped: by definition .vue is Vue-side and is allowed to import
+// other .vue files.
+const sources = import.meta.glob("./**/*.{ts,tsx}", {
+ query: "?raw",
+ import: "default",
+ eager: true,
+}) as Record<string, string>;
+
+// Mount-bridge Vue files that React code is permitted to import until Phase B
+// retires the Vue app shell. Adding new entries here requires explicit review.
+const allowedVueImports = new Set([
+ "@/components/SessionExpiredSurfaceMount.vue",
+ "@/components/AgentWindowMount.vue",
+]);
+
+const vueImportPattern = /from\s+["']([^"']+\.vue)["']/g;
+
+describe("React layer must not import .vue files", () => {
+ test("no .tsx or .ts file under frontend/src/react/ imports a .vue file", () => {
+ const violations: string[] = [];
+ for (const [file, source] of Object.entries(sources)) {
+ // Don't scan this guard itself (it contains .vue strings as test data
+ // in the allowlist above).
+ if (file.endsWith("/no-react-to-vue-imports.test.ts")) continue;
+ // Don't scan the sibling guard (same reason — it has .vue strings as
+ // banned-import test data).
+ if (file.endsWith("/no-legacy-vue-deps.test.ts")) continue;
+
+ let match: RegExpExecArray | null;
+ vueImportPattern.lastIndex = 0;
+ while ((match = vueImportPattern.exec(source)) !== null) {
+ const importPath = match[1];
+ if (!allowedVueImports.has(importPath)) {
+ violations.push(`${file}: ${importPath}`);
+ }
+ }
+ }
+ expect(violations).toEqual([]);
+ });
+});