Skip to content

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

feat(frontend): STANDALONE mode for console (#8769)

Liu Jibdd1df0fcc39
diff --git a/frontend/src/components/BannersWrapper.vue b/frontend/src/components/BannersWrapper.vue
index b9180f2994..83522b3977 100644
--- a/frontend/src/components/BannersWrapper.vue
+++ b/frontend/src/components/BannersWrapper.vue
@@ -1,24 +1,27 @@
<template>
- <BannerUpgradeSubscription />
- <template v-if="shouldShowDemoBanner">
- <BannerDemo />
- </template>
- <template v-if="shouldShowDebugBanner">
- <BannerDebug />
- </template>
- <template v-if="shouldShowSubscriptionBanner">
- <BannerSubscription />
- </template>
- <template v-if="shouldShowReadonlyBanner">
- <div class="bg-info">
- <div class="text-center py-1 px-3 font-medium text-white truncate">
- {{ $t("banner.readonly") }}
+ <HideInStandaloneMode>
+ <BannerUpgradeSubscription />
+ <template v-if="shouldShowDemoBanner">
+ <BannerDemo />
+ </template>
+ <template v-if="shouldShowDebugBanner">
+ <BannerDebug />
+ </template>
+ <template v-if="shouldShowSubscriptionBanner">
+ <BannerSubscription />
+ </template>
+ <template v-if="shouldShowReadonlyBanner">
+ <div class="bg-info">
+ <div class="text-center py-1 px-3 font-medium text-white truncate">
+ {{ $t("banner.readonly") }}
+ </div>
</div>
- </div>
- </template>
- <template v-if="shouldShowExternalUrlBanner">
- <BannerExternalUrl />
- </template>
+ </template>
+ <template v-if="shouldShowExternalUrlBanner">
+ <BannerExternalUrl />
+ </template>
+ </HideInStandaloneMode>
+
<BannerAnnouncement />
</template>
@@ -38,6 +41,7 @@ import BannerDemo from "@/views/BannerDemo.vue";
import BannerExternalUrl from "@/views/BannerExternalUrl.vue";
import BannerSubscription from "@/views/BannerSubscription.vue";
import BannerUpgradeSubscription from "@/views/BannerUpgradeSubscription.vue";
+import HideInStandaloneMode from "./misc/HideInStandaloneMode.vue";
const actuatorStore = useActuatorV1Store();
const currentUserV1 = useCurrentUserV1();
diff --git a/frontend/src/components/KBar/KBarWrapper.vue b/frontend/src/components/KBar/KBarWrapper.vue
index e86535b326..8bdc26a836 100644
--- a/frontend/src/components/KBar/KBarWrapper.vue
+++ b/frontend/src/components/KBar/KBarWrapper.vue
@@ -27,10 +27,11 @@ import {
KBarSearch,
defineAction,
} from "@bytebase/vue-kbar";
+import { storeToRefs } from "pinia";
import { defineComponent, computed } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
-import { useCurrentUserV1 } from "@/store";
+import { useActuatorV1Store, useCurrentUserV1 } from "@/store";
import { UNKNOWN_USER_NAME } from "@/types";
import { useModalStackStatus } from "../../bbkit/BBModalStack.vue";
import KBarFooter from "./KBarFooter.vue";
@@ -54,10 +55,15 @@ export default defineComponent({
const { t } = useI18n();
const router = useRouter();
const modalStack = useModalStackStatus();
+ const { pageMode } = storeToRefs(useActuatorV1Store());
const placeholder = computed(() => t("kbar.options.placeholder"));
const disabled = computed(() => {
+ if (pageMode.value === "STANDALONE") {
+ return true;
+ }
+
if (modalStack.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
diff --git a/frontend/src/components/misc/HideInStandaloneMode.vue b/frontend/src/components/misc/HideInStandaloneMode.vue
new file mode 100644
index 0000000000..6433b99b6a
--- /dev/null
+++ b/frontend/src/components/misc/HideInStandaloneMode.vue
@@ -0,0 +1,10 @@
+<template>
+ <slot v-if="pageMode !== 'STANDALONE'" name="default" />
+</template>
+
+<script setup lang="ts">
+import { storeToRefs } from "pinia";
+import { useActuatorV1Store } from "@/store";
+
+const { pageMode } = storeToRefs(useActuatorV1Store());
+</script>
diff --git a/frontend/src/layouts/BodyLayout.vue b/frontend/src/layouts/BodyLayout.vue
index 185e0ab977..759f21d2d2 100644
--- a/frontend/src/layouts/BodyLayout.vue
+++ b/frontend/src/layouts/BodyLayout.vue
@@ -1,29 +1,101 @@
<template>
<div class="h-full flex flex-col overflow-hidden">
<div class="flex-1 flex overflow-hidden">
- <!-- Off-canvas menu for mobile, show/hide based on off-canvas menu state. -->
- <div v-if="state.showMobileOverlay" class="md:hidden">
- <div class="fixed inset-0 flex z-40">
- <div class="fixed inset-0">
- <div class="absolute inset-0 bg-gray-600 opacity-75"></div>
- </div>
- <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
- 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"
- @click.prevent="state.showMobileOverlay = false"
+ <HideInStandaloneMode>
+ <!-- Off-canvas menu for mobile, show/hide based on off-canvas menu state. -->
+ <div v-if="state.showMobileOverlay" class="md:hidden">
+ <div class="fixed inset-0 flex z-40">
+ <div class="fixed inset-0">
+ <div class="absolute inset-0 bg-gray-600 opacity-75"></div>
+ </div>
+ <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
+ 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"
+ @click.prevent="state.showMobileOverlay = false"
+ >
+ <span class="sr-only">Close sidebar</span>
+ <!-- Heroicon name: x -->
+ <heroicons-solid:x class="h-6 w-6 text-white" />
+ </button>
+ </div>
+ <!-- Mobile Sidebar -->
+ <div class="flex-1 h-0 py-4 overflow-y-auto">
+ <router-view name="leftSidebar" />
+ </div>
+ <router-link
+ to="/archive"
+ class="outline-item group flex items-center px-4 py-1.5"
+ >
+ <heroicons-outline:archive class="w-5 h-5 mr-2" />
+ {{ $t("common.archive") }}
+ </router-link>
+ <div
+ class="flex-shrink-0 flex border-t border-block-border px-3 py-1.5"
>
- <span class="sr-only">Close sidebar</span>
- <!-- Heroicon name: x -->
- <heroicons-solid:x class="h-6 w-6 text-white" />
- </button>
+ <div
+ v-if="isDemo"
+ class="text-sm flex whitespace-nowrap text-accent"
+ >
+ <heroicons-outline:presentation-chart-bar
+ class="w-5 h-5 mr-1"
+ />
+ {{ $t("common.demo-mode") }}
+ </div>
+ <router-link
+ v-else-if="!isFreePlan || !hasPermission"
+ to="/setting/subscription"
+ exact-active-class=""
+ class="text-sm flex"
+ >
+ {{ $t(currentPlan) }}
+ </router-link>
+ <div
+ v-else
+ class="text-sm flex whitespace-nowrap mr-1 text-accent cursor-pointer"
+ @click="state.showTrialModal = true"
+ >
+ <heroicons-solid:sparkles class="w-5 h-5" />
+ {{ $t(currentPlan) }}
+ </div>
+ <div
+ class="text-sm flex items-center gap-x-1 ml-auto tooltip-wrapper"
+ :class="
+ canUpgrade
+ ? 'text-success cursor-pointer'
+ : 'text-control-light cursor-default'
+ "
+ @click="state.showReleaseModal = canUpgrade"
+ >
+ <heroicons-outline:volume-up
+ v-if="canUpgrade"
+ class="h-4 w-4"
+ />
+ {{ version }}
+ <span v-if="gitCommit" class="tooltip"
+ >Git hash {{ gitCommit }}</span
+ >
+ </div>
+ </div>
+ </div>
+ <div class="flex-shrink-0 w-14" aria-hidden="true">
+ <!-- Force sidebar to shrink to fit close icon -->
</div>
- <!-- Mobile Sidebar -->
- <div class="flex-1 h-0 py-4 overflow-y-auto">
+ </div>
+ </div>
+
+ <!-- Static sidebar for desktop -->
+ <aside
+ class="hidden md:flex md:flex-shrink-0"
+ data-label="bb-dashboard-static-sidebar"
+ >
+ <div class="flex flex-col w-52 bg-control-bg">
+ <!-- Sidebar component, swap this element with another sidebar if you like -->
+ <div class="flex-1 flex flex-col py-0 overflow-y-auto">
<router-view name="leftSidebar" />
</div>
<router-link
@@ -34,7 +106,7 @@
{{ $t("common.archive") }}
</router-link>
<div
- class="flex-shrink-0 flex border-t border-block-border px-3 py-1.5"
+ class="flex-shrink-0 flex justify-between border-t border-block-border px-3 py-1.5"
>
<div
v-if="isDemo"
@@ -49,12 +121,12 @@
v-else-if="!isFreePlan || !hasPermission"
to="/setting/subscription"
exact-active-class=""
- class="text-sm flex"
+ class="text-sm flex whitespace-nowrap mr-1"
>
{{ $t(currentPlan) }}
</router-link>
<div
- v-else
+ v-else-if="subscriptionStore.canTrial"
class="text-sm flex whitespace-nowrap mr-1 text-accent cursor-pointer"
@click="state.showTrialModal = true"
>
@@ -62,7 +134,7 @@
{{ $t(currentPlan) }}
</div>
<div
- class="text-sm flex items-center gap-x-1 ml-auto tooltip-wrapper"
+ class="text-xs flex items-center gap-x-1 tooltip-wrapper whitespace-nowrap"
:class="
canUpgrade
? 'text-success cursor-pointer'
@@ -75,153 +147,98 @@
class="h-4 w-4"
/>
{{ version }}
- <span v-if="gitCommit" class="tooltip"
- >Git hash {{ gitCommit }}</span
- >
+ <span v-if="canUpgrade" class="tooltip whitespace-nowrap">
+ {{ $t("settings.release.new-version-available") }}
+ </span>
+ <span v-else-if="gitCommit" class="tooltip">
+ Git hash {{ gitCommit }}
+ </span>
</div>
</div>
</div>
- <div class="flex-shrink-0 w-14" aria-hidden="true">
- <!-- Force sidebar to shrink to fit close icon -->
- </div>
- </div>
- </div>
+ </aside>
+ </HideInStandaloneMode>
- <!-- Static sidebar for desktop -->
- <aside
- class="hidden md:flex md:flex-shrink-0"
- data-label="bb-dashboard-static-sidebar"
- >
- <div class="flex flex-col w-52 bg-control-bg">
- <!-- Sidebar component, swap this element with another sidebar if you like -->
- <div class="flex-1 flex flex-col py-0 overflow-y-auto">
- <router-view name="leftSidebar" />
- </div>
- <router-link
- to="/archive"
- class="outline-item group flex items-center px-4 py-1.5"
- >
- <heroicons-outline:archive class="w-5 h-5 mr-2" />
- {{ $t("common.archive") }}
- </router-link>
- <div
- class="flex-shrink-0 flex justify-between border-t border-block-border px-3 py-1.5"
- >
- <div
- v-if="isDemo"
- class="text-sm flex whitespace-nowrap text-accent"
- >
- <heroicons-outline:presentation-chart-bar class="w-5 h-5 mr-1" />
- {{ $t("common.demo-mode") }}
- </div>
- <router-link
- v-else-if="!isFreePlan || !hasPermission"
- to="/setting/subscription"
- exact-active-class=""
- class="text-sm flex whitespace-nowrap mr-1"
- >
- {{ $t(currentPlan) }}
- </router-link>
- <div
- v-else-if="subscriptionStore.canTrial"
- class="text-sm flex whitespace-nowrap mr-1 text-accent cursor-pointer"
- @click="state.showTrialModal = true"
- >
- <heroicons-solid:sparkles class="w-5 h-5" />
- {{ $t(currentPlan) }}
- </div>
- <div
- class="text-xs flex items-center gap-x-1 tooltip-wrapper whitespace-nowrap"
- :class="
- canUpgrade
- ? 'text-success cursor-pointer'
- : 'text-control-light cursor-default'
- "
- @click="state.showReleaseModal = canUpgrade"
- >
- <heroicons-outline:volume-up v-if="canUpgrade" class="h-4 w-4" />
- {{ version }}
- <span v-if="canUpgrade" class="tooltip whitespace-nowrap">
- {{ $t("settings.release.new-version-available") }}
- </span>
- <span v-else-if="gitCommit" class="tooltip">
- Git hash {{ gitCommit }}
- </span>
- </div>
- </div>
- </div>
- </aside>
<div
- class="flex flex-col min-w-0 flex-1 border-l border-r border-block-border"
+ class="flex flex-col min-w-0 flex-1"
+ :class="pageMode !== 'STANDALONE' && 'border-x border-block-border'"
data-label="bb-main-body-wrapper"
>
- <nav
- class="bg-white border-b border-block-border"
- data-label="bb-dashboard-header"
- >
- <div class="max-w-full mx-auto">
- <DashboardHeader />
- </div>
- </nav>
-
- <!-- Static sidebar for mobile -->
- <aside class="md:hidden">
- <div
- class="flex items-center justify-start bg-gray-50 border-b border-block-border px-4"
+ <HideInStandaloneMode>
+ <nav
+ class="bg-white border-b border-block-border"
+ data-label="bb-dashboard-header"
>
- <div>
- <button
- type="button"
- class="-mr-3 h-8 w-8 inline-flex items-center justify-center rounded-md text-gray-500 hover:text-gray-900"
- @click.prevent="state.showMobileOverlay = true"
- >
- <span class="sr-only">Open sidebar</span>
- <!-- Heroicon name: menu -->
- <heroicons-outline:menu class="h-4 w-4" />
- </button>
+ <div class="max-w-full mx-auto">
+ <DashboardHeader />
</div>
- <div v-if="showBreadcrumb" class="ml-4">
- <Breadcrumb />
- </div>
- </div>
- </aside>
+ </nav>
- <div class="w-full mx-auto md:flex">
- <div class="md:min-w-0 md:flex-1">
- <div v-if="showBreadcrumb" class="hidden md:block px-4 pt-4">
- <Breadcrumb />
- </div>
+ <!-- Static sidebar for mobile -->
+ <aside class="md:hidden">
<div
- class="w-full flex flex-row justify-between items-center flex-wrap px-2 gap-x-4"
+ class="flex items-center justify-start bg-gray-50 border-b border-block-border px-4"
>
- <div v-if="quickActionList.length > 0" class="flex-1 pt-3 pb-2">
- <QuickActionPanel :quick-action-list="quickActionList" />
+ <div>
+ <button
+ type="button"
+ class="-mr-3 h-8 w-8 inline-flex items-center justify-center rounded-md text-gray-500 hover:text-gray-900"
+ @click.prevent="state.showMobileOverlay = true"
+ >
+ <span class="sr-only">Open sidebar</span>
+ <!-- Heroicon name: menu -->
+ <heroicons-outline:menu class="h-4 w-4" />
+ </button>
+ </div>
+ <div v-if="showBreadcrumb" class="ml-4">
+ <Breadcrumb />
+ </div>
+ </div>
+ </aside>
+
+ <div class="w-full mx-auto md:flex">
+ <div class="md:min-w-0 md:flex-1">
+ <div v-if="showBreadcrumb" class="hidden md:block px-4 pt-4">
+ <Breadcrumb />
</div>
<div
- v-if="route.name === 'workspace.home'"
- class="hidden md:flex"
+ class="w-full flex flex-row justify-between items-center flex-wrap px-2 gap-x-4"
>
- <a
- href="/sql-editor"
- target="_blank"
- class="btn-normal items-center !px-4 !text-base"
+ <div v-if="quickActionList.length > 0" class="flex-1 pt-3 pb-2">
+ <QuickActionPanel :quick-action-list="quickActionList" />
+ </div>
+ <div
+ v-if="route.name === 'workspace.home'"
+ class="hidden md:flex"
>
- <heroicons-outline:terminal
- class="text-accent w-6 h-6 mr-2"
- />
- <span class="whitespace-nowrap">{{
- $t("sql-editor.self")
- }}</span>
- </a>
+ <a
+ href="/sql-editor"
+ target="_blank"
+ class="btn-normal items-center !px-4 !text-base"
+ >
+ <heroicons-outline:terminal
+ class="text-accent w-6 h-6 mr-2"
+ />
+ <span class="whitespace-nowrap">{{
+ $t("sql-editor.self")
+ }}</span>
+ </a>
+ </div>
</div>
</div>
</div>
- </div>
+ </HideInStandaloneMode>
<!-- This area may scroll -->
<div
id="bb-layout-main"
class="md:min-w-0 md:flex-1 overflow-y-auto"
- :class="showBreadcrumb && quickActionList.length == 0 ? 'mt-2' : ''"
+ :class="
+ pageMode !== 'STANDALONE' &&
+ showBreadcrumb &&
+ quickActionList.length == 0
+ ? 'mt-2'
+ : ''
+ "
>
<!-- Start main area-->
<router-view name="content" />
@@ -230,7 +247,7 @@
</div>
</div>
- <Quickstart />
+ <Quickstart v-if="pageMode !== 'STANDALONE'" />
</div>
<TrialModal
@@ -247,6 +264,7 @@
import { storeToRefs } from "pinia";
import { computed, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
+import HideInStandaloneMode from "@/components/misc/HideInStandaloneMode.vue";
import {
useActuatorV1Store,
useCurrentUserV1,
@@ -283,7 +301,7 @@ const hasPermission = hasWorkspacePermissionV1(
useCurrentUserV1().value.userRole
);
-const { isDemo } = storeToRefs(actuatorStore);
+const { pageMode, isDemo } = storeToRefs(actuatorStore);
actuatorStore.tryToRemindRelease().then((openRemindModal) => {
state.showReleaseModal = openRemindModal;
diff --git a/frontend/src/layouts/ProjectLayout.vue b/frontend/src/layouts/ProjectLayout.vue
index 3a79d17a9e..85aa9e19c6 100644
--- a/frontend/src/layouts/ProjectLayout.vue
+++ b/frontend/src/layouts/ProjectLayout.vue
@@ -1,32 +1,34 @@
<template>
<ArchiveBanner v-if="project.state === State.DELETED" class="py-2" />
- <h1 class="px-4 py-2 text-xl font-bold leading-6 text-main truncate">
- <template v-if="isDefaultProject">
- {{ $t("database.unassigned-databases") }}
- </template>
- <template v-else>
- {{ project.title }}
- </template>
- <span
- v-if="isTenantProject"
- class="text-sm font-normal px-2 ml-2 rounded whitespace-nowrap inline-flex items-center bg-gray-200"
- >
- {{ $t("project.mode.batch") }}
- </span>
- </h1>
- <BBAttention
- v-if="isDefaultProject"
- class="mx-6 mb-4"
- :style="'INFO'"
- :title="$t('project.overview.info-slot-content')"
- />
- <BBTabFilter
- class="px-3 pb-2 border-b border-block-border"
- :responsive="false"
- :tab-item-list="tabItemList"
- :selected-index="state.selectedIndex"
- @select-index="selectTab"
- />
+ <HideInStandaloneMode>
+ <h1 class="px-4 py-2 text-xl font-bold leading-6 text-main truncate">
+ <template v-if="isDefaultProject">
+ {{ $t("database.unassigned-databases") }}
+ </template>
+ <template v-else>
+ {{ project.title }}
+ </template>
+ <span
+ v-if="isTenantProject"
+ class="text-sm font-normal px-2 ml-2 rounded whitespace-nowrap inline-flex items-center bg-gray-200"
+ >
+ {{ $t("project.mode.batch") }}
+ </span>
+ </h1>
+ <BBAttention
+ v-if="isDefaultProject"
+ class="mx-6 mb-4"
+ :style="'INFO'"
+ :title="$t('project.overview.info-slot-content')"
+ />
+ <BBTabFilter
+ class="px-3 pb-2 border-b border-block-border"
+ :responsive="false"
+ :tab-item-list="tabItemList"
+ :selected-index="state.selectedIndex"
+ @select-index="selectTab"
+ />
+ </HideInStandaloneMode>
<div class="py-4 px-6">
<router-view
@@ -44,6 +46,7 @@ import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { BBTabFilterItem } from "@/bbkit/types";
import ArchiveBanner from "@/components/ArchiveBanner.vue";
+import HideInStandaloneMode from "@/components/misc/HideInStandaloneMode.vue";
import {
useCurrentUserIamPolicy,
useCurrentUserV1,