Skip to content

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

chore: deprecate kbar (#15213)

ecmadao6431095de128
diff --git a/frontend/package.json b/frontend/package.json
index a6410c7bda..10a943fc8d 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -20,7 +20,6 @@
},
"dependencies": {
"@bufbuild/protobuf": "^2.1.0",
- "@bytebase/vue-kbar": "0.1.8",
"@joe-re/sql-parser": "^1.7.0",
"@markdoc/markdoc": "0.4.0",
"@soerenmartius/vue3-clipboard": "0.1.2",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 3951bf090e..f2900e1642 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -13,9 +13,6 @@ importers:
'@bufbuild/protobuf':
specifier: ^2.1.0
version: 2.2.3
- '@bytebase/vue-kbar':
- specifier: 0.1.8
'@joe-re/sql-parser':
specifier: ^1.7.0
version: 1.7.1
@@ -954,11 +951,6 @@ packages:
'@bufbuild/[email protected]':
resolution: {integrity: sha512-tFQoXHJdkEOSwj5tRIZSPNUuXK3RaR7T1nUrPgbYX1pUbvqqaaZAsfo+NXBPsz5rZMSKVFrgK1WL8Q/MSLvprg==}
- '@bytebase/[email protected]':
- resolution: {integrity: sha512-XfF3JadEvWzFngpu1U6C3RvseBEoWXF51Y0D3gL2R7T8Lx+OHEoPCR8jxCMXzROCCJ+eheerKqEiFl5WXrWw4w==}
- peerDependencies:
- vue: ^3.2.33
-
'@codingame/[email protected]':
resolution: {integrity: sha512-4udds/yfMRwrzRF6Yq5lI/vn4TEDT4r4nxSJXJ4KNpLoSWNV2p63NMItBGKmFBKCJQpIMtvO2O0IeX9gso2v2A==}
hasBin: true
@@ -1319,8 +1311,8 @@ packages:
resolution: {integrity: sha512-8tR1xe7ZEbkabTuE/tNhzpolygUn9OaYp9yuYAF4MgDNZg06C3Qny80bes2/e9/Wm3aVkPUlCw6WgU7mQd0yEg==}
engines: {node: '>= 16'}
- '@intlify/[email protected]':
- resolution: {integrity: sha512-DvpNSxiMrFqYMaGSRDDnQgO/L0MqNH4KWw9CUx8LRHHIdWp08En9DpmSRNpauUOxKpHAhyJJxx92BHZk9J84EQ==}
+ '@intlify/[email protected]':
+ resolution: {integrity: sha512-2kGiWoXaeV8HZlhU/Nml12oTbhv7j2ufsJ5vQaa0VTjzUmZVdd/nmKFRAOJ/FtjO90Qba5AnZDwsrY7ZND5udA==}
engines: {node: '>= 16'}
'@intlify/[email protected]':
@@ -2094,34 +2086,12 @@ packages:
'@vueuse/[email protected]':
resolution: {integrity: sha512-GVyH1iYqNANwcahAx8JBm6awaNgvR/SwZ1fjr10b8l1HIgDp82ngNbfzJUgOgWEoxjL+URAggnlilAEXwCOZtg==}
- '@vueuse/[email protected]':
- resolution: {integrity: sha512-PRRgbATMpoeUmkCEBtUeJgOwtew8s+4UsEd+Pm7MhkjL2ihCNrSqxNVtM6NFE4uP2sWnkGcZpCjPuNSxowJ1Ow==}
- peerDependencies:
- '@vue/composition-api': ^1.1.0
- vue: ^2.6.0 || ^3.2.0
- peerDependenciesMeta:
- '@vue/composition-api':
- optional: true
- vue:
- optional: true
-
'@vueuse/[email protected]':
resolution: {integrity: sha512-Ui7Lo2a7AxrMAXRF+fAp9QsXuwTeeZ8fIB9wsLHqzq9MQk+2gMYE2IGJW48VMJ8ecvCB3z3GsGLKLbSasQ5Qlg==}
'@vueuse/[email protected]':
resolution: {integrity: sha512-vMpcL1lStUU6O+kdj6YdHDixh0odjPAUM15uJ9f7MY781jcYkIwFA4iv2EfoIPO6vBmvutI1HxxAwmf0cx5ISQ==}
- '@vueuse/[email protected]':
- resolution: {integrity: sha512-rN2qd22AUl7VdBxihagWyhUNHCyVk9IpvBTTfHoLH9G7rGE552X1f+zeCfehuno0zXif13jPw+icW/wn2a0rnQ==}
- peerDependencies:
- '@vue/composition-api': ^1.1.0
- vue: ^2.6.0 || ^3.2.0
- peerDependenciesMeta:
- '@vue/composition-api':
- optional: true
- vue:
- optional: true
-
resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
@@ -4343,9 +4313,6 @@ packages:
resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==}
- resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}
-
resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}
@@ -5578,15 +5545,6 @@ snapshots:
'@bufbuild/[email protected]': {}
- dependencies:
- '@vueuse/core': 7.7.1([email protected]([email protected]))
- match-sorter: 6.3.4
- tiny-invariant: 1.3.3
- vue: 3.5.13([email protected])
- transitivePeerDependencies:
- - '@vue/composition-api'
-
'@codingame/[email protected]':
dependencies:
'@codingame/monaco-vscode-base-service-override': 1.85.6
@@ -5923,7 +5881,7 @@ snapshots:
'@intlify/[email protected]': {}
- '@intlify/[email protected]': {}
+ '@intlify/[email protected]': {}
'@intlify/[email protected]': {}
@@ -5931,8 +5889,8 @@ snapshots:
dependencies:
'@eslint-community/eslint-utils': 4.4.1([email protected]([email protected]))
'@intlify/bundle-utils': 10.0.0([email protected]([email protected]([email protected])))
- '@intlify/shared': 11.1.0
+ '@intlify/shared': 11.1.1
'@rollup/pluginutils': 5.1.4([email protected])
'@typescript-eslint/scope-manager': 8.23.0
'@typescript-eslint/typescript-estree': 8.23.0([email protected])
@@ -5954,11 +5912,11 @@ snapshots:
- supports-color
- typescript
dependencies:
'@babel/parser': 7.26.7
optionalDependencies:
- '@intlify/shared': 11.1.0
+ '@intlify/shared': 11.1.1
'@vue/compiler-dom': 3.5.13
vue: 3.5.13([email protected])
@@ -6774,13 +6732,6 @@ snapshots:
transitivePeerDependencies:
- typescript
- dependencies:
- '@vueuse/shared': 7.7.1([email protected]([email protected]))
- optionalDependencies:
- vue: 3.5.13([email protected])
-
'@vueuse/[email protected]': {}
@@ -6789,12 +6740,6 @@ snapshots:
transitivePeerDependencies:
- typescript
- dependencies:
- optionalDependencies:
- vue: 3.5.13([email protected])
-
@@ -9297,8 +9242,6 @@ snapshots:
-
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index a8d2f59f66..b736b9dab1 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -13,19 +13,17 @@
>
<NDialogProvider>
<OverlayStackManager>
- <KBarWrapper>
- <NotificationContext>
- <AuthContext>
- <router-view v-if="actuatorStore.initialized" />
- <div
- v-else
- class="fixed inset-0 bg-white flex flex-col items-center justify-center"
- >
- <NSpin />
- </div>
- </AuthContext>
- </NotificationContext>
- </KBarWrapper>
+ <NotificationContext>
+ <AuthContext>
+ <router-view v-if="actuatorStore.initialized" />
+ <div
+ v-else
+ class="fixed inset-0 bg-white flex flex-col items-center justify-center"
+ >
+ <NSpin />
+ </div>
+ </AuthContext>
+ </NotificationContext>
</OverlayStackManager>
</NDialogProvider>
</NNotificationProvider>
@@ -51,7 +49,6 @@ import { themeOverrides, dateLang, generalLang } from "../naive-ui.config";
import { provideAppRootContext } from "./AppRootContext";
import AuthContext from "./AuthContext.vue";
import NotificationContext from "./NotificationContext.vue";
-import KBarWrapper from "./components/KBar/KBarWrapper.vue";
import OverlayStackManager from "./components/misc/OverlayStackManager.vue";
import { overrideAppProfile } from "./customAppProfile";
import { t } from "./plugins/i18n";
diff --git a/frontend/src/components/KBar/KBarFooter.vue b/frontend/src/components/KBar/KBarFooter.vue
deleted file mode 100644
index e6aefec5f8..0000000000
--- a/frontend/src/components/KBar/KBarFooter.vue
+++ /dev/null
@@ -1,113 +0,0 @@
-<template>
- <footer>
- <div class="key">
- <kbd>
- <svg width="15" height="15">
- <g
- fill="none"
- stroke="currentColor"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="1.2"
- >
- <path d="M12 3.53088v3c0 1-1 2-2 2H4M7 11.53088l-3-3 3-3"></path>
- </g>
- </svg>
- </kbd>
- <span>{{ $t("kbar.help.perform") }}</span>
- </div>
- <div class="key">
- <kbd>
- <svg width="15" height="15">
- <g
- fill="none"
- stroke="currentColor"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="1.2"
- >
- <path d="M7.5 3.5v8M10.5 8.5l-3 3-3-3"></path>
- </g>
- </svg>
- </kbd>
- <kbd>
- <svg width="15" height="15">
- <g
- fill="none"
- stroke="currentColor"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="1.2"
- >
- <path d="M7.5 11.5v-8M10.5 6.5l-3-3-3 3"></path>
- </g>
- </svg>
- </kbd>
- <span>{{ $t("kbar.help.navigate") }}</span>
- </div>
- <div v-if="isDeepAction" class="key">
- <kbd>
- <svg width="15" height="15" class="transform rotate-90">
- <g
- fill="none"
- stroke="currentColor"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="1.2"
- >
- <path d="M7.5 3.5v8M10.5 8.5l-3 3-3-3"></path>
- </g>
- </svg>
- </kbd>
- <span>{{ $t("kbar.help.back") }}</span>
- </div>
- <div class="key">
- <kbd>
- <svg width="15" height="15">
- <g
- fill="none"
- stroke="currentColor"
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="1.2"
- >
- <path
- d="M13.6167 8.936c-.1065.3583-.6883.962-1.4875.962-.7993 0-1.653-.9165-1.653-2.1258v-.5678c0-1.2548.7896-2.1016 1.653-2.1016.8634 0 1.3601.4778 1.4875 1.0724M9 6c-.1352-.4735-.7506-.9219-1.46-.8972-.7092.0246-1.344.57-1.344 1.2166s.4198.8812 1.3445.9805C8.465 7.3992 8.968 7.9337 9 8.5c.032.5663-.454 1.398-1.4595 1.398C6.6593 9.898 6 9 5.963 8.4851m-1.4748.5368c-.2635.5941-.8099.876-1.5443.876s-1.7073-.6248-1.7073-2.204v-.4603c0-1.0416.721-2.131 1.7073-2.131.9864 0 1.6425 1.031 1.5443 2.2492h-2.956"
- ></path>
- </g>
- </svg>
- </kbd>
- <span>{{ $t("kbar.help.close") }}</span>
- </div>
- </footer>
-</template>
-
-<script lang="ts">
-import { useKBarState } from "@bytebase/vue-kbar";
-import { computed, defineComponent } from "vue";
-
-export default defineComponent({
- name: "KBarFooter",
- setup() {
- const state = useKBarState();
-
- const isDeepAction = computed(() => {
- return !!state.value.currentRootActionId;
- });
-
- return { isDeepAction };
- },
-});
-</script>
-
-<style scoped>
-footer {
- @apply flex z-20 px-4 py-4 gap-3;
-}
-.key {
- @apply flex items-center justify-items-start text-xs text-gray-500 gap-0.5;
-}
-kbd {
- @apply w-6 h-6 flex items-center justify-center bg-black bg-opacity-10 rounded text-sm mx-px;
-}
-</style>
diff --git a/frontend/src/components/KBar/KBarHelper.vue b/frontend/src/components/KBar/KBarHelper.vue
deleted file mode 100644
index f69510ddd4..0000000000
--- a/frontend/src/components/KBar/KBarHelper.vue
+++ /dev/null
@@ -1,47 +0,0 @@
-<template>
- <slot />
-</template>
-
-<script lang="ts" setup>
-import { useKBarHandler } from "@bytebase/vue-kbar";
-import { defineAction, useRegisterActions } from "@bytebase/vue-kbar";
-import { watch, computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRoute, useRouter } from "vue-router";
-import { useRecentVisit } from "./useRecentVisit";
-
-const handler = useKBarHandler();
-const route = useRoute();
-const router = useRouter();
-const { recentVisit } = useRecentVisit();
-const { t } = useI18n();
-
-watch(
- () => route.fullPath,
- () => {
- // force hide kbar when page navigated
- handler.value.hide();
- }
-);
-
-const actions = computed(() => {
- return recentVisit.value
- .slice(1) // The first item is current page, just skip it.
- .filter(({ title, path }) => title && path)
- .map(({ title, path }, index) =>
- defineAction({
- // here `id` looks like "bb.recent_visited.1"
- id: `bb.recently_visited.${index + 1}`,
- section: t("kbar.recently-visited"),
- name: title,
- subtitle: path,
- shortcut: ["g", `${index + 1}`],
- keywords: "recently visited",
- perform: () => router.push({ path }),
- })
- );
-});
-
-// prepend recent visit actions to kbar
-useRegisterActions(actions, true);
-</script>
diff --git a/frontend/src/components/KBar/KBarWrapper.vue b/frontend/src/components/KBar/KBarWrapper.vue
deleted file mode 100644
index 523ebff030..0000000000
--- a/frontend/src/components/KBar/KBarWrapper.vue
+++ /dev/null
@@ -1,99 +0,0 @@
-<template>
- <KBarProvider
- :actions="globalActions"
- :options="{ placeholder, disabled, compare }"
- >
- <KBarPortal>
- <KBarPositioner class="bb-kbar-mask z-[999999]">
- <KBarAnimator class="bb-kbar-container">
- <KBarSearch class="bb-kbar-searchbox" />
- <RenderResults />
- <KBarFooter />
- </KBarAnimator>
- </KBarPositioner>
- </KBarPortal>
-
- <KBarHelper />
- <slot />
- </KBarProvider>
-</template>
-
-<script lang="ts">
-import {
- KBarProvider,
- KBarPortal,
- KBarPositioner,
- KBarAnimator,
- KBarSearch,
-} from "@bytebase/vue-kbar";
-import { defineComponent, computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useOverlayStackContext } from "@/components/misc/OverlayStackManager.vue";
-import { useCurrentUserV1, useAppFeature } from "@/store";
-import { UNKNOWN_USER_NAME } from "@/types";
-import KBarFooter from "./KBarFooter.vue";
-import KBarHelper from "./KBarHelper.vue";
-import RenderResults from "./RenderResults.vue";
-import { compareAction as compare } from "./utils";
-
-export default defineComponent({
- name: "KBarWrapper",
- components: {
- KBarProvider,
- KBarPortal,
- KBarPositioner,
- KBarAnimator,
- KBarSearch,
- RenderResults,
- KBarHelper,
- KBarFooter,
- },
- setup() {
- const { t } = useI18n();
- const { stack: overlayStack } = useOverlayStackContext();
- const disableKBar = useAppFeature("bb.feature.disable-kbar");
-
- const placeholder = computed(() => t("kbar.options.placeholder"));
-
- const disabled = computed(() => {
- if (disableKBar.value) {
- return true;
- }
-
- if (overlayStack.value.length > 0) {
- // Disable kbar when any modal dialog is shown
- // We don't want to show modal dialogs and kbar at the same time
- // This also avoids navigating through kbar, which may
- // cause unexpected results
- return true;
- }
-
- const currentUserV1 = useCurrentUserV1();
- // totally disable kbar when not logged in
- // since there is no point to show it on signin/signup pages
- return currentUserV1.value.name === UNKNOWN_USER_NAME;
- });
-
- const globalActions = computed(() => []);
-
- return {
- globalActions,
- placeholder,
- disabled,
- compare,
- };
- },
-});
-</script>
-
-<style scoped lang="postcss">
-.bb-kbar-mask {
- @apply bg-gray-300 bg-opacity-80;
-}
-.bb-kbar-container {
- @apply bg-white shadow-lg rounded-lg w-128 overflow-hidden divide-y;
-}
-.bb-kbar-searchbox {
- @apply px-4 py-4 text-lg w-full box-border outline-none border-none;
-}
-</style>
diff --git a/frontend/src/components/KBar/RenderResults.vue b/frontend/src/components/KBar/RenderResults.vue
deleted file mode 100644
index c5437d7df2..0000000000
--- a/frontend/src/components/KBar/RenderResults.vue
+++ /dev/null
@@ -1,106 +0,0 @@
-<template>
- <KBarResults
- :items="matches.results"
- :item-height="itemHeight"
- class="max-h-72"
- >
- <template #item="{ item, index, active }">
- <div v-if="typeof item === 'string'" class="section" :data-index="index">
- {{ item }}
- </div>
- <div v-else class="item" :class="{ active }" :data-index="index">
- <div class="content">
- <div class="main">
- <span v-if="isDeepAction(item)" class="parent">
- {{ findParent(item).name }}
- </span>
-
- <span class="name">{{ item.name }}</span>
-
- <span v-for="(tag, i) in item.data?.tags" :key="i" class="tag">
- {{ tag }}
- </span>
- </div>
- <span v-if="item.subtitle" class="subtitle">
- {{ item.subtitle }}
- </span>
- </div>
-
- <div v-if="item.shortcut?.length > 0" aria-hidden class="shortcut">
- <kbd v-for="(sc, j) in item.shortcut" :key="j">{{ sc }}</kbd>
- </div>
- </div>
- </template>
- </KBarResults>
-</template>
-
-<script lang="ts">
-import type { ActionImpl } from "@bytebase/vue-kbar";
-import { useKBarMatches, KBarResults, useKBarState } from "@bytebase/vue-kbar";
-import { defineComponent } from "vue";
-
-export default defineComponent({
- name: "RenderResults",
- components: { KBarResults },
- setup() {
- const state = useKBarState();
- const matches = useKBarMatches();
- const itemHeight = (params: { item: any; index: number }) => {
- if (typeof params.item === "string") return 32;
- return 48;
- };
-
- const isDeepAction = (action: ActionImpl): boolean => {
- return (
- !!action.parent && action.parent !== state.value.currentRootActionId
- );
- };
-
- const findParent = (child: ActionImpl): ActionImpl => {
- return state.value.actions.find((action) => action.id === child.parent)!;
- };
-
- return { matches, itemHeight, isDeepAction, findParent };
- },
-});
-</script>
-
-<style scoped>
-.section {
- @apply h-8 px-4 text-xs uppercase text-gray-500 flex items-center bg-gray-50;
-}
-.item {
- @apply h-12 box-border px-3 py-4 text-lg bg-transparent border-l-4 border-transparent cursor-pointer flex justify-between items-center gap-2;
-}
-.item.active {
- @apply bg-control-bg-hover border-current;
-}
-.content {
- @apply flex flex-col overflow-x-hidden;
-}
-.main {
- @apply flex items-center text-base gap-1;
-}
-.tag {
- @apply inline-block text-xs px-1 py-0.5 bg-black bg-opacity-10 rounded-sm;
-}
-.name {
- @apply overflow-x-hidden overflow-ellipsis whitespace-nowrap;
-}
-.subtitle {
- @apply text-xs text-gray-500 overflow-x-hidden overflow-ellipsis whitespace-nowrap;
-}
-.parent {
- @apply text-gray-500;
-}
-.parent::after {
- content: "›";
- @apply text-gray-500 mx-1;
-}
-.shortcut {
- @apply grid grid-flow-col gap-1 justify-self-end text-gray-500;
-}
-.shortcut kbd {
- @apply w-6 h-6 flex items-center justify-center bg-black bg-opacity-10 rounded text-sm;
-}
-</style>
diff --git a/frontend/src/components/KBar/useDatabaseActions.ts b/frontend/src/components/KBar/useDatabaseActions.ts
deleted file mode 100644
index 911e7b2775..0000000000
--- a/frontend/src/components/KBar/useDatabaseActions.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-import type { Action } from "@bytebase/vue-kbar";
-import { defineAction, useRegisterActions } from "@bytebase/vue-kbar";
-import { computed, unref } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { useDatabaseV1Store, useEnvironmentV1List } from "@/store";
-import type { ComposedDatabase, ComposedProject, MaybeRef } from "@/types";
-import { DEFAULT_PROJECT_NAME } from "@/types";
-import { State } from "@/types/proto/v1/common";
-import {
- groupBy,
- environmentV1Name,
- sortDatabaseV1List,
- databaseV1Url,
-} from "@/utils";
-
-const useDatabaseActions = (databaseList: MaybeRef<ComposedDatabase[]>) => {
- const { t } = useI18n();
- const router = useRouter();
- const environmentList = useEnvironmentV1List();
-
- const accessibleDatabaseList = computed(() => {
- return unref(databaseList).filter((db) => db.syncState === State.ACTIVE);
- });
-
- const sortedDatabaseList = computed(() => {
- return sortDatabaseV1List(accessibleDatabaseList.value);
- });
-
- const databaseListByEnvironment = computed(() => {
- const databasesByEnv = groupBy(
- sortedDatabaseList.value,
- (db) => db.effectiveEnvironment
- );
-
- return environmentList.value
- .filter((environment) => {
- const group = databasesByEnv.get(environment.name) ?? [];
- return group.length > 0;
- })
- .map((environment) => {
- const databases = databasesByEnv.get(environment.name)!;
- return {
- id: `bb.env.${environment.name}`,
- name: environmentV1Name(environment),
- children: databases.map((db) => ({
- id: `bb.database.${db.name}`,
- name: `${db.databaseName} (${db.instanceResource.title})`,
- link: databaseV1Url(db),
- })),
- };
- });
- });
-
- const kbarActions = computed((): Action[] => {
- const actions = databaseListByEnvironment.value.flatMap((group) =>
- group.children!.map((item) =>
- defineAction({
- // `item.id` is namespaced already
- // so here `id` looks like
- // "bb.database.7001" for non-tenant databases
- // "bb.project.3007.database.db3" for tenant databases
- id: item.id,
- section: t("common.databases"),
- name: item.name,
- // `group.name` is also a keyword to provide better search
- // e.g. "blog" under "staged" now can be searched by "bl st"
- // also "blog" under "HR system" (a project) can be searched by "bl hr"
- keywords: `database db ${group.name}`,
- data: {
- tags: [group.name],
- },
- perform: () => {
- router.push(item.link!);
- },
- })
- )
- );
- return actions;
- });
- useRegisterActions(kbarActions);
-};
-
-export const useProjectDatabaseActions = (
- project: MaybeRef<ComposedProject>,
- limit: number
-) => {
- const projectDatabaseList = computed(() => {
- return useDatabaseV1Store()
- .databaseListByProject(unref(project).name)
- .slice(0, limit); // Don't create too many actions
- });
- useDatabaseActions(projectDatabaseList);
-};
-
-export const useGlobalDatabaseActions = (limit: number) => {
- // Use this to make the list reactive when project is transferred.
- const databaseList = computed(() => {
- return useDatabaseV1Store()
- .databaseListByUser.filter((db) => db.project !== DEFAULT_PROJECT_NAME)
- .slice(0, limit); // Don't create too many actions
- });
- useDatabaseActions(databaseList);
-};
diff --git a/frontend/src/components/KBar/useProjectActions.ts b/frontend/src/components/KBar/useProjectActions.ts
deleted file mode 100644
index 05e50679ea..0000000000
--- a/frontend/src/components/KBar/useProjectActions.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import type { Action } from "@bytebase/vue-kbar";
-import { defineAction, useRegisterActions } from "@bytebase/vue-kbar";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { useProjectV1List } from "@/store";
-import { DEFAULT_PROJECT_NAME } from "@/types";
-import { extractProjectResourceName, hasProjectPermissionV2 } from "@/utils";
-
-export const useProjectActions = (limit: number) => {
- const { t } = useI18n();
- const router = useRouter();
- const { projectList } = useProjectV1List();
-
- const accessibleProjectList = computed(() => {
- return projectList.value.filter((project) => {
- return (
- project.name !== DEFAULT_PROJECT_NAME &&
- hasProjectPermissionV2(project, "bb.projects.get")
- );
- });
- });
-
- const sortedProjectList = computed(() => {
- return [...accessibleProjectList.value.slice(0, limit)].sort((a, b) =>
- a.title.localeCompare(b.title)
- );
- });
- const kbarActions = computed((): Action[] => {
- const actions = sortedProjectList.value.map((project) =>
- defineAction({
- // here `id` looks like "bb.project.projects/cms"
- id: `bb.project.${project.name}`,
- section: t("common.projects"),
- name: project.title,
- keywords: ["project", extractProjectResourceName(project.name)].join(
- " "
- ),
- data: {
- tags: [extractProjectResourceName(project.name)],
- },
- perform: () => {
- router.push({ path: `/${project.name}` });
- },
- })
- );
- return actions;
- });
- useRegisterActions(kbarActions);
-};
diff --git a/frontend/src/components/KBar/useRecentVisit.ts b/frontend/src/components/KBar/useRecentVisit.ts
deleted file mode 100644
index 36bd87587d..0000000000
--- a/frontend/src/components/KBar/useRecentVisit.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-import { useDebounce } from "@vueuse/core";
-import { computed, ref, watch, nextTick } from "vue";
-import { useRoute } from "vue-router";
-import { WORKSPACE_ROOT_MODULE } from "@/router/dashboard/workspaceRoutes";
-import { useCurrentUserV1 } from "@/store";
-import { useDynamicLocalStorage } from "@/utils";
-
-type RecentVisit = {
- title: string;
- path: string;
-};
-
-const STORAGE_KEY = "bb.kbar.recently_visited";
-const MAX_HISTORY = 3;
-
-export function useRecentVisit() {
- const route = useRoute();
- const currentUser = useCurrentUserV1();
-
- const recentVisit = useDynamicLocalStorage<RecentVisit[]>(
- computed(() => `${STORAGE_KEY}.${currentUser.value.name}`),
- []
- );
-
- const currentRoute = computed(() => {
- if (route.matched.length === 0) {
- // When the application is landing, vue router will
- // perform a redirection from "/" to current path
- // e.g. if landing URL is "/instance", this redirection
- // will be "/" -> "/instance".
- // This even happens when "/" -> "/".
- // `route.matched` is an empty array means this kind
- // of redirection is going to be performed right now.
- // We don't want to record the first "/" as a visit
- // because Home page is not shown at this time.
- return undefined;
- }
- return {
- name: route.name?.toString() ?? "",
- path: route.fullPath,
- };
- });
- const currentPage = ref<RecentVisit>();
-
- watch(
- // Debounce the listener so we can skip internal immediate redirections
- useDebounce(currentRoute, 50),
- async (currentRoute) => {
- if (!currentRoute) return;
- if (currentRoute.name === WORKSPACE_ROOT_MODULE) {
- // ignore app root path
- return;
- }
- if (
- currentRoute.path.startsWith("/auth") ||
- currentRoute.path.startsWith("/sql-editor") ||
- currentRoute.path.startsWith("/403") ||
- currentRoute.path.startsWith("/404")
- ) {
- // ignore auth related pages
- // kbar is invisible on these pages
- // and navigating to these pages does not make sense
- return;
- }
- // wait for vue flushing
- // otherwise `document.title` will not be dynamically updated
- await nextTick();
- const { title } = document;
- currentPage.value = {
- title,
- ...currentRoute,
- };
- },
- { immediate: true }
- );
-
- watch(
- currentPage,
- (curr) => {
- if (!curr) return;
- const list = recentVisit.value;
- const index = list.findIndex((item) => {
- // We treat the two URLs "the same" when their urls'
- // `path` are the same (means ignoring querystring and hash).
- // e.g. "/db?environment=5003" & "/db?environment=5005"
- // Because usually they are just different tab-panes
- // or filters on the page.
- return getPath(item.path) === getPath(curr.path);
- });
- if (index >= 0) {
- // current page exists in the history already
- // pull it out before next step
- list.splice(index, 1);
- }
- // then prepend the latest item to the queue
- list.unshift(curr);
-
- // ensure the queue's length
- // should be no more than (MAX_HISTORY + 1)
- // because current page will always be the first one in the list
- // but it will be not shown in kbar
- while (list.length > MAX_HISTORY + 1) {
- list.pop();
- }
- },
- {
- immediate: true,
- }
- );
-
- return {
- recentVisit,
- };
-}
-
-function getPath(url: string): string {
- return url.replace(/[?#].*$/, "");
-}
diff --git a/frontend/src/components/KBar/utils.ts b/frontend/src/components/KBar/utils.ts
deleted file mode 100644
index 6914504071..0000000000
--- a/frontend/src/components/KBar/utils.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import type { Action, CompareFn } from "@bytebase/vue-kbar";
-import { findLastIndex } from "lodash-es";
-
-const MAX_RANKING = Infinity;
-
-export const ACTION_RANKINGS = [
- "bb.recently_visited.",
- "bb.quickaction.",
- "bb.navigation.",
- "bb.navigation.global.",
- "bb.project.",
- "bb.database.",
- "bb.preferences.",
-];
-
-export const compareAction: CompareFn = (a, b) => {
- const ar = getActionRankingById(a.item);
- const br = getActionRankingById(b.item);
-
- // Sort by original index if they have same ranks.
- if (ar === br) return a.index - b.index;
-
- // Otherwise sort by ranking.
- return ar - br;
-};
-
-function getActionRankingById(action: Action) {
- const rank = findLastIndex(ACTION_RANKINGS, (prefix) =>
- action.id.startsWith(prefix)
- );
- // non-specified namespaces should always rank behind specified ones.
- if (rank < 0) return MAX_RANKING;
-
- return rank;
-}
diff --git a/frontend/src/components/ProfileDropdown.vue b/frontend/src/components/ProfileDropdown.vue
index 7e06256927..5c85abdfdf 100644
--- a/frontend/src/components/ProfileDropdown.vue
+++ b/frontend/src/components/ProfileDropdown.vue
@@ -77,7 +77,6 @@ const resetQuickstart = () => {
"instance.visit",
"database.visit",
"member.visit",
- "kbar.open",
"data.query",
"help.issue.detail",
"help.project",
diff --git a/frontend/src/components/Project/ProjectSidebarV1.vue b/frontend/src/components/Project/ProjectSidebarV1.vue
index c297392419..15aee17d60 100644
--- a/frontend/src/components/Project/ProjectSidebarV1.vue
+++ b/frontend/src/components/Project/ProjectSidebarV1.vue
@@ -9,16 +9,13 @@
</template>
<script setup lang="ts">
-import { defineAction, useRegisterActions } from "@bytebase/vue-kbar";
import { computed } from "vue";
-import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import type { SidebarItem } from "@/components/CommonSidebar.vue";
import CommonSidebar from "@/components/CommonSidebar.vue";
import { PROJECT_V1_ROUTE_DETAIL } from "@/router/dashboard/projectV1";
import { useRecentVisit } from "@/router/useRecentVisit";
import { getProjectName } from "@/store/modules/v1/common";
-import { useProjectDatabaseActions } from "../KBar/useDatabaseActions";
import { useCurrentProject } from "./useCurrentProject";
import { useProjectSidebar } from "./useProjectSidebar";
@@ -30,7 +27,6 @@ const props = defineProps<{
issueSlug?: string;
}>();
-const { t } = useI18n();
const router = useRouter();
const { record } = useRecentVisit();
@@ -46,8 +42,7 @@ const params = computed(() => {
const { project } = useCurrentProject(params);
-const { projectSidebarItemList, flattenNavigationItems, checkIsActive } =
- useProjectSidebar(project);
+const { projectSidebarItemList, checkIsActive } = useProjectSidebar(project);
const getItemClass = (item: SidebarItem) => {
const list = ["outline-item"];
@@ -75,22 +70,4 @@ const onSelect = (item: SidebarItem, e: MouseEvent | undefined) => {
router.replace(route);
}
};
-
-const navigationKbarActions = computed(() => {
- const actions = flattenNavigationItems.value
- .filter((item) => !item.hide && item.path)
- .map((item) =>
- defineAction({
- id: `bb.navigation.project.${project.value.name}.${item.path}`,
- name: item.title,
- section: t("kbar.navigation"),
- keywords: [item.title.toLowerCase(), item.path].join(" "),
- perform: () => onSelect(item, undefined),
- })
- );
- return actions;
-});
-useRegisterActions(navigationKbarActions);
-
-useProjectDatabaseActions(project, 10);
</script>
diff --git a/frontend/src/components/Quickstart.vue b/frontend/src/components/Quickstart.vue
index 8d2399c8f5..a9b0c77d5e 100644
--- a/frontend/src/components/Quickstart.vue
+++ b/frontend/src/components/Quickstart.vue
@@ -107,7 +107,6 @@
</template>
<script setup lang="ts">
-import { useKBarHandler, useKBarEventOnce } from "@bytebase/vue-kbar";
import { XIcon, CheckCircleIcon } from "lucide-vue-next";
import type { Ref } from "vue";
import { computed, unref, watchEffect } from "vue";
@@ -152,7 +151,6 @@ type IntroItem = {
const { t } = useI18n();
const projectStore = useProjectV1Store();
const uiStateStore = useUIStateStore();
-const kbarHandler = useKBarHandler();
const show = computed(() => {
return !uiStateStore.getIntroStateByKey("hidden");
@@ -170,17 +168,6 @@ const sampleProject = computed(() => {
const introList = computed(() => {
const introList: IntroItem[] = [
- {
- name: computed(() =>
- t("quick-start.use-kbar", {
- shortcut: `${navigator.platform.match(/mac/i) ? "cmd" : "ctrl"}-k`,
- })
- ),
- click: () => {
- kbarHandler.value.show();
- },
- done: computed(() => uiStateStore.getIntroStateByKey("kbar.open")),
- },
{
name: computed(() => t("quick-start.view-an-issue")),
link: {
@@ -338,14 +325,6 @@ const hideQuickstart = (silent = false) => {
});
};
-useKBarEventOnce("open", () => {
- // once kbar is open, mark the quickstart as done
- uiStateStore.saveIntroStateByKey({
- key: "kbar.open",
- newState: true,
- });
-});
-
watchEffect(async () => {
if (!showQuickstart.value) {
return;
diff --git a/frontend/src/customAppProfile.ts b/frontend/src/customAppProfile.ts
index d34ae8f6c9..9be56d876e 100644
--- a/frontend/src/customAppProfile.ts
+++ b/frontend/src/customAppProfile.ts
@@ -42,7 +42,6 @@ const overrideAppFeatures = (
// mode=STANDALONE is not easy to read, but for legacy support we keep it as
// some customers are using it.
actuatorStore.overrideAppFeatures({
- "bb.feature.disable-kbar": true,
"bb.feature.databases.operations": new Set([
"CHANGE-DATA",
"EDIT-SCHEMA",
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index bd36be53df..086a5c795f 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -237,19 +237,6 @@
"error-page": {
"go-back-home": "Go back home"
},
- "kbar": {
- "recently-visited": "Recently Visited",
- "navigation": "Navigation",
- "help": {
- "navigate": "to navigate",
- "perform": "to perform",
- "close": "to close",
- "back": "to back"
- },
- "options": {
- "placeholder": "Type a command or search…"
- }
- },
"task": {
"checking": "Checking...",
"check-result": {
@@ -1287,7 +1274,6 @@
"visit-database": "@:common.visit @:common.databases",
"visit-environment": "@:common.visit @:common.environments",
"visit-member": "@:common.visit @:common.members",
- "use-kbar": "Use kbar ({shortcut})",
"query-data": "Query data",
"notice": {
"title": "Quickstart guide dismissed",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 46eae5e0e9..402167b0ff 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -237,19 +237,6 @@
"error-page": {
"go-back-home": "Volver al inicio"
},
- "kbar": {
- "recently-visited": "Visitado Recientemente",
- "navigation": "Navegación",
- "help": {
- "navigate": "navegar",
- "perform": "realizar",
- "close": "cerrar",
- "back": "volver"
- },
- "options": {
- "placeholder": "Escriba un comando o búsqueda…"
- }
- },
"task": {
"checking": "Comprobando...",
"check-result": {
@@ -1287,7 +1274,6 @@
"visit-database": "@:common.visit @:common.databases",
"visit-environment": "@:common.visit @:common.environments",
"visit-member": "@:common.visit @:common.members",
- "use-kbar": "Usar kbar ({shortcut})",
"query-data": "Consultar datos",
"notice": {
"title": "Guía de inicio rápido omitida",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 4697251402..a01398bac9 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -237,19 +237,6 @@
"error-page": {
"go-back-home": "ホームページに戻る"
},
- "kbar": {
- "recently-visited": "最近の訪問",
- "navigation": "ナビゲーション",
- "help": {
- "navigate": "選ぶ",
- "perform": "埋め込む",
- "close": "閉じる",
- "back": "戻る"
- },
- "options": {
- "placeholder": "コマンドを入力するか検索してください…"
- }
- },
"task": {
"checking": "検査中…",
"check-result": {
@@ -1287,7 +1274,6 @@
"visit-database": "@:{'common.databases'}に@:{'common.visit'}する",
"visit-environment": "@:{'common.environments'}に@:{'common.visit'}する",
"visit-member": "@:{'common.members'}に@:{'common.visit'}する",
- "use-kbar": "kbar ({shortcut}) を使用する",
"query-data": "クエリデータ",
"notice": {
"title": "クイックスタートガイドを終了しました",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index b7d8c23d48..012d1976be 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -237,19 +237,6 @@
"error-page": {
"go-back-home": "Về trang chủ"
},
- "kbar": {
- "recently-visited": "Đã xem gần đây",
- "navigation": "Điều hướng",
- "help": {
- "navigate": "để điều hướng",
- "perform": "để thực hiện",
- "close": "để đóng",
- "back": "để quay lại"
- },
- "options": {
- "placeholder": "Nhập lệnh hoặc tìm kiếm…"
- }
- },
"task": {
"checking": "Đang kiểm tra...",
"check-result": {
@@ -1287,7 +1274,6 @@
"visit-database": "@:common.visit @:common.databases",
"visit-environment": "@:common.visit @:common.environments",
"visit-member": "@:common.visit @:common.members",
- "use-kbar": "Sử dụng kbar ({shortcut})",
"query-data": "Truy vấn dữ liệu",
"notice": {
"title": "Đã bỏ qua hướng dẫn bắt đầu nhanh",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 2462b44517..9102590d5e 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -237,19 +237,6 @@
"error-page": {
"go-back-home": "回到主页"
},
- "kbar": {
- "recently-visited": "最近访问",
- "navigation": "导航",
- "help": {
- "navigate": "选择",
- "perform": "执行",
- "close": "关闭",
- "back": "返回"
- },
- "options": {
- "placeholder": "输入命令或搜索…"
- }
- },
"task": {
"checking": "检查中…",
"check-result": {
@@ -1287,7 +1274,6 @@
"visit-database": "@:common.visit@:common.databases",
"visit-environment": "@:common.visit@:common.environments",
"visit-member": "@:common.visit@:common.members",
- "use-kbar": "使用 kbar ({shortcut})",
"query-data": "查询数据",
"notice": {
"title": "新手任务已关闭",
diff --git a/frontend/src/router/useRecentVisit.ts b/frontend/src/router/useRecentVisit.ts
index 358e6eeecb..ee6ee6381a 100644
--- a/frontend/src/router/useRecentVisit.ts
+++ b/frontend/src/router/useRecentVisit.ts
@@ -52,7 +52,6 @@ export function useRecentVisit() {
// ensure the queue's length
// should be no more than (MAX_HISTORY + 1)
// because current page will always be the first one in the list
- // but it will be not shown in kbar
while (recentVisit.value.length > MAX_HISTORY + 1) {
recentVisit.value.pop();
}
diff --git a/frontend/src/types/appProfile.ts b/frontend/src/types/appProfile.ts
index f43301834c..d6fb6e8535 100644
--- a/frontend/src/types/appProfile.ts
+++ b/frontend/src/types/appProfile.ts
@@ -6,7 +6,6 @@ export type AppFeatures = {
"bb.feature.database-change-mode":
| DatabaseChangeMode.PIPELINE
| DatabaseChangeMode.EDITOR;
- "bb.feature.disable-kbar": boolean;
"bb.feature.disallow-navigate-to-console": boolean;
"bb.feature.hide-banner": boolean;
"bb.feature.hide-help": boolean;
@@ -61,7 +60,6 @@ export const defaultAppProfile = (): AppProfile => ({
features: {
"bb.feature.default-workspace-view": "CONSOLE",
"bb.feature.database-change-mode": DatabaseChangeMode.PIPELINE,
- "bb.feature.disable-kbar": false,
"bb.feature.disallow-navigate-to-console": false,
"bb.feature.hide-banner": false,
"bb.feature.hide-help": false,
diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vue
index 379e0e0e7a..2191bc27c0 100644
--- a/frontend/src/views/DashboardHeader.vue
+++ b/frontend/src/views/DashboardHeader.vue
@@ -21,32 +21,6 @@
</router-link>
<div class="flex-1 flex justify-end items-center space-x-3">
- <NButton
- class="!hidden md:!flex"
- size="small"
- @click="onClickSearchButton"
- >
- <template #icon>
- <SearchIcon class="w-4 h-auto" />
- </template>
- <span class="text-control-placeholder text-sm mr-4">
- {{ $t("common.search") }}
- </span>
- <span class="flex items-center space-x-1">
- <kbd
- class="h-4 flex items-center justify-center bg-black bg-opacity-10 leading-none rounded px-1 text-control overflow-y-hidden"
- >
- <span v-if="isMac" class="text-base leading-none">⌘</span>
- <span
- v-else
- class="tracking-tighter text-xs transform scale-x-90 leading-none"
- >
- Ctrl
- </span>
- <span class="pl-1 text-xs leading-none">K</span>
- </kbd>
- </span>
- </NButton>
<NButton
v-if="currentPlan === PlanType.FREE"
size="small"
@@ -87,12 +61,9 @@
</template>
<script lang="ts" setup>
-import { defineAction, useRegisterActions } from "@bytebase/vue-kbar";
-import { useKBarHandler } from "@bytebase/vue-kbar";
import { useLocalStorage, useWindowSize } from "@vueuse/core";
import {
CircleDotIcon,
- SearchIcon,
SquareTerminalIcon,
MessagesSquareIcon,
} from "lucide-vue-next";
@@ -100,7 +71,6 @@ import { NButton, NTooltip } from "naive-ui";
import { storeToRefs } from "pinia";
import { v4 as uuidv4 } from "uuid";
import { computed, reactive } from "vue";
-import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import ProjectSwitchPopover from "@/components/Project/ProjectSwitch/ProjectSwitchPopover.vue";
import { useCurrentProject } from "@/components/Project/useCurrentProject";
@@ -109,7 +79,6 @@ import {
WORKSPACE_ROUTE_MY_ISSUES,
WORKSPACE_ROUTE_LANDING,
} from "@/router/dashboard/workspaceRoutes";
-import { SETTING_ROUTE_WORKSPACE_GENERAL } from "@/router/dashboard/workspaceSetting";
import {
SQL_EDITOR_DATABASE_MODULE,
SQL_EDITOR_HOME_MODULE,
@@ -121,7 +90,6 @@ import { PlanType } from "@/types/proto/v1/subscription_service";
import {
extractDatabaseResourceName,
extractProjectResourceName,
- hasWorkspacePermissionV2,
} from "@/utils";
import { getComponentIdLocalStorageKey } from "@/utils/localStorage";
import BytebaseLogo from "../components/BytebaseLogo.vue";
@@ -139,7 +107,6 @@ interface LocalState {
showProjectModal: boolean;
}
-const { t } = useI18n();
const subscriptionStore = useSubscriptionV1Store();
const router = useRouter();
const { locale } = useLanguage();
@@ -164,18 +131,8 @@ const params = computed(() => {
const { project, database } = useCurrentProject(params);
-const isMac = navigator.platform.match(/mac/i);
-const handler = useKBarHandler();
-const onClickSearchButton = () => {
- handler.value.show();
-};
-
const { currentPlan } = storeToRefs(subscriptionStore);
-const hasGetSettingPermission = computed(() => {
- return hasWorkspacePermissionV2("bb.settings.get");
-});
-
const sqlEditorLink = computed(() => {
if (isValidProjectName(project.value.name)) {
if (isValidDatabaseName(database.value.name)) {
@@ -218,22 +175,6 @@ const goToMyIssues = () => {
).value = uuidv4();
};
-const kbarActions = computed(() => {
- if (!hasGetSettingPermission.value) {
- return [];
- }
- return [
- defineAction({
- id: "bb.navigation.global.settings",
- name: t("common.settings"),
- section: t("kbar.navigation"),
- keywords: "navigation",
- perform: () => router.push({ name: SETTING_ROUTE_WORKSPACE_GENERAL }),
- }),
- ];
-});
-useRegisterActions(kbarActions);
-
const handleWantHelp = () => {
if (locale.value === "zh-CN") {
state.showQRCodeModal = true;
diff --git a/frontend/src/views/DashboardSidebar.vue b/frontend/src/views/DashboardSidebar.vue
index 3e117309c0..85bcc10428 100644
--- a/frontend/src/views/DashboardSidebar.vue
+++ b/frontend/src/views/DashboardSidebar.vue
@@ -9,22 +9,14 @@
</template>
<script lang="ts" setup>
-import type { Action } from "@bytebase/vue-kbar";
-import { defineAction, useRegisterActions } from "@bytebase/vue-kbar";
import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
import CommonSidebar from "@/components/CommonSidebar.vue";
-import { useGlobalDatabaseActions } from "@/components/KBar/useDatabaseActions";
-import { useProjectActions } from "@/components/KBar/useProjectActions";
import { WORKSPACE_ROUTE_LANDING } from "@/router/dashboard/workspaceRoutes";
import { SQL_EDITOR_HOME_MODULE } from "@/router/sqlEditor";
import { useAppFeature } from "@/store";
import { DatabaseChangeMode } from "@/types/proto/v1/setting_service";
-import { useDashboardSidebar, type DashboardSidebarItem } from "@/utils";
+import { useDashboardSidebar } from "@/utils";
-const { t } = useI18n();
-const router = useRouter();
const databaseChangeMode = useAppFeature("bb.feature.database-change-mode");
const { getItemClass, dashboardSidebarItemList } = useDashboardSidebar();
@@ -34,36 +26,4 @@ const logoRedirect = computed(() => {
}
return WORKSPACE_ROUTE_LANDING;
});
-
-const navigationKbarActions = computed((): Action[] => {
- return dashboardSidebarItemList.value
- .reduce((list, item) => {
- if (!item.children || item.children.length === 0) {
- if (item.navigationId && item.name && !item.hide) {
- list.push(item);
- }
- } else {
- for (const child of item.children) {
- if (child.navigationId && child.name && !child.hide) {
- list.push(child);
- }
- }
- }
- return list;
- }, [] as DashboardSidebarItem[])
- .map((item) => {
- return defineAction({
- id: item.navigationId,
- name: item.title,
- section: t("kbar.navigation"),
- shortcut: item.shortcuts,
- keywords: item.title?.toLocaleLowerCase(),
- perform: () => router.push({ name: item.name }),
- });
- });
-});
-useRegisterActions(navigationKbarActions);
-
-useProjectActions(10);
-useGlobalDatabaseActions(10);
</script>