Skip to content

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

chore(frontend): remove naive-ui and its peer dependencies (#20389)

boojack40843bac6873
diff --git a/docs/superpowers/plans/2026-05-25-naive-ui-removal.md b/docs/superpowers/plans/2026-05-25-naive-ui-removal.md
new file mode 100644
index 0000000000..8100b23b24
--- /dev/null
+++ b/docs/superpowers/plans/2026-05-25-naive-ui-removal.md
@@ -0,0 +1,665 @@
+# Naive-UI Removal 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:** Remove `naive-ui` and its peer deps (`vdirs`, `vueuc`) from the frontend in a single PR. The app must continue to build, type-check, lint, test, and run after the change.
+
+**Architecture:** Twelve sequential tasks. Each task leaves the build green so we can stop and verify mid-way. Order is chosen so that earlier tasks cannot break later ones: type decoupling → dead-code deletion → live-consumer migration → global wiring removal → dep removal → verification.
+
+**Tech Stack:** Vue 3, Vite 8, pnpm 11, TypeScript 6, vue-tsc, ESLint, Biome.
+
+**Spec:** `docs/superpowers/specs/2026-05-25-naive-ui-removal-design.md`
+
+---
+
+## File Structure
+
+**Files modified:**
+- `frontend/src/types/v2-shared.ts` — decouple `ResourceSelectOption` from naive-ui's `SelectOption`
+- `frontend/src/types/sqlEditor/tree.ts` — decouple `SQLEditorTreeNode` from `TreeOption`
+- `frontend/src/utils/v1/databaseResource.ts` — decouple `DatabaseTreeOption` from `TreeOption`/`TransferOption`
+- `frontend/src/bbkit/index.ts` — remove deleted-wrapper re-exports
+- `frontend/src/AuthContext.vue` — inline CSS spinner, drop `BBSpin` import
+- `frontend/src/App.vue` — drop `NConfigProvider` wrapper and theme-config import
+- `frontend/src/main.ts` — drop `NaiveUI` plugin import and registration
+- `frontend/src/assets/css/tailwind.css` — remove naive-ui focus-ring overrides
+- `frontend/vite.config.ts` — drop `naive-ui` chunk entry from `manualChunks`
+- `frontend/package.json` — remove `naive-ui`, `vdirs`, `vueuc` (via `pnpm remove`)
+- `frontend/pnpm-lock.yaml` — auto-updated by `pnpm remove`
+
+**Files deleted:**
+- `frontend/src/bbkit/BBAlert.vue` (0 consumers)
+- `frontend/src/bbkit/BBAttention.vue` (0 consumers)
+- `frontend/src/bbkit/BBButtonConfirm.vue` (0 consumers)
+- `frontend/src/bbkit/BBTextField.vue` (0 consumers)
+- `frontend/src/bbkit/BBSpin.vue` (after Task 5 migrates AuthContext.vue)
+- `frontend/src/utils/naive-ui.ts` (`useAutoHeightDataTable`, 0 consumers)
+- `frontend/src/plugins/naive-ui.ts` (global registration plugin)
+- `frontend/naive-ui.config.ts` (theme + locale config)
+
+**Files created:** none.
+
+---
+
+## Task 1: Decouple `ResourceSelectOption` from naive-ui
+
+**Files:**
+- Modify: `frontend/src/types/v2-shared.ts`
+
+Three React consumers (`CustomApproval/utils.ts`, `sensitive-data/components-utils.ts`, `database-group/utils.ts`) use this type as a plain object shape. They never access naive-ui-specific `SelectOption` fields. Replace the `extends` with a standalone interface.
+
+- [ ] **Step 1: Replace the file contents**
+
+```typescript
+// frontend/src/types/v2-shared.ts
+export type ResourceSelectOption<T> = {
+ resource?: T;
+ value: string;
+ label: string;
+ // Allow arbitrary extra fields the Vue-side select components may set;
+ // React consumers only read value/label/resource.
+ [key: string]: unknown;
+};
+
+export type SelectSize = "tiny" | "small" | "medium" | "large";
+```
+
+- [ ] **Step 2: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS (vue-tsc and tsc both clean).
+
+- [ ] **Step 3: Commit**
+
+```bash
+git add frontend/src/types/v2-shared.ts
+git commit -m "refactor(types): decouple ResourceSelectOption from naive-ui"
+```
+
+---
+
+## Task 2: Decouple `SQLEditorTreeNode` from naive-ui `TreeOption`
+
+**Files:**
+- Modify: `frontend/src/types/sqlEditor/tree.ts`
+
+`SQLEditorTreeNode` extends naive-ui's `TreeOption`. Consumers (`stores/sqlEditor/`, `react/components/sql-editor/ConnectionPane/`) read `disabled`, `children`, `key`, plus the locally-added `meta` field. Define the minimal shape inline.
+
+- [ ] **Step 1: Replace the `TreeOption` import and `SQLEditorTreeNode` declaration**
+
+Edit `frontend/src/types/sqlEditor/tree.ts`:
+
+Remove line 1:
+```typescript
+import type { TreeOption } from "naive-ui";
+```
+
+Replace the `SQLEditorTreeNode` declaration (lines 50-56) with:
+
+```typescript
+export type SQLEditorTreeNode<
+ T extends SQLEditorTreeNodeType = SQLEditorTreeNodeType,
+> = {
+ meta: SQLEditorTreeNodeMeta<T>;
+ key: string;
+ label?: string;
+ disabled?: boolean;
+ isLeaf?: boolean;
+ children?: SQLEditorTreeNode[];
+};
+```
+
+- [ ] **Step 2: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS. If any consumer accesses a field not listed above (`prefix`, `suffix`, `checkboxDisabled`, etc.), the error will pinpoint the line — add the field to the standalone type with the correct optional signature.
+
+- [ ] **Step 3: Commit**
+
+```bash
+git add frontend/src/types/sqlEditor/tree.ts
+git commit -m "refactor(sql-editor): decouple SQLEditorTreeNode from naive-ui"
+```
+
+---
+
+## Task 3: Decouple `DatabaseTreeOption` from naive-ui
+
+**Files:**
+- Modify: `frontend/src/utils/v1/databaseResource.ts`
+
+`DatabaseTreeOption` extends both `TreeOption` and `TransferOption`. Code in this file sets only `label`, `value`, `level`, `isLeaf`, and `children`. The only external consumer (`RequestQueryButton.tsx`) imports `parseStringToResource`, not the type.
+
+- [ ] **Step 1: Remove the naive-ui import and rewrite the interface**
+
+Edit `frontend/src/utils/v1/databaseResource.ts`:
+
+Remove line 2:
+```typescript
+import type { TransferOption, TreeOption } from "naive-ui";
+```
+
+Replace the `DatabaseTreeOption` declaration (lines 26-33) with:
+
+```typescript
+export interface DatabaseTreeOption<L = DatabaseResourceType> {
+ label: string;
+ level: L;
+ value: string;
+ isLeaf?: boolean;
+ disabled?: boolean;
+ children?: DatabaseTreeOption[];
+}
+```
+
+- [ ] **Step 2: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS.
+
+- [ ] **Step 3: Commit**
+
+```bash
+git add frontend/src/utils/v1/databaseResource.ts
+git commit -m "refactor(database): decouple DatabaseTreeOption from naive-ui"
+```
+
+---
+
+## Task 4: Delete unused bbkit wrappers and update barrel
+
+**Files:**
+- Delete: `frontend/src/bbkit/BBAlert.vue`
+- Delete: `frontend/src/bbkit/BBAttention.vue`
+- Delete: `frontend/src/bbkit/BBButtonConfirm.vue`
+- Delete: `frontend/src/bbkit/BBTextField.vue`
+- Delete: `frontend/src/utils/naive-ui.ts`
+- Modify: `frontend/src/bbkit/index.ts`
+
+Each of these has zero consumers per the cascade audit. Delete the files and remove the re-exports.
+
+- [ ] **Step 1: Verify zero consumers (sanity check before delete)**
+
+Run from repo root:
+```bash
+cd /Users/steven/Projects/bytebase/bb/frontend && \
+ grep -rn 'BBAlert\b\|BBAttention\b\|BBButtonConfirm\b\|BBTextField\b\|useAutoHeightDataTable\b' \
+ src --include='*.ts' --include='*.tsx' --include='*.vue' \
+ | grep -v 'src/bbkit/' | grep -v 'src/utils/naive-ui.ts'
+```
+
+Expected: no output (the only matches are the definitions themselves, which are excluded by the `grep -v` filters).
+
+If any line is printed, **stop and investigate** — there is a consumer the audit missed. Add a migration step before proceeding.
+
+- [ ] **Step 2: Delete the five files**
+
+```bash
+rm frontend/src/bbkit/BBAlert.vue
+rm frontend/src/bbkit/BBAttention.vue
+rm frontend/src/bbkit/BBButtonConfirm.vue
+rm frontend/src/bbkit/BBTextField.vue
+rm frontend/src/utils/naive-ui.ts
+```
+
+- [ ] **Step 3: Update the bbkit barrel**
+
+Replace `frontend/src/bbkit/index.ts` with:
+
+```typescript
+import BBSpin from "./BBSpin.vue";
+
+export * from "./types";
+
+export { BBSpin };
+```
+
+- [ ] **Step 4: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add -A frontend/src/bbkit frontend/src/utils/naive-ui.ts
+git commit -m "chore(bbkit): delete unused naive-ui wrappers"
+```
+
+---
+
+## Task 5: Inline CSS spinner in AuthContext.vue and delete BBSpin.vue
+
+**Files:**
+- Modify: `frontend/src/AuthContext.vue`
+- Delete: `frontend/src/bbkit/BBSpin.vue`
+- Modify: `frontend/src/bbkit/index.ts`
+
+`AuthContext.vue` is the sole live consumer of `BBSpin`. The current usage is `<BBSpin />` (no size override) inside a centered container during auth bootstrap. Replace with a self-contained CSS spinner — a 20×20 div with a 2-px border, three sides in `currentColor`, one side transparent, rotating 360° infinitely.
+
+The current BBSpin renders `NSpin` at small size with stroke-width 25 — a ~20-px circular spinner using the theme's accent color. The inline replacement matches that visual.
+
+- [ ] **Step 1: Update AuthContext.vue**
+
+Edit `frontend/src/AuthContext.vue`:
+
+Replace the template (lines 1-17) with:
+
+```vue
+<template>
+ <slot v-if="ready"></slot>
+ <div v-else class="flex items-center justify-center h-screen">
+ <span class="bb-spinner" aria-label="Loading" role="status"></span>
+ </div>
+ <template v-if="!isAuthRoute && authStore.isLoggedIn">
+ <!-- Session-expired surface lives in the React app
+ (src/react/app/SessionExpiredSurfaceGate.tsx).
+ InactiveRemindModal stays mounted here because it reads Vue router
+ state via the bridged provide/inject context, which the sibling
+ React app doesn't carry. -->
+ <ReactPageMount
+ v-if="!authStore.unauthenticatedOccurred"
+ page="InactiveRemindModal"
+ />
+ </template>
+</template>
+```
+
+Remove line 22:
+```typescript
+import { BBSpin } from "@/bbkit";
+```
+
+Append a scoped `<style>` block to the end of the file (after the closing `</script>`):
+
+```vue
+<style scoped>
+.bb-spinner {
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ border: 2px solid var(--color-accent, currentcolor);
+ border-top-color: transparent;
+ border-radius: 50%;
+ animation: bb-spinner-rotate 0.8s linear infinite;
+}
+
+@keyframes bb-spinner-rotate {
+ to {
+ transform: rotate(360deg);
+ }
+}
+</style>
+```
+
+- [ ] **Step 2: Delete BBSpin.vue**
+
+```bash
+rm frontend/src/bbkit/BBSpin.vue
+```
+
+- [ ] **Step 3: Update the bbkit barrel to remove the last BB* export**
+
+Replace `frontend/src/bbkit/index.ts` with:
+
+```typescript
+export * from "./types";
+```
+
+- [ ] **Step 4: Verify nothing else imports BBSpin**
+
+Run:
+```bash
+grep -rn 'BBSpin\b' frontend/src --include='*.ts' --include='*.tsx' --include='*.vue'
+```
+
+Expected: no output.
+
+- [ ] **Step 5: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS.
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add frontend/src/AuthContext.vue frontend/src/bbkit/BBSpin.vue frontend/src/bbkit/index.ts
+git commit -m "refactor(auth): inline CSS spinner, delete BBSpin"
+```
+
+---
+
+## Task 6: Strip NConfigProvider from App.vue
+
+**Files:**
+- Modify: `frontend/src/App.vue`
+
+`NConfigProvider` injects naive-ui's theme. Theme tokens are already CSS custom properties in `tailwind.css`, so removing the wrapper has no visual effect on app-level styling. After Task 5, no surviving file renders a naive-ui component, so the provider is a dead wrapper.
+
+- [ ] **Step 1: Update the template**
+
+Edit `frontend/src/App.vue`. Replace the template block (lines 1-11) with:
+
+```vue
+<template>
+ <AuthContext>
+ <router-view />
+ </AuthContext>
+</template>
+```
+
+- [ ] **Step 2: Remove the naive-ui import and theme-config import**
+
+In the `<script setup>` block, remove:
+
+```typescript
+import { NConfigProvider } from "naive-ui";
+```
+
+And remove:
+
+```typescript
+import { dateLang, generalLang, themeOverrides } from "../naive-ui.config";
+```
+
+- [ ] **Step 3: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS. `dateLang`, `generalLang`, and `themeOverrides` are no longer referenced anywhere.
+
+- [ ] **Step 4: Commit**
+
+```bash
+git add frontend/src/App.vue
+git commit -m "refactor(app): drop NConfigProvider wrapper from App.vue"
+```
+
+---
+
+## Task 7: Remove naive-ui plugin wiring from main.ts and delete the plugin
+
+**Files:**
+- Modify: `frontend/src/main.ts`
+- Delete: `frontend/src/plugins/naive-ui.ts`
+- Delete: `frontend/naive-ui.config.ts`
+
+After Task 6, nothing references the plugin or the config file.
+
+- [ ] **Step 1: Update main.ts**
+
+Edit `frontend/src/main.ts`:
+
+Remove line 11:
+```typescript
+import NaiveUI from "./plugins/naive-ui";
+```
+
+Change line 64 from:
+```typescript
+app.use(router).use(highlight).use(i18n).use(NaiveUI);
+```
+
+To:
+```typescript
+app.use(router).use(highlight).use(i18n);
+```
+
+- [ ] **Step 2: Delete the plugin and config files**
+
+```bash
+rm frontend/src/plugins/naive-ui.ts
+rm frontend/naive-ui.config.ts
+```
+
+- [ ] **Step 3: Verify no remaining references**
+
+Run:
+```bash
+grep -rn 'plugins/naive-ui\|naive-ui\.config' frontend/src frontend/vite.config.ts frontend/tsconfig*.json 2>/dev/null
+```
+
+Expected: no output.
+
+- [ ] **Step 4: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add frontend/src/main.ts frontend/src/plugins/naive-ui.ts frontend/naive-ui.config.ts
+git commit -m "chore(plugins): remove naive-ui plugin and theme config"
+```
+
+---
+
+## Task 8: Remove naive-ui CSS overrides from tailwind.css
+
+**Files:**
+- Modify: `frontend/src/assets/css/tailwind.css`
+
+The focus-ring overrides at lines 421-426 target `.n-base-selection-input`, `.n-base-selection-input-tag__input`, and `.n-input__input-el` — all naive-ui-specific selectors that are now dead.
+
+- [ ] **Step 1: Remove the override block**
+
+Edit `frontend/src/assets/css/tailwind.css`. Delete lines 421-426 (the comment `/* compatibility fixes for tailwindcss and naive-ui */` through the closing `}` of the `.n-input__input-el:focus` rule):
+
+```css
+/* compatibility fixes for tailwindcss and naive-ui */
+.n-base-selection-input:focus,
+.n-base-selection-input-tag__input:focus,
+.n-input__input-el:focus {
+ box-shadow: 0 0 0 0;
+}
+```
+
+- [ ] **Step 2: Verify no other naive-ui CSS selectors remain**
+
+Run:
+```bash
+grep -rn '\.n-[a-z]' frontend/src/assets frontend/src --include='*.css' --include='*.scss' --include='*.vue'
+```
+
+Expected: no output (any remaining `.n-*` selectors would also be dead).
+
+- [ ] **Step 3: Commit**
+
+```bash
+git add frontend/src/assets/css/tailwind.css
+git commit -m "style(css): drop naive-ui focus-ring overrides"
+```
+
+---
+
+## Task 9: Update vite.config.ts manualChunks
+
+**Files:**
+- Modify: `frontend/vite.config.ts`
+
+The `ui-framework` chunk currently contains only naive-ui (per the audit). Remove the entry.
+
+- [ ] **Step 1: Remove the naive-ui chunk entry**
+
+Edit `frontend/vite.config.ts`. Delete lines 98-101 (the comment and the `if` block):
+
+```typescript
+ // UI framework
+ if (id.includes("naive-ui")) {
+ return "ui-framework";
+ }
+```
+
+- [ ] **Step 2: Verify build config still parses**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS (the tsconfig covers vite.config.ts).
+
+- [ ] **Step 3: Commit**
+
+```bash
+git add frontend/vite.config.ts
+git commit -m "build(vite): drop naive-ui manualChunks entry"
+```
+
+---
+
+## Task 10: Drop naive-ui, vdirs, vueuc from package.json
+
+**Files:**
+- Modify: `frontend/package.json`
+- Modify: `frontend/pnpm-lock.yaml`
+
+After Task 9, nothing imports `naive-ui`, `vdirs`, or `vueuc`. Remove them.
+
+- [ ] **Step 1: Final source scan before dep removal**
+
+Run:
+```bash
+grep -rn '\bnaive-ui\b\|from "vdirs"\|from "vueuc"' frontend/src frontend/vite.config.ts frontend/*.ts frontend/*.json 2>/dev/null
+```
+
+Expected: no output. If anything matches, **stop** — there is still a live reference. Resolve it before continuing (likely an earlier task missed a file).
+
+- [ ] **Step 2: Run pnpm remove**
+
+```bash
+pnpm --dir frontend remove naive-ui vdirs vueuc
+```
+
+Expected: command succeeds; `package.json` no longer lists the three deps; `pnpm-lock.yaml` is updated.
+
+- [ ] **Step 3: Verify package.json**
+
+Run:
+```bash
+grep -E '"naive-ui"|"vdirs"|"vueuc"' frontend/package.json
+```
+
+Expected: no output.
+
+- [ ] **Step 4: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS. If a residual import survives, vue-tsc or tsc will fail with `Cannot find module 'naive-ui'`. Fix the import and re-run.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add frontend/package.json frontend/pnpm-lock.yaml
+git commit -m "build(deps): drop naive-ui, vdirs, vueuc"
+```
+
+---
+
+## Task 11: Full verification pass
+
+**Files:** none modified.
+
+Run every gate end-to-end. This task does not commit.
+
+- [ ] **Step 1: Source grep — nothing references naive-ui**
+
+```bash
+grep -rn '\bnaive-ui\b' frontend/src frontend/vite.config.ts frontend/*.ts frontend/*.json 2>/dev/null
+```
+
+Expected: no output.
+
+- [ ] **Step 2: Source grep — no vdirs/vueuc imports**
+
+```bash
+grep -rn 'from "vdirs"\|from "vueuc"\|from '\''vdirs'\''\|from '\''vueuc'\''' frontend/src 2>/dev/null
+```
+
+Expected: no output.
+
+- [ ] **Step 3: Source grep — no auto-registered naive-ui templates**
+
+```bash
+grep -rn '<n-[a-z]' frontend/src --include='*.vue'
+```
+
+Expected: no output.
+
+- [ ] **Step 4: Source grep — no .n-* CSS selectors**
+
+```bash
+grep -rn '\.n-[a-z]' frontend/src --include='*.css' --include='*.scss' --include='*.vue'
+```
+
+Expected: no output.
+
+- [ ] **Step 5: Lint and format**
+
+Run: `pnpm --dir frontend fix`
+Expected: command exits 0. If files are modified, re-stage and `git commit -m "chore: apply lint fixes after naive-ui removal"`.
+
+- [ ] **Step 6: CI-mode check**
+
+Run: `pnpm --dir frontend check`
+Expected: PASS (ESLint + Biome CI + react-i18n + react-layering + i18n sort all green).
+
+- [ ] **Step 7: Type-check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS.
+
+- [ ] **Step 8: Unit tests**
+
+Run: `pnpm --dir frontend test`
+Expected: PASS.
+
+---
+
+## Task 12: Manual smoke test of auth flow
+
+**Files:** none modified.
+
+The only behavioral change is the spinner in `AuthContext.vue`. Manually verify the auth bootstrap renders correctly.
+
+- [ ] **Step 1: Start the dev server**
+
+In one terminal:
+```bash
+pnpm --dir frontend dev
+```
+
+In another terminal, ensure the backend is running on port 8080:
+```bash
+PG_URL=postgresql://bbdev@localhost/bbdev go run ./backend/bin/server/main.go --port 8080 --data . --debug
+```
+
+- [ ] **Step 2: Verify the spinner during signin**
+
+Open the dev URL (typically `http://localhost:3000`). On a cold load (clear cookies / hard-reload), the spinner should appear briefly during auth bootstrap, centered on the page, rotating smoothly.
+
+If the spinner does not appear or does not animate, inspect the DOM for the `.bb-spinner` element and confirm the `<style scoped>` block in `AuthContext.vue` is present.
+
+- [ ] **Step 3: Verify the dashboard renders**
+
+After login, confirm the dashboard loads with no visual regressions. Sidebar, header, footer all render correctly (these are still Vue, but had no naive-ui dependency — should be visually identical).
+
+- [ ] **Step 4: Verify a few key pages**
+
+Click into:
+- Projects list → a project → Issue list → an issue
+- A database detail page (overview tab)
+- SQL Editor
+
+These are all React pages; nothing should have changed visually. The intent of the smoke test is to confirm the global wiring removal did not break React mount points.
+
+- [ ] **Step 5: Check the browser console**
+
+Open DevTools → Console. Expected: no errors related to `naive-ui`, `NConfigProvider`, `vdirs`, `vueuc`, or undefined Vue components.
+
+- [ ] **Step 6: If smoke test passes, the PR is ready**
+
+No commit needed for this task — verification only.
+
+---
+
+## Out-of-band follow-ups (not in this PR)
+
+- The eight surviving Vue files (`App.vue`, `AuthContext.vue`, `BodyLayout.vue`, `DashboardLayout.vue`, `SplashLayout.vue`, and four React-mount bridges) remain. Phase B of the broader Vue → React migration (router swap, shell port, Pinia → Zustand) covers their eventual removal.
+- The `bbkit/` directory will be left with `BBUtil.ts` (a pure `hashCode()` utility) and `index.ts` re-exporting `./types`. Consider moving `hashCode` to a shared utility location in a follow-up so `bbkit/` can be deleted entirely.
diff --git a/docs/superpowers/specs/2026-05-25-naive-ui-removal-design.md b/docs/superpowers/specs/2026-05-25-naive-ui-removal-design.md
new file mode 100644
index 0000000000..642552b802
--- /dev/null
+++ b/docs/superpowers/specs/2026-05-25-naive-ui-removal-design.md
@@ -0,0 +1,191 @@
+# Remove naive-ui from the frontend
+
+**Date:** 2026-05-25
+**Scope:** Single PR
+**Owner:** TBD
+
+## Context
+
+The frontend is mid-migration from Vue to React. React UI is built on Base UI
+(`@base-ui/react`) wrapped in shadcn-style primitives under
+`frontend/src/react/components/ui/`. The Vue surface still imports `naive-ui`
+(v2.44.1) as its component library, but the actual usage has shrunk
+dramatically as pages have moved to React.
+
+A cascade audit shows naive-ui usage is now confined to:
+
+- 11 files under `frontend/src/` that directly import from `naive-ui`
+- 1 root-level theme config: `frontend/naive-ui.config.ts`
+- 3 lines of CSS overrides in `frontend/src/assets/css/tailwind.css`
+- 3 package-json deps: `naive-ui`, `vdirs`, `vueuc`
+
+Of the 11 direct importers, the live downstream cascade is exactly
+**three files**: `App.vue`, `AuthContext.vue`, and `main.ts`. Everything else
+is unused, type-only, or already decoupled from naive-ui's runtime.
+
+The React side has zero naive-ui imports — it only consumes a handful of
+type-only re-exports and a pure utility function from files that *happen* to
+also export naive-ui-flavored types.
+
+## Goal
+
+Remove `naive-ui` and its peer deps (`vdirs`, `vueuc`) from `package.json`
+and delete or decouple every file that imports them. The app must still
+build, type-check, lint, test, and run after the change.
+
+## Non-goals
+
+- **Not migrating router, app shell, or Pinia stores.** vue-router, the
+ Vue layout shells (`BodyLayout.vue`, `DashboardLayout.vue`,
+ `SplashLayout.vue`), Pinia, and vue-i18n stay. This PR strictly removes
+ naive-ui; the larger Vue → React extraction is out of scope.
+- **Not introducing a replacement Vue component library.** The eight
+ Vue files that survive after naive-ui removal are pure layouts and
+ React-mount bridges; none of them needs UI primitives.
+- **Not touching React UI.** The React Base UI stack is already canonical.
+
+## Approach
+
+Seven sequential steps inside a single branch. Each step leaves the build
+green so we can stop and verify mid-way if needed.
+
+### Step 1 — Decouple types from naive-ui
+
+Three files re-export types that extend naive-ui types. Replace the
+`extends` with standalone interfaces containing only the fields actually
+consumed.
+
+- `frontend/src/types/v2-shared.ts` — `ResourceSelectOption<T>` currently
+ extends `SelectOption` from naive-ui. Rewrite as a standalone interface.
+ Three React utility files consume this type:
+ - `frontend/src/react/components/CustomApproval/utils.ts`
+ - `frontend/src/react/lib/sensitive-data/components-utils.ts`
+ - `frontend/src/react/lib/database-group/utils.ts`
+- `frontend/src/types/sqlEditor/tree.ts` — drop `extends TreeOption`;
+ inline the fields the tree code uses.
+- `frontend/src/utils/v1/databaseResource.ts` — `DatabaseTreeOption`
+ drops its naive-ui `TreeOption` extension. The lone React consumer
+ (`RequestQueryButton.tsx`) only uses `parseStringToResource`, not the
+ type, so this is safe.
+
+### Step 2 — Delete dead wrappers
+
+These files have zero consumers in the codebase:
+
+- `frontend/src/bbkit/BBAttention.vue`
+- `frontend/src/bbkit/BBButtonConfirm.vue`
+- `frontend/src/bbkit/BBTextField.vue`
+- `frontend/src/bbkit/BBAlert.vue`
+- `frontend/src/utils/naive-ui.ts` (`useAutoHeightDataTable` composable)
+
+Update `frontend/src/bbkit/index.ts` to drop the corresponding re-exports.
+
+### Step 3 — Migrate the single live BBSpin consumer
+
+`frontend/src/AuthContext.vue` is the only file that imports `BBSpin` from
+`@/bbkit`. Inline a CSS-only spinner in `AuthContext.vue` (no Vue
+component, no external dep — a div with a CSS rotation animation),
+then delete `frontend/src/bbkit/BBSpin.vue` and the corresponding
+re-export in `frontend/src/bbkit/index.ts`.
+
+### Step 4 — Strip the global naive-ui wiring
+
+- `frontend/src/App.vue` — remove the `<NConfigProvider>` wrapper. Theme
+ tokens are already CSS custom properties (`--color-accent`, `--color-error`,
+ etc.) defined in `tailwind.css`, so removing the provider is a no-op for
+ visual rendering.
+- `frontend/src/main.ts` — remove the `app.use(NaiveUI)` registration call
+ and the corresponding import.
+- Delete `frontend/src/plugins/naive-ui.ts` (the 29-component global
+ registration plugin and style-tag re-append logic).
+- Delete `frontend/naive-ui.config.ts` (theme overrides + zhCN locale
+ config). Before deletion, confirm that any locale strings worth keeping
+ already exist in `frontend/src/locales/zh-CN.json` — the `dateZhCN`
+ binding from naive-ui isn't a translation, it's date-formatting wiring
+ for naive-ui's own date components, so nothing to port.
+
+### Step 5 — Clean up CSS overrides
+
+In `frontend/src/assets/css/tailwind.css` (around lines 421–426), remove
+the focus-ring resets targeting `.n-base-selection-input`,
+`.n-base-selection-input-tag__input`, and `.n-input__input-el`. These
+selectors become dead once naive-ui is gone.
+
+### Step 6 — Drop dependencies
+
+```
+pnpm --dir frontend remove naive-ui vdirs vueuc
+```
+
+Then update `frontend/vite.config.ts`: remove `naive-ui` from the
+`ui-framework` entry of `build.rollupOptions.output.manualChunks` (the
+chunk can remain for other UI libs in that group, or collapse if naive-ui
+was its only member — confirm during implementation).
+
+### Step 7 — Verify
+
+Run, in order:
+
+1. `pnpm --dir frontend fix` — ESLint + Biome auto-fix + i18n sort
+2. `pnpm --dir frontend check` — ESLint + Biome CI + react-i18n check +
+ react-layering scanner + i18n sort check
+3. `pnpm --dir frontend type-check` — vue-tsc (still covers remaining
+ Vue files) + tsc (React)
+4. `pnpm --dir frontend test`
+5. `pnpm --dir frontend dev` — manual smoke test of the auth flow, since
+ `AuthContext.vue` is the only file with a meaningful behavioral
+ change (the spinner)
+
+## Risks
+
+1. **Hidden auto-registered usage.** The audit found no
+ `unplugin-vue-components` naive-ui resolver, and all naive-ui
+ components are explicitly registered in `plugins/naive-ui.ts`. If a
+ template somewhere uses `<n-foo>` without an import, type-check
+ won't catch it (Vue templates are loosely typed for global
+ components). Mitigation: after dropping the deps, run `grep -r '<n-'
+ frontend/src/` to catch any stragglers.
+
+2. **Theme regression in remaining Vue surfaces.** `NConfigProvider`
+ injected naive-ui's theme. The eight surviving Vue files
+ (`BodyLayout.vue`, `DashboardLayout.vue`, `SplashLayout.vue`, and
+ five React-mount bridges) don't render naive-ui components, so this
+ should be a no-op. Confirm visually in the smoke test.
+
+3. **vite chunking change.** Removing naive-ui from `manualChunks`
+ slightly reshuffles the bundle. This is cosmetic — the chunk just
+ becomes smaller. If the `ui-framework` entry had naive-ui as its only
+ member, drop the entry entirely.
+
+4. **dateZhCN behavioral change.** `naive-ui.config.ts` wires `dateZhCN`
+ into NConfigProvider, which only affects naive-ui's own
+ date-picker / calendar components. Since none of those are rendered
+ in the surviving Vue surfaces, removal is a no-op. No app-level i18n
+ change is needed.
+
+## Verification checklist
+
+Before opening the PR:
+
+- [ ] `grep -r 'naive-ui' frontend/src/` returns zero results
+- [ ] `grep -r 'from "vdirs"' frontend/src/` and `from "vueuc"` return zero
+- [ ] `grep -r '<n-' frontend/src/` returns zero (template auto-reg check)
+- [ ] `pnpm --dir frontend check` passes
+- [ ] `pnpm --dir frontend type-check` passes
+- [ ] `pnpm --dir frontend test` passes
+- [ ] `pnpm --dir frontend dev` boots; signin → dashboard flow works;
+ `AuthContext` spinner shows during auth bootstrap
+- [ ] `package.json` no longer lists `naive-ui`, `vdirs`, or `vueuc`
+- [ ] `pnpm-lock.yaml` updated
+
+## Out-of-band follow-ups (not in this PR)
+
+- The eight surviving Vue files (`App.vue`, `AuthContext.vue`,
+ `BodyLayout.vue`, `DashboardLayout.vue`, `SplashLayout.vue`, and four
+ React-mount bridges) remain. Phase B of the broader Vue → React
+ migration (router swap, shell port, Pinia → Zustand) covers their
+ eventual removal.
+- The `bbkit/` directory will be left with `BBUtil.ts` (a pure
+ `hashCode()` utility) and `index.ts`. Consider moving `hashCode` to
+ a shared utility location in a follow-up so `bbkit/` can be deleted
+ entirely.
diff --git a/frontend/naive-ui.config.ts b/frontend/naive-ui.config.ts
deleted file mode 100644
index 5bd5ce6b2d..0000000000
--- a/frontend/naive-ui.config.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import {
- dateZhCN,
- type GlobalThemeOverrides,
- type NDateLocale,
- type NLocale,
- zhCN,
-} from "naive-ui";
-import { computed } from "vue";
-import { callCssVariable } from "@/utils";
-import { locale } from "./src/plugins/i18n";
-
-export const themeOverrides = computed((): GlobalThemeOverrides => {
- return {
- common: {
- primaryColor: callCssVariable("--color-accent"),
- primaryColorHover: callCssVariable("--color-accent-hover"),
- primaryColorPressed: callCssVariable("--color-accent"),
-
- successColor: callCssVariable("--color-success"),
- successColorHover: callCssVariable("--color-success-hover"),
- successColorPressed: callCssVariable("--color-success"),
-
- warningColor: callCssVariable("--color-warning"),
- warningColorHover: callCssVariable("--color-warning-hover"),
- warningColorPressed: callCssVariable("--color-warning"),
-
- infoColor: callCssVariable("--color-info"),
- infoColorHover: callCssVariable("--color-info-hover"),
- infoColorPressed: callCssVariable("--color-info"),
-
- errorColor: callCssVariable("--color-error"),
- errorColorHover: callCssVariable("--color-error-hover"),
- errorColorPressed: callCssVariable("--color-error"),
- },
- Button: {
- color: "white",
- colorHover: "white",
- colorFocus: "white",
- colorPressed: "white",
- },
- };
-});
-
-export const darkThemeOverrides = computed((): GlobalThemeOverrides => {
- return {
- common: {
- primaryColor: callCssVariable("--color-matrix-green"),
- primaryColorHover: callCssVariable("--color-matrix-green-hover"),
- primaryColorPressed: callCssVariable("--color-matrix-green"),
- },
- Button: {
- color: "transparent",
- colorHover: "transparent",
- colorFocus: "transparent",
- colorPressed: "transparent",
- colorInfo: callCssVariable("--color-matrix-green"),
- colorHoverInfo: callCssVariable("--color-matrix-green-hover"),
- colorFocusInfo: callCssVariable("--color-matrix-green"),
- borderInfo: callCssVariable("--color-matrix-green"),
- borderHoverInfo: callCssVariable("--color-matrix-green-hover"),
- borderFocusInfo: callCssVariable("--color-matrix-green"),
- },
- Tabs: {
- tabTextColorCard: callCssVariable("--color-control-placeholder"),
- },
- };
-});
-
-const isZhCn = (): boolean => {
- return locale.value === "zh-CN";
-};
-
-export const dateLang = computed((): NDateLocale | null => {
- return isZhCn() ? dateZhCN : null;
-});
-
-export const generalLang = computed((): NLocale | null => {
- return isZhCn() ? zhCN : null;
-});
diff --git a/frontend/package.json b/frontend/package.json
index 8a46f61bd1..03285cbf17 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -70,7 +70,6 @@
"markdown-it": "^14.1.0",
"monaco-editor": "npm:@codingame/[email protected]",
"monaco-languageclient": "10.7.0",
- "naive-ui": "2.44.1",
"normalize-wheel": "^1.0.1",
"pev2": "1.21.0",
"pinia": "3.0.4",
@@ -93,13 +92,11 @@
"sql-formatter": "15.7.3",
"tailwind-merge": "^3.4.0",
"uuid": "14.0.0",
- "vdirs": "^0.1.8",
"vscode": "npm:@codingame/[email protected]",
"vscode-languageclient": "9.0.1",
"vscode-ws-jsonrpc": "3.5.0",
"vue": "3.5.34",
"vue-draggable-plus": "^0.6.0",
- "vueuc": "0.4.65",
"zustand": "^5.0.13"
},
"devDependencies": {
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 3e0b4a09e6..3287a003e5 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -12,7 +12,7 @@ importers:
dependencies:
'@base-ui/react':
specifier: ^1.3.0
'@buf/googleapis_googleapis.bufbuild_es':
specifier: 2.10.2-20260414192239-c17df5b2beca.1
version: 2.10.2-20260414192239-c17df5b2beca.1(@bufbuild/[email protected])
@@ -148,9 +148,6 @@ importers:
monaco-languageclient:
specifier: 10.7.0
version: 10.7.0
- naive-ui:
- specifier: 2.44.1
normalize-wheel:
specifier: ^1.0.1
version: 1.0.1
@@ -217,9 +214,6 @@ importers:
uuid:
specifier: 14.0.0
version: 14.0.0
- vdirs:
- specifier: ^0.1.8
vscode:
specifier: npm:@codingame/[email protected]
version: '@codingame/[email protected]'
@@ -235,9 +229,6 @@ importers:
vue-draggable-plus:
specifier: ^0.6.0
version: 0.6.1(@types/[email protected])
- vueuc:
- specifier: 0.4.65
zustand:
specifier: ^5.0.13
@@ -1270,16 +1261,6 @@ packages:
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
engines: {node: '>=12'}
- '@css-render/[email protected]':
- resolution: {integrity: sha512-QK513CJ7yEQxm/P3EwsI+d+ha8kSOcjGvD6SevM41neEMxdULE+18iuQK6tEChAWMOQNQPLG/Rw3Khb69r5neg==}
- peerDependencies:
- css-render: ~0.15.14
-
- '@css-render/[email protected]':
- resolution: {integrity: sha512-//8027GSbxE9n3QlD73xFY6z4ZbHbvrOVB7AO6hsmrEzGbg+h2A09HboUyDgu+xsmj7JnvJD39Irt+2D0+iV8g==}
- peerDependencies:
- vue: ^3.0.11
-
'@csstools/[email protected]':
resolution: {integrity: sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==}
engines: {node: '>=18'}
@@ -1343,9 +1324,6 @@ packages:
'@emnapi/[email protected]':
resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==}
- '@emotion/[email protected]':
- resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==}
-
'@esbuild/[email protected]':
resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==}
engines: {node: '>=18'}
@@ -1851,9 +1829,6 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==}
- '@juggle/[email protected]':
- resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==}
-
'@markdoc/[email protected]':
resolution: {integrity: sha512-NxreNThm7foFgMMQD6zgk7rKkcFMmdC8J5r+Zn4FKoN75F5YjvwdihwF11VhrBfL3CXnD4+YG1VYwvBL+igzvw==}
engines: {node: '>=14.7.0'}
@@ -2809,9 +2784,6 @@ packages:
resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
engines: {node: '>=12'}
- resolution: {integrity: sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==}
-
resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==}
@@ -3033,9 +3005,6 @@ packages:
resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==}
- resolution: {integrity: sha512-9nF4PdUle+5ta4W5SyZdLCCmFd37uVimSjg1evcTqKJCyvCEEj12WKzOSBNak6r4im4J4iYXKH1OWpUV5LBYFg==}
-
resolution: {integrity: sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==}
engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0}
@@ -3052,9 +3021,6 @@ packages:
resolution: {integrity: sha512-7D2EPVltRrsTkhpQmksIu+LxeWAIEk6wRDMJ1qljlv+CKHJM+cJLlfhWIzNA44eAsHXSNe3+vO6DW1yCYx8SuQ==}
engines: {node: '>=20'}
- resolution: {integrity: sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==}
-
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
@@ -3195,14 +3161,6 @@ packages:
resolution: {integrity: sha512-BnBS08aLUM+DKamupXs3w2tJJoqU+AkaE/+6vQxi/G/DPmIZFJJp9Dkb1kM03AZx8ADehDUZgsNxju3mPXZYIA==}
engines: {node: '>=20'}
- resolution: {integrity: sha512-sg8HqoTEulcbbbVXeg84u5UnlsQa8GS5QXMqjjYIhS4abEVVKIUwe0/l/UhrZdKaL/W5eWZNlbTeEIiOXTcsBQ==}
- peerDependencies:
- date-fns: ^3.0.0 || ^4.0.0
-
- resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==}
-
resolution: {integrity: sha512-YbwwqR/uYpeoP4pu043q+LTDLFBLApUP6VxRihdfNTqu4ubqMlGDLd6ErXhEgsyvY0K6nCs7nggYumAN+9uEuQ==}
@@ -3479,9 +3437,6 @@ packages:
resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
engines: {node: '>=0.8.x'}
- resolution: {integrity: sha512-qaeGN5bx63s/AXgQo8gj6fBkxge+OoLddLniox5qtLAEY5HSnuSlISXVPxnSae1dWblvTh4/HoMIB+mbMsvZzw==}
-
resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==}
engines: {node: '>=12.0.0'}
@@ -4329,12 +4284,6 @@ packages:
resolution: {integrity: sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==}
- resolution: {integrity: sha512-reo8Esw0p58liZwbUutC7meW24Xbn3EwNv91zReWKm2W4JPu+zfgJRn/F7aO0BFmvN+h2brA2M5lRvYqLq4kuA==}
- engines: {node: '>=20'}
- peerDependencies:
- vue: ^3.0.0
-
resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@@ -4822,9 +4771,6 @@ packages:
resolution: {integrity: sha512-bnnvJL28/Rtz/kz2+4wpBjHzWoEzXhVg/TE8BeVGJHUqE8THNIRnDxDWMktwM+qahvlRdvlLdsQfYe+cuqfZeA==}
- resolution: {integrity: sha512-2+SMxtG1PcsL0uyhkumlOU6Qo9TAQ/WyH7tthnPIOQB05/12jz9naq6GZ6iZ6ApVsO3rr2gsnTf3++OV63kE1Q==}
-
resolution: {integrity: sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==}
@@ -5055,9 +5001,6 @@ packages:
resolution: {integrity: sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==}
engines: {node: '>=20'}
- resolution: {integrity: sha512-M8RGFoKtZ8dF+iwJfAJTOH/SM4KluKOKRJpjCMhI8bG3qB74zrFoArKZ62ll0Fr3mqkMJiQOmWYkdYgDeITYQg==}
-
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
@@ -5200,11 +5143,6 @@ packages:
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
- resolution: {integrity: sha512-H9V1zGRLQZg9b+GdMk8MXDN2Lva0zx72MPahDKc30v+DtwKjfyOSXWRIX4t2mhDubM1H09gPhWeth/BJWPHGUw==}
- peerDependencies:
- vue: ^3.0.11
-
resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==}
@@ -5304,11 +5242,6 @@ packages:
resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==}
engines: {node: '>=0.10.0'}
- resolution: {integrity: sha512-iox0I3RZzxtKlcgYaStQYKEzWWGAduMmq+jS7OrNdQo1FgGfPMubGL3uGHOU9n97NIvfFDBGnpSvkWyb/NSn/Q==}
- peerDependencies:
- vue: ^3.0.0
-
resolution: {integrity: sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==}
engines: {node: '>=14.0.0'}
@@ -5391,11 +5324,6 @@ packages:
typescript:
optional: true
- resolution: {integrity: sha512-lXuMl+8gsBmruudfxnMF9HW4be8rFziylXFu1VHVNbLVhRTXXV4njvpRuJapD/8q+oFEMSfQMH16E/85VoWRyQ==}
- peerDependencies:
- vue: ^3.0.11
-
resolution: {integrity: sha512-Tm7jR1xTzBbPW+6y1tknKiEhz04Wf/1iZkcTJjSFcpNko43+dFW6+OOeQe9taJIug3NdfUAjFKgUSyQrIKaDvQ==}
@@ -6228,7 +6156,7 @@ snapshots:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.28.5
dependencies:
'@babel/runtime': 7.29.2
@@ -6239,7 +6167,6 @@ snapshots:
use-sync-external-store: 1.6.0([email protected])
optionalDependencies:
'@types/react': 19.2.14
- date-fns: 4.1.0
dependencies:
@@ -6624,14 +6551,6 @@ snapshots:
dependencies:
'@jridgewell/trace-mapping': 0.3.9
- dependencies:
- css-render: 0.15.14
-
- dependencies:
- vue: 3.5.34([email protected])
-
'@csstools/[email protected]': {}
'@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':
@@ -6695,8 +6614,6 @@ snapshots:
tslib: 2.8.1
optional: true
- '@emotion/[email protected]': {}
-
'@esbuild/[email protected]':
optional: true
@@ -7073,8 +6990,6 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5
- '@juggle/[email protected]': {}
-
optionalDependencies:
'@types/linkify-it': 3.0.5
@@ -8016,8 +7931,6 @@ snapshots:
-
@@ -8237,11 +8150,6 @@ snapshots:
- dependencies:
- '@emotion/hash': 0.8.0
- csstype: 3.0.11
-
dependencies:
mdn-data: 2.12.2
@@ -8258,8 +8166,6 @@ snapshots:
css-tree: 3.1.0
lru-cache: 11.2.4
-
@@ -8425,12 +8331,6 @@ snapshots:
whatwg-mimetype: 4.0.0
whatwg-url: 15.1.0
- dependencies:
- date-fns: 4.1.0
-
-
@@ -8743,8 +8643,6 @@ snapshots:
-
@@ -9777,28 +9675,6 @@ snapshots:
- dependencies:
- '@css-render/plugin-bem': 0.15.14([email protected])
- '@css-render/vue3-ssr': 0.15.14([email protected]([email protected]))
- '@types/lodash': 4.17.21
- '@types/lodash-es': 4.17.12
- async-validator: 4.2.5
- css-render: 0.15.14
- csstype: 3.2.3
- date-fns: 4.1.0
- date-fns-tz: 3.2.0([email protected])
- evtd: 0.2.4
- highlight.js: 11.11.1
- lodash: 4.17.23
- lodash-es: 4.18.1
- seemly: 0.3.10
- treemate: 0.3.11
- vue: 3.5.34([email protected])
-
@@ -10397,8 +10273,6 @@ snapshots:
-
@@ -10612,8 +10486,6 @@ snapshots:
dependencies:
punycode: 2.3.1
-
@@ -10763,11 +10635,6 @@ snapshots:
- dependencies:
- evtd: 0.2.4
- vue: 3.5.34([email protected])
-
dependencies:
'@types/unist': 3.0.3
@@ -10834,11 +10701,6 @@ snapshots:
- dependencies:
- evtd: 0.2.4
- vue: 3.5.34([email protected])
-
@@ -10922,17 +10784,6 @@ snapshots:
optionalDependencies:
typescript: 6.0.3
- dependencies:
- '@css-render/vue3-ssr': 0.15.14([email protected]([email protected]))
- '@juggle/resize-observer': 3.4.0
- css-render: 0.15.14
- evtd: 0.2.4
- seemly: 0.3.10
- vue: 3.5.34([email protected])
-
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 780f2f6346..fdb16f73c6 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -1,19 +1,12 @@
<template>
- <NConfigProvider
- :locale="generalLang"
- :date-locale="dateLang"
- :theme-overrides="themeOverrides"
- >
- <AuthContext>
- <router-view />
- </AuthContext>
- </NConfigProvider>
+ <AuthContext>
+ <router-view />
+ </AuthContext>
</template>
<script lang="ts" setup>
import { Code, ConnectError } from "@connectrpc/connect";
import { cloneDeep, isEqual } from "lodash-es";
-import { NConfigProvider } from "naive-ui";
import {
onErrorCaptured,
onMounted,
@@ -22,7 +15,6 @@ import {
watchEffect,
} from "vue";
import { useRoute, useRouter } from "vue-router";
-import { dateLang, generalLang, themeOverrides } from "../naive-ui.config";
import AuthContext from "./AuthContext.vue";
import { overrideAppProfile } from "./customAppProfile";
import { locale, t } from "./plugins/i18n";
diff --git a/frontend/src/AuthContext.vue b/frontend/src/AuthContext.vue
index d4938f74ea..2d731b6d3b 100644
--- a/frontend/src/AuthContext.vue
+++ b/frontend/src/AuthContext.vue
@@ -1,7 +1,11 @@
<template>
<slot v-if="ready"></slot>
<div v-else class="flex items-center justify-center h-screen">
- <BBSpin />
+ <Loader2
+ class="size-5 text-accent animate-spin"
+ aria-label="Loading"
+ role="status"
+ />
</div>
<template v-if="!isAuthRoute && authStore.isLoggedIn">
<!-- Session-expired surface lives in the React app
@@ -17,9 +21,9 @@
</template>
<script setup lang="ts">
+import { Loader2 } from "lucide-vue-next";
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
import { useRouter } from "vue-router";
-import { BBSpin } from "@/bbkit";
import ReactPageMount from "@/react/ReactPageMount.vue";
import { isAuthRelatedRoute } from "@/utils/auth";
import { t } from "./plugins/i18n";
diff --git a/frontend/src/assets/css/tailwind.css b/frontend/src/assets/css/tailwind.css
index 2b45544d40..36514c3edb 100644
--- a/frontend/src/assets/css/tailwind.css
+++ b/frontend/src/assets/css/tailwind.css
@@ -418,13 +418,6 @@
transform: scale(1);
}
-/* compatibility fixes for tailwindcss and naive-ui */
-.n-base-selection-input:focus,
-.n-base-selection-input-tag__input:focus,
-.n-input__input-el:focus {
- box-shadow: 0 0 0 0;
-}
-
/* SchemaDiagram screenshot capture: while `useScreenshot` flips this
attribute on <body>, any element marked `data-screenshot-hide` is
omitted from the html-to-image pass. Used for chrome affordances
diff --git a/frontend/src/bbkit/BBAlert.vue b/frontend/src/bbkit/BBAlert.vue
deleted file mode 100644
index fe7e26d08c..0000000000
--- a/frontend/src/bbkit/BBAlert.vue
+++ /dev/null
@@ -1,48 +0,0 @@
-<template>
- <NModal
- v-bind="$attrs"
- :show="show"
- preset="dialog"
- :type="type"
- :title="title"
- :content="description"
- :negative-text="cancelText"
- :positive-text="okText"
- :positive-button-props="positiveButtonProps"
- @update:show="$emit('update:show', $event)"
- @positive-click="() => $emit('ok')"
- @negative-click="() => $emit('cancel')"
- >
- <slot name="default" />
- </NModal>
-</template>
-
-<script lang="ts" setup>
-import { type ButtonProps, NModal } from "naive-ui";
-import { t } from "@/plugins/i18n";
-
-withDefaults(
- defineProps<{
- show: boolean;
- type: "info" | "warning" | "error";
- title: string;
- positiveButtonProps?: ButtonProps | undefined;
- description?: string;
- okText?: string;
- cancelText?: string;
- }>(),
- {
- type: "info",
- description: "",
- okText: () => t("common.ok"),
- cancelText: () => t("common.cancel"),
- payload: undefined,
- }
-);
-
-defineEmits<{
- (event: "ok"): void;
- (event: "cancel"): void;
- (event: "update:show", val: boolean): void;
-}>();
-</script>
diff --git a/frontend/src/bbkit/BBAttention.vue b/frontend/src/bbkit/BBAttention.vue
deleted file mode 100644
index 9938b07588..0000000000
--- a/frontend/src/bbkit/BBAttention.vue
+++ /dev/null
@@ -1,85 +0,0 @@
-<template>
- <NAlert :title="displayTitle" :type="type">
- <div
- class="flex flex-col justify-start items-start md:flex-row md:items-center md:justify-between"
- >
- <slot name="default">
- <div v-if="description" class="text-sm">
- <p class="whitespace-pre-wrap">
- {{ $te(description) ? $t(description) : description }}
- <a
- v-if="link"
- :href="link"
- target="__BLANK"
- class="inline-flex items-center normal-link ml-1 text-sm"
- >
- {{ $t("common.learn-more") }}
- <ExternalLinkIcon class="w-4 h-4 ml-1" />
- </a>
- </p>
- </div>
- </slot>
-
- <slot name="action">
- <div
- v-if="actionText != ''"
- class="flex items-center justify-end mt-4 md:mt-0 md:ml-2"
- >
- <NButton
- :type="buttonType"
- size="small"
- @click.prevent="$emit('click')"
- >
- {{ $t(actionText) }}
- </NButton>
- </div>
- </slot>
- </div>
- </NAlert>
-</template>
-
-<script lang="ts" setup>
-import { ExternalLinkIcon } from "lucide-vue-next";
-import { NAlert, NButton } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-
-const props = withDefaults(
- defineProps<{
- type: "default" | "info" | "success" | "warning" | "error";
- title?: string;
- description?: string;
- link?: string;
- actionText?: string;
- }>(),
- {
- title: "",
- description: "",
- link: undefined,
- actionText: "",
- }
-);
-
-defineEmits<{
- (event: "click"): void;
-}>();
-
-const { t, te } = useI18n();
-
-const displayTitle = computed(() => {
- const { title } = props;
- if (te(title)) return t(title);
- return title;
-});
-
-const buttonType = computed(() => {
- switch (props.type) {
- case "error":
- return "default";
- case "warning":
- return "default";
- default:
- return "primary";
- }
-});
-</script>
diff --git a/frontend/src/bbkit/BBButtonConfirm.vue b/frontend/src/bbkit/BBButtonConfirm.vue
deleted file mode 100644
index 63d3309be9..0000000000
--- a/frontend/src/bbkit/BBButtonConfirm.vue
+++ /dev/null
@@ -1,126 +0,0 @@
-<template>
- <NButton
- v-bind="$attrs"
- class="text-sm"
- :text="text"
- :size="size"
- :type="type === 'DELETE' ? 'error' : 'default'"
- :class="[!hideIcon && 'btn-icon']"
- @click.prevent.stop="
- () => {
- if (requireConfirm) {
- state.showModal = true;
- } else {
- $emit('confirm');
- }
- }
- "
- >
- <template v-if="!hideIcon">
- <component :is="alertIcon" class="w-4 h-4" />
- </template>
- <span v-if="buttonText" :class="[!hideIcon && 'ml-1']">
- {{ buttonText }}
- </span>
- </NButton>
- <BBAlert
- v-model:show="state.showModal"
- :type="alertType"
- :ok-text="okText"
- :title="confirmTitle"
- :description="confirmDescription"
- :positive-button-props="positiveButtonProps"
- :icon="() => alertIcon"
- @ok="
- () => {
- state.showModal = false;
- $emit('confirm');
- }
- "
- @cancel="state.showModal = false"
- >
- <slot name="default" />
- </BBAlert>
-</template>
-
-<script lang="tsx" setup>
-import { ArchiveIcon, Trash2Icon, Undo2Icon } from "lucide-vue-next";
-import { type ButtonProps, NButton } from "naive-ui";
-import { computed, reactive } from "vue";
-import { useI18n } from "vue-i18n";
-import BBAlert from "./BBAlert.vue";
-
-type BBButtonConfirmType = "NORMAL" | "DELETE" | "ARCHIVE" | "RESTORE";
-
-const props = withDefaults(
- defineProps<{
- type?: BBButtonConfirmType;
- text?: boolean;
- buttonText?: string;
- positiveButtonProps?: ButtonProps | undefined;
- requireConfirm?: boolean;
- okText?: string;
- confirmTitle?: string;
- confirmDescription?: string;
- hideIcon?: boolean;
- size?: "tiny" | "small" | "medium" | "large";
- }>(),
- {
- type: "DELETE",
- text: true, // Default to display as a text button.
- buttonText: "",
- requireConfirm: false,
- okText: "",
- confirmTitle: "",
- confirmDescription: "",
- hideIcon: false,
- size: "medium",
- }
-);
-
-defineEmits<{
- (event: "confirm"): void;
-}>();
-
-const { t } = useI18n();
-
-const state = reactive({
- showModal: false,
-});
-
-const alertType = computed(() => {
- switch (props.type) {
- case "DELETE":
- return "error";
- case "ARCHIVE":
- return "warning";
- default:
- return "info";
- }
-});
-
-const alertIcon = computed(() => {
- switch (props.type) {
- case "DELETE":
- return <Trash2Icon />;
- case "ARCHIVE":
- return <ArchiveIcon />;
- default:
- return <Undo2Icon />;
- }
-});
-
-const okText = computed(() => {
- return props.okText || t("common.delete");
-});
-const confirmTitle = computed(() => {
- return props.confirmTitle || t("bbkit.confirm-button.sure-to-delete");
-});
-const confirmDescription = computed(() => {
- return props.confirmDescription || t("bbkit.confirm-button.cannot-undo");
-});
-
-defineExpose({
- showAlert: () => (state.showModal = true),
-});
-</script>
diff --git a/frontend/src/bbkit/BBSpin.vue b/frontend/src/bbkit/BBSpin.vue
deleted file mode 100644
index b5a72c2d21..0000000000
--- a/frontend/src/bbkit/BBSpin.vue
+++ /dev/null
@@ -1,21 +0,0 @@
-<template>
- <NSpin
- v-bind="$attrs"
- :size="size"
- :stroke-width="25"
- :class="size === 'small' && 'w-5 h-5'"
- />
-</template>
-
-<script lang="ts" setup>
-import { NSpin } from "naive-ui";
-
-withDefaults(
- defineProps<{
- size?: "small" | "medium" | "large" | number;
- }>(),
- {
- size: "small",
- }
-);
-</script>
diff --git a/frontend/src/bbkit/BBTextField.vue b/frontend/src/bbkit/BBTextField.vue
deleted file mode 100644
index 7d37bb5c00..0000000000
--- a/frontend/src/bbkit/BBTextField.vue
+++ /dev/null
@@ -1,103 +0,0 @@
-<template>
- <NInput
- ref="inputField"
- v-bind="$attrs"
- v-model:value="state.text"
- :type="type"
- class="border-none!"
- :disabled="disabled"
- :clearable="clearable"
- :placeholder="placeholder"
- :autofocus="focusOnMount"
- :autosize="autosize"
- :status="state.hasError ? 'error' : undefined"
- @blur="onBlur"
- @focus="$emit('on-focus')"
- @update:value="onInput($event)"
- @keypress.enter="onPressEnter"
- @input="$emit('input', $event)"
- />
-</template>
-
-<script lang="ts" setup>
-import { isEmpty } from "lodash-es";
-import { NInput } from "naive-ui";
-import { reactive, ref, watch } from "vue";
-
-interface LocalState {
- text: string;
- hasError: boolean;
-}
-
-const props = withDefaults(
- defineProps<{
- autosize?: boolean | { minRows?: number; maxRows?: number };
- type?: "text" | "password" | "textarea";
- required?: boolean;
- value?: string;
- placeholder?: string;
- disabled?: boolean;
- focusOnMount?: boolean;
- endsOnEnter?: boolean;
- clearable?: boolean;
- }>(),
- {
- autosize: false,
- type: "text",
- required: false,
- value: "",
- placeholder: "",
- disabled: false,
- focusOnMount: false,
- endsOnEnter: false,
- clearable: false,
- }
-);
-
-const emit = defineEmits<{
- (event: "end-editing", value: string): void;
- (event: "update:value", value: string): void;
- (event: "input", value: string): void;
- (event: "on-focus"): void;
-}>();
-
-const inputField = ref();
-
-const state = reactive<LocalState>({
- text: props.value,
- hasError: false,
-});
-
-watch(
- () => props.value,
- (cur) => {
- state.text = cur;
- if (props.required && isEmpty(state.text.trim())) {
- state.hasError = true;
- } else {
- state.hasError = false;
- }
- }
-);
-
-const onBlur = () => {
- if (props.required && isEmpty(state.text.trim())) {
- state.hasError = true;
- } else {
- state.hasError = false;
- emit("end-editing", state.text);
- }
-};
-
-const onInput = (value: string) => {
- state.hasError = false;
- emit("update:value", value);
-};
-
-const onPressEnter = (e: Event) => {
- if (props.endsOnEnter) {
- const input = e.target as HTMLInputElement;
- input?.blur();
- }
-};
-</script>
diff --git a/frontend/src/bbkit/BBUtil.ts b/frontend/src/bbkit/BBUtil.ts
deleted file mode 100644
index cdc4e010fc..0000000000
--- a/frontend/src/bbkit/BBUtil.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export function hashCode(s: string): number {
- let hash = 0;
- for (let i = 0; i < s.length; i++) {
- hash = (hash << 5) - hash + s.charCodeAt(i);
- hash |= 0; // Convert to 32bit integer
- }
- return hash;
-}
diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.ts
deleted file mode 100644
index 02c0dd1190..0000000000
--- a/frontend/src/bbkit/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import BBAlert from "./BBAlert.vue";
-import BBAttention from "./BBAttention.vue";
-import BBButtonConfirm from "./BBButtonConfirm.vue";
-import BBSpin from "./BBSpin.vue";
-import BBTextField from "./BBTextField.vue";
-
-export * from "./types";
-
-export { BBAlert, BBAttention, BBButtonConfirm, BBSpin, BBTextField };
diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.ts
deleted file mode 100644
index eea861339f..0000000000
--- a/frontend/src/bbkit/types.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export type BBAvatarSizeType =
- | "MINI"
- | "TINY"
- | "SMALL"
- | "NORMAL"
- | "LARGE"
- | "HUGE";
diff --git a/frontend/src/composables/useCancelableTimeout.ts b/frontend/src/composables/useCancelableTimeout.ts
deleted file mode 100644
index 2293267fde..0000000000
--- a/frontend/src/composables/useCancelableTimeout.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { useTimestamp } from "@vueuse/core";
-import { computed, ref, unref } from "vue";
-import type { MaybeRef } from "@/types";
-
-export const useCancelableTimeout = (timeoutMS: MaybeRef<number>) => {
- const running = ref(false);
- const startTS = ref(0);
- const nowTS = useTimestamp();
-
- const elapsedMS = computed(() => {
- if (!running.value) return 0;
- return nowTS.value - startTS.value;
- });
-
- const expired = computed(() => {
- if (!running.value) return false;
- return elapsedMS.value > unref(timeoutMS);
- });
-
- const start = () => {
- startTS.value = Date.now();
- running.value = true;
- };
-
- const stop = () => {
- running.value = false;
- };
-
- return { start, stop, elapsedMS, expired };
-};
diff --git a/frontend/src/composables/useCurrentTimestamp.ts b/frontend/src/composables/useCurrentTimestamp.ts
deleted file mode 100644
index cf3bb9a5ee..0000000000
--- a/frontend/src/composables/useCurrentTimestamp.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { useIntervalFn } from "@vueuse/core";
-import { ref } from "vue";
-
-export const useCurrentTimestamp = () => {
- // Update every 1 second instead of every frame
- const currentTsInMS = ref(Date.now());
- const { pause, resume } = useIntervalFn(() => {
- currentTsInMS.value = Date.now();
- }, 1000);
-
- return {
- currentTsInMS,
- pause,
- resume,
- };
-};
diff --git a/frontend/src/composables/useDelayedValue.ts b/frontend/src/composables/useDelayedValue.ts
deleted file mode 100644
index 27bfb60dfb..0000000000
--- a/frontend/src/composables/useDelayedValue.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import type { Ref } from "vue";
-import { reactive, ref } from "vue";
-
-export type UseDelayedValueOptions = {
- delayBefore?: number;
- delayAfter?: number;
-};
-
-export const useDelayedValue = <T>(
- initialValue: T,
- options: UseDelayedValueOptions = {}
-) => {
- const { delayBefore = 0, delayAfter = 0 } = options;
- const valueRef = ref(initialValue) as Ref<T>;
- const state = reactive<{
- timer: ReturnType<typeof setTimeout> | undefined;
- }>({
- timer: undefined,
- });
- const cancel = () => {
- if (state.timer) {
- clearTimeout(state.timer);
- state.timer = undefined;
- }
- };
- const update = (
- value: T,
- direction: "before" | "after",
- overrideDelay: number | undefined = undefined
- ) => {
- const delay =
- overrideDelay ?? (direction === "before" ? delayBefore : delayAfter);
- cancel();
- if (delay) {
- state.timer = setTimeout(() => {
- valueRef.value = value;
- }, delay);
- } else {
- valueRef.value = value;
- }
- };
-
- return {
- value: valueRef,
- update,
- };
-};
diff --git a/frontend/src/composables/useElementVisibilityInScrollParent.ts b/frontend/src/composables/useElementVisibilityInScrollParent.ts
deleted file mode 100644
index 57f95b061f..0000000000
--- a/frontend/src/composables/useElementVisibilityInScrollParent.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { MaybeElementRef } from "@vueuse/core";
-import { unrefElement, useElementVisibility } from "@vueuse/core";
-import getScrollParent from "scrollparent";
-import { computed } from "vue";
-
-export const useElementVisibilityInScrollParent = (
- element: MaybeElementRef
-) => {
- const scrollTarget = computed((): HTMLElement | null => {
- const elem = unrefElement(element);
- if (!elem) {
- return null;
- }
- return getScrollParent(elem);
- });
-
- return useElementVisibility(element, { scrollTarget });
-};
diff --git a/frontend/src/composables/useEmitteryEventListener.ts b/frontend/src/composables/useEmitteryEventListener.ts
deleted file mode 100644
index 2a4455aa1f..0000000000
--- a/frontend/src/composables/useEmitteryEventListener.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import type Emittery from "emittery";
-import type {
- DatalessEventNames,
- EventName,
- OmnipresentEventData,
-} from "emittery";
-import { onUnmounted } from "vue";
-
-export const useEmitteryEventListener = <
- EventData = Record<EventName, unknown>,
- AllEventData = EventData & OmnipresentEventData,
- DatalessEvents = DatalessEventNames<EventData>,
- E extends keyof AllEventData = keyof AllEventData,
->(
- target: Emittery<EventData, AllEventData, DatalessEvents>,
- event: E | readonly E[],
- listener: (eventData: AllEventData[E]) => void | Promise<void>
-) => {
- const unsubscribe = target.on(event, listener);
-
- onUnmounted(() => {
- unsubscribe();
- });
-};
diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.ts
deleted file mode 100644
index 9eccd29f49..0000000000
--- a/frontend/src/composables/useExecuteSQL.ts
+++ /dev/null
@@ -1,368 +0,0 @@
-import { create } from "@bufbuild/protobuf";
-import { Code } from "@connectrpc/connect";
-import { cloneDeep, isEmpty } from "lodash-es";
-import { v4 as uuidv4 } from "uuid";
-import { markRaw, reactive } from "vue";
-import { t } from "@/plugins/i18n";
-import { useSQLEditorStore as useSQLEditorReactStore } from "@/react/stores/sqlEditor";
-import { useSQLEditorVueState } from "@/react/stores/sqlEditor/editor-vue-state";
-import { useSQLEditorTabStore } from "@/react/stores/sqlEditor/tab-vue-state";
-import {
- hasFeature,
- pushNotification,
- useDatabaseV1Store,
- useDBGroupStore,
- useSQLStore,
-} from "@/store";
-import type {
- BBNotificationStyle,
- QueryContextStatus,
- SQLEditorDatabaseQueryContext,
- SQLEditorQueryParams,
- SQLResultSetV1,
-} from "@/types";
-import { isValidDatabaseName } from "@/types";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import { DatabaseGroupView } from "@/types/proto-es/v1/database_group_service_pb";
-import type { Database } from "@/types/proto-es/v1/database_service_pb";
-import {
- type QueryOption,
- QueryOptionSchema,
- QueryRequestSchema,
- QueryResult_CommandError_Type,
-} from "@/types/proto-es/v1/sql_service_pb";
-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
-import {
- getDatabaseProject,
- getInstanceResource,
- getValidDataSourceByPolicy,
- hasPermissionToCreateChangeDatabaseIssueInProject,
-} from "@/utils";
-import { sqlEditorEvents } from "@/views/sql-editor/events";
-import { flattenNoSQLResult } from "./utils";
-
-// QUERY_INTERVAL_LIMIT is the minimal gap between two queries
-const QUERY_INTERVAL_LIMIT = 1000;
-
-const useExecuteSQL = () => {
- const state = reactive<{
- lastQueryTime?: number;
- }>({});
- const dbGroupStore = useDBGroupStore();
- const dbStore = useDatabaseV1Store();
- const tabStore = useSQLEditorTabStore();
- const sqlEditorStore = useSQLEditorVueState();
-
- const notify = (
- type: BBNotificationStyle,
- title: string,
- description?: string
- ) => {
- pushNotification({
- module: "bytebase",
- style: type,
- title,
- description,
- });
- };
-
- const preflight = async (params: SQLEditorQueryParams) => {
- state.lastQueryTime = Date.now();
-
- const tab = tabStore.currentTab;
- if (!tab) {
- return false;
- }
-
- if (tabStore.isDisconnected) {
- notify("CRITICAL", t("sql-editor.select-connection"));
- return false;
- }
-
- if (isEmpty(params.statement)) {
- notify("CRITICAL", t("sql-editor.notify-empty-statement"));
- return false;
- }
-
- if (!tab.databaseQueryContexts) {
- tab.databaseQueryContexts = new Map();
- }
- return true;
- };
-
- const changeContextStatus = (
- ctx: SQLEditorDatabaseQueryContext,
- status: QueryContextStatus
- ) => {
- switch (status) {
- case "EXECUTING":
- ctx.abortController = new AbortController();
- ctx.beginTimestampMS = Date.now();
- break;
- case "CANCELLED":
- ctx.abortController?.abort();
- break;
- case "DONE":
- break;
- }
- ctx.status = status;
- };
-
- const preExecute = async (params: SQLEditorQueryParams) => {
- const now = Date.now();
- if (
- state.lastQueryTime &&
- now - state.lastQueryTime < QUERY_INTERVAL_LIMIT
- ) {
- return;
- }
-
- const tab = tabStore.currentTab;
- if (!tab) {
- return;
- }
- const { mode } = tab;
- if (mode === "ADMIN") {
- return;
- }
-
- if (!preflight(params)) {
- return;
- }
-
- if (!isValidDatabaseName(params.connection.database)) {
- return;
- }
-
- const databaseQueryContexts = tab.databaseQueryContexts ?? new Map();
- const batchQueryDatabaseSet = new Set<string /* database name */>([
- params.connection.database,
- ]);
-
- // Check if the user selects multiple databases to query.
- if (tab.batchQueryContext && hasFeature(PlanFeature.FEATURE_BATCH_QUERY)) {
- const { databases = [], databaseGroups = [] } = tab.batchQueryContext;
- for (const databaseResourceName of databases) {
- if (!isValidDatabaseName(databaseResourceName)) {
- continue;
- }
- if (batchQueryDatabaseSet.has(databaseResourceName)) {
- continue;
- }
- batchQueryDatabaseSet.add(databaseResourceName);
- }
-
- if (hasFeature(PlanFeature.FEATURE_DATABASE_GROUPS)) {
- for (const databaseGroupName of databaseGroups) {
- try {
- const databaseGroup = await dbGroupStore.getOrFetchDBGroupByName(
- databaseGroupName,
- {
- skipCache: false,
- silent: true,
- view: DatabaseGroupView.FULL,
- }
- );
- for (const matchedDatabase of databaseGroup.matchedDatabases) {
- if (!isValidDatabaseName(matchedDatabase.name)) {
- continue;
- }
- if (batchQueryDatabaseSet.has(matchedDatabase.name)) {
- continue;
- }
- batchQueryDatabaseSet.add(matchedDatabase.name);
- }
- } catch {
- // skip
- }
- }
- }
- }
-
- for (const [database, contexts] of databaseQueryContexts.entries()) {
- if (!batchQueryDatabaseSet.has(database)) {
- for (const context of contexts) {
- changeContextStatus(context, "CANCELLED");
- }
- databaseQueryContexts.delete(database);
- }
- }
-
- const isBatch = batchQueryDatabaseSet.size > 1;
- await dbStore.batchGetOrFetchDatabases([...batchQueryDatabaseSet.keys()]);
-
- for (const databaseName of batchQueryDatabaseSet.values()) {
- if (!databaseQueryContexts.has(databaseName)) {
- databaseQueryContexts.set(databaseName, []);
- }
-
- if ((databaseQueryContexts.get(databaseName)?.length ?? 0) >= 50) {
- const ctx = databaseQueryContexts.get(databaseName)?.pop();
- if (ctx) {
- changeContextStatus(ctx, "CANCELLED");
- }
- }
-
- const database = dbStore.getDatabaseByName(databaseName);
- const resolvedDataSourceId =
- isBatch && tab.batchQueryContext.dataSourceType
- ? ((await getValidDataSourceByPolicy(
- database,
- tab.batchQueryContext.dataSourceType
- )) ?? "")
- : params.connection.dataSourceId;
- const context: SQLEditorDatabaseQueryContext = {
- id: uuidv4(),
- params: Object.assign(cloneDeep(params), {
- connection: {
- ...params.connection,
- ...(resolvedDataSourceId
- ? { dataSourceId: resolvedDataSourceId }
- : {}),
- },
- }),
- status: "PENDING",
- };
- databaseQueryContexts.get(databaseName)?.unshift(context);
- }
- };
-
- const runQuery = async (
- database: Database,
- context: SQLEditorDatabaseQueryContext
- ) => {
- if (context.status === "EXECUTING") {
- notify("INFO", t("common.tips"), t("sql-editor.can-not-execute-query"));
- return;
- }
-
- if (!isValidDatabaseName(database.name)) {
- notify(
- "CRITICAL",
- t("common.error"),
- t("sql-editor.invalid-database", { database: database.name })
- );
- return;
- }
-
- changeContextStatus(context, "EXECUTING");
-
- const finish = (resultSet: SQLResultSetV1) => {
- context.resultSet = resultSet;
- changeContextStatus(context, "DONE");
- };
-
- const { abortController } = context;
- if (!abortController) {
- return;
- }
- const sqlStore = useSQLStore();
-
- const dataSourceId = context.params.connection.dataSourceId;
-
- if (abortController.signal.aborted) {
- // Once any one of the batch queries is aborted, don't go further
- // and mock an "Aborted" result for the rest queries.
- return finish({
- error: t("sql-editor.request-aborted"),
- results: [],
- status: Code.Aborted,
- });
- }
-
- const queryOption = create(QueryOptionSchema, {
- ...(context.params.queryOption ?? ({} as QueryOption)),
- redisRunCommandsOn: sqlEditorStore.redisCommandOption,
- });
- const resultSet = await sqlStore.query(
- create(QueryRequestSchema, {
- name: database.name,
- ...(dataSourceId ? { dataSourceId } : {}),
- statement: context.params.statement,
- limit: context.params.limit ?? sqlEditorStore.resultRowsLimit,
- explain: context.params.explain,
- schema: context.params.connection.schema,
- container: context.params.connection.table,
- queryOption: queryOption,
- }),
- abortController.signal
- );
-
- // Merge the freshly-executed statement into the history cache
- // WITHOUT resetting pagination — the user keeps whatever pages
- // they had already loaded ("Load more"d), and the new entry just
- // gets prepended. After the cache update lands, emit the event so
- // the HistoryPane re-renders from it (store reactivity alone
- // doesn't reliably propagate into the React `useVueState`
- // subscriber, so we trigger the re-render explicitly).
- useSQLEditorReactStore
- .getState()
- .mergeLatest({
- project: sqlEditorStore.project,
- database: database.name,
- })
- .catch(() => {
- /* nothing */
- })
- .finally(() => {
- void sqlEditorEvents.emit("query-executed");
- });
-
- const instanceResource = getInstanceResource(database);
- if (instanceResource.engine === Engine.COSMOSDB) {
- flattenNoSQLResult(resultSet);
- }
-
- if (isDisallowChangeDatabaseError(resultSet)) {
- // Show a tips to navigate to issue creation
- // if the user is allowed to create issue in the project.
- if (
- hasPermissionToCreateChangeDatabaseIssueInProject(
- getDatabaseProject(database)
- )
- ) {
- sqlEditorStore.isShowExecutingHint = true;
- sqlEditorStore.executingHintDatabase = database;
- }
- return finish(resultSet);
- }
-
- return finish(markRaw(resultSet));
- };
-
- const execute = async (params: SQLEditorQueryParams) => {
- return preExecute(params);
- };
-
- return {
- execute,
- runQuery,
- };
-};
-
-export const isDisallowChangeDatabaseError = (resultSet: SQLResultSetV1) => {
- const isCommandError = resultSet.results.some((result) => {
- return (
- result.detailedError.case === "commandError" &&
- [
- QueryResult_CommandError_Type.DDL,
- QueryResult_CommandError_Type.DML,
- QueryResult_CommandError_Type.NON_READ_ONLY,
- ].includes(result.detailedError.value.commandType)
- );
- });
- if (isCommandError) {
- return true;
- }
-
- return resultSet.results.some((result) => {
- if (result.detailedError.case === "permissionDenied") {
- return result.detailedError.value.requiredPermissions.some((p) => {
- return p === "bb.sql.ddl" || p === "bb.sql.dml";
- });
- }
- return false;
- });
-};
-
-export { useExecuteSQL };
diff --git a/frontend/src/composables/useLanguage.ts b/frontend/src/composables/useLanguage.ts
deleted file mode 100644
index 585ef74c75..0000000000
--- a/frontend/src/composables/useLanguage.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { useLocalStorage } from "@vueuse/core";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import {
- emitStorageChangedEvent,
- STORAGE_KEY_LANGUAGE,
- setDocumentTitle,
-} from "@/utils";
-
-/**
- * Language hook for i18n
- * @returns
- */
-const useLanguage = () => {
- const { availableLocales, locale } = useI18n();
- const currentRoute = useRouter().currentRoute;
- const storage = useLocalStorage<string>(STORAGE_KEY_LANGUAGE, "");
-
- const setLocale = (lang: string) => {
- locale.value = lang;
- storage.value = lang;
- emitStorageChangedEvent();
-
- if (currentRoute.value.meta.title) {
- setDocumentTitle(currentRoute.value.meta.title(currentRoute.value));
- }
- };
-
- const toggleLocales = () => {
- const locales = availableLocales;
- const nextLocale =
- locales[(locales.indexOf(locale.value) + 1) % locales.length];
- setLocale(nextLocale);
- };
-
- return {
- locale,
- availableLocales,
- setLocale,
- toggleLocales,
- };
-};
-
-export { useLanguage };
diff --git a/frontend/src/composables/useLastActivity.ts b/frontend/src/composables/useLastActivity.ts
deleted file mode 100644
index 110ee4bac8..0000000000
--- a/frontend/src/composables/useLastActivity.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { computed } from "vue";
-import { useCurrentUserV1 } from "@/store";
-import { storageKeyLastActivity, useDynamicLocalStorage } from "@/utils";
-
-export const useLastActivity = () => {
- const currentUser = useCurrentUserV1();
- const lastActivityTs = useDynamicLocalStorage<number>(
- computed(() => storageKeyLastActivity(currentUser.value.email)),
- Date.now()
- );
- return { lastActivityTs };
-};
diff --git a/frontend/src/composables/useProgressivePoll.ts b/frontend/src/composables/useProgressivePoll.ts
deleted file mode 100644
index a10d5bc5e5..0000000000
--- a/frontend/src/composables/useProgressivePoll.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import { random } from "lodash-es";
-import { onBeforeUnmount, reactive, unref } from "vue";
-import type { MaybeRef } from "@/types";
-import { minmax } from "@/utils";
-
-type ProgressivePollOptions = {
- interval: {
- min: number;
- max: number;
- growth: number;
- jitter: number;
- };
-};
-
-type ProgressivePollState = {
- timer: ReturnType<typeof setTimeout> | undefined;
-};
-
-// Poll with time interval increasing progressively
-// e.g., 1s, 2s, 4s, 8s, 16s, 30s, 30s, 30s, 30s...
-export const useProgressivePoll = (
- tick: () => void,
- options: MaybeRef<ProgressivePollOptions>
-) => {
- const state = reactive<ProgressivePollState>({
- timer: undefined,
- });
-
- const stop = () => {
- if (!state.timer) return;
- clearTimeout(state.timer);
- state.timer = undefined;
- };
-
- const poll = (interval: number) => {
- stop();
-
- const { min, max, growth, jitter } = unref(options).interval;
- const int = minmax(interval + random(-jitter, jitter), min, max);
-
- state.timer = setTimeout(() => {
- tick();
-
- const next = Math.min(int * growth, max);
- poll(next);
- }, int);
- };
-
- const start = () => {
- poll(unref(options).interval.min);
- };
-
- onBeforeUnmount(stop);
-
- return { stop, start, restart: start };
-};
diff --git a/frontend/src/composables/useReleaseCategories.ts b/frontend/src/composables/useReleaseCategories.ts
deleted file mode 100644
index 8040de0f01..0000000000
--- a/frontend/src/composables/useReleaseCategories.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { create } from "@bufbuild/protobuf";
-import { computed, type Ref, ref, watch } from "vue";
-import { releaseServiceClientConnect } from "@/connect";
-import { ListReleaseCategoriesRequestSchema } from "@/types/proto-es/v1/release_service_pb";
-
-export const useReleaseCategories = (projectName: Ref<string>) => {
- const categories = ref<string[]>([]);
- const loading = ref(false);
-
- const fetchCategories = async () => {
- if (!projectName.value) {
- categories.value = [];
- return;
- }
-
- loading.value = true;
- try {
- const request = create(ListReleaseCategoriesRequestSchema, {
- parent: projectName.value,
- });
- const response =
- await releaseServiceClientConnect.listReleaseCategories(request);
- categories.value = response.categories;
- } catch (error) {
- console.error("Failed to fetch release categories:", error);
- categories.value = [];
- } finally {
- loading.value = false;
- }
- };
-
- watch(
- () => projectName.value,
- () => {
- fetchCategories();
- },
- { immediate: true }
- );
-
- return {
- categories: computed(() => categories.value),
- loading: computed(() => loading.value),
- refresh: fetchCategories,
- };
-};
diff --git a/frontend/src/composables/useRouteChangeGuard.ts b/frontend/src/composables/useRouteChangeGuard.ts
deleted file mode 100644
index b1ea103061..0000000000
--- a/frontend/src/composables/useRouteChangeGuard.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { useEventListener } from "@vueuse/core";
-import { type Ref } from "vue";
-import { onBeforeRouteLeave } from "vue-router";
-import { t } from "@/plugins/i18n";
-
-export const useRouteChangeGuard = (
- isEditing: Ref<boolean>,
- content?: string
-) => {
- useEventListener("beforeunload", (e) => {
- if (!isEditing.value) {
- return;
- }
- e.returnValue = content ?? t("common.leave-without-saving");
- return e.returnValue;
- });
-
- onBeforeRouteLeave((to, from, next) => {
- if (isEditing.value) {
- if (!window.confirm(content ?? t("common.leave-without-saving"))) {
- return;
- }
- }
- next();
- });
-};
diff --git a/frontend/src/composables/useScrollState.ts b/frontend/src/composables/useScrollState.ts
deleted file mode 100644
index 2861581462..0000000000
--- a/frontend/src/composables/useScrollState.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { useEventListener, useScroll } from "@vueuse/core";
-import type { Ref } from "vue";
-import { computed, ref, unref, watchEffect } from "vue";
-import type { MaybeRef } from "@/types";
-
-export const useVerticalScrollState = (
- elemRef: Ref<HTMLElement | undefined>,
- maxHeight: MaybeRef<number>
-) => {
- const height = ref(0);
- const updateHeight = () => {
- const elem = elemRef.value;
- if (!elem) {
- height.value = 0;
- return;
- }
- height.value = elem.scrollHeight;
- };
- watchEffect(updateHeight);
- useEventListener("resize", updateHeight);
- const show = computed(() => height.value > unref(maxHeight));
-
- const scroll = useScroll(elemRef);
- const top = computed(() => {
- return show.value && !scroll.arrivedState.top;
- });
- const bottom = computed(() => {
- return show.value && !scroll.arrivedState.bottom;
- });
- return computed(() => ({
- top: top.value,
- bottom: bottom.value,
- }));
-};
diff --git a/frontend/src/composables/useWideScreen.ts b/frontend/src/composables/useWideScreen.ts
deleted file mode 100644
index 9da0e6270e..0000000000
--- a/frontend/src/composables/useWideScreen.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { useWindowSize } from "@vueuse/core";
-import { computed } from "vue";
-import { TailwindBreakpoints } from "@/utils";
-
-export const useWideScreen = (breakpoint: number = TailwindBreakpoints.md) => {
- const { width } = useWindowSize();
- return computed(() => width.value >= breakpoint);
-};
diff --git a/frontend/src/connect/index.ts b/frontend/src/connect/index.ts
index 88c12ca4dc..d483955142 100644
--- a/frontend/src/connect/index.ts
+++ b/frontend/src/connect/index.ts
@@ -37,7 +37,7 @@ import {
activeInterceptor,
} from "./middlewares";
import { protobufJsonRegistry } from "@/types/protobufJsonRegistry";
-import { isDev } from "@/utils";
+import { isDev } from "@/utils/util";
const address = import.meta.env.BB_GRPC_LOCAL || window.location.origin;
diff --git a/frontend/src/connect/middlewares/activeInterceptorMiddleware.ts b/frontend/src/connect/middlewares/activeInterceptorMiddleware.ts
index 5407682da6..f2c14254bd 100644
--- a/frontend/src/connect/middlewares/activeInterceptorMiddleware.ts
+++ b/frontend/src/connect/middlewares/activeInterceptorMiddleware.ts
@@ -1,14 +1,20 @@
import { type Interceptor } from "@connectrpc/connect";
-import { useLastActivity } from "@/composables/useLastActivity";
import { useCurrentUserV1 } from "@/store";
+import { storageKeyLastActivity } from "@/utils/storage-keys";
export const activeInterceptor: Interceptor = (next) => async (req) => {
const resp = await next(req);
const me = useCurrentUserV1();
// ignore the GetCurrentUser method, it's automatically called by the script.
if (me.value && req.method.name !== "GetCurrentUser") {
- const { lastActivityTs } = useLastActivity();
- lastActivityTs.value = Date.now();
+ try {
+ localStorage.setItem(
+ storageKeyLastActivity(me.value.email),
+ String(Date.now())
+ );
+ } catch {
+ // ignore quota / disabled-storage errors
+ }
}
return resp;
};
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index 339f30f111..6cd63cd922 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -8,7 +8,6 @@ import "./assets/css/tailwind.css";
import dayjs from "./plugins/dayjs";
import highlight from "./plugins/highlight";
import i18n from "./plugins/i18n";
-import NaiveUI from "./plugins/naive-ui";
import "./polyfill";
// Side-effect: registers the bb.vue-notification window listener and
// constructs the toastManager singleton. Must load before any auth/error
@@ -61,7 +60,7 @@ migrateStorageKeys();
}
await Promise.all(initPromises);
- app.use(router).use(highlight).use(i18n).use(NaiveUI);
+ app.use(router).use(highlight).use(i18n);
app.mount("#app");
diff --git a/frontend/src/plugins/ai/logic/useDynamicSuggestions.ts b/frontend/src/plugins/ai/logic/useDynamicSuggestions.ts
index 675d760370..778ca1fb87 100644
--- a/frontend/src/plugins/ai/logic/useDynamicSuggestions.ts
+++ b/frontend/src/plugins/ai/logic/useDynamicSuggestions.ts
@@ -2,7 +2,6 @@ import { create as createProto } from "@bufbuild/protobuf";
import { createContextValues } from "@connectrpc/connect";
import { head, uniq, values } from "lodash-es";
import { computed, type MaybeRefOrGetter, reactive, ref, toValue } from "vue";
-import { hashCode } from "@/bbkit/BBUtil";
import { sqlServiceClientConnect } from "@/connect";
import { silentContextKey } from "@/connect/context-key";
import type { Engine } from "@/types/proto-es/v1/common_pb";
@@ -13,6 +12,7 @@ import {
AICompletionRequestSchema,
} from "@/types/proto-es/v1/sql_service_pb";
import { storageKeyAiSuggestions } from "@/utils";
+import { hashCode } from "@/utils/string";
import * as promptUtils from "./prompt";
export type SuggestionContext = {
diff --git a/frontend/src/plugins/ai/react/ChatView/EmptyView.tsx b/frontend/src/plugins/ai/react/ChatView/EmptyView.tsx
index e6d341c133..61eb69b8b4 100644
--- a/frontend/src/plugins/ai/react/ChatView/EmptyView.tsx
+++ b/frontend/src/plugins/ai/react/ChatView/EmptyView.tsx
@@ -2,11 +2,8 @@ import { Inbox } from "lucide-react";
import { useTranslation } from "react-i18next";
/**
- * React port of `plugins/ai/components/ChatView/EmptyView.vue`.
* Empty-state placeholder shown when a `mode="VIEW"` conversation has
- * no messages. Replaces naive-ui's `NEmpty` with a simple inline icon +
- * caption — the only place in the AI plugin that used `NEmpty` so
- * keeping naive-ui just for this would be wasteful.
+ * no messages.
*/
export function EmptyView() {
const { t } = useTranslation();
diff --git a/frontend/src/plugins/naive-ui.ts b/frontend/src/plugins/naive-ui.ts
deleted file mode 100644
index 4a503a689a..0000000000
--- a/frontend/src/plugins/naive-ui.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import {
- create,
- NAlert,
- NButton,
- NButtonGroup,
- NCascader,
- NDataTable,
- NDropdown,
- NInput,
- NInputGroup,
- NInputGroupLabel,
- NMessageProvider,
- NModal,
- NPopconfirm,
- NPopover,
- NPopselect,
- NRadio,
- NRadioGroup,
- NSelect,
- NSpace,
- NTab,
- NTabPane,
- NTabs,
- NTag,
- NTooltip,
- NTree,
- NUpload,
- NUploadDragger,
-} from "naive-ui";
-import type { App } from "vue";
-
-const naive = create({
- components: [
- NAlert,
- NButton,
- NButtonGroup,
- NCascader,
- NDataTable,
- NDropdown,
- NInput,
- NInputGroup,
- NInputGroupLabel,
- NMessageProvider,
- NModal,
- NPopover,
- NPopselect,
- NPopconfirm,
- NRadio,
- NRadioGroup,
- NSpace,
- NTab,
- NTabs,
- NTabPane,
- NTag,
- NTooltip,
- NTree,
- NSelect,
- NUpload,
- NUploadDragger,
- ],
-});
-
-const install = (app: App) => {
- app.use(naive);
- reAppendMetaTag("naive-ui-style");
- reAppendMetaTag("vueuc-style");
-};
-
-export default install;
-
-const reAppendMetaTag = (name: string) => {
- const meta = document.createElement("meta");
- meta.name = name;
- document.head.appendChild(meta);
-};
diff --git a/frontend/src/react/components/SchemaDiagram/ER/TableNode.tsx b/frontend/src/react/components/SchemaDiagram/ER/TableNode.tsx
index 60a70de679..ec75f496cf 100644
--- a/frontend/src/react/components/SchemaDiagram/ER/TableNode.tsx
+++ b/frontend/src/react/components/SchemaDiagram/ER/TableNode.tsx
@@ -1,12 +1,12 @@
import { Diamond, Key, Pencil } from "lucide-react";
import { useCallback, useMemo } from "react";
-import { hashCode } from "@/bbkit/BBUtil";
import { cn } from "@/react/lib/utils";
import type {
ColumnMetadata,
SchemaMetadata,
TableMetadata,
} from "@/types/proto-es/v1/database_service_pb";
+import { hashCode } from "@/utils/string";
import { useGeometry, useSchemaDiagramContext } from "../common/context";
import { FocusButton } from "../common/FocusButton";
import { isIndex, isPrimaryKey } from "../common/schema";
diff --git a/frontend/src/react/components/SchemaEditorLite/Aside/tree-builder.ts b/frontend/src/react/components/SchemaEditorLite/Aside/tree-builder.ts
index 7a72a233d5..32ee5d2e9e 100644
--- a/frontend/src/react/components/SchemaEditorLite/Aside/tree-builder.ts
+++ b/frontend/src/react/components/SchemaEditorLite/Aside/tree-builder.ts
@@ -23,7 +23,7 @@ import {
} from "../core/spec";
import type { EditTarget } from "../types";
-// Tree node types — framework-agnostic (no naive-ui TreeOption dependency).
+// Tree node types — framework-agnostic.
// react-arborist uses `id` + `name` + `children` by default,
// but we keep `key` + `label` + `children` and map in the component.
diff --git a/frontend/src/react/components/sql-editor/AccessGrantItem.tsx b/frontend/src/react/components/sql-editor/AccessGrantItem.tsx
index 6b0524bd12..131f1ba36f 100644
--- a/frontend/src/react/components/sql-editor/AccessGrantItem.tsx
+++ b/frontend/src/react/components/sql-editor/AccessGrantItem.tsx
@@ -13,7 +13,6 @@ import {
getAccessGrantStatusTagType,
} from "@/utils/accessGrant";
-// Map naive-ui tag type to shadcn Badge variant.
function mapTagTypeToBadgeVariant(
tagType: "success" | "warning" | "error" | "default"
): "default" | "secondary" | "destructive" | "warning" | "success" {
diff --git a/frontend/src/react/components/sql-editor/Panels/FunctionsPanel/FunctionsPanel.tsx b/frontend/src/react/components/sql-editor/Panels/FunctionsPanel/FunctionsPanel.tsx
index 216d61d789..37d452777c 100644
--- a/frontend/src/react/components/sql-editor/Panels/FunctionsPanel/FunctionsPanel.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/FunctionsPanel/FunctionsPanel.tsx
@@ -2,12 +2,12 @@ import { ChevronLeft, FunctionSquare } from "lucide-react";
import { useState } from "react";
import { Button } from "@/react/components/ui/button";
import { useVueState } from "@/react/hooks/useVueState";
-import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
-import { useDBSchemaV1Store } from "@/store";
import {
extractKeyWithPosition,
keyWithPosition,
-} from "@/views/sql-editor/EditorCommon/utils";
+} from "@/react/lib/keyWithPosition";
+import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
+import { useDBSchemaV1Store } from "@/store";
import { CodeViewer } from "../common/CodeViewer";
import { PanelSearchBox } from "../common/PanelSearchBox";
import { useViewStateNav } from "../common/useViewStateNav";
diff --git a/frontend/src/react/components/sql-editor/Panels/FunctionsPanel/FunctionsTable.tsx b/frontend/src/react/components/sql-editor/Panels/FunctionsPanel/FunctionsTable.tsx
index cf459a374a..e6a6591976 100644
--- a/frontend/src/react/components/sql-editor/Panels/FunctionsPanel/FunctionsTable.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/FunctionsPanel/FunctionsTable.tsx
@@ -9,12 +9,12 @@ import {
TableHeader,
TableRow,
} from "@/react/components/ui/table";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import type {
DatabaseMetadata,
FunctionMetadata,
SchemaMetadata,
} from "@/types/proto-es/v1/database_service_pb";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
import { useViewStateNav } from "../common/useViewStateNav";
interface FunctionsTableProps {
diff --git a/frontend/src/react/components/sql-editor/Panels/InfoPanel/InfoPanel.tsx b/frontend/src/react/components/sql-editor/Panels/InfoPanel/InfoPanel.tsx
index b2fd33c49a..b60f5e8ebd 100644
--- a/frontend/src/react/components/sql-editor/Panels/InfoPanel/InfoPanel.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/InfoPanel/InfoPanel.tsx
@@ -1,6 +1,7 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useVueState } from "@/react/hooks/useVueState";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import { DatabaseOverviewInfo } from "@/react/pages/project/database-detail/overview/DatabaseOverviewInfo";
import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
import { useDBSchemaV1Store } from "@/store";
@@ -10,7 +11,6 @@ import {
instanceV1SupportsPackage,
instanceV1SupportsSequence,
} from "@/utils";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
import { PanelSearchBox } from "../common/PanelSearchBox";
import { useViewStateNav } from "../common/useViewStateNav";
import { ExternalTablesTable } from "../ExternalTablesPanel/ExternalTablesTable";
diff --git a/frontend/src/react/components/sql-editor/Panels/PackagesPanel/PackagesPanel.tsx b/frontend/src/react/components/sql-editor/Panels/PackagesPanel/PackagesPanel.tsx
index 4931563ad1..4fd98181d2 100644
--- a/frontend/src/react/components/sql-editor/Panels/PackagesPanel/PackagesPanel.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/PackagesPanel/PackagesPanel.tsx
@@ -2,12 +2,12 @@ import { ChevronLeft, Package } from "lucide-react";
import { useState } from "react";
import { Button } from "@/react/components/ui/button";
import { useVueState } from "@/react/hooks/useVueState";
-import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
-import { useDBSchemaV1Store } from "@/store";
import {
extractKeyWithPosition,
keyWithPosition,
-} from "@/views/sql-editor/EditorCommon/utils";
+} from "@/react/lib/keyWithPosition";
+import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
+import { useDBSchemaV1Store } from "@/store";
import { CodeViewer } from "../common/CodeViewer";
import { PanelSearchBox } from "../common/PanelSearchBox";
import { useViewStateNav } from "../common/useViewStateNav";
diff --git a/frontend/src/react/components/sql-editor/Panels/PackagesPanel/PackagesTable.tsx b/frontend/src/react/components/sql-editor/Panels/PackagesPanel/PackagesTable.tsx
index 7737bef97a..68aca619f1 100644
--- a/frontend/src/react/components/sql-editor/Panels/PackagesPanel/PackagesTable.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/PackagesPanel/PackagesTable.tsx
@@ -9,12 +9,12 @@ import {
TableHeader,
TableRow,
} from "@/react/components/ui/table";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import type {
DatabaseMetadata,
PackageMetadata,
SchemaMetadata,
} from "@/types/proto-es/v1/database_service_pb";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
import { useViewStateNav } from "../common/useViewStateNav";
interface PackagesTableProps {
diff --git a/frontend/src/react/components/sql-editor/Panels/Panels.tsx b/frontend/src/react/components/sql-editor/Panels/Panels.tsx
index 2635c81dc0..2e9ae27bd3 100644
--- a/frontend/src/react/components/sql-editor/Panels/Panels.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/Panels.tsx
@@ -7,7 +7,6 @@ import {
Separator as PanelResizeHandle,
} from "react-resizable-panels";
import { useShallow } from "zustand/react/shallow";
-import { useExecuteSQL } from "@/composables/useExecuteSQL";
import { aiContextEvents } from "@/plugins/ai/logic";
import { AIChatToSQL, AIContextProvider } from "@/plugins/ai/react";
import { resizeHandleClass } from "@/react/components/SchemaEditorLite/resize";
@@ -26,6 +25,7 @@ import { TerminalPanel } from "@/react/components/sql-editor/TerminalPanel/Termi
import { TriggersPanel } from "@/react/components/sql-editor/TriggersPanel";
import { ViewsPanel } from "@/react/components/sql-editor/ViewsPanel";
import { Alert } from "@/react/components/ui/alert";
+import { useExecuteSQL } from "@/react/hooks/useExecuteSQL";
import { useVueState } from "@/react/hooks/useVueState";
import {
selectEditorPanelSize,
diff --git a/frontend/src/react/components/sql-editor/Panels/ProceduresPanel/ProceduresPanel.tsx b/frontend/src/react/components/sql-editor/Panels/ProceduresPanel/ProceduresPanel.tsx
index 24ddb7d42c..caff4a908d 100644
--- a/frontend/src/react/components/sql-editor/Panels/ProceduresPanel/ProceduresPanel.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/ProceduresPanel/ProceduresPanel.tsx
@@ -2,12 +2,12 @@ import { ChevronLeft, FileCode } from "lucide-react";
import { useState } from "react";
import { Button } from "@/react/components/ui/button";
import { useVueState } from "@/react/hooks/useVueState";
-import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
-import { useDBSchemaV1Store } from "@/store";
import {
extractKeyWithPosition,
keyWithPosition,
-} from "@/views/sql-editor/EditorCommon/utils";
+} from "@/react/lib/keyWithPosition";
+import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
+import { useDBSchemaV1Store } from "@/store";
import { CodeViewer } from "../common/CodeViewer";
import { PanelSearchBox } from "../common/PanelSearchBox";
import { useViewStateNav } from "../common/useViewStateNav";
diff --git a/frontend/src/react/components/sql-editor/Panels/ProceduresPanel/ProceduresTable.tsx b/frontend/src/react/components/sql-editor/Panels/ProceduresPanel/ProceduresTable.tsx
index bce8d83638..886bb198b9 100644
--- a/frontend/src/react/components/sql-editor/Panels/ProceduresPanel/ProceduresTable.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/ProceduresPanel/ProceduresTable.tsx
@@ -9,12 +9,12 @@ import {
TableHeader,
TableRow,
} from "@/react/components/ui/table";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import type {
DatabaseMetadata,
ProcedureMetadata,
SchemaMetadata,
} from "@/types/proto-es/v1/database_service_pb";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
import { useViewStateNav } from "../common/useViewStateNav";
interface ProceduresTableProps {
diff --git a/frontend/src/react/components/sql-editor/Panels/SequencesPanel/SequencesPanel.tsx b/frontend/src/react/components/sql-editor/Panels/SequencesPanel/SequencesPanel.tsx
index 1cb53e2886..2ead20e433 100644
--- a/frontend/src/react/components/sql-editor/Panels/SequencesPanel/SequencesPanel.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/SequencesPanel/SequencesPanel.tsx
@@ -1,8 +1,8 @@
import { useState } from "react";
import { useVueState } from "@/react/hooks/useVueState";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
import { useDBSchemaV1Store } from "@/store";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
import { PanelSearchBox } from "../common/PanelSearchBox";
import { useViewStateNav } from "../common/useViewStateNav";
import { SequencesTable } from "./SequencesTable";
diff --git a/frontend/src/react/components/sql-editor/Panels/SequencesPanel/SequencesTable.tsx b/frontend/src/react/components/sql-editor/Panels/SequencesPanel/SequencesTable.tsx
index e435edd5cf..f6da1226c6 100644
--- a/frontend/src/react/components/sql-editor/Panels/SequencesPanel/SequencesTable.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/SequencesPanel/SequencesTable.tsx
@@ -9,12 +9,12 @@ import {
TableHeader,
TableRow,
} from "@/react/components/ui/table";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import type {
DatabaseMetadata,
SchemaMetadata,
SequenceMetadata,
} from "@/types/proto-es/v1/database_service_pb";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
import { EllipsisCell } from "../common/EllipsisCell";
import { useViewStateNav } from "../common/useViewStateNav";
diff --git a/frontend/src/react/components/sql-editor/Panels/TablesPanel/TableDetail.tsx b/frontend/src/react/components/sql-editor/Panels/TablesPanel/TableDetail.tsx
index 87ba203ab8..0508e31484 100644
--- a/frontend/src/react/components/sql-editor/Panels/TablesPanel/TableDetail.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/TablesPanel/TableDetail.tsx
@@ -16,16 +16,16 @@ import {
TabsPanel,
TabsTrigger,
} from "@/react/components/ui/tabs";
+import {
+ extractKeyWithPosition,
+ keyWithPosition,
+} from "@/react/lib/keyWithPosition";
import type {
Database,
DatabaseMetadata,
SchemaMetadata,
TableMetadata,
} from "@/types/proto-es/v1/database_service_pb";
-import {
- extractKeyWithPosition,
- keyWithPosition,
-} from "@/views/sql-editor/EditorCommon/utils";
import { CodeViewer } from "../common/CodeViewer";
import { PanelSearchBox } from "../common/PanelSearchBox";
import { ColumnsTable } from "../common/tables/ColumnsTable";
diff --git a/frontend/src/react/components/sql-editor/Panels/TriggersPanel/TriggersPanel.tsx b/frontend/src/react/components/sql-editor/Panels/TriggersPanel/TriggersPanel.tsx
index c5cabd6a0c..e81b856ed9 100644
--- a/frontend/src/react/components/sql-editor/Panels/TriggersPanel/TriggersPanel.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/TriggersPanel/TriggersPanel.tsx
@@ -2,12 +2,12 @@ import { ChevronLeft, Zap } from "lucide-react";
import { useState } from "react";
import { Button } from "@/react/components/ui/button";
import { useVueState } from "@/react/hooks/useVueState";
-import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
-import { useDBSchemaV1Store } from "@/store";
import {
extractKeyWithPosition,
keyWithPosition,
-} from "@/views/sql-editor/EditorCommon/utils";
+} from "@/react/lib/keyWithPosition";
+import { useConnectionOfCurrentSQLEditorTab } from "@/react/stores/sqlEditor/tab-vue-state";
+import { useDBSchemaV1Store } from "@/store";
import { CodeViewer } from "../common/CodeViewer";
import { PanelSearchBox } from "../common/PanelSearchBox";
import { useViewStateNav } from "../common/useViewStateNav";
diff --git a/frontend/src/react/components/sql-editor/Panels/TriggersPanel/TriggersTable.tsx b/frontend/src/react/components/sql-editor/Panels/TriggersPanel/TriggersTable.tsx
index 6eef6ae732..b86eb4061a 100644
--- a/frontend/src/react/components/sql-editor/Panels/TriggersPanel/TriggersTable.tsx
+++ b/frontend/src/react/components/sql-editor/Panels/TriggersPanel/TriggersTable.tsx
@@ -9,11 +9,11 @@ import {
TableHeader,
TableRow,
} from "@/react/components/ui/table";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import type {
TableMetadata,
TriggerMetadata,
} from "@/types/proto-es/v1/database_service_pb";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
import { useViewStateNav } from "../common/useViewStateNav";
interface TriggersTableProps {
diff --git a/frontend/src/react/components/sql-editor/Panels/common/useTableContainerHeight.ts b/frontend/src/react/components/sql-editor/Panels/common/useTableContainerHeight.ts
index 427621b03b..a0b43c93d2 100644
--- a/frontend/src/react/components/sql-editor/Panels/common/useTableContainerHeight.ts
+++ b/frontend/src/react/components/sql-editor/Panels/common/useTableContainerHeight.ts
@@ -2,8 +2,7 @@ import { useEffect, useRef, useState } from "react";
/**
* Tracks the container element's available height so the inner table
- * can size its scroll area to fill the panel without spilling. React
- * counterpart of Vue's `useAutoHeightDataTable` — without naive-ui.
+ * can size its scroll area to fill the panel without spilling.
*
* Returns a `ref` to attach to the outer container plus the observed
* `maxHeight` in pixels (0 until the first measurement).
diff --git a/frontend/src/react/components/sql-editor/ResultPanel/DatabaseQueryContext.tsx b/frontend/src/react/components/sql-editor/ResultPanel/DatabaseQueryContext.tsx
index c3ce9e00a0..09f42003d0 100644
--- a/frontend/src/react/components/sql-editor/ResultPanel/DatabaseQueryContext.tsx
+++ b/frontend/src/react/components/sql-editor/ResultPanel/DatabaseQueryContext.tsx
@@ -1,9 +1,9 @@
import { Loader2 } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
-import { useExecuteSQL } from "@/composables/useExecuteSQL";
import { ResultView } from "@/react/components/sql-editor/ResultView";
import { Button } from "@/react/components/ui/button";
+import { useExecuteSQL } from "@/react/hooks/useExecuteSQL";
import { useSQLEditorTabStore } from "@/react/stores/sqlEditor/tab-vue-state";
import type {
SQLEditorDatabaseQueryContext,
@@ -114,9 +114,8 @@ export function DatabaseQueryContext({
/**
* Returns a humanized elapsed-time string ("3.2s") that ticks once per
- * second while `running` is true. Replaces the Vue `useCurrentTimestamp`
- * + computed combo. Stops/clears the interval on unmount or when
- * `running` flips to false.
+ * second while `running` is true. Stops/clears the interval on unmount
+ * or when `running` flips to false.
*/
function useElapsed(running: boolean, beginMS: number | undefined): string {
const [now, setNow] = useState(() => Date.now());
diff --git a/frontend/src/react/components/sql-editor/ResultView/PrettyJSON.tsx b/frontend/src/react/components/sql-editor/ResultView/PrettyJSON.tsx
index 1366768e6b..b4f53ffde0 100644
--- a/frontend/src/react/components/sql-editor/ResultView/PrettyJSON.tsx
+++ b/frontend/src/react/components/sql-editor/ResultView/PrettyJSON.tsx
@@ -22,7 +22,7 @@ export function PrettyJSON({ content }: PrettyJSONProps) {
await Promise.all([
import("pretty-print-json"),
import("lossless-json"),
- import("@/composables/utils"),
+ import("@/utils/sqlResult"),
]);
await import("./pretty-print-json.css");
if (controller.signal.aborted) return;
diff --git a/frontend/src/react/components/sql-editor/ResultView/ResultView.tsx b/frontend/src/react/components/sql-editor/ResultView/ResultView.tsx
index 26bad27102..528874321b 100644
--- a/frontend/src/react/components/sql-editor/ResultView/ResultView.tsx
+++ b/frontend/src/react/components/sql-editor/ResultView/ResultView.tsx
@@ -4,7 +4,6 @@ import dayjs from "dayjs";
import { InfoIcon, LoaderCircle } from "lucide-react";
import { type ReactNode, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
-import { isDisallowChangeDatabaseError } from "@/composables/useExecuteSQL";
import {
DataExportButton,
type DataExportRequest,
@@ -18,6 +17,7 @@ import {
TabsTrigger,
} from "@/react/components/ui/tabs";
import { Tooltip } from "@/react/components/ui/tooltip";
+import { isDisallowChangeDatabaseError } from "@/react/hooks/useExecuteSQL";
import { useVueState } from "@/react/hooks/useVueState";
import { cn } from "@/react/lib/utils";
import { useSQLEditorVueState } from "@/react/stores/sqlEditor/editor-vue-state";
diff --git a/frontend/src/react/components/sql-editor/ResultView/SingleResultView.tsx b/frontend/src/react/components/sql-editor/ResultView/SingleResultView.tsx
index 0c182c0b78..914a3bbac6 100644
--- a/frontend/src/react/components/sql-editor/ResultView/SingleResultView.tsx
+++ b/frontend/src/react/components/sql-editor/ResultView/SingleResultView.tsx
@@ -11,11 +11,6 @@ import {
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { v4 as uuidv4 } from "uuid";
-import { useExecuteSQL } from "@/composables/useExecuteSQL";
-import {
- flattenElasticsearchSearchResult,
- flattenNoSQLQueryResult,
-} from "@/composables/utils";
import {
AdvancedSearch,
type ScopeOption,
@@ -31,6 +26,7 @@ import { Button } from "@/react/components/ui/button";
import { EllipsisText } from "@/react/components/ui/ellipsis-text";
import { Switch } from "@/react/components/ui/switch";
import { Tooltip } from "@/react/components/ui/tooltip";
+import { useExecuteSQL } from "@/react/hooks/useExecuteSQL";
import { useVueState } from "@/react/hooks/useVueState";
import { cn } from "@/react/lib/utils";
import { useSQLEditorVueState } from "@/react/stores/sqlEditor/editor-vue-state";
@@ -48,6 +44,10 @@ import {
type RowValue,
} from "@/types/proto-es/v1/sql_service_pb";
import { createExplainToken } from "@/utils/pev2";
+import {
+ flattenElasticsearchSearchResult,
+ flattenNoSQLQueryResult,
+} from "@/utils/sqlResult";
import { STORAGE_KEY_SQL_EDITOR_NOSQL_TABLE_VIEW } from "@/utils/storage-keys";
import { isNullOrUndefined } from "@/utils/util";
import {
diff --git a/frontend/src/react/components/sql-editor/SchemaPane/SchemaPane.test.tsx b/frontend/src/react/components/sql-editor/SchemaPane/SchemaPane.test.tsx
index 58cd779603..c317a47889 100644
--- a/frontend/src/react/components/sql-editor/SchemaPane/SchemaPane.test.tsx
+++ b/frontend/src/react/components/sql-editor/SchemaPane/SchemaPane.test.tsx
@@ -134,13 +134,13 @@ vi.mock("@/router", () => ({ router: { resolve: () => ({ href: "/" }) } }));
vi.mock("@/router/sqlEditor", () => ({
SQL_EDITOR_DATABASE_MODULE: "sql-editor.database",
}));
-vi.mock("@/views/sql-editor/EditorCommon/utils", () => ({
+vi.mock("@/react/lib/keyWithPosition", () => ({
keyWithPosition: (k: string, p: number) => `${k}###${p}`,
}));
vi.mock("@/views/sql-editor/events", () => ({
sqlEditorEvents: { emit: vi.fn(), on: vi.fn(() => () => {}) },
}));
-vi.mock("@/composables/useExecuteSQL", () => ({
+vi.mock("@/react/hooks/useExecuteSQL", () => ({
useExecuteSQL: () => ({ execute: vi.fn() }),
}));
vi.mock("@/react/components/monaco/sqlFormatter", () => ({
diff --git a/frontend/src/react/components/sql-editor/SchemaPane/actions.test.tsx b/frontend/src/react/components/sql-editor/SchemaPane/actions.test.tsx
index 7a57803acb..cd14581a85 100644
--- a/frontend/src/react/components/sql-editor/SchemaPane/actions.test.tsx
+++ b/frontend/src/react/components/sql-editor/SchemaPane/actions.test.tsx
@@ -124,7 +124,7 @@ vi.mock("@/router/sqlEditor", () => ({
SQL_EDITOR_DATABASE_MODULE: "sql-editor.database",
}));
-vi.mock("@/views/sql-editor/EditorCommon/utils", () => ({
+vi.mock("@/react/lib/keyWithPosition", () => ({
keyWithPosition: (k: string, p: number) => `${k}###${p}`,
}));
@@ -132,7 +132,7 @@ vi.mock("@/views/sql-editor/events", () => ({
sqlEditorEvents: { emit: vi.fn() },
}));
-vi.mock("@/composables/useExecuteSQL", () => ({
+vi.mock("@/react/hooks/useExecuteSQL", () => ({
useExecuteSQL: () => ({ execute: vi.fn() }),
}));
diff --git a/frontend/src/react/components/sql-editor/SchemaPane/actions.tsx b/frontend/src/react/components/sql-editor/SchemaPane/actions.tsx
index 46c8245b4e..56f36c95ed 100644
--- a/frontend/src/react/components/sql-editor/SchemaPane/actions.tsx
+++ b/frontend/src/react/components/sql-editor/SchemaPane/actions.tsx
@@ -15,8 +15,9 @@ import {
import type { ReactNode } from "react";
import { useCallback, useMemo } from "react";
import { useTranslation } from "react-i18next";
-import { useExecuteSQL } from "@/composables/useExecuteSQL";
import { formatSQL } from "@/react/components/monaco/sqlFormatter";
+import { useExecuteSQL } from "@/react/hooks/useExecuteSQL";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import { useSQLEditorTabStore } from "@/react/stores/sqlEditor/tab-vue-state";
import { router } from "@/router";
import { SQL_EDITOR_DATABASE_MODULE } from "@/router/sqlEditor";
@@ -56,7 +57,6 @@ import {
sortByDictionary,
supportGetStringSchema,
} from "@/utils";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
import { sqlEditorEvents } from "@/views/sql-editor/events";
import {
type NodeTarget,
diff --git a/frontend/src/react/components/sql-editor/SchemaPane/schemaTree.ts b/frontend/src/react/components/sql-editor/SchemaPane/schemaTree.ts
index 67352a6ee0..95501d4116 100644
--- a/frontend/src/react/components/sql-editor/SchemaPane/schemaTree.ts
+++ b/frontend/src/react/components/sql-editor/SchemaPane/schemaTree.ts
@@ -1,5 +1,6 @@
import type { ReactNode } from "react";
import i18n from "@/react/i18n";
+import { keyWithPosition } from "@/react/lib/keyWithPosition";
import type {
CheckConstraintMetadata,
ColumnMetadata,
@@ -15,7 +16,6 @@ import type {
// Deep-import both helpers to avoid pulling barrels that transitively
// reach monaco / Vue surfaces. Both files are framework-agnostic pure TS.
import { keyForDependencyColumn } from "@/utils/v1/dbSchema";
-import { keyWithPosition } from "@/views/sql-editor/EditorCommon/utils";
/**
* React port of `src/views/sql-editor/AsidePanel/SchemaPane/tree.ts`.
@@ -166,8 +166,7 @@ export type NodeMeta<T extends NodeType = NodeType> = {
};
/**
- * Minimal tree-row contract we share with the React `Tree` primitive.
- * Mirrors the subset of naive-ui's `TreeOption` the schema pane uses:
+ * Minimal tree-row contract we share with the React `Tree` primitive:
* `key`, `label`, `disabled`, `isLeaf`, plus our `meta` payload and
* recursive `children`.
*/
diff --git a/frontend/src/react/components/sql-editor/StandardPanel/EditorMain.tsx b/frontend/src/react/components/sql-editor/StandardPanel/EditorMain.tsx
index 3b841b50d7..4dbd85e337 100644
--- a/frontend/src/react/components/sql-editor/StandardPanel/EditorMain.tsx
+++ b/frontend/src/react/components/sql-editor/StandardPanel/EditorMain.tsx
@@ -1,6 +1,6 @@
import { useCallback, useEffect } from "react";
-import { useExecuteSQL } from "@/composables/useExecuteSQL";
import { ReadonlyModeNotSupported } from "@/react/components/sql-editor/ReadonlyModeNotSupported";
+import { useExecuteSQL } from "@/react/hooks/useExecuteSQL";
import { useVueState } from "@/react/hooks/useVueState";
import {
useConnectionOfCurrentSQLEditorTab,
@@ -33,10 +33,6 @@ interface EditorMainProps {
*
* AI side pane has been hoisted to `StandardPanel.vue` (Vue host) so
* the cross-framework boundary stays clean — see Stage 17 design.
- *
- * Calls the existing Vue `useExecuteSQL` composable directly: its body
- * is Pinia-store-driven and the only Vue-specific bits (`reactive`,
- * `markRaw`) behave as no-ops outside Vue's reactivity system.
*/
export function EditorMain({ onChangeConnection }: EditorMainProps) {
const tabStore = useSQLEditorTabStore();
diff --git a/frontend/src/react/components/sql-editor/TabList.tsx b/frontend/src/react/components/sql-editor/TabList.tsx
index 9458759e04..84852a7320 100644
--- a/frontend/src/react/components/sql-editor/TabList.tsx
+++ b/frontend/src/react/components/sql-editor/TabList.tsx
@@ -353,8 +353,6 @@ export function TabList() {
{t("common.cancel")}
</Button>
<Button
- // Vue's confirm dialog used naive-ui's primary (accent) button
- // for the affirmative action — not destructive (red). Match.
variant="default"
onClick={() => {
pendingClose?.resolve(true);
diff --git a/frontend/src/react/components/sql-editor/TerminalPanel/TerminalPanel.tsx b/frontend/src/react/components/sql-editor/TerminalPanel/TerminalPanel.tsx
index 0d38f060ff..adcf5bc7cb 100644
--- a/frontend/src/react/components/sql-editor/TerminalPanel/TerminalPanel.tsx
+++ b/frontend/src/react/components/sql-editor/TerminalPanel/TerminalPanel.tsx
@@ -1,5 +1,5 @@
import { Loader2 } from "lucide-react";
-import { useCallback, useEffect, useMemo, useRef } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import type { IStandaloneCodeEditor } from "@/react/components/monaco/types";
import { ConnectionHolder } from "@/react/components/sql-editor/ConnectionHolder";
@@ -67,12 +67,24 @@ export function TerminalPanel() {
: undefined) ?? EMPTY_QUERY_LIST
);
- const expired = useVueState(() => {
- const tab = tabStore.currentTab;
- if (!tab) return false;
- const session = getWebTerminalQuerySession(tab);
- return session.timer.expired.value;
- });
+ // Poll the per-tab timer's expired flag every 250ms so the Cancel
+ // button appears once the running query passes the timeout. Cheap
+ // enough at this cadence; the timer object itself has no reactive
+ // hook to subscribe to.
+ const [expired, setExpired] = useState(false);
+ useEffect(() => {
+ const tick = () => {
+ const tab = tabStore.currentTab;
+ if (!tab) {
+ setExpired(false);
+ return;
+ }
+ setExpired(getWebTerminalQuerySession(tab).timer.expired());
+ };
+ tick();
+ const interval = setInterval(tick, 250);
+ return () => clearInterval(interval);
+ }, [tabStore, currentTabId]);
// Pre-fetch any database referenced by an existing query item so the
// ResultView can render `database.environment` etc. synchronously.
diff --git a/frontend/src/react/components/sql-editor/useDropdown.ts b/frontend/src/react/components/sql-editor/useDropdown.ts
index 5fb5803f63..b131c47149 100644
--- a/frontend/src/react/components/sql-editor/useDropdown.ts
+++ b/frontend/src/react/components/sql-editor/useDropdown.ts
@@ -1,24 +1,10 @@
/**
- * useDropdown — React port of Vue dropdown.ts
+ * useDropdown — context-menu state for the worksheet tree.
*
- * Key differences from the Vue source:
- *
- * 1. Positioning: Vue's NDropdown uses manual x/y coordinates. Base UI's
- * ContextMenu handles positioning internally on right-click. Therefore
- * `x`/`y` are dropped and `handleMenuShow` is renamed to
- * `handleContextMenu` to reflect it is the onContextMenu handler.
- *
- * 2. Delete confirm: Vue uses naive-ui `useDialog`. React dependency-inverts
- * this: the hook exposes `confirmDelete` state; the consumer (SheetTree)
- * binds a shadcn AlertDialog to it.
- *
- * 3. Share panel: Vue uses a naive-ui Popover. React side exposes
- * `showSharePanel` + `handleSharePanelShow` so that SheetTree can mount
- * the actual SharePopoverBody component. No dialog logic lives here.
- *
- * 4. Vue refs/reactive → React useState/useMemo.
- * Vue computed → useMemo.
- * t() from @/plugins/i18n → useTranslation from react-i18next.
+ * The hook exposes `confirmDelete` state that the consumer (SheetTree) binds
+ * to a shadcn AlertDialog, and `showSharePanel` + `handleSharePanelShow` so
+ * SheetTree can mount the SharePopoverBody component itself. No dialog logic
+ * lives here.
*/
import { useMemo, useState } from "react";
@@ -45,7 +31,7 @@ export type DropdownOptionType =
| "multi-select"
| "duplicate";
-/** A single menu entry. Mirrors naive-ui's DropdownOption in shape. */
+/** A single menu entry. */
export type MenuItem =
| { type: "item"; key: DropdownOptionType; label: string; disabled?: boolean }
| { type: "separator" };
diff --git a/frontend/src/react/components/ui/layer.ts b/frontend/src/react/components/ui/layer.ts
index 0bf6cceb31..e51ce2379d 100644
--- a/frontend/src/react/components/ui/layer.ts
+++ b/frontend/src/react/components/ui/layer.ts
@@ -7,14 +7,8 @@ export const LAYER_ROOT_ID = {
} as const;
export const LAYER_Z_INDEX = {
- // Legacy naive-ui popovers sit at ~2000 during the Vue->React migration.
- // React overlays mounted inside Vue popovers (e.g. a nested React Popover
- // inside a naive-ui share popover) must sit above their Vue ancestor.
- // 2500 keeps React overlays above naive-ui popovers but below naive-ui
- // modals (3000) and notifications (5000).
overlay: 2500,
agent: 2600,
- // Forced re-auth must sit above naive-ui notifications/messages.
critical: 7000,
} as const;
diff --git a/frontend/src/react/components/ui/toaster.tsx b/frontend/src/react/components/ui/toaster.tsx
index c36e485635..b8fc6f1c3c 100644
--- a/frontend/src/react/components/ui/toaster.tsx
+++ b/frontend/src/react/components/ui/toaster.tsx
@@ -60,8 +60,7 @@ export function Toaster() {
className="fixed bottom-4 right-4 flex w-(--toast-width) flex-col gap-2"
style={{
// Tailwind v4 reads CSS vars; expose toast width here so the
- // toast card class can reference it. Width matches naive-ui's
- // default.
+ // toast card class can reference it.
["--toast-width" as string]: "24rem",
zIndex: LAYER_Z_INDEX.overlay,
}}
diff --git a/frontend/src/react/hooks/useExecuteSQL.ts b/frontend/src/react/hooks/useExecuteSQL.ts
new file mode 100644
index 0000000000..ba929c8139
--- /dev/null
+++ b/frontend/src/react/hooks/useExecuteSQL.ts
@@ -0,0 +1,377 @@
+import { create } from "@bufbuild/protobuf";
+import { Code } from "@connectrpc/connect";
+import { cloneDeep, isEmpty } from "lodash-es";
+import { useCallback, useRef } from "react";
+import { useTranslation } from "react-i18next";
+import { v4 as uuidv4 } from "uuid";
+import { useSQLEditorStore as useSQLEditorReactStore } from "@/react/stores/sqlEditor";
+import { useSQLEditorVueState } from "@/react/stores/sqlEditor/editor-vue-state";
+import { useSQLEditorTabStore } from "@/react/stores/sqlEditor/tab-vue-state";
+import {
+ hasFeature,
+ pushNotification,
+ useDatabaseV1Store,
+ useDBGroupStore,
+ useSQLStore,
+} from "@/store";
+import type {
+ BBNotificationStyle,
+ QueryContextStatus,
+ SQLEditorDatabaseQueryContext,
+ SQLEditorQueryParams,
+ SQLResultSetV1,
+} from "@/types";
+import { isValidDatabaseName } from "@/types";
+import { Engine } from "@/types/proto-es/v1/common_pb";
+import { DatabaseGroupView } from "@/types/proto-es/v1/database_group_service_pb";
+import type { Database } from "@/types/proto-es/v1/database_service_pb";
+import {
+ type QueryOption,
+ QueryOptionSchema,
+ QueryRequestSchema,
+ QueryResult_CommandError_Type,
+} from "@/types/proto-es/v1/sql_service_pb";
+import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
+import {
+ getDatabaseProject,
+ getInstanceResource,
+ getValidDataSourceByPolicy,
+ hasPermissionToCreateChangeDatabaseIssueInProject,
+} from "@/utils";
+import { flattenNoSQLResult } from "@/utils/sqlResult";
+import { sqlEditorEvents } from "@/views/sql-editor/events";
+
+// QUERY_INTERVAL_LIMIT is the minimal gap between two queries
+const QUERY_INTERVAL_LIMIT = 1000;
+
+export const useExecuteSQL = () => {
+ const { t } = useTranslation();
+ const lastQueryTimeRef = useRef<number | undefined>(undefined);
+ const dbGroupStore = useDBGroupStore();
+ const dbStore = useDatabaseV1Store();
+ const tabStore = useSQLEditorTabStore();
+ const sqlEditorStore = useSQLEditorVueState();
+
+ const notify = (
+ type: BBNotificationStyle,
+ title: string,
+ description?: string
+ ) => {
+ pushNotification({
+ module: "bytebase",
+ style: type,
+ title,
+ description,
+ });
+ };
+
+ const preflight = useCallback(
+ async (params: SQLEditorQueryParams) => {
+ lastQueryTimeRef.current = Date.now();
+
+ const tab = tabStore.currentTab;
+ if (!tab) {
+ return false;
+ }
+
+ if (tabStore.isDisconnected) {
+ notify("CRITICAL", t("sql-editor.select-connection"));
+ return false;
+ }
+
+ if (isEmpty(params.statement)) {
+ notify("CRITICAL", t("sql-editor.notify-empty-statement"));
+ return false;
+ }
+
+ if (!tab.databaseQueryContexts) {
+ tab.databaseQueryContexts = new Map();
+ }
+ return true;
+ },
+ [tabStore, t]
+ );
+
+ const changeContextStatus = (
+ ctx: SQLEditorDatabaseQueryContext,
+ status: QueryContextStatus
+ ) => {
+ switch (status) {
+ case "EXECUTING":
+ ctx.abortController = new AbortController();
+ ctx.beginTimestampMS = Date.now();
+ break;
+ case "CANCELLED":
+ ctx.abortController?.abort();
+ break;
+ case "DONE":
+ break;
+ }
+ ctx.status = status;
+ };
+
+ const preExecute = useCallback(
+ async (params: SQLEditorQueryParams) => {
+ const now = Date.now();
+ if (
+ lastQueryTimeRef.current &&
+ now - lastQueryTimeRef.current < QUERY_INTERVAL_LIMIT
+ ) {
+ return;
+ }
+
+ const tab = tabStore.currentTab;
+ if (!tab) {
+ return;
+ }
+ const { mode } = tab;
+ if (mode === "ADMIN") {
+ return;
+ }
+
+ if (!preflight(params)) {
+ return;
+ }
+
+ if (!isValidDatabaseName(params.connection.database)) {
+ return;
+ }
+
+ const databaseQueryContexts = tab.databaseQueryContexts ?? new Map();
+ const batchQueryDatabaseSet = new Set<string /* database name */>([
+ params.connection.database,
+ ]);
+
+ // Check if the user selects multiple databases to query.
+ if (
+ tab.batchQueryContext &&
+ hasFeature(PlanFeature.FEATURE_BATCH_QUERY)
+ ) {
+ const { databases = [], databaseGroups = [] } = tab.batchQueryContext;
+ for (const databaseResourceName of databases) {
+ if (!isValidDatabaseName(databaseResourceName)) {
+ continue;
+ }
+ if (batchQueryDatabaseSet.has(databaseResourceName)) {
+ continue;
+ }
+ batchQueryDatabaseSet.add(databaseResourceName);
+ }
+
+ if (hasFeature(PlanFeature.FEATURE_DATABASE_GROUPS)) {
+ for (const databaseGroupName of databaseGroups) {
+ try {
+ const databaseGroup = await dbGroupStore.getOrFetchDBGroupByName(
+ databaseGroupName,
+ {
+ skipCache: false,
+ silent: true,
+ view: DatabaseGroupView.FULL,
+ }
+ );
+ for (const matchedDatabase of databaseGroup.matchedDatabases) {
+ if (!isValidDatabaseName(matchedDatabase.name)) {
+ continue;
+ }
+ if (batchQueryDatabaseSet.has(matchedDatabase.name)) {
+ continue;
+ }
+ batchQueryDatabaseSet.add(matchedDatabase.name);
+ }
+ } catch {
+ // skip
+ }
+ }
+ }
+ }
+
+ for (const [database, contexts] of databaseQueryContexts.entries()) {
+ if (!batchQueryDatabaseSet.has(database)) {
+ for (const context of contexts) {
+ changeContextStatus(context, "CANCELLED");
+ }
+ databaseQueryContexts.delete(database);
+ }
+ }
+
+ const isBatch = batchQueryDatabaseSet.size > 1;
+ await dbStore.batchGetOrFetchDatabases([...batchQueryDatabaseSet.keys()]);
+
+ for (const databaseName of batchQueryDatabaseSet.values()) {
+ if (!databaseQueryContexts.has(databaseName)) {
+ databaseQueryContexts.set(databaseName, []);
+ }
+
+ if ((databaseQueryContexts.get(databaseName)?.length ?? 0) >= 50) {
+ const ctx = databaseQueryContexts.get(databaseName)?.pop();
+ if (ctx) {
+ changeContextStatus(ctx, "CANCELLED");
+ }
+ }
+
+ const database = dbStore.getDatabaseByName(databaseName);
+ const resolvedDataSourceId =
+ isBatch && tab.batchQueryContext.dataSourceType
+ ? ((await getValidDataSourceByPolicy(
+ database,
+ tab.batchQueryContext.dataSourceType
+ )) ?? "")
+ : params.connection.dataSourceId;
+ const context: SQLEditorDatabaseQueryContext = {
+ id: uuidv4(),
+ params: Object.assign(cloneDeep(params), {
+ connection: {
+ ...params.connection,
+ ...(resolvedDataSourceId
+ ? { dataSourceId: resolvedDataSourceId }
+ : {}),
+ },
+ }),
+ status: "PENDING",
+ };
+ databaseQueryContexts.get(databaseName)?.unshift(context);
+ }
+ },
+ [tabStore, dbStore, dbGroupStore, preflight]
+ );
+
+ const runQuery = useCallback(
+ async (database: Database, context: SQLEditorDatabaseQueryContext) => {
+ if (context.status === "EXECUTING") {
+ notify("INFO", t("common.tips"), t("sql-editor.can-not-execute-query"));
+ return;
+ }
+
+ if (!isValidDatabaseName(database.name)) {
+ notify(
+ "CRITICAL",
+ t("common.error"),
+ t("sql-editor.invalid-database", { database: database.name })
+ );
+ return;
+ }
+
+ changeContextStatus(context, "EXECUTING");
+
+ const finish = (resultSet: SQLResultSetV1) => {
+ context.resultSet = resultSet;
+ changeContextStatus(context, "DONE");
+ };
+
+ const { abortController } = context;
+ if (!abortController) {
+ return;
+ }
+ const sqlStore = useSQLStore();
+
+ const dataSourceId = context.params.connection.dataSourceId;
+
+ if (abortController.signal.aborted) {
+ // Once any one of the batch queries is aborted, don't go further
+ // and mock an "Aborted" result for the rest queries.
+ return finish({
+ error: t("sql-editor.request-aborted"),
+ results: [],
+ status: Code.Aborted,
+ });
+ }
+
+ const queryOption = create(QueryOptionSchema, {
+ ...(context.params.queryOption ?? ({} as QueryOption)),
+ redisRunCommandsOn: sqlEditorStore.redisCommandOption,
+ });
+ const resultSet = await sqlStore.query(
+ create(QueryRequestSchema, {
+ name: database.name,
+ ...(dataSourceId ? { dataSourceId } : {}),
+ statement: context.params.statement,
+ limit: context.params.limit ?? sqlEditorStore.resultRowsLimit,
+ explain: context.params.explain,
+ schema: context.params.connection.schema,
+ container: context.params.connection.table,
+ queryOption: queryOption,
+ }),
+ abortController.signal
+ );
+
+ // Merge the freshly-executed statement into the history cache
+ // WITHOUT resetting pagination — the user keeps whatever pages
+ // they had already loaded ("Load more"d), and the new entry just
+ // gets prepended. After the cache update lands, emit the event so
+ // the HistoryPane re-renders from it (store reactivity alone
+ // doesn't reliably propagate into the React `useVueState`
+ // subscriber, so we trigger the re-render explicitly).
+ useSQLEditorReactStore
+ .getState()
+ .mergeLatest({
+ project: sqlEditorStore.project,
+ database: database.name,
+ })
+ .catch(() => {
+ /* nothing */
+ })
+ .finally(() => {
+ void sqlEditorEvents.emit("query-executed");
+ });
+
+ const instanceResource = getInstanceResource(database);
+ if (instanceResource.engine === Engine.COSMOSDB) {
+ flattenNoSQLResult(resultSet);
+ }
+
+ if (isDisallowChangeDatabaseError(resultSet)) {
+ // Show a tips to navigate to issue creation
+ // if the user is allowed to create issue in the project.
+ if (
+ hasPermissionToCreateChangeDatabaseIssueInProject(
+ getDatabaseProject(database)
+ )
+ ) {
+ sqlEditorStore.isShowExecutingHint = true;
+ sqlEditorStore.executingHintDatabase = database;
+ }
+ return finish(resultSet);
+ }
+
+ return finish(resultSet);
+ },
+ [sqlEditorStore, t]
+ );
+
+ const execute = useCallback(
+ async (params: SQLEditorQueryParams) => {
+ return preExecute(params);
+ },
+ [preExecute]
+ );
+
+ return {
+ execute,
+ runQuery,
+ };
+};
+
+export const isDisallowChangeDatabaseError = (resultSet: SQLResultSetV1) => {
+ const isCommandError = resultSet.results.some((result) => {
+ return (
+ result.detailedError.case === "commandError" &&
+ [
+ QueryResult_CommandError_Type.DDL,
+ QueryResult_CommandError_Type.DML,
+ QueryResult_CommandError_Type.NON_READ_ONLY,
+ ].includes(result.detailedError.value.commandType)
+ );
+ });
+ if (isCommandError) {
+ return true;
+ }
+
+ return resultSet.results.some((result) => {
+ if (result.detailedError.case === "permissionDenied") {
+ return result.detailedError.value.requiredPermissions.some((p) => {
+ return p === "bb.sql.ddl" || p === "bb.sql.dml";
+ });
+ }
+ return false;
+ });
+};
diff --git a/frontend/src/react/lib/cancelableTimer.ts b/frontend/src/react/lib/cancelableTimer.ts
new file mode 100644
index 0000000000..78499d56da
--- /dev/null
+++ b/frontend/src/react/lib/cancelableTimer.ts
@@ -0,0 +1,25 @@
+// Cancelable countdown timer for non-component callers (e.g. service
+// modules, Zustand store factories). React components should use a hook
+// that wires this into useEffect for proper cleanup.
+export type CancelableTimer = {
+ start: () => void;
+ stop: () => void;
+ elapsedMS: () => number;
+ expired: () => boolean;
+};
+
+export const createCancelableTimer = (timeoutMS: number): CancelableTimer => {
+ let running = false;
+ let startTS = 0;
+ return {
+ start: () => {
+ startTS = Date.now();
+ running = true;
+ },
+ stop: () => {
+ running = false;
+ },
+ elapsedMS: () => (running ? Date.now() - startTS : 0),
+ expired: () => running && Date.now() - startTS > timeoutMS,
+ };
+};
diff --git a/frontend/src/views/sql-editor/EditorCommon/utils.ts b/frontend/src/react/lib/keyWithPosition.ts
similarity index 100%
rename from frontend/src/views/sql-editor/EditorCommon/utils.ts
rename to frontend/src/react/lib/keyWithPosition.ts
diff --git a/frontend/src/react/locales/en-US.json b/frontend/src/react/locales/en-US.json
index 42f0480614..063b6a1488 100644
--- a/frontend/src/react/locales/en-US.json
+++ b/frontend/src/react/locales/en-US.json
@@ -412,6 +412,7 @@
"system": "System",
"table": "Table",
"text-wrap": "Text Wrap",
+ "tips": "Tips",
"title": "Title",
"to": "To",
"total": "Total",
@@ -2720,6 +2721,7 @@
},
"binary-format": "Binary format",
"boolean-format": "Boolean format",
+ "can-not-execute-query": "Cannot execute query when loading data.",
"cancel-selection": "Cancel selection",
"choose-folder": "Choose or create folder",
"choose-folder-tips": "You can create a new folder by entering a non-existent path. The folders should be joined with a \"/\".",
@@ -2756,6 +2758,7 @@
"title": "Close the unsaved sheet?"
}
},
+ "invalid-database": "Invalid database {database}",
"jit": "Just-In-Time Access",
"last-synced": "Last synced: <time></time>",
"link-access": "Link access",
@@ -2773,6 +2776,7 @@
"not-member-of-any-projects": "You are not any member of any projects."
},
"no-queriable-database": "No queriable database",
+ "notify-empty-statement": "Please input your SQL statements in the editor",
"only-select-allowed": "Only read-only statements are allowed to execute.",
"open-in-new-tab": "Open in new tab",
"pending-query": "Pending query",
@@ -2795,6 +2799,7 @@
"self": "Run redis command on",
"single-node": "Single node"
},
+ "request-aborted": "User aborted the request",
"request-access": "Request Access",
"request-data-access": "Request Data Access",
"request-jit": "Request just-in-time access",
@@ -2817,6 +2822,7 @@
"search-scope-row-number-description": "Enter a row number to jump to that row.",
"search-scope-row-number-title": "Row number",
"select-a-database-to-start": "Select a database to start",
+ "select-connection": "Please select connections",
"select-encoding": "Select encoding",
"self": "SQL Editor",
"show-databases-without-query-permission": "Show databases without query permissions",
diff --git a/frontend/src/react/locales/es-ES.json b/frontend/src/react/locales/es-ES.json
index d284aaea72..8e7155a933 100644
--- a/frontend/src/react/locales/es-ES.json
+++ b/frontend/src/react/locales/es-ES.json
@@ -406,6 +406,7 @@
"system": "Sistema",
"table": "Tabla",
"text-wrap": "Ajuste de texto",
+ "tips": "Consejos",
"title": "Título",
"to": "Hasta",
"total": "Total",
@@ -2708,6 +2709,7 @@
},
"binary-format": "Formato binario",
"boolean-format": "Formato booleano",
+ "can-not-execute-query": "No se puede ejecutar la consulta al cargar datos.",
"cancel-selection": "Cancelar selección",
"choose-folder": "Seleccionar o crear una carpeta",
"choose-folder-tips": "Puedes crear una nueva carpeta introduciendo una ruta que no exista. Las carpetas deben unirse con una barra diagonal (\"/\").",
@@ -2744,6 +2746,7 @@
"title": "¿Cerrar la hoja no guardada?"
}
},
+ "invalid-database": "Base de datos no válida {database}",
"jit": "Just-In-Time Access",
"last-synced": "Última sincronización: <time></time>",
"link-access": "Acceso al enlace",
@@ -2761,6 +2764,7 @@
"not-member-of-any-projects": "No eres miembro de ningún proyecto."
},
"no-queriable-database": "No hay base de datos consultable",
+ "notify-empty-statement": "Ingrese sus declaraciones SQL en el editor",
"only-select-allowed": "Solo se permiten ejecutar declaraciones de solo lectura.",
"open-in-new-tab": "Abrir en nueva pestaña",
"pending-query": "Consulta pendiente",
@@ -2783,6 +2787,7 @@
"self": "Ejecute el comando redis en",
"single-node": "Nodo único"
},
+ "request-aborted": "El usuario abortó la solicitud",
"request-access": "Request Access",
"request-data-access": "Request Data Access",
"request-jit": "Request just-in-time access",
@@ -2805,6 +2810,7 @@
"search-scope-row-number-description": "Ingrese un número de fila para saltar a esa fila.",
"search-scope-row-number-title": "Número de fila",
"select-a-database-to-start": "Seleccione una base de datos para comenzar",
+ "select-connection": "Por favor seleccione conexiones",
"select-encoding": "Seleccionar codificación",
"self": "Editor de SQL",
"show-databases-without-query-permission": "Muestra las bases de datos que no tienen permisos de consulta",
diff --git a/frontend/src/react/locales/ja-JP.json b/frontend/src/react/locales/ja-JP.json
index 2ab2d3da76..9217e2b4d9 100644
--- a/frontend/src/react/locales/ja-JP.json
+++ b/frontend/src/react/locales/ja-JP.json
@@ -406,6 +406,7 @@
"system": "システム",
"table": "テーブル",
"text-wrap": "テキストの折り返し",
+ "tips": "プロンプトメッセージ",
"title": "タイトル",
"to": "終了",
"total": "Total",
@@ -2708,6 +2709,7 @@
},
"binary-format": "バイナリ形式",
"boolean-format": "ブール形式",
+ "can-not-execute-query": "データのロード中にクエリを実行できません",
"cancel-selection": "選択をキャンセル",
"choose-folder": "フォルダを選択または作成",
"choose-folder-tips": "存在しないパスを入力することで新しいフォルダを作成できます。フォルダは「/」で結合する必要があります。",
@@ -2744,6 +2746,7 @@
"title": "未保存のワークシートを閉じてもよろしいですか?"
}
},
+ "invalid-database": "無効なデータベース {database}",
"jit": "Just-In-Time Access",
"last-synced": "最終同期時間: <time></time>",
"link-access": "リンクアクセス",
@@ -2761,6 +2764,7 @@
"not-member-of-any-projects": "あなたはどのプロジェクトのメンバーでもありません。"
},
"no-queriable-database": "クエリ可能なデータベースがありません",
+ "notify-empty-statement": "エディターに SQL ステートメントを入力してください",
"only-select-allowed": "読み取り専用ステートメントのみが実行を許可されます",
"open-in-new-tab": "新しいタブで開く",
"pending-query": "保留中のクエリ",
@@ -2783,6 +2787,7 @@
"self": "redisコマンドを実行する",
"single-node": "単一ノード"
},
+ "request-aborted": "ユーザーがリクエストを中止しました",
"request-access": "Request Access",
"request-data-access": "Request Data Access",
"request-jit": "Request just-in-time access",
@@ -2805,6 +2810,7 @@
"search-scope-row-number-description": "行番号を入力してその行にジャンプします。",
"search-scope-row-number-title": "行番号",
"select-a-database-to-start": "開始するにはデータベースを選択してください",
+ "select-connection": "データ接続を選択してください",
"select-encoding": "エンコーディングの選択",
"self": "SQLエディタ",
"show-databases-without-query-permission": "クエリ権限のないデータベースを表示します",
diff --git a/frontend/src/react/locales/vi-VN.json b/frontend/src/react/locales/vi-VN.json
index 11c055538e..ae327b6567 100644
--- a/frontend/src/react/locales/vi-VN.json
+++ b/frontend/src/react/locales/vi-VN.json
@@ -406,6 +406,7 @@
"system": "Hệ thống",
"table": "Bảng",
"text-wrap": "Ngắt dòng văn bản",
+ "tips": "Mẹo",
"title": "Tiêu đề",
"to": "Đến",
"total": "Total",
@@ -2708,6 +2709,7 @@
},
"binary-format": "Định dạng nhị phân",
"boolean-format": "Định dạng boolean",
+ "can-not-execute-query": "Không thể thực hiện truy vấn khi đang tải dữ liệu.",
"cancel-selection": "Hủy chọn",
"choose-folder": "Chọn hoặc tạo thư mục",
"choose-folder-tips": "Bạn có thể tạo một thư mục mới bằng cách nhập một đường dẫn không tồn tại. Các thư mục phải được nối bằng dấu \"/\".",
@@ -2744,6 +2746,7 @@
"title": "Đóng trang tính chưa lưu?"
}
},
+ "invalid-database": "Cơ sở dữ liệu không hợp lệ {database}",
"jit": "Just-In-Time Access",
"last-synced": "Đã đồng bộ lần cuối: <time></time>",
"link-access": "Truy cập liên kết",
@@ -2761,6 +2764,7 @@
"not-member-of-any-projects": "Bạn không phải là thành viên của bất kỳ dự án nào."
},
"no-queriable-database": "Không có cơ sở dữ liệu có thể truy vấn",
+ "notify-empty-statement": "Vui lòng nhập câu lệnh SQL của bạn vào trình soạn thảo",
"only-select-allowed": "Chỉ cho phép thực thi câu lệnh chỉ đọc.",
"open-in-new-tab": "Mở trong tab mới",
"pending-query": "Đang chờ truy vấn",
@@ -2783,6 +2787,7 @@
"self": "Chạy lệnh redis trên",
"single-node": "Nút đơn"
},
+ "request-aborted": "Người dùng đã hủy yêu cầu",
"request-access": "Request Access",
"request-data-access": "Request Data Access",
"request-jit": "Request just-in-time access",
@@ -2805,6 +2810,7 @@
"search-scope-row-number-description": "Nhập số dòng để chuyển đến dòng đó.",
"search-scope-row-number-title": "Số dòng",
"select-a-database-to-start": "Chọn một cơ sở dữ liệu để bắt đầu",
+ "select-connection": "Vui lòng chọn kết nối",
"select-encoding": "Chọn mã hóa",
"self": "Trình soạn thảo SQL",
"show-databases-without-query-permission": "Hiển thị cơ sở dữ liệu không có quyền truy vấn",
diff --git a/frontend/src/react/locales/zh-CN.json b/frontend/src/react/locales/zh-CN.json
index a9958bea88..df7665ac21 100644
--- a/frontend/src/react/locales/zh-CN.json
+++ b/frontend/src/react/locales/zh-CN.json
@@ -406,6 +406,7 @@
"system": "系统",
"table": "表",
"text-wrap": "文本折行",
+ "tips": "提示信息",
"title": "标题",
"to": "到",
"total": "Total",
@@ -2708,6 +2709,7 @@
},
"binary-format": "二进制格式",
"boolean-format": "布尔格式",
+ "can-not-execute-query": "加载数据时无法执行查询",
"cancel-selection": "取消选择",
"choose-folder": "选择或创建文件夹",
"choose-folder-tips": "您可以通过输入不存在的路径来创建新文件夹。文件夹之间应以\"/\"连接。",
@@ -2744,6 +2746,7 @@
"title": "确定关闭未保存的工作表?"
}
},
+ "invalid-database": "数据库 {database} 无效",
"jit": "即时访问",
"last-synced": "上次同步时间:<time></time>",
"link-access": "链接访问权限",
@@ -2761,6 +2764,7 @@
"not-member-of-any-projects": "你不是任何项目的成员。"
},
"no-queriable-database": "没有可查询的数据库",
+ "notify-empty-statement": "请在编辑器中输入 SQL 语句",
"only-select-allowed": "只允许执行只读语句",
"open-in-new-tab": "在新选项卡中打开",
"pending-query": "待处理查询",
@@ -2783,6 +2787,7 @@
"self": "运行 redis 命令",
"single-node": "单节点"
},
+ "request-aborted": "用户中止了请求",
"request-access": "申请访问",
"request-data-access": "申请数据访问",
"request-jit": "申请即时访问",
@@ -2805,6 +2810,7 @@
"search-scope-row-number-description": "输入行号跳转到指定行。",
"search-scope-row-number-title": "行号",
"select-a-database-to-start": "选择数据库以开始",
+ "select-connection": "请选择数据连接",
"select-encoding": "选择编码",
"self": "SQL 编辑器",
"show-databases-without-query-permission": "显示没有查询权限的数据库",
diff --git a/frontend/src/react/pages/project/ProjectDatabaseDetailPage.test.tsx b/frontend/src/react/pages/project/ProjectDatabaseDetailPage.test.tsx
index b142505fe2..1fd3a26890 100644
--- a/frontend/src/react/pages/project/ProjectDatabaseDetailPage.test.tsx
+++ b/frontend/src/react/pages/project/ProjectDatabaseDetailPage.test.tsx
@@ -174,9 +174,6 @@ const mocks = vi.hoisted(() => {
i18nPlugin: {
install: vi.fn(),
},
- naivePlugin: {
- install: vi.fn(),
- },
routeNames: {
databaseDetail: "workspace.project.database.detail",
},
@@ -298,10 +295,6 @@ vi.mock("@/plugins/i18n", () => ({
default: mocks.i18nPlugin,
}));
-vi.mock("@/plugins/naive-ui", () => ({
- default: mocks.naivePlugin,
-}));
-
vi.mock("@/store/modules/v1/actuator", () => ({
useActuatorV1Store: mocks.useActuatorV1Store,
}));
@@ -520,7 +513,6 @@ beforeEach(() => {
mocks.pinia.install.mockReset();
mocks.highlightPlugin.install.mockReset();
mocks.i18nPlugin.install.mockReset();
- mocks.naivePlugin.install.mockReset();
mocks.useActuatorV1Store.mockReset();
mocks.useActuatorV1Store.mockReturnValue({
serverInfo: {
diff --git a/frontend/src/react/stores/sqlEditor/webTerminal-service.ts b/frontend/src/react/stores/sqlEditor/webTerminal-service.ts
index 65c0ecb42a..27f52aa09f 100644
--- a/frontend/src/react/stores/sqlEditor/webTerminal-service.ts
+++ b/frontend/src/react/stores/sqlEditor/webTerminal-service.ts
@@ -5,8 +5,11 @@ import { cloneDeep } from "lodash-es";
import type { Subscription } from "rxjs";
import { fromEventPattern, Observable } from "rxjs";
import { markRaw, ref } from "vue";
-import { useCancelableTimeout } from "@/composables/useCancelableTimeout";
import { refreshTokens } from "@/connect/refreshToken";
+import {
+ type CancelableTimer,
+ createCancelableTimer,
+} from "@/react/lib/cancelableTimer";
import { useSQLEditorVueState } from "@/react/stores/sqlEditor/editor-vue-state";
import { pushNotification, useDatabaseV1Store } from "@/store";
import type {
@@ -40,13 +43,13 @@ const QUERY_TIMEOUT_MS = 5000;
/**
* Per-tab admin-mode streaming session. The `tab` + `timer` + `controller`
* fields are framework-agnostic mutable services (Emittery / RxJS /
- * `useCancelableTimeout`); the query items themselves live in the zustand
+ * `createCancelableTimer`); the query items themselves live in the zustand
* `webTerminalQueryItemsByTabId` slice so React consumers re-render via
* selectors instead of `useVueState` on a Vue ref.
*/
export interface WebTerminalQuerySession {
tab: SQLEditorTab;
- timer: ReturnType<typeof useCancelableTimeout>;
+ timer: CancelableTimer;
controller: StreamingQueryController;
}
@@ -59,7 +62,7 @@ export const getWebTerminalQuerySession = (
if (existed) return existed;
const session: WebTerminalQuerySession = {
tab,
- timer: markRaw(useCancelableTimeout(QUERY_TIMEOUT_MS)),
+ timer: createCancelableTimer(QUERY_TIMEOUT_MS),
controller: createStreamingQueryController(),
};
sessions.set(tab.id, session);
diff --git a/frontend/src/shell-bridge.test.ts b/frontend/src/shell-bridge.test.ts
index cd49bec886..459424d455 100644
--- a/frontend/src/shell-bridge.test.ts
+++ b/frontend/src/shell-bridge.test.ts
@@ -30,26 +30,6 @@ const mocks = vi.hoisted(() => ({
),
}));
-vi.mock("naive-ui", async () => {
- const { defineComponent, h } = await import("vue");
- const passthrough = (name: string) =>
- defineComponent({
- name,
- setup(_, { slots }) {
- return () => h("div", slots.default?.());
- },
- });
- return {
- NConfigProvider: passthrough("NConfigProvider"),
- };
-});
-
-vi.mock("../naive-ui.config", () => ({
- dateLang: {},
- generalLang: {},
- themeOverrides: {},
-}));
-
vi.mock("@/react/ReactPageMount.vue", async () => {
const { defineComponent, h } = await import("vue");
return {
diff --git a/frontend/src/types/sqlEditor/tree.ts b/frontend/src/types/sqlEditor/tree.ts
index d47cecf765..6d6970614c 100644
--- a/frontend/src/types/sqlEditor/tree.ts
+++ b/frontend/src/types/sqlEditor/tree.ts
@@ -1,4 +1,3 @@
-import type { TreeOption } from "naive-ui";
import type { Database } from "../proto-es/v1/database_service_pb";
import type { InstanceResource } from "../proto-es/v1/instance_service_pb";
import type { Environment } from "../v1/environment";
@@ -49,9 +48,12 @@ type SQLEditorTreeNodeMeta<
export type SQLEditorTreeNode<
T extends SQLEditorTreeNodeType = SQLEditorTreeNodeType,
-> = TreeOption & {
+> = {
meta: SQLEditorTreeNodeMeta<T>;
key: string;
+ label?: string;
+ disabled?: boolean;
+ isLeaf?: boolean;
children?: SQLEditorTreeNode[];
};
diff --git a/frontend/src/types/v2-shared.ts b/frontend/src/types/v2-shared.ts
index 054841b9e1..eb3dcd6150 100644
--- a/frontend/src/types/v2-shared.ts
+++ b/frontend/src/types/v2-shared.ts
@@ -1,9 +1,10 @@
-import type { SelectOption } from "naive-ui";
-
-export type ResourceSelectOption<T> = SelectOption & {
+export type ResourceSelectOption<T> = {
resource?: T;
value: string;
label: string;
+ // Allow arbitrary extra fields the Vue-side select components may set;
+ // React consumers only read value/label/resource.
+ [key: string]: unknown;
};
export type SelectSize = "tiny" | "small" | "medium" | "large";
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
index 5e9a33039c..18194da805 100644
--- a/frontend/src/utils/index.ts
+++ b/frontend/src/utils/index.ts
@@ -18,7 +18,6 @@ export * from "./idp";
export * from "./workspaceApprovalSetting";
export * from "./TinyTimer";
export * from "./sheet";
-export * from "./naive-ui";
export * from "./workloadIdentity";
export * from "./auth";
diff --git a/frontend/src/utils/naive-ui.ts b/frontend/src/utils/naive-ui.ts
deleted file mode 100644
index b68f3c5806..0000000000
--- a/frontend/src/utils/naive-ui.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { pausableWatch, useElementSize } from "@vueuse/core";
-import type { DataTableInst, VirtualListInst } from "naive-ui";
-import { computed, type MaybeRef, ref, unref } from "vue";
-import { nextAnimationFrame } from "./dom";
-
-type AutoHeightDataTableOptions = {
- maxHeight: number | null;
-};
-const defaultAutoHeightDataTableOptions = (): AutoHeightDataTableOptions => ({
- maxHeight: null,
-});
-
-export const useAutoHeightDataTable = (
- data?: MaybeRef<unknown[]>,
- options?: MaybeRef<Partial<AutoHeightDataTableOptions>>
-) => {
- const opts = computed(() => ({
- ...defaultAutoHeightDataTableOptions(),
- ...unref(options),
- }));
- const GAP_HEIGHT = 2;
- const dataTableRef = ref<DataTableInst>();
- const containerElRef = ref<HTMLElement>();
- const tableHeaderElRef = computed(
- () =>
- containerElRef.value?.querySelector("thead.n-data-table-thead") as
- | HTMLElement
- | undefined
- );
- const { height: containerHeight } = useElementSize(containerElRef);
- const { height: tableHeaderHeight } = useElementSize(tableHeaderElRef);
- const tableBodyHeight = ref(0);
-
- const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(
- [() => unref(data), containerHeight, tableHeaderHeight, opts],
- async () => {
- if (containerHeight.value === 0 || tableHeaderHeight.value === 0) return;
- if (opts.value.maxHeight === null) {
- // The table height is always limited by the container height
- // and need not to be adjusted automatically
- tableBodyHeight.value =
- containerHeight.value - tableHeaderHeight.value - GAP_HEIGHT;
- return;
- }
-
- pauseWatch();
- const experimentalMaxBodyHeight =
- opts.value.maxHeight - tableHeaderHeight.value - GAP_HEIGHT;
- tableBodyHeight.value = experimentalMaxBodyHeight;
- await nextAnimationFrame();
- resumeWatch();
- },
- { immediate: true }
- );
-
- // Use this to avoid unnecessary initial rendering
- const layoutReady = computed(() => tableHeaderHeight.value > 0);
-
- const virtualListRef = computed(() => {
- // biome-ignore lint/suspicious/noExplicitAny: accessing internal naive-ui refs
- return (dataTableRef.value as any)?.$refs?.mainTableInstRef?.bodyInstRef // eslint-disable-line @typescript-eslint/no-explicit-any
- ?.virtualListRef as VirtualListInst | undefined;
- });
-
- const scrollerRef = computed(() => {
- // biome-ignore lint/suspicious/noExplicitAny: accessing internal naive-ui refs
- const getter = (dataTableRef.value as any)?.$refs.mainTableInstRef.$refs // eslint-disable-line @typescript-eslint/no-explicit-any
- .bodyInstRef.virtualListContainer;
- if (typeof getter === "function") {
- return getter() as HTMLElement | undefined;
- }
- return undefined;
- });
-
- return {
- dataTableRef,
- containerElRef,
- tableHeaderElRef,
- tableBodyHeight,
- layoutReady,
- virtualListRef,
- scrollerRef,
- };
-};
diff --git a/frontend/src/composables/utils.test.ts b/frontend/src/utils/sqlResult.test.ts
similarity index 97%
rename from frontend/src/composables/utils.test.ts
rename to frontend/src/utils/sqlResult.test.ts
index 859cace514..47b673ffca 100644
--- a/frontend/src/composables/utils.test.ts
+++ b/frontend/src/utils/sqlResult.test.ts
@@ -5,7 +5,7 @@ import {
QueryRowSchema,
RowValueSchema,
} from "@/types/proto-es/v1/sql_service_pb";
-import { flattenNoSQLQueryResult } from "./utils";
+import { flattenNoSQLQueryResult } from "./sqlResult";
describe("flattenNoSQLQueryResult", () => {
test("flattens raw MongoDB document rows into table columns on demand", () => {
diff --git a/frontend/src/composables/utils.ts b/frontend/src/utils/sqlResult.ts
similarity index 100%
rename from frontend/src/composables/utils.ts
rename to frontend/src/utils/sqlResult.ts
diff --git a/frontend/src/utils/string.ts b/frontend/src/utils/string.ts
index bd59dc5766..66eb4e3914 100644
--- a/frontend/src/utils/string.ts
+++ b/frontend/src/utils/string.ts
@@ -31,3 +31,12 @@ const UNICODE_WHITESPACE = new RegExp(
export const normalizeTitle = (title: string): string =>
title.replace(UNICODE_WHITESPACE, "");
+
+export function hashCode(s: string): number {
+ let hash = 0;
+ for (let i = 0; i < s.length; i++) {
+ hash = (hash << 5) - hash + s.charCodeAt(i);
+ hash |= 0; // Convert to 32bit integer
+ }
+ return hash;
+}
diff --git a/frontend/src/utils/v1/databaseResource.ts b/frontend/src/utils/v1/databaseResource.ts
index 8985ac48d5..0673a29b11 100644
--- a/frontend/src/utils/v1/databaseResource.ts
+++ b/frontend/src/utils/v1/databaseResource.ts
@@ -1,5 +1,4 @@
import { flatten, isUndefined } from "lodash-es";
-import type { TransferOption, TreeOption } from "naive-ui";
import { useDBSchemaV1Store } from "@/store";
import {
databaseNamePrefix,
@@ -23,12 +22,12 @@ export type DatabaseResourceType =
| "tables"
| "columns";
-export interface DatabaseTreeOption<L = DatabaseResourceType>
- extends TreeOption,
- TransferOption {
+export interface DatabaseTreeOption<L = DatabaseResourceType> {
label: string;
level: L;
value: string;
+ isLeaf?: boolean;
+ disabled?: boolean;
children?: DatabaseTreeOption[];
}
diff --git a/frontend/src/views/sql-editor/EditorCommon/hover-state.ts b/frontend/src/views/sql-editor/EditorCommon/hover-state.ts
deleted file mode 100644
index 5d62e0b3fd..0000000000
--- a/frontend/src/views/sql-editor/EditorCommon/hover-state.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import type { Ref } from "vue";
-import { inject, provide, ref } from "vue";
-import { useDelayedValue } from "@/composables/useDelayedValue";
-import type { Position } from "@/types";
-
-type UpdateFn<T> = ReturnType<typeof useDelayedValue<T | undefined>>["update"];
-
-export type HoverStateContext<S> = {
- state: Ref<S | undefined>;
- position: Ref<Position>;
- update: UpdateFn<S>;
-};
-
-export const useHoverStateContext = <S>(key: string): HoverStateContext<S> => {
- const KEY = `bb.sql-editor.${key}.hover-state`;
- return inject(KEY)!;
-};
-
-export const provideHoverStateContext = <S>(key: string) => {
- const { value: state, update } = useDelayedValue<S | undefined>(undefined, {
- delayBefore: 1000,
- delayAfter: 350,
- });
- const position = ref<Position>({
- x: 0,
- y: 0,
- });
- const context: HoverStateContext<S> = {
- state,
- position,
- update,
- };
-
- const KEY = `bb.sql-editor.${key}.hover-state`;
- provide(KEY, context);
-
- return context;
-};
diff --git a/frontend/src/views/sql-editor/EditorCommon/index.ts b/frontend/src/views/sql-editor/EditorCommon/index.ts
deleted file mode 100644
index 265d314969..0000000000
--- a/frontend/src/views/sql-editor/EditorCommon/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from "./hover-state";
-export * from "./utils";
diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json
index 497b30e378..0b3ab3a6f0 100644
--- a/frontend/tsconfig.app.json
+++ b/frontend/tsconfig.app.json
@@ -2,7 +2,6 @@
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": [
"env.d.ts",
- "naive-ui.config.ts",
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue"
diff --git a/frontend/tsconfig.vitest.json b/frontend/tsconfig.vitest.json
index a515400df9..cdce34b95f 100644
--- a/frontend/tsconfig.vitest.json
+++ b/frontend/tsconfig.vitest.json
@@ -2,7 +2,6 @@
"extends": "./tsconfig.app.json",
"include": [
"env.d.ts",
- "naive-ui.config.ts",
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue"
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 2db9b675ec..6abb95a571 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -95,10 +95,6 @@ export default defineConfig({
if (id.includes("sql-formatter") || id.includes("antlr4")) {
return "sql-tools";
}
- // UI framework
- if (id.includes("naive-ui")) {
- return "ui-framework";
- }
// Utilities
if (id.includes("lodash") || id.includes("dayjs")) {
return "utils";