Skip to content

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

fix: sql editor sidebar (#21048)

ecmadao7846373c546e
diff --git a/backend/server/echo_routes.go b/backend/server/echo_routes.go
index 663c54feda..8d10ae8ee8 100644
--- a/backend/server/echo_routes.go
+++ b/backend/server/echo_routes.go
@@ -63,6 +63,41 @@ func configureEchoRouters(
registerPprof(e, &profile.RuntimeDebug)
+ registerMetricsRoute(e, profile)
+
+ e.GET("/healthz", func(c *echo.Context) error {
+ return c.String(http.StatusOK, "OK")
+ })
+
+ // LSP server.
+ e.GET(lspAPI, lspServer.Router)
+
+ hookGroup := e.Group(webhookAPIPrefix)
+ scimGroup := hookGroup.Group(scimAPIPrefix)
+ directorySyncServer.RegisterDirectorySyncRoutes(scimGroup)
+
+ // Stripe (SaaS only, requires both API key and webhook secret).
+ if profile.SaaS && profile.StripeAPISecret != "" && profile.StripeWebhookSecret != "" {
+ stripeplugin.Init(profile.StripeAPISecret)
+ stripeGroup := hookGroup.Group("/stripe")
+ stripeWebhookHandler.RegisterRoutes(stripeGroup)
+ }
+
+ // OAuth2 server.
+ oauth2Service.RegisterRoutes(e)
+
+ // MCP server.
+ mcpServer.RegisterRoutes(e)
+
+ // Embed frontend (must be last to serve as fallback for SPA routes).
+ embedFrontend(e)
+}
+
+func registerMetricsRoute(e *echo.Echo, profile *config.Profile) {
+ if profile.SaaS {
+ return
+ }
+
// Prometheus metrics - use custom registry to avoid duplicate registration in tests
registry := prometheus.NewRegistry()
e.Use(echoprometheus.NewMiddlewareWithConfig(echoprometheus.MiddlewareConfig{
@@ -93,33 +128,6 @@ func configureEchoRouters(
promhttp.HandlerOpts{},
),
)))
-
- e.GET("/healthz", func(c *echo.Context) error {
- return c.String(http.StatusOK, "OK")
- })
-
- // LSP server.
- e.GET(lspAPI, lspServer.Router)
-
- hookGroup := e.Group(webhookAPIPrefix)
- scimGroup := hookGroup.Group(scimAPIPrefix)
- directorySyncServer.RegisterDirectorySyncRoutes(scimGroup)
-
- // Stripe (SaaS only, requires both API key and webhook secret).
- if profile.SaaS && profile.StripeAPISecret != "" && profile.StripeWebhookSecret != "" {
- stripeplugin.Init(profile.StripeAPISecret)
- stripeGroup := hookGroup.Group("/stripe")
- stripeWebhookHandler.RegisterRoutes(stripeGroup)
- }
-
- // OAuth2 server.
- oauth2Service.RegisterRoutes(e)
-
- // MCP server.
- mcpServer.RegisterRoutes(e)
-
- // Embed frontend (must be last to serve as fallback for SPA routes).
- embedFrontend(e)
}
func recoverMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
diff --git a/backend/server/echo_routes_test.go b/backend/server/echo_routes_test.go
index d6a48242e1..5cde7b2df4 100644
--- a/backend/server/echo_routes_test.go
+++ b/backend/server/echo_routes_test.go
@@ -7,6 +7,8 @@ import (
"testing"
"github.com/labstack/echo/v5"
+
+ "github.com/bytebase/bytebase/backend/component/config"
)
func TestSecurityHeadersMiddleware_GA4Sources(t *testing.T) {
@@ -69,6 +71,40 @@ func TestSecurityHeadersMiddleware_SaaSAllowsPostHogHosts(t *testing.T) {
}
}
+func TestMetricsRouteDisabledInSaaS(t *testing.T) {
+ tests := []struct {
+ name string
+ saas bool
+ wantStatus int
+ }{
+ {
+ name: "self-host exposes metrics",
+ saas: false,
+ wantStatus: http.StatusOK,
+ },
+ {
+ name: "SaaS does not expose metrics",
+ saas: true,
+ wantStatus: http.StatusNotFound,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ e := echo.New()
+ registerMetricsRoute(e, &config.Profile{SaaS: tt.saas})
+
+ req := httptest.NewRequest(http.MethodGet, "/metrics", nil)
+ rec := httptest.NewRecorder()
+ e.ServeHTTP(rec, req)
+
+ if rec.Code != tt.wantStatus {
+ t.Fatalf("GET /metrics status = %d, want %d", rec.Code, tt.wantStatus)
+ }
+ })
+ }
+}
+
func cspDirective(csp string, directive string) string {
for _, source := range strings.Split(csp, ";") {
source = strings.TrimSpace(source)
diff --git a/frontend/src/components/WorkspaceSetupGuide.test.tsx b/frontend/src/components/WorkspaceSetupGuide.test.tsx
index bddacdd783..0a14ea7d6a 100644
--- a/frontend/src/components/WorkspaceSetupGuide.test.tsx
+++ b/frontend/src/components/WorkspaceSetupGuide.test.tsx
@@ -925,7 +925,7 @@ describe("WorkspaceSetupGuide", () => {
).toContain("workspace-setup-guide.actions.query");
});
- it("checks first query before a project database exists", async () => {
+ it("skips first query check before a project database exists", async () => {
mocks.fetchProjectList.mockResolvedValue({
projects: [{ name: "projects/project-a" }],
nextPageToken: "",
@@ -940,12 +940,7 @@ describe("WorkspaceSetupGuide", () => {
});
await render(<WorkspaceSetupGuide />);
- expect(mocks.searchQueryHistories).toHaveBeenCalledWith(
- expect.objectContaining({
- pageSize: 1,
- filter: 'type == "QUERY"',
- })
- );
+ expect(mocks.searchQueryHistories).not.toHaveBeenCalled();
expect(container.querySelector("[data-testid='active-action']")).toBeNull();
});
diff --git a/frontend/src/components/WorkspaceSetupGuide.tsx b/frontend/src/components/WorkspaceSetupGuide.tsx
index bda5aee992..8ee9dc5fb7 100644
--- a/frontend/src/components/WorkspaceSetupGuide.tsx
+++ b/frontend/src/components/WorkspaceSetupGuide.tsx
@@ -185,17 +185,19 @@ export function WorkspaceSetupGuide() {
}
}
- try {
- const queryHistoryResult =
- await sqlServiceClientConnect.searchQueryHistories(
- create(SearchQueryHistoriesRequestSchema, {
- pageSize: 1,
- filter: 'type == "QUERY"',
- })
- );
- hasFirstQuery = queryHistoryResult.queryHistories.length > 0;
- } catch {
- hasFirstQuery = false;
+ if (databaseName) {
+ try {
+ const queryHistoryResult =
+ await sqlServiceClientConnect.searchQueryHistories(
+ create(SearchQueryHistoriesRequestSchema, {
+ pageSize: 1,
+ filter: 'type == "QUERY"',
+ })
+ );
+ hasFirstQuery = queryHistoryResult.queryHistories.length > 0;
+ } catch {
+ hasFirstQuery = false;
+ }
}
setSetupState({
diff --git a/frontend/src/modules/sql-editor/components/GutterBar.test.tsx b/frontend/src/modules/sql-editor/components/GutterBar.test.tsx
index 6a24cb0228..3e687e08c7 100644
--- a/frontend/src/modules/sql-editor/components/GutterBar.test.tsx
+++ b/frontend/src/modules/sql-editor/components/GutterBar.test.tsx
@@ -124,6 +124,17 @@ describe("GutterBar", () => {
unmount();
});
+ test("falls back from ACCESS when the project does not allow JIT access", () => {
+ mocks.projectData = { allowJustInTimeAccess: false };
+ mocks.state.asidePanelTab = "ACCESS";
+
+ const { render, unmount } = renderIntoContainer(<GutterBar />);
+ render();
+
+ expect(mocks.setAsidePanelTab).toHaveBeenCalledWith("WORKSHEET");
+ unmount();
+ });
+
test("does not render the Bytebase logo", () => {
mocks.projectData = { allowJustInTimeAccess: false };
const { container, render, unmount } = renderIntoContainer(<GutterBar />);
diff --git a/frontend/src/modules/sql-editor/components/GutterBar.tsx b/frontend/src/modules/sql-editor/components/GutterBar.tsx
index 6b556d3dba..ce2c3eb843 100644
--- a/frontend/src/modules/sql-editor/components/GutterBar.tsx
+++ b/frontend/src/modules/sql-editor/components/GutterBar.tsx
@@ -1,3 +1,4 @@
+import { useEffect } from "react";
import { useAppProject } from "@/hooks/useAppProject";
import type { AsidePanelTab } from "@/modules/sql-editor/store";
import { useSQLEditorStore } from "@/modules/sql-editor/store";
@@ -12,12 +13,19 @@ import { TabItem } from "./TabItem";
* Replaces frontend/src/views/sql-editor/AsidePanel/GutterBar/GutterBar.vue.
*/
export function GutterBar() {
+ const asidePanelTab = useSQLEditorStore((s) => s.asidePanelTab);
const setAsidePanelTab = useSQLEditorStore((s) => s.setAsidePanelTab);
const projectName = useSQLEditorEditorState((s) => s.project);
const resolvedProject = useAppProject(projectName);
const project = projectName ? resolvedProject : undefined;
+ useEffect(() => {
+ if (asidePanelTab === "ACCESS" && !project?.allowJustInTimeAccess) {
+ setAsidePanelTab("WORKSHEET");
+ }
+ }, [asidePanelTab, project?.allowJustInTimeAccess, setAsidePanelTab]);
+
const handleClickTab = (target: AsidePanelTab) => {
setAsidePanelTab(target);
};
diff --git a/frontend/src/modules/sql-editor/components/SQLEditorRouteShell.test.tsx b/frontend/src/modules/sql-editor/components/SQLEditorRouteShell.test.tsx
index b4dee4cebe..793f820d60 100644
--- a/frontend/src/modules/sql-editor/components/SQLEditorRouteShell.test.tsx
+++ b/frontend/src/modules/sql-editor/components/SQLEditorRouteShell.test.tsx
@@ -2,6 +2,7 @@ import { act } from "react";
import { createRoot } from "react-dom/client";
import { beforeEach, describe, expect, test, vi } from "vitest";
import type { ReactRoute } from "@/app/router";
+import { sqlEditorEvents } from "@/modules/sql-editor/model/events";
import type { SQLEditorTab } from "@/types";
import { SQLEditorRouteShell } from "./SQLEditorRouteShell";
@@ -200,6 +201,7 @@ const renderShell = () => {
beforeEach(() => {
vi.clearAllMocks();
+ localStorage.clear();
mocks.maybeSwitchProject.mockImplementation(
async (project: string) => project
);
@@ -437,6 +439,26 @@ describe("SQLEditorRouteShell", () => {
unmount();
});
+ test("restores the sidebar tab from project-scoped localStorage", async () => {
+ localStorage.setItem(
+ "bb.sql-editor.sidebar.last-visited-tab.projects/proj1",
+ JSON.stringify("SCHEMA")
+ );
+
+ const { unmount } = renderShell();
+
+ await act(async () => {
+ await sqlEditorEvents.emit("project-context-ready", {
+ project: "projects/proj1",
+ });
+ await new Promise((resolve) => requestAnimationFrame(resolve));
+ });
+
+ expect(mocks.setAsidePanelTab).toHaveBeenCalledWith("SCHEMA");
+
+ unmount();
+ });
+
test("updates a stale database URL when the active tab is disconnected", async () => {
mocks.tabsState.tabsById.set("tab-blank", {
id: "tab-blank",
diff --git a/frontend/src/modules/sql-editor/components/SQLEditorRouteShell.tsx b/frontend/src/modules/sql-editor/components/SQLEditorRouteShell.tsx
index 0d873a0067..309ba8c220 100644
--- a/frontend/src/modules/sql-editor/components/SQLEditorRouteShell.tsx
+++ b/frontend/src/modules/sql-editor/components/SQLEditorRouteShell.tsx
@@ -48,7 +48,7 @@ import {
getDefaultPagination,
getSheetStatement,
isWorksheetReadableV1,
- STORAGE_KEY_SQL_EDITOR_SIDEBAR_TAB,
+ storageKeySqlEditorSidebarTab,
} from "@/utils";
import { SQLEditorHomePage } from "./SQLEditorHomePage";
@@ -568,7 +568,7 @@ export function SQLEditorRouteShell() {
"project-context-ready",
({ data: { project } }) => {
if (!project) return;
- requestAnimationFrame(() => restoreLastVisitedSidebarTab());
+ requestAnimationFrame(() => restoreLastVisitedSidebarTab(project));
}
);
return () => {
@@ -576,20 +576,20 @@ export function SQLEditorRouteShell() {
};
}, []);
- const sidebarRestoredRef = useRef(false);
- const restoreLastVisitedSidebarTab = () => {
+ const sidebarRestoredProjectRef = useRef("");
+ const restoreLastVisitedSidebarTab = (project: string) => {
// A query-history deep link forces the HISTORY panel open, ahead of the
// `?panel=` override and the localStorage default.
if (useSQLEditorStore.getState().linkedQueryHistory) {
setAsidePanelTab("HISTORY");
- sidebarRestoredRef.current = true;
+ sidebarRestoredProjectRef.current = project;
return;
}
let stored: AsidePanelTab = "WORKSHEET";
try {
const raw = window.localStorage.getItem(
- STORAGE_KEY_SQL_EDITOR_SIDEBAR_TAB
+ storageKeySqlEditorSidebarTab(project)
);
if (raw) {
const parsed = JSON.parse(raw);
@@ -611,16 +611,16 @@ export function SQLEditorRouteShell() {
} else {
setAsidePanelTab(stored);
}
- sidebarRestoredRef.current = true;
+ sidebarRestoredProjectRef.current = project;
};
// Persist sidebar tab changes back to localStorage (debounced).
const asidePanelTab = useSQLEditorStore((s) => s.asidePanelTab);
const persistSidebarRef = useRef(
- debounce((tab: AsidePanelTab) => {
+ debounce((project: string, tab: AsidePanelTab) => {
try {
window.localStorage.setItem(
- STORAGE_KEY_SQL_EDITOR_SIDEBAR_TAB,
+ storageKeySqlEditorSidebarTab(project),
JSON.stringify(tab)
);
} catch {
@@ -629,9 +629,10 @@ export function SQLEditorRouteShell() {
}, 100)
);
useEffect(() => {
- if (!sidebarRestoredRef.current) return;
- persistSidebarRef.current(asidePanelTab);
- }, [asidePanelTab]);
+ if (!isValidProjectName(projectNameState)) return;
+ if (sidebarRestoredProjectRef.current !== projectNameState) return;
+ persistSidebarRef.current(projectNameState, asidePanelTab);
+ }, [asidePanelTab, projectNameState]);
// ---- unsaved-tabs guard -----------------------------------------------
diff --git a/frontend/src/routes/project/ProjectDatabasesPage.test.tsx b/frontend/src/routes/project/ProjectDatabasesPage.test.tsx
index e15a4fe422..6b5d08136f 100644
--- a/frontend/src/routes/project/ProjectDatabasesPage.test.tsx
+++ b/frontend/src/routes/project/ProjectDatabasesPage.test.tsx
@@ -62,6 +62,10 @@ vi.mock("@/app/router", () => ({
},
},
},
+ useCurrentRoute: () => ({
+ name: mocks.routerCurrentName,
+ query: mocks.routerCurrentQuery,
+ }),
}));
vi.mock("@/app/analytics/provider", () => ({
@@ -419,6 +423,35 @@ describe("ProjectDatabasesPage", () => {
});
});
+ test("updates syncing guidance when the syncing instance query changes", async () => {
+ mocks.instancesByName = {
+ "instances/prod": { name: "instances/prod", title: "Prod Instance" },
+ };
+ const container = document.createElement("div");
+ const root = createRoot(container);
+
+ await act(async () => {
+ root.render(<ProjectDatabasesPage projectId="demo" />);
+ });
+
+ expect(container.textContent).not.toContain(
+ "db.project-instance-syncing-title"
+ );
+
+ mocks.routerCurrentQuery = { syncingInstance: "prod" };
+ await act(async () => {
+ root.render(<ProjectDatabasesPage projectId="demo" />);
+ });
+
+ expect(container.textContent).toContain(
+ "db.project-instance-syncing-titleProd Instance"
+ );
+
+ act(() => {
+ root.unmount();
+ });
+ });
+
test("falls back to create database after redirected instance sync finds no databases", async () => {
vi.useFakeTimers();
mocks.routerCurrentQuery = { syncingInstance: "prod" };
@@ -519,6 +552,10 @@ describe("ProjectDatabasesPage", () => {
) as HTMLButtonElement;
expect(sqlEditorButton.className).toContain("bg-accent");
expect(nextActionButton.className).toContain("border-control-border");
+ expect(
+ sqlEditorButton.compareDocumentPosition(nextActionButton) &
+ Node.DOCUMENT_POSITION_FOLLOWING
+ ).toBeTruthy();
await act(async () => {
sqlEditorButton.click();
});
diff --git a/frontend/src/routes/project/ProjectDatabasesPage.tsx b/frontend/src/routes/project/ProjectDatabasesPage.tsx
index 740831b5a9..f9714de74f 100644
--- a/frontend/src/routes/project/ProjectDatabasesPage.tsx
+++ b/frontend/src/routes/project/ProjectDatabasesPage.tsx
@@ -5,7 +5,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
import { createBehaviorMetric } from "@/app/analytics/behavior";
import { behaviorAnalytics } from "@/app/analytics/provider";
-import { router } from "@/app/router";
+import { router, useCurrentRoute } from "@/app/router";
import {
INSTANCE_ROUTE_CREATE,
SQL_EDITOR_DATABASE_MODULE,
@@ -83,6 +83,7 @@ import {
export function ProjectDatabasesPage({ projectId }: { projectId: string }) {
const { t } = useTranslation();
+ const currentRoute = useCurrentRoute();
const removeDatabaseMetadataCache = useAppStore(
(s) => s.removeDatabaseMetadataCache
);
@@ -239,11 +240,11 @@ export function ProjectDatabasesPage({ projectId }: { projectId: string }) {
const [selectedNames, setSelectedNames] = useState<Set<string>>(new Set());
const [visibleDatabases, setVisibleDatabases] = useState<Database[]>([]);
const syncingInstanceId = useMemo(() => {
- const { syncingInstance } = router.currentRoute.value.query;
+ const { syncingInstance } = currentRoute.query;
return typeof syncingInstance === "string" && syncingInstance
? syncingInstance
: undefined;
- }, []);
+ }, [currentRoute.query]);
const syncingInstanceName = syncingInstanceId
? `${instanceNamePrefix}${syncingInstanceId}`
: undefined;
@@ -673,27 +674,27 @@ export function ProjectDatabasesPage({ projectId }: { projectId: string }) {
<span>{t("db.project-instance-synced-description")}</span>
<div className="ml-auto flex flex-wrap items-center gap-x-2 gap-y-2">
<PermissionGuard
- permissions={PERMISSIONS_FOR_DATABASE_CREATE_ISSUE}
+ permissions={["bb.sql.select"]}
project={project}
>
<Button
size="sm"
- appearance="outline"
- onClick={handleCreateFirstChange}
+ onClick={handleOpenFirstDatabaseInSQLEditor}
>
- {t("db.project-instance-synced-action")}
+ <SquareTerminal className="size-4" />
+ {t("db.project-instance-synced-sql-editor-action")}
</Button>
</PermissionGuard>
<PermissionGuard
- permissions={["bb.sql.select"]}
+ permissions={PERMISSIONS_FOR_DATABASE_CREATE_ISSUE}
project={project}
>
<Button
size="sm"
- onClick={handleOpenFirstDatabaseInSQLEditor}
+ appearance="outline"
+ onClick={handleCreateFirstChange}
>
- <SquareTerminal className="size-4" />
- {t("db.project-instance-synced-sql-editor-action")}
+ {t("db.project-instance-synced-action")}
</Button>
</PermissionGuard>
</div>
diff --git a/frontend/src/routes/workspace/MembersPage.tsx b/frontend/src/routes/workspace/MembersPage.tsx
index 31f662b515..aea28d39b9 100644
--- a/frontend/src/routes/workspace/MembersPage.tsx
+++ b/frontend/src/routes/workspace/MembersPage.tsx
@@ -2253,7 +2253,6 @@ export function MembersPage({ projectId }: { projectId?: string }) {
{!projectName && remainingUserCount <= 3 && (
<Alert
variant="warning"
- className="mb-2"
title={t("subscription.usage.user-count.title")}
description={
<>
@@ -2272,7 +2271,6 @@ export function MembersPage({ projectId }: { projectId?: string }) {
)}
{projectName && (
<ProjectPageInfo
- className="mb-2"
description={
<>
{t("project.members.description")}{" "}
diff --git a/frontend/src/routes/workspace/UsersPage.tsx b/frontend/src/routes/workspace/UsersPage.tsx
index 1f19748508..c915aca672 100644
--- a/frontend/src/routes/workspace/UsersPage.tsx
+++ b/frontend/src/routes/workspace/UsersPage.tsx
@@ -618,11 +618,7 @@ function UserForm({
}, [email, isEditMode, enforceIdentityDomain, workspaceDomains]);
const isFormValid =
- email.length > 0 &&
- emailDomainValid &&
- !passwordHint &&
- !passwordMismatch &&
- (isEditMode || password.length > 0);
+ email.length > 0 && emailDomainValid && !passwordHint && !passwordMismatch;
// Dirty tracking — in edit mode the Update button is disabled unless
// something actually changed. Create mode is always "dirty".
@@ -667,6 +663,7 @@ function UserForm({
};
const handleCreate = async () => {
+ // Empty password is valid on create; backend will generate a random password.
const createdUser = await createUser({
...create(UserSchema, {}),
title: title || extractUserTitle(email),
@@ -808,7 +805,6 @@ function UserForm({
<FormField>
<FormTitle id="user-form-password-title">
{t("settings.profile.password")}
- <span className="ml-0.5 text-error">*</span>
</FormTitle>
<span
className={`flex items-center gap-x-1 text-sm text-control-placeholder ${
@@ -835,7 +831,7 @@ function UserForm({
<CircleAlert className="w-4 cursor-help" />
</Tooltip>
</span>
- <div className="relative mt-1 flex w-full items-center">
+ <div className="relative flex w-full items-center">
<Input
id="user-form-password"
aria-labelledby="user-form-password-title"
@@ -864,9 +860,8 @@ function UserForm({
<FormField>
<FormTitle id="user-form-password-confirm-title">
{t("settings.profile.password-confirm")}
- <span className="ml-0.5 text-error">*</span>
</FormTitle>
- <div className="relative mt-1 flex w-full items-center">
+ <div className="relative flex w-full items-center">
<Input
id="user-form-password-confirm"
aria-labelledby="user-form-password-confirm-title"
diff --git a/frontend/src/routes/workspace/UsersPageLayout.test.ts b/frontend/src/routes/workspace/UsersPageLayout.test.ts
index 5a2241c9e3..f4aa4f96a4 100644
--- a/frontend/src/routes/workspace/UsersPageLayout.test.ts
+++ b/frontend/src/routes/workspace/UsersPageLayout.test.ts
@@ -20,7 +20,7 @@ describe("UsersPage drawer layout", () => {
);
const hintErrorIndex = source.indexOf('passwordHint ? "text-error" : ""');
const passwordInputIndex = source.indexOf(
- 'className="relative mt-1 flex w-full items-center"'
+ 'className="relative flex w-full items-center"'
);
expect(passwordTitleIndex).toBeGreaterThan(-1);
@@ -40,4 +40,12 @@ describe("UsersPage drawer layout", () => {
expect(source).not.toContain("textlabel");
expect(source).not.toContain("textinfolabel");
});
+
+ test("does not require password when creating a user", () => {
+ const source = readFileSync(join(sectionDir, "UsersPage.tsx"), "utf8");
+
+ expect(source).not.toContain("(isEditMode || password.length > 0)");
+ expect(source).toContain("password,");
+ expect(source).toContain("backend will generate a random password");
+ });
});
diff --git a/frontend/src/utils/storage-keys.ts b/frontend/src/utils/storage-keys.ts
index 6dc6182c4d..7544ae77e4 100644
--- a/frontend/src/utils/storage-keys.ts
+++ b/frontend/src/utils/storage-keys.ts
@@ -33,6 +33,8 @@ export const STORAGE_KEY_SQL_EDITOR_AI_PANEL_SIZE =
"bb.sql-editor.ai-panel-size";
export const STORAGE_KEY_SQL_EDITOR_SIDEBAR_TAB =
"bb.sql-editor.sidebar.last-visited-tab";
+export const storageKeySqlEditorSidebarTab = (project: string) =>
+ `${STORAGE_KEY_SQL_EDITOR_SIDEBAR_TAB}.${project}`;
export const STORAGE_KEY_SQL_EDITOR_CODE_VIEWER_FORMAT =
"bb.sql-editor.editor-panel.code-viewer.format";
export const STORAGE_KEY_SQL_EDITOR_DETAIL_FORMAT =