Skip to content

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

feat(sql-editor): alter schema opens new window (#2837)

Liu Ji8b668ffa7be0
diff --git a/frontend/src/views/sql-editor/AsidePanel/DatabaseTree.vue b/frontend/src/views/sql-editor/AsidePanel/DatabaseTree.vue
index 55e1dfa30c..ef3d39740a 100644
--- a/frontend/src/views/sql-editor/AsidePanel/DatabaseTree.vue
+++ b/frontend/src/views/sql-editor/AsidePanel/DatabaseTree.vue
@@ -47,7 +47,7 @@ import { escape } from "lodash-es";
import { DropdownOption } from "naive-ui";
import { ref, computed, h, nextTick, onMounted, watch } from "vue";
import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
+import { stringify } from "qs";
import { ConnectionAtom, UNKNOWN_ID } from "@/types";
import {
@@ -75,7 +75,6 @@ type DropdownOptionWithConnectionAtom = DropdownOption & {
const { t } = useI18n();
-const router = useRouter();
const instanceStore = useInstanceStore();
const databaseStore = useDatabaseStore();
const sqlEditorStore = useSQLEditorStore();
@@ -212,19 +211,15 @@ const gotoAlterSchema = (option: ConnectionAtom) => {
return;
}
- router.push({
- name: "workspace.issue.detail",
- params: {
- issueSlug: "new",
- },
- query: {
- template: "bb.issue.database.schema.update",
- name: `[${database.name}] Alter schema`,
- project: database.project.id,
- databaseList: databaseId,
- sql: `ALTER TABLE ${option.label}`,
- },
- });
+ const query = {
+ template: "bb.issue.database.schema.update",
+ name: `[${database.name}] Alter schema`,
+ project: database.project.id,
+ databaseList: databaseId,
+ sql: `ALTER TABLE ${option.label}`,
+ };
+ const url = `/issue/new?${stringify(query)}`;
+ window.open(url, "_blank");
};
const handleSelect = (key: string) => {
diff --git a/frontend/src/views/sql-editor/AsidePanel/TableSchema.vue b/frontend/src/views/sql-editor/AsidePanel/TableSchema.vue
index 48ad2dbd8f..46cd4310e7 100644
--- a/frontend/src/views/sql-editor/AsidePanel/TableSchema.vue
+++ b/frontend/src/views/sql-editor/AsidePanel/TableSchema.vue
@@ -65,7 +65,7 @@
<script lang="ts" setup>
import { ref, watch } from "vue";
-import { useRouter } from "vue-router";
+import { stringify } from "qs";
import { Database } from "@/types";
import { useSQLEditorStore, useTableStore } from "@/store";
@@ -78,7 +78,6 @@ const tableStore = useTableStore();
const sqlEditorStore = useSQLEditorStore();
const tableInfo = ref();
-const router = useRouter();
const gotoAlterSchema = () => {
// TODO(Jim): Remove the dependency of `sqlEditorStore.connectionContext.option`
@@ -96,19 +95,15 @@ const gotoAlterSchema = () => {
const databaseName = databaseList.find(
(database: Database) => database.id === databaseId
).name;
- router.push({
- name: "workspace.issue.detail",
- params: {
- issueSlug: "new",
- },
- query: {
- template: "bb.issue.database.schema.update",
- name: `[${databaseName}] Alter schema`,
- project: projectId,
- databaseList: databaseId,
- sql: `ALTER TABLE ${tableName}`,
- },
- });
+ const query = {
+ template: "bb.issue.database.schema.update",
+ name: `[${databaseName}] Alter schema`,
+ project: projectId,
+ databaseList: databaseId,
+ sql: `ALTER TABLE ${tableName}`,
+ };
+ const url = `/issue/new?${stringify(query)}`;
+ window.open(url, "_blank");
};
const handleClosePane = () => {