Skip to content

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

chore: add project id into query (#8487)

boojack8ea28ef2b0bf
diff --git a/frontend/src/components/Branch/BranchCreateView.vue b/frontend/src/components/Branch/BranchCreateView.vue
index 99e268d9d7..c2578f09af 100644
--- a/frontend/src/components/Branch/BranchCreateView.vue
+++ b/frontend/src/components/Branch/BranchCreateView.vue
@@ -62,9 +62,9 @@
<script lang="ts" setup>
import { cloneDeep, uniqueId } from "lodash-es";
import { NButton, NDivider } from "naive-ui";
-import { computed, reactive, ref, watch } from "vue";
+import { computed, onMounted, reactive, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
+import { useRoute, useRouter } from "vue-router";
import SchemaEditorV1 from "@/components/SchemaEditorV1/index.vue";
import {
pushNotification,
@@ -117,6 +117,7 @@ const props = defineProps({
const { t } = useI18n();
const router = useRouter();
+const route = useRoute();
const projectStore = useProjectV1Store();
const databaseStore = useDatabaseV1Store();
const schemaDesignStore = useSchemaDesignStore();
@@ -131,6 +132,12 @@ const state = reactive<LocalState>({
});
const refreshId = ref<string>("");
+onMounted(() => {
+ if (route.query.projectId) {
+ state.projectId = route.query.projectId as string;
+ }
+});
+
watch(
() => [
state.schemaDesign.baselineDatabase,
diff --git a/frontend/src/components/ProjectBranchesPanel.vue b/frontend/src/components/ProjectBranchesPanel.vue
index b631e81e23..7301cb742a 100644
--- a/frontend/src/components/ProjectBranchesPanel.vue
+++ b/frontend/src/components/ProjectBranchesPanel.vue
@@ -1,12 +1,7 @@
<template>
<div class="space-y-3 pt-2 w-full overflow-x-auto">
<div class="w-full flex flex-row justify-between items-center">
- <div class="flex flex-row justify-start items-center space-x-2">
- <NButton type="primary" @click="handleCreateBranch">
- <heroicons-solid:plus class="w-4 h-auto mr-0.5" />
- <span>{{ $t("database.new-branch") }}</span>
- </NButton>
- </div>
+ <div class="flex flex-row justify-start items-center"></div>
<div class="flex flex-row justify-end items-center gap-x-2">
<NInput
v-model:value="state.searchKeyword"
@@ -14,6 +9,10 @@
clearable
:placeholder="$t('schema-designer.action.filter-by-name')"
/>
+ <NButton type="primary" @click="handleCreateBranch">
+ <heroicons-solid:plus class="w-4 h-auto mr-0.5" />
+ <span>{{ $t("database.new-branch") }}</span>
+ </NButton>
</div>
</div>
@@ -38,7 +37,7 @@ import { getProjectAndSchemaDesignSheetId } from "@/store/modules/v1/common";
import { SchemaDesign } from "@/types/proto/v1/schema_design_service";
const props = defineProps<{
- projectId?: string;
+ projectId: string;
}>();
interface LocalState {
@@ -52,9 +51,7 @@ const state = reactive<LocalState>({
searchKeyword: "",
});
-const project = computed(() =>
- projectV1Store.getProjectByUID(props.projectId || "")
-);
+const project = computed(() => projectV1Store.getProjectByUID(props.projectId));
const filteredBranches = computed(() => {
return orderBy(
@@ -78,6 +75,9 @@ const handleCreateBranch = () => {
params: {
branchSlug: "new",
},
+ query: {
+ projectId: props.projectId,
+ },
});
};