Skip to content

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

chore: show branches in the merge branch selector (#9712)

Danny Xu2f37dd15fb69
diff --git a/frontend/src/components/Branch/BranchDetailView.vue b/frontend/src/components/Branch/BranchDetailView.vue
index 1604e3fb3e..5695e3b038 100644
--- a/frontend/src/components/Branch/BranchDetailView.vue
+++ b/frontend/src/components/Branch/BranchDetailView.vue
@@ -99,6 +99,7 @@
<MergeBranchPanel
v-if="state.showDiffEditor && mergeBranchPanelContext"
+ :project="project"
:source-branch-name="mergeBranchPanelContext.sourceBranchName"
:target-branch-name="mergeBranchPanelContext.targetBranchName"
@dismiss="state.showDiffEditor = false"
@@ -148,7 +149,7 @@ interface LocalState {
}
const props = defineProps<{
- // Should be a schema design name of main branch.
+ projectId: string;
branch: Branch;
viewMode?: boolean;
}>();
@@ -157,9 +158,7 @@ const { t } = useI18n();
const router = useRouter();
const databaseStore = useDatabaseV1Store();
const branchStore = useBranchStore();
-const { branchList, ready } = useBranchList(
- getProjectAndBranchId(props.branch.name)[0]
-);
+const { branchList, ready } = useBranchList(props.projectId);
const { runSQLCheck } = provideSQLCheckContext();
const state = reactive<LocalState>({
branchId: "",
diff --git a/frontend/src/components/Branch/BranchSelector.vue b/frontend/src/components/Branch/BranchSelector.vue
index 2da8f01a9f..a4d60118c1 100644
--- a/frontend/src/components/Branch/BranchSelector.vue
+++ b/frontend/src/components/Branch/BranchSelector.vue
@@ -16,11 +16,7 @@
<script lang="ts" setup>
import { NSelect, SelectOption, SelectRenderLabel } from "naive-ui";
import { computed, h } from "vue";
-import { useDatabaseV1Store, useProjectV1Store, useBranchList } from "@/store";
-import {
- getProjectAndBranchId,
- projectNamePrefix,
-} from "@/store/modules/v1/common";
+import { useDatabaseV1Store, useBranchList } from "@/store";
import { UNKNOWN_ID } from "@/types";
import { Branch } from "@/types/proto/v1/branch_service";
import { InstanceV1EngineIcon } from "../v2";
@@ -42,20 +38,10 @@ defineEmits<{
}>();
const { branchList: branchList } = useBranchList(props.project || "");
-const projectStore = useProjectV1Store();
const databaseStore = useDatabaseV1Store();
const combinedBranchList = computed(() => {
let list = branchList.value;
- if (props.project) {
- const project = projectStore.getProjectByUID(props.project);
- if (project) {
- list = list.filter((branch) => {
- const [projectName] = getProjectAndBranchId(branch.name);
- return project.name === `${projectNamePrefix}${projectName}`;
- });
- }
- }
if (props.filter) {
list = list.filter(props.filter);
}
diff --git a/frontend/src/components/Branch/MergeBranchPanel.vue b/frontend/src/components/Branch/MergeBranchPanel.vue
index e694287ca3..009cb4f245 100644
--- a/frontend/src/components/Branch/MergeBranchPanel.vue
+++ b/frontend/src/components/Branch/MergeBranchPanel.vue
@@ -26,6 +26,7 @@
<BranchSelector
class="!w-4/5 text-center"
:clearable="false"
+ :project="getProjectName(project.name)"
:branch="state.targetBranchName"
:filter="targetBranchFilter"
@update:branch="
@@ -84,6 +85,8 @@ import { useI18n } from "vue-i18n";
import { Drawer, DrawerContent } from "@/components/v2";
import { pushNotification } from "@/store";
import { useBranchStore } from "@/store/modules/branch";
+import { getProjectName } from "@/store/modules/v1/common";
+import { ComposedProject } from "@/types";
import { Branch } from "@/types/proto/v1/branch_service";
import { DiffEditor } from "../MonacoEditor";
@@ -94,6 +97,7 @@ interface LocalState {
}
const props = defineProps<{
+ project: ComposedProject;
sourceBranchName: string;
targetBranchName: string;
}>();
@@ -185,6 +189,8 @@ const handleMergeBranch = async () => {
await branchStore.mergeBranch({
name: targetBranch.value.name,
headBranch: sourceBranch.value.name,
+ mergedSchema: "",
+ etag: "",
});
} catch (error: any) {
// If there is conflict, we need to show the conflict and let user resolve it.
diff --git a/frontend/src/views/branch/BranchDetail.vue b/frontend/src/views/branch/BranchDetail.vue
index ab68756057..16658d99aa 100644
--- a/frontend/src/views/branch/BranchDetail.vue
+++ b/frontend/src/views/branch/BranchDetail.vue
@@ -4,7 +4,11 @@
<BranchCreateView :project-id="project?.uid" v-bind="$attrs" />
</template>
<template v-else-if="branch">
- <BranchDetailView :branch="branch" v-bind="$attrs" />
+ <BranchDetailView
+ :project-id="getProjectName(project?.name) || ''"
+ :branch="branch"
+ v-bind="$attrs"
+ />
</template>
</template>
</template>
@@ -18,6 +22,7 @@ import BranchCreateView from "@/components/Branch/BranchCreateView.vue";
import BranchDetailView from "@/components/Branch/BranchDetailView.vue";
import { useProjectV1Store } from "@/store";
import { useBranchStore } from "@/store/modules/branch";
+import { getProjectName } from "@/store/modules/v1/common";
import { idFromSlug } from "@/utils";
const { t } = useI18n();
@@ -32,9 +37,6 @@ const branch = computed(() => {
return branchStore.getBranchByName(branchFullName.value);
});
const project = computed(() => {
- if (route.params.projectSlug === "-") {
- return;
- }
return projectStore.getProjectByUID(
String(idFromSlug(route.params.projectSlug as string))
);