Skip to content

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

move to three column layout

天舟ab8008dab688
diff --git a/frontend/src/assets/css/tailwind.css b/frontend/src/assets/css/tailwind.css
index 6f6c371d48..d0307f2e4f 100644
--- a/frontend/src/assets/css/tailwind.css
+++ b/frontend/src/assets/css/tailwind.css
@@ -36,6 +36,10 @@
@apply text-normal-text hover:underline;
}
+.iconlink {
+ @apply text-normal-text hover:bg-link-hover focus:outline-none;
+}
+
.sidebar-link {
@apply text-normal-text hover:bg-link-hover text-sm leading-5 font-medium focus:outline-none;
}
diff --git a/frontend/src/components/Breadcrumb.vue b/frontend/src/components/Breadcrumb.vue
index 29ac6c4b90..dce62bcf9e 100644
--- a/frontend/src/components/Breadcrumb.vue
+++ b/frontend/src/components/Breadcrumb.vue
@@ -1,6 +1,6 @@
<template>
- <ol class="flex items-center space-x-2">
- <li v-for="(item, index) in breadcrumbList" :key="index">
+ <nav class="flex" aria-label="Breadcrumb">
+ <div v-for="(item, index) in breadcrumbList" :key="index">
<div class="flex items-center space-x-2">
<svg
v-if="index > 0"
@@ -59,8 +59,8 @@
</svg>
</button>
</div>
- </li>
- </ol>
+ </div>
+ </nav>
</template>
<script lang="ts">
diff --git a/frontend/src/layouts/DashboardLayout.vue b/frontend/src/layouts/DashboardLayout.vue
new file mode 100644
index 0000000000..a25c8bcdbe
--- /dev/null
+++ b/frontend/src/layouts/DashboardLayout.vue
@@ -0,0 +1,141 @@
+<template>
+ <!-- This example requires Tailwind CSS v2.0+ -->
+ <div>
+ <nav class="bg-white border-b border-block-border">
+ <div class="max-w-full mx-auto px-4 sm:px-6 lg:px-8">
+ <div class="flex items-center justify-between h-16">
+ <div class="flex items-center">
+ <div class="flex-shrink-0">
+ <router-link to="/" active-class="" exact-active-class=""
+ ><img
+ class="h-10 w-auto"
+ src="../assets/logo.svg"
+ alt="Bytebase"
+ /></router-link>
+ </div>
+ <div class="hidden md:block">
+ <div class="ml-10 flex items-baseline space-x-4">
+ <!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
+ <router-link to="/" class="link px-3 py-2 rounded-md"
+ >Dashboard</router-link
+ >
+
+ <router-link to="/instance" class="link px-3 py-2 rounded-md"
+ >Instance</router-link
+ >
+
+ <router-link to="/environment" class="link px-3 py-2 rounded-md"
+ >Environment</router-link
+ >
+ </div>
+ </div>
+ </div>
+ <div>
+ <div class="flex items-center">
+ <router-link to="/inbox" class="iconlink p-1 rounded-full">
+ <span class="sr-only">View Inbox</span>
+ <!-- Heroicon name: bell -->
+ <svg
+ class="h-6 w-6"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke="currentColor"
+ aria-hidden="true"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
+ />
+ </svg>
+ </router-link>
+
+ <div class="ml-2">
+ <ProfileDropdown />
+ </div>
+ <div class="ml-2 -mr-2 flex md:hidden">
+ <!-- Mobile menu button -->
+ <button
+ @click.prevent="state.showMobileMenu = !state.showMobileMenu"
+ class="iconlink inline-flex items-center justify-center rounded-md"
+ >
+ <span class="sr-only">Open main menu</span>
+ <!--
+ Heroicon name: menu
+
+ Menu open: "hidden", Menu closed: "block"
+ -->
+ <svg
+ class="w-6 h-6"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
+ ></path>
+ </svg>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!--
+ Mobile menu, toggle classes based on menu state.
+
+ Open: "block", closed: "hidden"
+ -->
+ <div v-if="state.showMobileMenu" class="block md:hidden">
+ <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
+ <!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
+ <router-link to="/" class="link rounded-md block px-3 py-2"
+ >Dashboard</router-link
+ >
+
+ <router-link to="/instance" class="link rounded-md block px-3 py-2"
+ >Instance</router-link
+ >
+
+ <router-link to="/environment" class="link rounded-md block px-3 py-2"
+ >Environment</router-link
+ >
+ </div>
+ </div>
+ </nav>
+
+ <main>
+ <div class="max-w-full">
+ <router-view />
+ </div>
+ </main>
+ </div>
+</template>
+
+<script lang="ts">
+import { reactive } from "vue";
+import ProfileDropdown from "../components/ProfileDropdown.vue";
+
+interface LocalState {
+ showMobileMenu: boolean;
+}
+
+export default {
+ name: "DashboardLayout",
+ components: { ProfileDropdown },
+ setup(props, ctx) {
+ const state = reactive<LocalState>({
+ showMobileMenu: false,
+ });
+
+ return { state };
+ },
+};
+</script>
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 44a8ceff49..beb782443b 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -1,5 +1,7 @@
import { defineAsyncComponent } from "vue";
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
+import DashboardLayout from "../layouts/DashboardLayout.vue";
+import ThreeColumnView from "../views/ThreeColumnView.vue";
import MainContent from "../views/MainContent.vue";
import MainSidebar from "../views/MainSidebar.vue";
import EmptyView from "../views/EmptyView.vue";
@@ -40,157 +42,142 @@ const routes: Array<RouteRecordRaw> = [
{
path: "/",
name: HOME_MODULE,
- component: MasterDetail,
+ component: DashboardLayout,
children: [
{
path: "404",
name: "error.404",
meta: { displayName: "404" },
- components: {
- content: defineAsyncComponent(() => import("../views/Page404.vue")),
- leftsidebar: MainSidebar,
- rightsidebar: ActivitySidebar,
- },
+ component: defineAsyncComponent(() => import("../views/Page404.vue")),
},
{
path: "500",
name: "error.500",
meta: { displayName: "500" },
- components: {
- content: defineAsyncComponent(() => import("../views/Page500.vue")),
- leftsidebar: MainSidebar,
- rightsidebar: ActivitySidebar,
- },
+ component: defineAsyncComponent(() => import("../views/Page500.vue")),
},
{
path: "inbox",
name: "workspace.inbox",
meta: { displayName: "Inbox" },
- components: {
- content: defineAsyncComponent(() => import("../views/Inbox.vue")),
- leftsidebar: MainSidebar,
- rightsidebar: ActivitySidebar,
- },
+ component: defineAsyncComponent(() => import("../views/Inbox.vue")),
props: { actionbar: true, content: true },
},
- {
- path: "environment",
- name: "workspace.environment",
- meta: { displayName: "Environment" },
- components: {
- content: defineAsyncComponent(
- () => import("../views/EnvironmentDashboard.vue")
- ),
- leftsidebar: MainSidebar,
- rightsidebar: ActivitySidebar,
- },
- props: { actionbar: true, content: true },
- },
- {
- path: "setting",
- name: "setting",
- meta: { displayName: "Setting" },
- components: {
- content: defineAsyncComponent(() => import("../views/Setting.vue")),
- leftsidebar: defineAsyncComponent(
- () => import("../views/SettingSidebar.vue")
- ),
- rightsidebar: ActivitySidebar,
- },
- children: [
- {
- path: "",
- name: "setting.accountprofile",
- meta: { displayName: "Account Profile" },
- component: defineAsyncComponent(
- () => import("../views/SettingAccountProfile.vue")
- ),
- alias: "account/profile",
- props: true,
- },
- {
- path: "general",
- name: "setting.workspace.general",
- meta: { displayName: "General" },
- component: defineAsyncComponent(
- () => import("../views/SettingWorkspaceGeneral.vue")
- ),
- props: true,
- },
- {
- path: "agent",
- name: "setting.workspace.agent",
- meta: { displayName: "Agents" },
- component: defineAsyncComponent(
- () => import("../views/SettingWorkspaceAgent.vue")
- ),
- props: true,
- },
- {
- path: "member",
- name: "setting.workspace.member",
- meta: { displayName: "Members" },
- component: defineAsyncComponent(
- () => import("../views/SettingWorkspaceMember.vue")
- ),
- props: true,
- },
- {
- path: "plan",
- name: "setting.workspace.plan",
- meta: { displayName: "Plans" },
- component: defineAsyncComponent(
- () => import("../views/SettingWorkspacePlan.vue")
- ),
- props: true,
- },
- {
- path: "billing",
- name: "setting.workspace.billing",
- meta: { displayName: "Billings" },
- component: defineAsyncComponent(
- () => import("../views/SettingWorkspaceBilling.vue")
- ),
- props: true,
- },
- {
- path: "integration/slack",
- name: "setting.workspace.integration.slack",
- meta: { displayName: "Slack" },
- component: defineAsyncComponent(
- () => import("../views/SettingWorkspaceIntegrationSlack.vue")
- ),
- props: true,
- },
- {
- // Use absolute path to specify the whole path while still leverages the nested route
- path: "/:groupSlug/:projectSlug/setting",
- name: "setting.workspace.project",
- meta: { displayName: "Setting" },
- component: defineAsyncComponent(
- () => import("../views/SettingWorkspaceProject.vue")
- ),
- props: true,
- },
- ],
- },
{
path: "",
name: HOME_MODULE,
- components: {
- content: MainContent,
- leftsidebar: MainSidebar,
- rightsidebar: ActivitySidebar,
- },
+ component: ThreeColumnView,
children: [
{
path: "",
name: HOME_MODULE,
- meta: { displayName: "Home" },
+ meta: { displayName: "Home", rightSidebar: true },
components: {
- actionbar: ActionbarHome,
content: Home,
+ leftSidebar: MainSidebar,
+ rightSidebar: ActivitySidebar,
+ },
+ props: { actionbar: true, content: true },
+ },
+ {
+ path: "setting",
+ name: "setting",
+ meta: { displayName: "Setting" },
+ components: {
+ content: defineAsyncComponent(
+ () => import("../views/Setting.vue")
+ ),
+ leftSidebar: defineAsyncComponent(
+ () => import("../views/SettingSidebar.vue")
+ ),
+ },
+ children: [
+ {
+ path: "",
+ name: "setting.accountprofile",
+ meta: { displayName: "Account Profile" },
+ component: defineAsyncComponent(
+ () => import("../views/SettingAccountProfile.vue")
+ ),
+ alias: "account/profile",
+ props: true,
+ },
+ {
+ path: "general",
+ name: "setting.workspace.general",
+ meta: { displayName: "General" },
+ component: defineAsyncComponent(
+ () => import("../views/SettingWorkspaceGeneral.vue")
+ ),
+ props: true,
+ },
+ {
+ path: "agent",
+ name: "setting.workspace.agent",
+ meta: { displayName: "Agents" },
+ component: defineAsyncComponent(
+ () => import("../views/SettingWorkspaceAgent.vue")
+ ),
+ props: true,
+ },
+ {
+ path: "member",
+ name: "setting.workspace.member",
+ meta: { displayName: "Members" },
+ component: defineAsyncComponent(
+ () => import("../views/SettingWorkspaceMember.vue")
+ ),
+ props: true,
+ },
+ {
+ path: "plan",
+ name: "setting.workspace.plan",
+ meta: { displayName: "Plans" },
+ component: defineAsyncComponent(
+ () => import("../views/SettingWorkspacePlan.vue")
+ ),
+ props: true,
+ },
+ {
+ path: "billing",
+ name: "setting.workspace.billing",
+ meta: { displayName: "Billings" },
+ component: defineAsyncComponent(
+ () => import("../views/SettingWorkspaceBilling.vue")
+ ),
+ props: true,
+ },
+ {
+ path: "integration/slack",
+ name: "setting.workspace.integration.slack",
+ meta: { displayName: "Slack" },
+ component: defineAsyncComponent(
+ () => import("../views/SettingWorkspaceIntegrationSlack.vue")
+ ),
+ props: true,
+ },
+ {
+ // Use absolute path to specify the whole path while still leverages the nested route
+ path: "/:groupSlug/:projectSlug/setting",
+ name: "setting.workspace.project",
+ meta: { displayName: "Setting" },
+ component: defineAsyncComponent(
+ () => import("../views/SettingWorkspaceProject.vue")
+ ),
+ props: true,
+ },
+ ],
+ },
+ {
+ path: "environment",
+ name: "workspace.environment",
+ meta: { displayName: "Environment" },
+ components: {
+ content: defineAsyncComponent(
+ () => import("../views/EnvironmentDashboard.vue")
+ ),
+ leftSidebar: MainSidebar,
},
props: { actionbar: true, content: true },
},
@@ -199,10 +186,10 @@ const routes: Array<RouteRecordRaw> = [
name: "workspace.pipeline.detail",
meta: { displayName: "Pipeline" },
components: {
- actionbar: EmptyView,
content: defineAsyncComponent(
() => import("../views/PipelineDetail.vue")
),
+ leftSidebar: MainSidebar,
},
props: { actionbar: true, content: true },
},
@@ -253,8 +240,7 @@ const routes: Array<RouteRecordRaw> = [
export const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
- linkActiveClass: "text-gray-900 bg-link-hover",
- linkExactActiveClass: "text-gray-900 bg-link-hover",
+ linkExactActiveClass: "bg-link-hover",
});
router.beforeEach((to, from, next) => {
diff --git a/frontend/src/views/ActivitySidebar.vue b/frontend/src/views/ActivitySidebar.vue
index c32ae5781c..b17452dab1 100644
--- a/frontend/src/views/ActivitySidebar.vue
+++ b/frontend/src/views/ActivitySidebar.vue
@@ -1,5 +1,5 @@
<template>
- <div class="pt-6 pb-2">
+ <div class="pl-6 pt-6 pb-2">
<h2 class="text-sm leading-5 font-semibold">Activity</h2>
</div>
<div>
@@ -29,7 +29,7 @@
<!-- More items... -->
</ul>
- <div class="py-4 text-sm leading-5 border-t border-block-border">
+ <div class="pl-6 py-4 text-sm leading-5 border-t border-block-border">
<a href="#" class="link">View all activity &rarr;</a>
</div>
</div>
diff --git a/frontend/src/views/MasterDetail.vue b/frontend/src/views/MasterDetail.vue
index 13fc8218ee..26368e57d5 100644
--- a/frontend/src/views/MasterDetail.vue
+++ b/frontend/src/views/MasterDetail.vue
@@ -63,7 +63,7 @@
/></router-link>
<ProfileDropdown />
</div>
- <router-view name="leftsidebar" />
+ <router-view name="leftSidebar" />
<div
class="flex-shrink-0 flex flex-row border-t border-block-border p-3 text-gray-700"
>
@@ -97,7 +97,7 @@
<ProfileDropdown />
</div>
</div>
- <router-view name="leftsidebar" />
+ <router-view name="leftSidebar" />
<div
class="flex-shrink-0 flex flex-row border-t border-block-border p-3 text-gray-700"
>
diff --git a/frontend/src/views/ThreeColumnView.vue b/frontend/src/views/ThreeColumnView.vue
new file mode 100644
index 0000000000..e0af25db80
--- /dev/null
+++ b/frontend/src/views/ThreeColumnView.vue
@@ -0,0 +1,219 @@
+<template>
+ <!-- This example requires Tailwind CSS v2.0+ -->
+ <div class="h-screen flex overflow-hidden bg-white">
+ <!-- Off-canvas menu for mobile, show/hide based on off-canvas menu state. -->
+ <div v-if="state.showMobileOverlay" class="lg:hidden">
+ <div class="fixed inset-0 flex z-40">
+ <!--
+ Off-canvas menu overlay, show/hide based on off-canvas menu state.
+
+ Entering: "transition-opacity ease-linear duration-300"
+ From: "opacity-0"
+ To: "opacity-100"
+ Leaving: "transition-opacity ease-linear duration-300"
+ From: "opacity-100"
+ To: "opacity-0"
+ -->
+ <div class="fixed inset-0">
+ <div class="absolute inset-0 bg-gray-600 opacity-75"></div>
+ </div>
+ <!--
+ Off-canvas menu, show/hide based on off-canvas menu state.
+
+ Entering: "transition ease-in-out duration-300 transform"
+ From: "-translate-x-full"
+ To: "translate-x-0"
+ Leaving: "transition ease-in-out duration-300 transform"
+ From: "translate-x-0"
+ To: "-translate-x-full"
+ -->
+ <div
+ tabindex="0"
+ class="relative flex-1 flex flex-col max-w-xs w-full bg-white focus:outline-none"
+ >
+ <div class="absolute top-0 right-0 -mr-12 pt-2">
+ <button
+ @click.prevent="state.showMobileOverlay = false"
+ type="button"
+ class="ml-1 flex items-center justify-center h-10 w-10 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white"
+ >
+ <span class="sr-only">Close sidebar</span>
+ <!-- Heroicon name: x -->
+ <svg
+ class="h-6 w-6 text-white"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke="currentColor"
+ aria-hidden="true"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M6 18L18 6M6 6l12 12"
+ />
+ </svg>
+ </button>
+ </div>
+ <div class="flex-1 h-0 pt-5 pb-4 overflow-y-auto">
+ <router-view name="leftSidebar" />
+ </div>
+ <div class="flex-shrink-0 flex border-t border-gray-200 p-4">
+ <a href="#" class="flex-shrink-0 group block">
+ <div class="flex items-center">
+ <svg
+ class="w-5 h-5"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
+ ></path>
+ </svg>
+ <a href="/" class="ml-1 text-sm">Help &amp; Feedback</a>
+ </div>
+ </a>
+ </div>
+ </div>
+ <div class="flex-shrink-0 w-14" aria-hidden="true">
+ <!-- Force sidebar to shrink to fit close icon -->
+ </div>
+ </div>
+ </div>
+
+ <!-- Static sidebar for desktop -->
+ <div class="hidden lg:flex lg:flex-shrink-0">
+ <div class="flex flex-col w-64">
+ <!-- Sidebar component, swap this element with another sidebar if you like -->
+ <div
+ class="flex flex-col h-0 flex-1 border-r border-gray-200 bg-gray-100"
+ >
+ <div class="flex-1 flex flex-col pt-5 pb-4 overflow-y-auto">
+ <router-view name="leftSidebar" />
+ </div>
+ <div class="flex-shrink-0 flex border-t border-gray-200 p-4">
+ <a href="#" class="flex-shrink-0 w-full group block">
+ <div class="flex items-center">
+ <svg
+ class="w-5 h-5"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
+ ></path>
+ </svg>
+ <a href="/" class="ml-1 text-sm">Help &amp; Feedback</a>
+ </div>
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="flex flex-col min-w-0 flex-1 overflow-hidden">
+ <div class="lg:hidden">
+ <div
+ class="flex items-center justify-start bg-gray-50 border-b border-gray-200 px-4 py-1.5"
+ >
+ <div>
+ <button
+ @click.prevent="state.showMobileOverlay = true"
+ type="button"
+ class="-mr-3 h-12 w-12 inline-flex items-center justify-center rounded-md text-gray-500 hover:text-gray-900"
+ >
+ <span class="sr-only">Open sidebar</span>
+ <!-- Heroicon name: menu -->
+ <svg
+ class="h-6 w-6"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke="currentColor"
+ aria-hidden="true"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M4 6h16M4 12h16M4 18h16"
+ />
+ </svg>
+ </button>
+ </div>
+ <div class="ml-4">
+ <Breadcrumb />
+ </div>
+ </div>
+ </div>
+ <div class="flex-grow w-full mx-auto lg:flex">
+ <!-- Left sidebar & main wrapper -->
+ <div class="flex-1 min-w-0 bg-white lg:flex">
+ <div class="bg-white lg:min-w-0 lg:flex-1">
+ <div class="hidden lg:block px-4 py-3">
+ <Breadcrumb />
+ </div>
+
+ <div class="h-full overflow-hidden">
+ <!-- Start main area-->
+ <router-view name="content" />
+ <!-- End main area -->
+ </div>
+ </div>
+ </div>
+
+ <div
+ v-if="showRightSidebar"
+ class="bg-gray-50 lg:flex-shrink-0 lg:border-l lg:border-gray-200"
+ >
+ <div class="h-full py-6 lg:w-80">
+ <!-- Start right column area -->
+ <router-view name="rightSidebar" />
+ <!-- End right column area -->
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script lang="ts">
+import { computed, reactive } from "vue";
+import { useRouter } from "vue-router";
+import Breadcrumb from "../components/Breadcrumb.vue";
+
+interface LocalState {
+ showMobileOverlay: boolean;
+}
+
+export default {
+ name: "ThreeColumnView",
+ components: {
+ Breadcrumb,
+ },
+ setup(props, ctx) {
+ const state = reactive<LocalState>({
+ showMobileOverlay: false,
+ });
+
+ const showRightSidebar = computed(() => {
+ return useRouter().currentRoute.value.meta.rightSidebar;
+ });
+
+ return {
+ state,
+ showRightSidebar,
+ };
+ },
+};
+</script>