Skip to content

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

chore: branch little refactoring (#9710)

Danny Xu0d287f73f30e
diff --git a/frontend/src/components/Branch/BranchDataTable.vue b/frontend/src/components/Branch/BranchDataTable.vue
index 1b9575d750..5c6d5ae136 100644
--- a/frontend/src/components/Branch/BranchDataTable.vue
+++ b/frontend/src/components/Branch/BranchDataTable.vue
@@ -16,18 +16,13 @@ import { NDataTable } from "naive-ui";
import { computed, h } from "vue";
import { useI18n } from "vue-i18n";
import BranchBaseline from "@/components/Branch/BranchBaseline.vue";
-import { useDatabaseV1Store, useProjectV1Store, useUserStore } from "@/store";
-import {
- getProjectAndBranchId,
- projectNamePrefix,
-} from "@/store/modules/v1/common";
+import { useDatabaseV1Store, useUserStore } from "@/store";
import { Branch } from "@/types/proto/v1/branch_service";
type BranchRowData = {
branch: Branch;
name: string;
branchName: string;
- projectName: string;
baselineVersion: string;
updatedTimeStr: string;
children?: BranchRowData[];
@@ -35,7 +30,6 @@ type BranchRowData = {
const props = defineProps<{
branches: Branch[];
- hideProjectColumn?: boolean;
ready?: boolean;
}>();
@@ -45,7 +39,6 @@ const emit = defineEmits<{
const { t } = useI18n();
const userV1Store = useUserStore();
-const projectV1Store = useProjectV1Store();
const databaseStore = useDatabaseV1Store();
const dataTableRows = computed(() => {
@@ -53,10 +46,6 @@ const dataTableRows = computed(() => {
return branch.parentBranch === "";
});
const parentRows: BranchRowData[] = parentBranches.map((branch) => {
- const [projectName] = getProjectAndBranchId(branch.name);
- const project = projectV1Store.getProjectByName(
- `${projectNamePrefix}${projectName}`
- );
const database = databaseStore.getDatabaseByName(branch.baselineDatabase);
const baselineVersion = `(${database.effectiveEnvironmentEntity.title}) ${database.databaseName}`;
@@ -64,7 +53,6 @@ const dataTableRows = computed(() => {
branch: branch,
name: branch.branchId,
branchName: branch.branchId,
- projectName: project.title,
baselineVersion: baselineVersion,
updatedTimeStr: getUpdatedTimeStr(branch),
children: [],
@@ -82,8 +70,6 @@ const dataTableRows = computed(() => {
branch: childBranch,
name: childBranch.branchId,
branchName: `${parentRow.branchName}/${childBranch.branchId}`,
- // Child branch does not show project name.
- projectName: "",
baselineVersion: "",
updatedTimeStr: getUpdatedTimeStr(childBranch),
});
@@ -98,10 +84,6 @@ const dataTableColumns = computed(() => {
title: t("common.branch"),
key: "branchName",
};
- const PROJECT_NAME_COLUMN = {
- title: t("common.project"),
- key: "projectName",
- };
const BASELINE_VERSION_COLUMN = {
title: t("schema-designer.baseline-version"),
key: "baselineVersion",
@@ -119,7 +101,6 @@ const dataTableColumns = computed(() => {
return [
BRANCH_NAME_COLUMN,
- !props.hideProjectColumn ? PROJECT_NAME_COLUMN : undefined,
BASELINE_VERSION_COLUMN,
UPDATED_TIME_COLUMN,
].filter((column) => column);
diff --git a/frontend/src/components/ProjectBranchesPanel.vue b/frontend/src/components/ProjectBranchesPanel.vue
index 59df8ec2e7..e0dea9c08a 100644
--- a/frontend/src/components/ProjectBranchesPanel.vue
+++ b/frontend/src/components/ProjectBranchesPanel.vue
@@ -15,7 +15,6 @@
<BranchDataTable
class="border"
:branches="filteredBranches"
- :hide-project-column="true"
:ready="ready"
@click="handleBranchClick"
/>
@@ -77,8 +76,8 @@ const handleCreateBranch = () => {
});
};
-const handleBranchClick = async (schemaDesign: Branch) => {
- const [_, branchId] = getProjectAndBranchId(schemaDesign.name);
+const handleBranchClick = async (branch: Branch) => {
+ const [_, branchId] = getProjectAndBranchId(branch.name);
router.push({
name: "workspace.project.branch.detail",
params: {
diff --git a/frontend/src/views/branch/BranchDetail.vue b/frontend/src/views/branch/BranchDetail.vue
index 84d680c15f..ab68756057 100644
--- a/frontend/src/views/branch/BranchDetail.vue
+++ b/frontend/src/views/branch/BranchDetail.vue
@@ -85,7 +85,7 @@ const documentTitle = computed(() => {
return t("schema-designer.new-branch");
} else {
if (branch.value) {
- return branch.value.title;
+ return branch.value.branchId;
}
}
return t("common.loading");