Skip to content

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

refactor: get rid of 3rd-party dependencies (#18249)

ecmadao5947976a4afb
diff --git a/frontend/.pnpmfile.cjs b/frontend/.pnpmfile.cjs
index 2a09e40dec..995f8d5973 100644
--- a/frontend/.pnpmfile.cjs
+++ b/frontend/.pnpmfile.cjs
@@ -14,26 +14,6 @@ module.exports = {
}
);
}
- if (pkg.name === "@types/splitpanes") {
- // https://github.com/bytebase/bytebase/security/dependabot/65
- // @types/splitpanes depends on vue@2
- // but it's just a type reference, and will not be actually compiled
- // into our build.
- // So we won't resolve it, to avoid security vulnerability.
- const key = "vue";
- if (pkg.dependencies) {
- Reflect.deleteProperty(pkg.dependencies, key);
- }
- if (pkg.devDependencies) {
- Reflect.deleteProperty(pkg.devDependencies, key);
- }
- if (pkg.peerDependencies) {
- Reflect.deleteProperty(pkg.peerDependencies, key);
- }
- if (pkg.peerDependenciesMeta) {
- Reflect.deleteProperty(pkg.peerDependenciesMeta, key);
- }
- }
return pkg;
},
},
diff --git a/frontend/package.json b/frontend/package.json
index d2c45e1eef..d89a9d4777 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -64,7 +64,6 @@
"pinia": "3.0.3",
"pouchdb": "^9.0.0",
"pouchdb-find": "^9.0.0",
- "qrcode": "^1.5.4",
"qs": "6.14.0",
"regenerator-runtime": "^0.14.1",
"rxjs": "^7.8.2",
@@ -72,7 +71,6 @@
"scrollparent": "^2.1.0",
"semver": "7.7.3",
"slug": "11.0.1",
- "splitpanes": "4.0.4",
"sql-formatter": "15.6.10",
"string-width": "^8.0.0",
"tailwind-merge": "^3.3.0",
@@ -109,12 +107,10 @@
"@types/normalize-wheel": "^1.0.4",
"@types/pouchdb": "^6.4.2",
"@types/pouchdb-find": "^7.3.3",
- "@types/qrcode": "^1.5.6",
"@types/qs": "6.14.0",
"@types/scrollparent": "^2.0.3",
"@types/semver": "7.7.1",
"@types/slug": "5.0.9",
- "@types/splitpanes": "2.2.6",
"@types/uuid": "11.0.0",
"@vitejs/plugin-legacy": "~7.2.1",
"@vitejs/plugin-vue": "6.0.1",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index bf40a6aa93..5fbb10e33f 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -4,7 +4,7 @@ settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
-pnpmfileChecksum: sha256-im1brr/X3QAOxHAaowhxSTUh7fDrGsj11u9EY4szJJE=
+pnpmfileChecksum: sha256-D+Oiltjq0mI5+T73et/+VdZYEDWjB/193i1+mwbpq0Y=
importers:
@@ -142,9 +142,6 @@ importers:
pouchdb-find:
specifier: ^9.0.0
version: 9.0.0
- qrcode:
- specifier: ^1.5.4
- version: 1.5.4
qs:
specifier: 6.14.0
version: 6.14.0
@@ -166,9 +163,6 @@ importers:
slug:
specifier: 11.0.1
version: 11.0.1
- splitpanes:
- specifier: 4.0.4
sql-formatter:
specifier: 15.6.10
version: 15.6.10
@@ -272,9 +266,6 @@ importers:
'@types/pouchdb-find':
specifier: ^7.3.3
version: 7.3.3
- '@types/qrcode':
- specifier: ^1.5.6
- version: 1.5.6
'@types/qs':
specifier: 6.14.0
version: 6.14.0
@@ -287,9 +278,6 @@ importers:
'@types/slug':
specifier: 5.0.9
version: 5.0.9
- '@types/splitpanes':
- specifier: 2.2.6
- version: 2.2.6
'@types/uuid':
specifier: 11.0.0
version: 11.0.0
@@ -2453,9 +2441,6 @@ packages:
resolution: {integrity: sha512-YsI47rASdtzR+3V3JE2UKY58snhm0AglHBpyckQBkRYoCbTvGagXHtV0x5n8nzN04jQmvTG+Sm85cIzKT3KXBA==}
- '@types/[email protected]':
- resolution: {integrity: sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==}
-
resolution: {integrity: sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==}
@@ -2468,9 +2453,6 @@ packages:
resolution: {integrity: sha512-6Yp8BSplP35Esa/wOG1wLNKiqXevpQTEF/RcL/NV6BBQaMmZh4YlDwCgrrFSoUE4xAGvnKd5c+lkQJmPrBAzfQ==}
- '@types/[email protected]':
- resolution: {integrity: sha512-3dV5sO1Ht74iER4jJU03mreL3f+Q2h47ZqXS6Sfbqc6hkCvsDrX1GA0NbYWRdNvZemPyTDzUoApWKeoGbALwkQ==}
-
resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==}
@@ -2886,10 +2868,6 @@ packages:
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-eA7Ys/DGw+pnkWWSE/id29f2IcPHVoE8wxtvE5JdvD2V28VTDPy1yEeo11Guz0sJ4ZeGRcm3uaTcAqK1LXaphA==}
@@ -2922,9 +2900,6 @@ packages:
resolution: {integrity: sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==}
- resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==}
-
resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
engines: {node: '>=12'}
@@ -3170,10 +3145,6 @@ packages:
supports-color:
optional: true
- resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
- engines: {node: '>=0.10.0'}
-
resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==}
@@ -3213,9 +3184,6 @@ packages:
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
engines: {node: '>=0.3.1'}
- resolution: {integrity: sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==}
-
resolution: {integrity: sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==}
@@ -3461,10 +3429,6 @@ packages:
resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}
engines: {node: '>=8'}
- resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
engines: {node: '>=10'}
@@ -3923,10 +3887,6 @@ packages:
resolution: {integrity: sha512-arhlxbFRmoQHl33a0Zkle/YWlmNwoyt6QNZEIJcqNbdrsix5Lvc4HyyI3EnwxTYlZYc32EbYrQ8SzEZ7dqgg9A==}
engines: {node: '>=14'}
- resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
engines: {node: '>=10'}
@@ -4240,26 +4200,14 @@ packages:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
- resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
engines: {node: '>=10'}
- resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
engines: {node: '>=10'}
- resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
@@ -4332,10 +4280,6 @@ packages:
resolution: {integrity: sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==}
- resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==}
- engines: {node: '>=10.13.0'}
-
resolution: {integrity: sha512-yuGIEjDAYnnOex9ddMnKZEMFE0CcGo6zbfzDklkmT1m5z734ss6JMzN9rNB3+RR7iS+F10D4/BVIaXOyh8PQKw==}
engines: {node: '>= 10.12'}
@@ -4415,11 +4359,6 @@ packages:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==}
- engines: {node: '>=10.13.0'}
- hasBin: true
-
resolution: {integrity: sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==}
engines: {node: '>=0.6'}
@@ -4498,9 +4437,6 @@ packages:
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
engines: {node: '>=0.10.0'}
- resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
-
resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==}
@@ -4588,9 +4524,6 @@ packages:
engines: {node: '>=10'}
hasBin: true
- resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
-
resolution: {integrity: sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==}
@@ -4662,11 +4595,6 @@ packages:
peerDependencies:
vue: ^3.2.0
- resolution: {integrity: sha512-RbysugZhjbCw5fgplvk3hOXr41stahQDtZhHVkhnnJI6H4wlGDhM2kIpbehy7v92duy9GnMa8zIhHigIV1TWtg==}
- peerDependencies:
- vue: ^3.2.0
-
resolution: {integrity: sha512-0bJOPQrRO/JkjQhiThVayq0hOKnI1tHI+2OTkmT7TGtc6kqS+V7kveeMzRW+RNQGxofmTmet9ILvztyuxv0cJQ==}
hasBin: true
@@ -5179,9 +5107,6 @@ packages:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
- resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==}
-
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
engines: {node: '>= 8'}
@@ -5196,10 +5121,6 @@ packages:
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
engines: {node: '>=0.10.0'}
- resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
engines: {node: '>=10'}
@@ -5238,9 +5159,6 @@ packages:
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
engines: {node: '>=0.4'}
- resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==}
-
resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
engines: {node: '>=10'}
@@ -5257,18 +5175,10 @@ packages:
engines: {node: '>= 14.6'}
hasBin: true
- resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
- resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
engines: {node: '>=12'}
@@ -8041,10 +7951,6 @@ snapshots:
'@types/pouchdb-node': 6.1.7
'@types/pouchdb-replication': 6.4.7
- '@types/[email protected]':
- dependencies:
- '@types/node': 24.10.0
-
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -8053,8 +7959,6 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]': {}
-
'@types/[email protected]': {}
@@ -8581,8 +8485,6 @@ snapshots:
-
@@ -8621,12 +8523,6 @@ snapshots:
select: 1.1.2
tiny-emitter: 2.1.0
- dependencies:
- string-width: 4.2.3
- strip-ansi: 6.0.1
- wrap-ansi: 6.2.0
-
dependencies:
string-width: 4.2.3
@@ -8893,8 +8789,6 @@ snapshots:
dependencies:
ms: 2.1.3
-
@@ -8926,8 +8820,6 @@ snapshots:
-
@@ -9195,11 +9087,6 @@ snapshots:
dependencies:
to-regex-range: 5.0.1
- dependencies:
- locate-path: 5.0.0
- path-exists: 4.0.0
-
dependencies:
locate-path: 6.0.0
@@ -9626,10 +9513,6 @@ snapshots:
pkg-types: 2.3.0
quansync: 0.2.11
- dependencies:
- p-locate: 4.1.0
-
dependencies:
p-locate: 5.0.0
@@ -10140,24 +10023,14 @@ snapshots:
type-check: 0.4.0
word-wrap: 1.2.5
- dependencies:
- p-try: 2.2.0
-
dependencies:
yocto-queue: 0.1.0
- dependencies:
- p-limit: 2.3.0
-
dependencies:
p-limit: 3.1.0
-
@@ -10237,8 +10110,6 @@ snapshots:
exsolve: 1.0.7
pathe: 2.0.3
-
dependencies:
async: 3.2.6
@@ -10358,12 +10229,6 @@ snapshots:
- dependencies:
- dijkstrajs: 1.0.3
- pngjs: 5.0.0
- yargs: 15.4.1
-
dependencies:
side-channel: 1.1.0
@@ -10465,8 +10330,6 @@ snapshots:
-
@@ -10556,8 +10419,6 @@ snapshots:
-
@@ -10623,10 +10484,6 @@ snapshots:
dependencies:
vue: 3.5.22([email protected])
- dependencies:
- vue: 3.5.22([email protected])
-
dependencies:
argparse: 2.0.1
@@ -11131,8 +10988,6 @@ snapshots:
tr46: 0.0.3
webidl-conversions: 3.0.1
-
dependencies:
isexe: 2.0.0
@@ -11144,12 +10999,6 @@ snapshots:
- dependencies:
- ansi-styles: 4.3.0
- string-width: 4.2.3
- strip-ansi: 6.0.1
-
dependencies:
ansi-styles: 4.3.0
@@ -11176,8 +11025,6 @@ snapshots:
-
@@ -11189,27 +11036,8 @@ snapshots:
- dependencies:
- camelcase: 5.3.1
- decamelize: 1.2.0
-
- dependencies:
- cliui: 6.0.0
- decamelize: 1.2.0
- find-up: 4.1.0
- get-caller-file: 2.0.5
- require-directory: 2.1.1
- require-main-filename: 2.0.0
- set-blocking: 2.0.0
- string-width: 4.2.3
- which-module: 2.0.1
- y18n: 4.0.3
- yargs-parser: 18.1.3
-
dependencies:
cliui: 8.0.1
diff --git a/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue b/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue
index 7bd6a6e4d9..2e0d9747ab 100644
--- a/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue
+++ b/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue
@@ -44,7 +44,7 @@
/>
</div>
</div>
- <template v-if="state.enabled">
+ <NCollapseTransition :show="state.enabled" class="flex flex-col gap-y-4">
<div>
<label class="flex items-center gap-x-2 mb-2">
<span class="font-medium">{{
@@ -153,7 +153,7 @@
</span>
</NTooltip>
</div>
- </template>
+ </NCollapseTransition>
</div>
</div>
</div>
@@ -161,7 +161,7 @@
<script lang="ts" setup>
import { create } from "@bufbuild/protobuf";
-import { NSelect, NTooltip } from "naive-ui";
+import { NCollapseTransition, NSelect, NTooltip } from "naive-ui";
import scrollIntoView from "scroll-into-view-if-needed";
import { computed, onMounted, reactive, ref, watch, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
diff --git a/frontend/src/components/GeneralSetting/AnnouncementSetting.vue b/frontend/src/components/GeneralSetting/AnnouncementSetting.vue
index e5c5427b25..cf09692140 100644
--- a/frontend/src/components/GeneralSetting/AnnouncementSetting.vue
+++ b/frontend/src/components/GeneralSetting/AnnouncementSetting.vue
@@ -15,7 +15,7 @@
</span>
</div>
<div class="flex-1 lg:px-5">
- <div class="mb-7 mt-5 lg:mt-0">
+ <div class="mt-5 lg:mt-0">
<label class="flex items-center gap-x-2">
<span class="font-medium">{{
$t(
diff --git a/frontend/src/components/ProfileDropdown.vue b/frontend/src/components/ProfileDropdown.vue
index 78baa2740b..cfb5d8cafb 100644
--- a/frontend/src/components/ProfileDropdown.vue
+++ b/frontend/src/components/ProfileDropdown.vue
@@ -236,7 +236,12 @@ const options = computed((): DropdownOption[] => [
key: "profile",
type: "render",
render() {
- return <ProfilePreview link={props.link} />;
+ return (
+ <ProfilePreview
+ link={props.link}
+ onClick={() => (showDropdown.value = false)}
+ />
+ );
},
},
{
diff --git a/frontend/src/components/ProfilePreview.vue b/frontend/src/components/ProfilePreview.vue
index 8189d45c07..7235931445 100644
--- a/frontend/src/components/ProfilePreview.vue
+++ b/frontend/src/components/ProfilePreview.vue
@@ -4,6 +4,7 @@
class="px-4 py-3 menu-item w-48"
role="menuitem"
v-bind="bindings"
+ @click="$emit('click')"
>
<p class="text-sm flex justify-between gap-x-2">
<span class="text-main font-medium truncate text-ellipsis">
@@ -31,6 +32,10 @@ const props = withDefaults(
}
);
+defineEmits<{
+ (event: "click"): void;
+}>();
+
const router = useRouter();
const currentUserV1 = useCurrentUserV1();
diff --git a/frontend/src/components/RecoveryCodesView.vue b/frontend/src/components/RecoveryCodesView.vue
index 4a66bb1014..47bedbd939 100644
--- a/frontend/src/components/RecoveryCodesView.vue
+++ b/frontend/src/components/RecoveryCodesView.vue
@@ -22,14 +22,14 @@
</template>
</BBAttention>
<div
- class="mt-8 w-full mx-auto flex flex-col justify-start items-start"
+ class="w-full mx-auto flex flex-col justify-start items-start"
v-bind="$attrs"
>
<ul
class="w-full grid grid-cols-2 list-disc list-inside mx-auto gap-4 gap-x-24 p-8 px-12 border rounded-md bg-gray-50"
>
<li v-for="code in props.recoveryCodes" :key="code">
- <code class="-ml-2">{{ code }}</code>
+ <code class="ml-2">{{ code }}</code>
</li>
</ul>
</div>
diff --git a/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue b/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue
index 70d4510def..3d4faed964 100644
--- a/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue
+++ b/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue
@@ -4,26 +4,28 @@
v-bind="$attrs"
>
<MaskSpinner v-if="combinedLoading" />
- <Splitpanes
- class="default-theme w-full flex-1 flex flex-row overflow-hidden relative"
+ <NSplit
+ :min="0.15"
+ :max="0.4"
+ :default-size="0.25"
+ :resize-trigger-size="1"
>
- <Pane min-size="15" size="25">
+ <template #1>
<Aside
v-if="ready"
@update-is-editing="$emit('update-is-editing', $event)"
/>
- </Pane>
- <Pane min-size="60" size="75">
+ </template>
+ <template #2>
<Editor v-if="ready" />
- </Pane>
- </Splitpanes>
+ </template>
+ </NSplit>
</div>
</template>
<script lang="ts" setup>
import { cloneDeep } from "lodash-es";
-import { Pane, Splitpanes } from "splitpanes";
-import "splitpanes/dist/splitpanes.css";
+import { NSplit } from "naive-ui";
import { computed, onMounted, toRef } from "vue";
import MaskSpinner from "@/components/misc/MaskSpinner.vue";
import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";
@@ -161,37 +163,3 @@ defineExpose({
isDirty: context.isDirty,
});
</script>
-
-<style lang="postcss" scoped>
-/* splitpanes pane style */
-.bb-schema-editor :deep(.splitpanes.default-theme .splitpanes__pane) {
- background-color: transparent;
- transition: none !important;
-}
-
-.bb-schema-editor :deep(.splitpanes.default-theme .splitpanes__splitter) {
- background-color: var(--color-gray-100);
- border: none;
-}
-
-.bb-schema-editor :deep(.splitpanes.default-theme .splitpanes__splitter:hover) {
- background-color: var(--color-indigo-300);
-}
-
-.bb-schema-editor
- :deep(.splitpanes.default-theme .splitpanes__splitter::before),
-.bb-schema-editor
- :deep(.splitpanes.default-theme .splitpanes__splitter::after) {
- background-color: var(--color-gray-700);
- opacity: 0.5;
- color: white;
-}
-
-.bb-schema-editor
- :deep(.splitpanes.default-theme .splitpanes__splitter:hover::before),
-.bb-schema-editor
- :deep(.splitpanes.default-theme .splitpanes__splitter:hover::after) {
- background-color: white;
- opacity: 1;
-}
-</style>
diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vue
index 110fa29ba7..a477da6086 100644
--- a/frontend/src/views/ProfileDashboard.vue
+++ b/frontend/src/views/ProfileDashboard.vue
@@ -28,18 +28,10 @@
:disabled="!allowSaveEdit"
@click.prevent="saveEdit"
>
- <template #icon>
- <heroicons-solid:save class="h-5 w-5" />
- </template>
{{ $t("common.save") }}
</NButton>
</template>
<NButton v-else @click.prevent="editUser">
- <template #icon>
- <heroicons-solid:pencil
- class="h-5 w-5 text-control-light"
- />
- </template>
{{ $t("common.edit") }}
</NButton>
</template>
@@ -155,12 +147,12 @@
<FeatureBadge :feature="PlanFeature.FEATURE_TWO_FA" class="ml-2" />
</span>
<div class="flex gap-x-2">
+ <NButton v-if="isMFAEnabled" type="error" @click="disable2FA">
+ {{ $t("common.disable") }}
+ </NButton>
<NButton v-if="user.email === currentUser.email" @click="enable2FA">
{{ isMFAEnabled ? $t("common.edit") : $t("common.enable") }}
</NButton>
- <NButton v-if="isMFAEnabled" @click="disable2FA">
- {{ $t("common.disable") }}
- </NButton>
</div>
</div>
<p class="mt-4 text-sm text-gray-500">
@@ -181,9 +173,9 @@
:options="dropDownOptions"
placement="bottom-end"
>
- <heroicons-outline:ellipsis-horizontal
- class="w-8 p-1 h-auto cursor-pointer hover:bg-gray-100 rounded-sm"
- />
+ <MiniActionButton size="small">
+ <EllipsisIcon class="w-8" />
+ </MiniActionButton>
</NDropdown>
</div>
</div>
@@ -224,6 +216,7 @@ import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";
import type { ConnectError } from "@connectrpc/connect";
import { computedAsync, useTitle } from "@vueuse/core";
import { cloneDeep, isEqual } from "lodash-es";
+import { EllipsisIcon } from "lucide-vue-next";
import type { DropdownOption } from "naive-ui";
import { NButton, NDropdown, NInput, NTag } from "naive-ui";
import { computed, nextTick, onMounted, onUnmounted, reactive, ref } from "vue";
@@ -239,6 +232,7 @@ import RegenerateRecoveryCodesView from "@/components/RegenerateRecoveryCodesVie
import { ActionConfirmModal } from "@/components/SchemaEditorLite";
import UserPassword from "@/components/User/Settings/UserPassword.vue";
import UserAvatar from "@/components/User/UserAvatar.vue";
+import { MiniActionButton } from "@/components/v2";
import { useRouteChangeGuard } from "@/composables/useRouteChangeGuard";
import { WORKSPACE_ROUTE_USER_PROFILE } from "@/router/dashboard/workspaceRoutes";
import {
diff --git a/frontend/src/views/SettingWorkspaceGeneral.vue b/frontend/src/views/SettingWorkspaceGeneral.vue
index 238aa5ccbb..62ab7376e2 100644
--- a/frontend/src/views/SettingWorkspaceGeneral.vue
+++ b/frontend/src/views/SettingWorkspaceGeneral.vue
@@ -39,7 +39,7 @@
:allow-edit="allowEdit"
/>
- <div v-if="allowEdit && isDirty" class="sticky -bottom-4 z-10">
+ <div v-if="allowEdit && isDirty" class="sticky bottom-0 z-10">
<div
class="flex justify-between w-full py-4 border-block-border bg-white"
>
@@ -70,6 +70,7 @@ import {
SecuritySetting,
} from "@/components/GeneralSetting";
import { useRouteChangeGuard } from "@/composables/useRouteChangeGuard";
+import { useBodyLayoutContext } from "@/layouts/common";
import { pushNotification } from "@/store";
import { useSettingV1Store } from "@/store/modules/v1/setting";
@@ -105,6 +106,10 @@ const settingRefList = computed(() => {
];
});
+const { overrideMainContainerClass } = useBodyLayoutContext();
+
+overrideMainContainerClass("!pb-0");
+
onMounted(async () => {
await useSettingV1Store().fetchSettingList();
// If the route has a hash, try to scroll to the element with the value.
diff --git a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
index 2bcc7f8b46..50127386db 100644
--- a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
+++ b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
@@ -85,8 +85,9 @@
</template>
</SQLReviewTabsByEngine>
+
+ <NDivider />
<BBButtonConfirm
- class="my-4!"
:disabled="!hasDeleteReviwConfigPermission"
:type="'DELETE'"
:button-text="$t('sql-review.delete')"
@@ -145,7 +146,7 @@
<script lang="tsx" setup>
import { useTitle } from "@vueuse/core";
-import { NButton } from "naive-ui";
+import { NButton, NDivider } from "naive-ui";
import {
computed,
nextTick,
diff --git a/frontend/src/views/TwoFactorSetup.vue b/frontend/src/views/TwoFactorSetup.vue
index 9c91fb0e62..b0ee0a974d 100644
--- a/frontend/src/views/TwoFactorSetup.vue
+++ b/frontend/src/views/TwoFactorSetup.vue
@@ -81,19 +81,13 @@
</i18n-t>
</p>
<div class="w-full flex flex-col justify-center items-center pb-8">
- <img
- :src="state.qrcodeDataUrl"
- class="border w-64 mt-4 rounded-lg"
- alt=""
- />
+ <NQrCode :value="otpauthUrl" :size="150" :padding="0" />
<span class="mt-4 mb-2 text-sm font-medium">{{
$t("two-factor.setup-steps.setup-auth-app.verify-code")
}}</span>
- <BBTextField
- v-model:value="state.otpCode"
- required
- style="width: 16rem"
- placeholder="XXXXXX"
+ <NInputOtp
+ v-model:value="state.otpCodes"
+ @finish="onOtpCodeFinish"
/>
</div>
</div>
@@ -119,11 +113,10 @@
import { create } from "@bufbuild/protobuf";
import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";
import type { ConnectError } from "@connectrpc/connect";
-import * as QRCode from "qrcode";
-import { computed, onMounted, onUnmounted, reactive, watch } from "vue";
+import { NInputOtp, NQrCode } from "naive-ui";
+import { computed, onMounted, onUnmounted, reactive } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
-import { BBTextField } from "@/bbkit";
import LearnMoreLink from "@/components/LearnMoreLink.vue";
import RecoveryCodesView from "@/components/RecoveryCodesView.vue";
import TwoFactorSecretModal from "@/components/TwoFactorSecretModal.vue";
@@ -134,6 +127,7 @@ import { pushNotification, useCurrentUserV1, useUserStore } from "@/store";
import { UpdateUserRequestSchema } from "@/types/proto-es/v1/user_service_pb";
const issuerName = "Bytebase";
+const digits = 6;
const SETUP_AUTH_APP_STEP = 0;
const DOWNLOAD_RECOVERY_CODES_STEP = 1;
@@ -143,8 +137,7 @@ type Step = typeof SETUP_AUTH_APP_STEP | typeof DOWNLOAD_RECOVERY_CODES_STEP;
interface LocalState {
currentStep: Step;
showSecretModal: boolean;
- qrcodeDataUrl: string;
- otpCode: string;
+ otpCodes: string[];
recoveryCodesDownloaded: boolean;
timeRemaining: string;
isExpired: boolean;
@@ -161,8 +154,7 @@ const userStore = useUserStore();
const state = reactive<LocalState>({
currentStep: SETUP_AUTH_APP_STEP,
showSecretModal: false,
- qrcodeDataUrl: "",
- otpCode: "",
+ otpCodes: [],
recoveryCodesDownloaded: false,
timeRemaining: "5:00",
isExpired: false,
@@ -181,7 +173,9 @@ const stepTabList = computed(() => {
const allowNext = computed(() => {
if (state.currentStep === SETUP_AUTH_APP_STEP) {
- return state.otpCode.length >= 6 && !state.isExpired;
+ return (
+ state.otpCodes.filter((v) => v).length === digits && !state.isExpired
+ );
} else {
return state.recoveryCodesDownloaded;
}
@@ -226,7 +220,7 @@ const startCountdown = () => {
};
const handleRegenerateSecret = async () => {
- state.otpCode = "";
+ state.otpCodes = [];
await regenerateTempMfaSecret();
startCountdown();
};
@@ -257,7 +251,7 @@ const regenerateTempMfaSecret = async () => {
);
};
-const verifyTOPCode = async () => {
+const verifyOTPCode = async () => {
try {
await userStore.updateUser(
create(UpdateUserRequestSchema, {
@@ -267,7 +261,7 @@ const verifyTOPCode = async () => {
updateMask: create(FieldMaskSchema, {
paths: [],
}),
- otpCode: state.otpCode,
+ otpCode: state.otpCodes.join(""),
})
);
} catch (error) {
@@ -291,12 +285,28 @@ const cancelSetup = () => {
}
};
+const onOtpCodeFinish = async (value: string[]) => {
+ state.otpCodes = value;
+ const result = await verifyOTPCode();
+ if (result && state.currentStep === SETUP_AUTH_APP_STEP) {
+ state.currentStep++;
+ }
+};
+
const tryChangeStep = async (nextStepIndex: number) => {
- if (nextStepIndex === DOWNLOAD_RECOVERY_CODES_STEP) {
- const result = await verifyTOPCode();
- if (!result) {
- return;
+ switch (nextStepIndex) {
+ case DOWNLOAD_RECOVERY_CODES_STEP: {
+ const result = await verifyOTPCode();
+ if (!result) {
+ return;
+ }
+ break;
}
+ case SETUP_AUTH_APP_STEP:
+ state.otpCodes = [];
+ break;
+ default:
+ break;
}
state.currentStep = nextStepIndex as Step;
};
@@ -332,12 +342,8 @@ const tryFinishSetup = async () => {
}
};
-watch(
- [currentUser],
- async () => {
- const otpauthUrl = `otpauth://totp/${issuerName}:${currentUser.value.email}?algorithm=SHA1&digits=6&issuer=${issuerName}&period=30&secret=${currentUser.value.tempOtpSecret}`;
- state.qrcodeDataUrl = await QRCode.toDataURL(otpauthUrl);
- },
- { deep: true, immediate: true }
+const otpauthUrl = computed(
+ () =>
+ `otpauth://totp/${issuerName}:${currentUser.value.email}?algorithm=SHA1&digits=${digits}&issuer=${issuerName}&period=30&secret=${currentUser.value.tempOtpSecret}`
);
</script>
diff --git a/frontend/src/views/auth/MultiFactor.vue b/frontend/src/views/auth/MultiFactor.vue
index 275b2221d9..023d62e59e 100644
--- a/frontend/src/views/auth/MultiFactor.vue
+++ b/frontend/src/views/auth/MultiFactor.vue
@@ -1,8 +1,8 @@
<template>
<div
- class="mx-auto w-full h-full py-6 flex flex-col justify-center items-center bg-gray-100 rounded-lg"
+ class="mx-auto w-full h-full py-6 flex flex-col justify-center items-center"
>
- <div class="w-80 bg-white p-8 py-6 rounded-lg shadow-sm">
+ <NCard class="w-80 p-8 py-6 shadow-sm">
<img
class="h-12 w-auto mx-auto mb-8"
src="@/assets/logo-full.svg"
@@ -13,14 +13,13 @@
@submit.prevent="challenge"
>
<template v-if="state.selectedMFAType === 'OTP'">
- <heroicons-outline:device-phone-mobile
+ <SmartphoneIcon
class="w-8 h-auto opacity-60"
/>
<p class="my-2 mb-4">{{ $t("multi-factor.auth-code") }}</p>
- <BBTextField
- v-model:value="state.otpCode"
- placeholder="XXXXXX"
- class="w-full"
+ <NInputOtp
+ v-model:value="state.otpCodes"
+ @finish="onOtpCodeFinish"
/>
</template>
<template v-else-if="state.selectedMFAType === 'RECOVERY_CODE'">
@@ -60,12 +59,13 @@
</li>
</ul>
</div>
- </div>
+ </NCard>
</div>
</template>
<script lang="ts" setup>
-import { NButton } from "naive-ui";
+import { SmartphoneIcon } from "lucide-vue-next";
+import { NButton, NCard, NInputOtp } from "naive-ui";
import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router";
@@ -76,7 +76,7 @@ type MFAType = "OTP" | "RECOVERY_CODE";
interface LocalState {
selectedMFAType: MFAType;
- otpCode: string;
+ otpCodes: string[];
recoveryCode: string;
}
@@ -85,7 +85,7 @@ const route = useRoute();
const authStore = useAuthStore();
const state = reactive<LocalState>({
selectedMFAType: "OTP",
- otpCode: "",
+ otpCodes: [],
recoveryCode: "",
});
@@ -103,10 +103,15 @@ const challengeDescription = computed(() => {
}
});
+const onOtpCodeFinish = async (value: string[]) => {
+ state.otpCodes = value;
+ await challenge();
+};
+
const challenge = async () => {
const mfaContext: any = {};
if (state.selectedMFAType === "OTP") {
- mfaContext.otpCode = state.otpCode;
+ mfaContext.otpCode = state.otpCodes.join("");
} else if (state.selectedMFAType === "RECOVERY_CODE") {
mfaContext.recoveryCode = state.recoveryCode;
}
diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/TriggersTable.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/TriggersTable.vue
index c1f6419cf7..8ea7690d01 100644
--- a/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/TriggersTable.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/TriggersTable.vue
@@ -1,58 +1,56 @@
<template>
- <Splitpanes
- horizontal
- class="w-full h-full overflow-x-auto relative flex flex-col"
+ <NSplit
+ :disabled="!detail"
+ :size="detail ? 0.6 : 1"
+ :resize-trigger-size="1"
>
- <Pane class="flex-1 overflow-y-hidden" :size="detail ? 60 : 100">
- <div ref="containerElRef" class="w-full h-full">
- <NDataTable
- v-bind="$attrs"
- ref="dataTableRef"
- size="small"
- :row-key="
- ({ trigger, position }) => keyWithPosition(trigger.name, position)
- "
- :columns="columns"
- :data="layoutReady ? filteredTriggers : []"
- :row-props="rowProps"
- :max-height="tableBodyHeight"
- :virtual-scroll="true"
- :striped="true"
- :bordered="true"
- :bottom-bordered="true"
- row-class-name="cursor-pointer"
- />
+ <template #1>
+ <div class="h-full flex-1 overflow-y-hidden">
+ <div ref="containerElRef" class="w-full h-full">
+ <NDataTable
+ v-bind="$attrs"
+ ref="dataTableRef"
+ size="small"
+ :row-key="
+ ({ trigger, position }) => keyWithPosition(trigger.name, position)
+ "
+ :columns="columns"
+ :data="layoutReady ? filteredTriggers : []"
+ :row-props="rowProps"
+ :max-height="tableBodyHeight"
+ :virtual-scroll="true"
+ :striped="true"
+ :bordered="true"
+ :bottom-bordered="true"
+ row-class-name="cursor-pointer"
+ />
+ </div>
</div>
- </Pane>
- <Pane
- v-if="detail"
- class="flex flex-col items-stretch shrink-0 overflow-hidden"
- :size="40"
- >
- <CodeViewer
- :db="db"
- :title="detail.trigger.name"
- :code="detail.trigger.body"
- header-class="p-0! h-[34px]"
- >
- <template #title-prefix>
- <NButton text @click="deselect">
- <ChevronDownIcon class="w-5 h-5" />
- <div class="flex items-center gap-1">
- <TriggerIcon class="w-4 h-4" />
+ </template>
+ <template #2>
+ <div v-if="detail" class="h-full flex flex-col items-stretch shrink-0 overflow-hidden">
+ <CodeViewer
+ :db="db"
+ :title="detail.trigger.name"
+ :code="detail.trigger.body"
+ header-class="p-0! h-[34px]"
+ >
+ <template #title-prefix>
+ <NButton text @click="deselect">
+ <template #icon>
+ <TriggerIcon class="w-4 h-4" />
+ </template>
<span>{{ detail.trigger.name }}</span>
- </div>
- </NButton>
- </template>
- </CodeViewer>
- </Pane>
- </Splitpanes>
+ </NButton>
+ </template>
+ </CodeViewer>
+ </div>
+ </template>
+ </NSplit>
</template>
<script setup lang="tsx">
-import { ChevronDownIcon } from "lucide-vue-next";
-import { type DataTableColumn, NButton, NDataTable } from "naive-ui";
-import { Pane, Splitpanes } from "splitpanes";
+import { type DataTableColumn, NButton, NDataTable, NSplit } from "naive-ui";
import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import { TriggerIcon } from "@/components/Icon";
diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DefinitionViewer.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DefinitionViewer.vue
index f2cfcba586..c6b3604a31 100644
--- a/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DefinitionViewer.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DefinitionViewer.vue
@@ -1,9 +1,13 @@
<template>
- <Splitpanes
- class="default-theme flex flex-row items-stretch flex-1 w-full overflow-hidden"
- @resized="handleAIPanelResize($event, 1)"
+ <NSplit
+ :disabled="!showAIPanel"
+ :size="editorPanelSize.size"
+ :min="editorPanelSize.min"
+ :max="editorPanelSize.max"
+ :resize-trigger-size="1"
+ @update:size="handleEditorPanelResize"
>
- <Pane>
+ <template #1>
<MonacoEditor
:content="content"
:readonly="true"
@@ -11,29 +15,27 @@
@select-content="handleSelectContent"
@ready="handleEditorReady"
/>
- </Pane>
- <Pane
- v-if="showAIPanel"
- :size="AIPanelSize"
- class="overflow-hidden flex flex-col"
- >
- <Suspense>
- <AIChatToSQL key="ai-chat-to-sql" />
- <template #fallback>
- <div
- class="w-full h-full grow flex flex-col items-center justify-center"
- >
- <BBSpin />
- </div>
- </template>
- </Suspense>
- </Pane>
- </Splitpanes>
+ </template>
+ <template #2>
+ <div class="h-full overflow-hidden flex flex-col">
+ <Suspense>
+ <AIChatToSQL key="ai-chat-to-sql" />
+ <template #fallback>
+ <div
+ class="w-full h-full grow flex flex-col items-center justify-center"
+ >
+ <BBSpin />
+ </div>
+ </template>
+ </Suspense>
+ </div>
+ </template>
+ </NSplit>
</template>
<script setup lang="ts">
import { computedAsync } from "@vueuse/core";
-import { Pane, Splitpanes } from "splitpanes";
+import { NSplit } from "naive-ui";
import { computed, ref } from "vue";
import { BBSpin } from "@/bbkit";
import {
@@ -61,7 +63,8 @@ const emit = defineEmits<{
(event: "back"): void;
}>();
-const { showAIPanel, AIPanelSize, handleAIPanelResize } = useSQLEditorContext();
+const { showAIPanel, editorPanelSize, handleEditorPanelResize } =
+ useSQLEditorContext();
const instanceEngine = computed(() => props.db.instanceResource.engine);
const AIContext = useAIContext();
const selectedStatement = ref("");
diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue
index cbab9193b1..fc20023873 100644
--- a/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue
@@ -26,48 +26,53 @@
</div>
</div>
- <Splitpanes
- class="default-theme flex flex-row items-stretch flex-1 w-full overflow-hidden"
- @resized="handleAIPanelResize($event, 1)"
+ <NSplit
+ :disabled="!showAIPanel"
+ :size="editorPanelSize.size"
+ :min="editorPanelSize.min"
+ :max="editorPanelSize.max"
+ :resize-trigger-size="1"
+ @update:size="handleEditorPanelResize"
>
- <Pane class="flex flex-col h-full overflow-hidden">
- <slot name="content-prefix" />
- <MonacoEditor
- :content="content"
- :readonly="true"
- :format-content-options="{
- disabled: format,
- callback: handleFormatContent,
- }"
- class="flex-1 w-full h-full relative"
- @select-content="selectedStatement = $event"
- @ready="handleEditorReady"
- />
- </Pane>
- <Pane
- v-if="showAIPanel"
- :size="AIPanelSize"
- class="overflow-hidden flex flex-col"
- >
- <Suspense>
- <AIChatToSQL key="ai-chat-to-sql" />
- <template #fallback>
- <div
- class="w-full h-full grow flex flex-col items-center justify-center"
- >
- <BBSpin />
- </div>
- </template>
- </Suspense>
- </Pane>
- </Splitpanes>
+ <template #1>
+ <div class="flex flex-col h-full overflow-hidden">
+ <slot name="content-prefix" />
+ <MonacoEditor
+ :content="content"
+ :readonly="true"
+ :format-content-options="{
+ disabled: format,
+ callback: handleFormatContent,
+ }"
+ class="flex-1 w-full h-full relative"
+ @select-content="selectedStatement = $event"
+ @ready="handleEditorReady"
+ />
+ </div>
+ </template>
+ <template #2>
+ <div
+ class="h-full overflow-hidden flex flex-col"
+ >
+ <Suspense>
+ <AIChatToSQL key="ai-chat-to-sql" />
+ <template #fallback>
+ <div
+ class="w-full h-full grow flex flex-col items-center justify-center"
+ >
+ <BBSpin />
+ </div>
+ </template>
+ </Suspense>
+ </div>
+ </template>
+ </NSplit>
</template>
<script setup lang="ts">
import { computedAsync, useLocalStorage } from "@vueuse/core";
import { ChevronLeftIcon } from "lucide-vue-next";
-import { NButton, NCheckbox } from "naive-ui";
-import { Pane, Splitpanes } from "splitpanes";
+import { NButton, NCheckbox, NSplit } from "naive-ui";
import { computed, ref } from "vue";
import { BBSpin } from "@/bbkit";
import {
@@ -96,7 +101,8 @@ defineEmits<{
(event: "back"): void;
}>();
-const { showAIPanel, AIPanelSize, handleAIPanelResize } = useSQLEditorContext();
+const { showAIPanel, editorPanelSize, handleEditorPanelResize } =
+ useSQLEditorContext();
const AIContext = useAIContext();
const format = useLocalStorage<boolean>(
"bb.sql-editor.editor-panel.code-viewer.format",
diff --git a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/StandardPanel.vue b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/StandardPanel.vue
index ab30845dfc..1a5f13d6eb 100644
--- a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/StandardPanel.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/StandardPanel.vue
@@ -1,75 +1,80 @@
<template>
- <Splitpanes
+ <NSplit
v-if="!tab || tab.mode === 'WORKSHEET'"
- horizontal
- class="default-theme overflow-hidden"
- :dbl-click-splitter="false"
+ direction="vertical"
+ :max="0.8"
+ :resize-trigger-size="1"
>
- <Pane class="flex flex-col overflow-hidden justify-start items-stretch">
- <template v-if="isDisconnected || allowReadonlyMode">
- <EditorAction @execute="handleExecuteFromActionBar" />
+ <template #1>
+ <div class="h-full flex flex-col overflow-hidden justify-start items-stretch">
+ <template v-if="isDisconnected || allowReadonlyMode">
+ <EditorAction @execute="handleExecuteFromActionBar" />
- <Splitpanes
- v-if="tab"
- class="default-theme overflow-hidden"
- @resized="handleAIPanelResize($event, 1)"
- >
- <Pane>
- <Suspense>
- <SQLEditor
- ref="sqlEditorRef"
- @execute="handleExecute"
- />
- <template #fallback>
- <div
- class="w-full h-full grow flex flex-col items-center justify-center"
- >
- <BBSpin />
- </div>
- </template>
- </Suspense>
- </Pane>
- <Pane
- v-if="showAIPanel"
- :size="AIPanelSize"
- class="overflow-hidden flex flex-col"
+ <NSplit
+ v-if="tab"
+ :disabled="!showAIPanel"
+ :size="editorPanelSize.size"
+ :min="editorPanelSize.min"
+ :max="editorPanelSize.max"
+ :resize-trigger-size="1"
+ @update:size="handleEditorPanelResize"
>
- <Suspense>
- <AIChatToSQL key="ai-chat-to-sql" />
- <template #fallback>
- <div
- class="w-full h-full grow flex flex-col items-center justify-center"
- >
- <BBSpin />
- </div>
- </template>
- </Suspense>
- </Pane>
- </Splitpanes>
- <Welcome v-else />
+ <template #1>
+ <Suspense>
+ <SQLEditor
+ ref="sqlEditorRef"
+ @execute="handleExecute"
+ />
+ <template #fallback>
+ <div
+ class="w-full h-full grow flex flex-col items-center justify-center"
+ >
+ <BBSpin />
+ </div>
+ </template>
+ </Suspense>
+ </template>
+ <template #2>
+ <div class="h-full overflow-hidden flex flex-col">
+ <Suspense>
+ <AIChatToSQL key="ai-chat-to-sql" />
+ <template #fallback>
+ <div
+ class="w-full h-full grow flex flex-col items-center justify-center"
+ >
+ <BBSpin />
+ </div>
+ </template>
+ </Suspense>
+ </div>
+ </template>
+ </NSplit>
+ <Welcome v-else />
- <ExecutingHintModal />
+ <ExecutingHintModal />
- <SaveSheetModal />
- </template>
+ <SaveSheetModal />
+ </template>
- <ReadonlyModeNotSupported v-else />
- </Pane>
- <Pane
- v-if="!isDisconnected && allowReadonlyMode"
- class="relative"
- :size="50"
- :min-size="20"
- >
- <ResultPanel />
- </Pane>
- </Splitpanes>
+ <ReadonlyModeNotSupported v-else />
+ </div>
+ </template>
+
+ <template #2>
+ <div
+ v-if="!isDisconnected && allowReadonlyMode"
+ class="relative h-full"
+ >
+ <ResultPanel />
+ </div>
+ </template>
+ </NSplit>
</template>
<script lang="ts" setup>
import { cloneDeep } from "lodash-es";
+import { NSplit } from "naive-ui";
import { storeToRefs } from "pinia";
-import { Pane, Splitpanes } from "splitpanes";
import { computed, defineAsyncComponent, nextTick, ref } from "vue";
import { BBSpin } from "@/bbkit";
import { useExecuteSQL } from "@/composables/useExecuteSQL";
@@ -100,7 +105,8 @@ const SQLEditor = defineAsyncComponent(() => import("./SQLEditor.vue"));
const tabStore = useSQLEditorTabStore();
const { currentTab: tab, isDisconnected } = storeToRefs(tabStore);
const { instance } = useConnectionOfCurrentSQLEditorTab();
-const { showAIPanel, AIPanelSize, handleAIPanelResize } = useSQLEditorContext();
+const { showAIPanel, editorPanelSize, handleEditorPanelResize } =
+ useSQLEditorContext();
const { cloneViewState } = useTabViewStateStore();
const sqlEditorRef = ref<InstanceType<typeof SQLEditor>>();
diff --git a/frontend/src/views/sql-editor/SQLEditorHomePage.vue b/frontend/src/views/sql-editor/SQLEditorHomePage.vue
index 0cb295f1b5..094dd53b3f 100644
--- a/frontend/src/views/sql-editor/SQLEditorHomePage.vue
+++ b/frontend/src/views/sql-editor/SQLEditorHomePage.vue
@@ -1,46 +1,50 @@
<template>
<div class="sqleditor--wrapper">
- <Splitpanes
- class="default-theme flex flex-col flex-1 overflow-hidden"
- :dbl-click-splitter="false"
+ <teleport v-if="hideSidebar" to="body">
+ <div
+ id="fff"
+ class="fixed rounded-full border border-control-border shadow-lg w-10 h-10 bottom-16 flex items-center justify-center bg-white hover:bg-control-bg cursor-pointer z-99999999 transition-all"
+ :class="[
+ state.sidebarExpanded ? 'left-[80%] -translate-x-5' : 'left-4',
+ ]"
+ style="
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+ transition-duration: 300ms;
+ "
+ @click="state.sidebarExpanded = !state.sidebarExpanded"
+ >
+ <heroicons-outline:chevron-left
+ class="w-6 h-6 transition-transform"
+ :class="[state.sidebarExpanded ? '' : '-scale-100']"
+ />
+ </div>
+ <Drawer
+ v-model:show="state.sidebarExpanded"
+ width="80vw"
+ placement="left"
+ >
+ <AsidePanel />
+ </Drawer>
+ </teleport>
+ <NSplit
+ direction="horizontal"
+ :disabled="hideSidebar"
+ :size="hideSidebar ? 0 : state.sizebarSize"
+ :min="0.1"
+ :max="0.4"
+ :resize-trigger-size="1"
+ @update:size="size => state.sizebarSize = size"
>
- <Pane v-if="windowWidth >= 800" size="30">
+ <template #1>
<AsidePanel />
- </Pane>
- <template v-else>
- <teleport to="body">
- <div
- id="fff"
- class="fixed rounded-full border border-control-border shadow-lg w-10 h-10 bottom-16 flex items-center justify-center bg-white hover:bg-control-bg cursor-pointer z-99999999 transition-all"
- :class="[
- state.sidebarExpanded ? 'left-[80%] -translate-x-5' : 'left-4',
- ]"
- style="
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transition-duration: 300ms;
- "
- @click="state.sidebarExpanded = !state.sidebarExpanded"
- >
- <heroicons-outline:chevron-left
- class="w-6 h-6 transition-transform"
- :class="[state.sidebarExpanded ? '' : '-scale-100']"
- />
- </div>
- <Drawer
- v-model:show="state.sidebarExpanded"
- width="80vw"
- placement="left"
- >
- <AsidePanel />
- </Drawer>
- </teleport>
</template>
- <Pane class="relative flex flex-col">
- <TabList />
-
- <EditorPanel />
- </Pane>
- </Splitpanes>
+ <template #2>
+ <div class="h-full relative flex flex-col">
+ <TabList />
+ <EditorPanel />
+ </div>
+ </template>
+ </NSplit>
<Quickstart v-if="actuatorStore.info?.enableSample" />
@@ -58,9 +62,9 @@
<script lang="ts" setup>
import { useWindowSize } from "@vueuse/core";
+import { NSplit } from "naive-ui";
import { storeToRefs } from "pinia";
-import { Pane, Splitpanes } from "splitpanes";
-import { reactive } from "vue";
+import { computed, reactive } from "vue";
import { useRouter } from "vue-router";
import IAMRemindModal from "@/components/IAMRemindModal.vue";
import Quickstart from "@/components/Quickstart.vue";
@@ -82,10 +86,12 @@ import { provideCurrentTabViewStateContext } from "./EditorPanel/context/viewSta
import TabList from "./TabList";
type LocalState = {
+ sizebarSize: number;
sidebarExpanded: boolean;
};
const state = reactive<LocalState>({
+ sizebarSize: 0.25,
sidebarExpanded: false,
});
@@ -105,6 +111,7 @@ const { project: projectName, projectContextReady } = storeToRefs(editorStore);
const { currentTab, isDisconnected } = storeToRefs(tabStore);
const { width: windowWidth } = useWindowSize();
+const hideSidebar = computed(() => windowWidth.value < 800);
useEmitteryEventListener(
editorEvents,
@@ -150,38 +157,6 @@ useEmitteryEventListener(editorEvents, "insert-at-caret", ({ content }) => {
});
</script>
-<style lang="postcss">
-@import "splitpanes/dist/splitpanes.css";
-
-/* splitpanes pane style */
-.splitpanes.default-theme .splitpanes__pane {
- background-color: transparent;
-}
-
-.splitpanes.default-theme .splitpanes__splitter {
- background-color: rgb(var(--color-gray-100));
- min-height: 8px;
- min-width: 8px;
-}
-
-.splitpanes.default-theme .splitpanes__splitter:hover {
- background-color: rgb(var(--color-accent));
-}
-
-.splitpanes.default-theme .splitpanes__splitter::before,
-.splitpanes.default-theme .splitpanes__splitter::after {
- background-color: rgb(var(--color-gray-700));
- opacity: 0.5;
- color: white;
-}
-
-.splitpanes.default-theme .splitpanes__splitter:hover::before,
-.splitpanes.default-theme .splitpanes__splitter:hover::after {
- background-color: white;
- opacity: 1;
-}
-</style>
-
<style scoped lang="postcss">
.sqleditor--wrapper {
width: 100%;
diff --git a/frontend/src/views/sql-editor/context.ts b/frontend/src/views/sql-editor/context.ts
index 6da23baab0..4e47f1e297 100644
--- a/frontend/src/views/sql-editor/context.ts
+++ b/frontend/src/views/sql-editor/context.ts
@@ -1,8 +1,8 @@
import { useLocalStorage } from "@vueuse/core";
import Emittery from "emittery";
import { type IRange } from "monaco-editor";
-import type { InjectionKey, Ref } from "vue";
-import { inject, provide, ref } from "vue";
+import type { ComputedRef, InjectionKey, Ref } from "vue";
+import { computed, inject, provide, ref } from "vue";
import { useProjectV1Store, useSQLEditorStore } from "@/store";
import type { SQLEditorTab } from "@/types";
import { isValidProjectName } from "@/types";
@@ -10,8 +10,7 @@ import type { GetSchemaStringRequest_ObjectType } from "@/types/proto-es/v1/data
export type AsidePanelTab = "SCHEMA" | "WORKSHEET" | "HISTORY";
-// 30% by default
-export const storedAIPanelSize = useLocalStorage("bb.plugin.ai.panel-size", 30);
+const minimumEditorPanelSize = 0.5;
export type SQLEditorEvents = Emittery<{
"save-sheet": {
@@ -40,7 +39,11 @@ export type SQLEditorContext = {
asidePanelTab: Ref<AsidePanelTab>;
showConnectionPanel: Ref<boolean>;
showAIPanel: Ref<boolean>;
- AIPanelSize: Ref<number>;
+ editorPanelSize: ComputedRef<{
+ size: number;
+ min: number;
+ max: number;
+ }>;
schemaViewer: Ref<
| {
schema?: string;
@@ -55,7 +58,7 @@ export type SQLEditorContext = {
events: SQLEditorEvents;
maybeSwitchProject: (project: string) => Promise<string | undefined>;
- handleAIPanelResize: (panes: { size: number }[], index?: number) => void;
+ handleEditorPanelResize: (size: number) => void;
};
export const KEY = Symbol(
@@ -70,11 +73,31 @@ export const provideSQLEditorContext = () => {
const editorStore = useSQLEditorStore();
const projectStore = useProjectV1Store();
+ const aiPanelSize = useLocalStorage(
+ "bb.plugin.editor.ai-panel-size",
+ 0.3 /* panel size should in [0.1, 1-minimumEditorPanelSize]*/
+ );
+ const showAIPanel = ref(false);
+ const editorPanelSize = computed(() => {
+ if (!showAIPanel.value) {
+ return {
+ size: 1,
+ max: 1,
+ min: 1,
+ };
+ }
+ return {
+ size: Math.max(1 - aiPanelSize.value, minimumEditorPanelSize),
+ max: 0.9,
+ min: minimumEditorPanelSize,
+ };
+ });
+
const context: SQLEditorContext = {
asidePanelTab: ref("WORKSHEET"),
showConnectionPanel: ref(false),
- showAIPanel: ref(false),
- AIPanelSize: storedAIPanelSize,
+ showAIPanel,
+ editorPanelSize,
schemaViewer: ref(undefined),
pendingInsertAtCaret: ref(),
events: new Emittery(),
@@ -95,16 +118,11 @@ export const provideSQLEditorContext = () => {
editorStore.projectContextReady = true;
}
},
- handleAIPanelResize: (panes, index = 0) => {
- try {
- if (!panes || !Array.isArray(panes) || panes.length <= index) return;
- const pane = panes[index];
- if (!pane || typeof pane.size !== "number") return;
- storedAIPanelSize.value = pane.size;
- } catch (error) {
- // Silently ignore errors from splitpanes during initialization
- console.debug("Splitpanes resize handler error (ignored):", error);
+ handleEditorPanelResize: (size: number) => {
+ if (size >= 1) {
+ return;
}
+ aiPanelSize.value = 1 - size;
},
};