Skip to content

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

feat: add search bar below bytebase logo (#662)

Liu Ji925c65845e9c
diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.yml
index fa3ca9c297..9587d8f547 100644
--- a/frontend/src/locales/en.yml
+++ b/frontend/src/locales/en.yml
@@ -171,6 +171,7 @@ common:
copied: Copied
manage: Manage
table: Table
+ search: Search
error-page:
go-back-home: Go back home
anomaly-center: Anomaly Center
diff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.yml
index 7307c95864..51266a6aaf 100644
--- a/frontend/src/locales/zh-CN.yml
+++ b/frontend/src/locales/zh-CN.yml
@@ -171,6 +171,7 @@ common:
copy: 拷贝
manage: 管理
table: 表
+ search: 搜索
error-page:
go-back-home: 回到主页
anomaly-center: 异常中心
diff --git a/frontend/src/views/DashboardSidebar.vue b/frontend/src/views/DashboardSidebar.vue
index 9926e36944..8f6f8b2ec1 100644
--- a/frontend/src/views/DashboardSidebar.vue
+++ b/frontend/src/views/DashboardSidebar.vue
@@ -1,6 +1,22 @@
<template>
<!-- Navigation -->
<nav class="px-2">
+ <button
+ class="mb-4 w-full flex items-center justify-between rounded-md border border-control-border bg-white hover:bg-control-bg-hover pl-2 pr-1 py-0.5 outline-none"
+ @click="onClickSearchButton"
+ >
+ <span class="text-control-placeholder">{{ $t("common.search") }}</span>
+ <span class="flex items-center space-x-1">
+ <kbd
+ class="h-5 flex items-center justify-center bg-black bg-opacity-10 rounded text-sm px-1 text-control overflow-y-hidden"
+ >
+ <span v-if="isMac" class="text-xl px-0.5">⌘</span>
+ <span v-else class="tracking-tighter transform scale-x-90">Ctrl</span>
+ <span class="ml-1 mr-0.5">K</span>
+ </kbd>
+ </span>
+ </button>
+
<router-link to="/" class="outline-item group flex items-center px-2 py-2">
<heroicons-outline:home class="w-5 h-5 mr-2" />
{{ $t("common.home") }}
@@ -35,4 +51,13 @@
import BookmarkListSidePanel from "../components/BookmarkListSidePanel.vue";
import ProjectListSidePanel from "../components/ProjectListSidePanel.vue";
import DatabaseListSidePanel from "../components/DatabaseListSidePanel.vue";
+import { useKBarHandler } from "@bytebase/vue-kbar";
+
+const isMac = navigator.platform.match(/mac/i);
+
+const handler = useKBarHandler();
+
+const onClickSearchButton = () => {
+ handler.value.show();
+};
</script>