Skip to content

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

chore: minor fixes (#13768)

Liu Ji05834b5f83ba
diff --git a/frontend/src/components/GeneralSetting/DatabaseChangeModeSetting.vue b/frontend/src/components/GeneralSetting/DatabaseChangeModeSetting.vue
index 6bc773e27f..dbf51bd70b 100644
--- a/frontend/src/components/GeneralSetting/DatabaseChangeModeSetting.vue
+++ b/frontend/src/components/GeneralSetting/DatabaseChangeModeSetting.vue
@@ -143,7 +143,10 @@ const save = async () => {
style: "SUCCESS",
title: t("settings.general.workspace.config-updated"),
});
- if (state.databaseChangeMode === DatabaseChangeMode.EDITOR) {
+ if (
+ state.databaseChangeMode === DatabaseChangeMode.EDITOR &&
+ !router.currentRoute.value.name?.toString().startsWith("sql-editor")
+ ) {
state.showModal = true;
}
};
diff --git a/frontend/src/components/ProvideSQLEditorContext.vue b/frontend/src/components/ProvideSQLEditorContext.vue
index f092641b60..70e4ed9274 100644
--- a/frontend/src/components/ProvideSQLEditorContext.vue
+++ b/frontend/src/components/ProvideSQLEditorContext.vue
@@ -114,24 +114,24 @@ const initializeProjects = async () => {
const projectInQuery = route.query.project as string;
const projectInParams = route.params.project as string;
+ let initializeSuccess = false;
if (typeof projectInQuery === "string" && projectInQuery) {
// Legacy "?project={project}"
const project = `projects/${projectInQuery}`;
editorStore.strictProject = true;
- await initProject(project);
+ initializeSuccess = await initProject(project);
} else if (typeof projectInParams === "string" && projectInParams) {
// "/sql-editor/projects/{project}"
const project = `projects/${projectInParams}`;
editorStore.strictProject = "strict" in route.query;
- await initProject(project);
+ initializeSuccess = await initProject(project);
} else {
// plain "/sql-editor"
-
if (hideProjects.value) {
// Direct to Default Project
editorStore.project = DEFAULT_PROJECT_NAME;
editorStore.strictProject = false;
- await initProject(DEFAULT_PROJECT_NAME);
+ initializeSuccess = await initProject(DEFAULT_PROJECT_NAME);
} else {
const { projectList, ready } = useProjectV1List();
await wrapRefAsPromise(ready, true);
@@ -151,14 +151,27 @@ const initializeProjects = async () => {
"";
}
editorStore.strictProject = false;
+ if (editorStore.project) {
+ initializeSuccess = true;
+ } else {
+ initializeSuccess = false;
+ }
}
}
-
- tabStore.maybeInitProject(editorStore.project);
+ if (initializeSuccess) {
+ tabStore.maybeInitProject(editorStore.project);
+ } else {
+ editorStore.project = "";
+ editorStore.storedLastViewedProject = "";
+ }
};
const handleProjectSwitched = async () => {
const { project } = editorStore;
+ if (!project) {
+ editorStore.databaseList = [];
+ return;
+ }
if (project) {
await projectStore.getOrFetchProjectByName(project, true /* silent */);
} else {
diff --git a/frontend/src/views/sql-editor/AsidePanel/AsidePanel.vue b/frontend/src/views/sql-editor/AsidePanel/AsidePanel.vue
index c4b282deec..42abe4a773 100644
--- a/frontend/src/views/sql-editor/AsidePanel/AsidePanel.vue
+++ b/frontend/src/views/sql-editor/AsidePanel/AsidePanel.vue
@@ -17,7 +17,7 @@
class="project-select"
:project-name="projectName"
:include-all="false"
- :include-default-project="true"
+ :include-default-project="allowAccessDefaultProject"
:loading="!projectContextReady"
@update:project-name="handleSwitchProject"
/>
@@ -44,7 +44,8 @@ import {
useSQLEditorStore,
useAppFeature,
} from "@/store";
-import { isValidProjectName } from "@/types";
+import { defaultProject, isValidProjectName } from "@/types";
+import { hasProjectPermissionV2 } from "@/utils";
import { useSQLEditorContext } from "../context";
import GutterBar from "./GutterBar";
import HistoryPane from "./HistoryPane";
@@ -64,6 +65,10 @@ const projectName = computed(() => {
return editorStore.currentProject?.name ?? null;
});
+const allowAccessDefaultProject = computed(() => {
+ return hasProjectPermissionV2(defaultProject(), "bb.projects.get");
+});
+
watch([project, projectContextReady], ([project, ready]) => {
if (!ready) {
treeStore.state = "LOADING";
diff --git a/frontend/src/views/sql-editor/SQLEditorSettingPage.vue b/frontend/src/views/sql-editor/SQLEditorSettingPage.vue
index 78bcfec5f1..bc2594315f 100644
--- a/frontend/src/views/sql-editor/SQLEditorSettingPage.vue
+++ b/frontend/src/views/sql-editor/SQLEditorSettingPage.vue
@@ -32,7 +32,7 @@
</teleport>
</template>
- <div class="flex-1 overflow-y-auto">
+ <div class="flex-1 overflow-y-auto overflow-x-hidden">
<router-view />
</div>
</div>