Skip to content

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

chore: add project filter to branches (#8636)

boojackc0bef0b07f68
diff --git a/frontend/src/views/branch/BranchDashboard.vue b/frontend/src/views/branch/BranchDashboard.vue
index ac914cbd04..3b3d3e497b 100644
--- a/frontend/src/views/branch/BranchDashboard.vue
+++ b/frontend/src/views/branch/BranchDashboard.vue
@@ -2,7 +2,10 @@
<div class="space-y-3 pt-2 w-full overflow-x-auto">
<div class="w-full px-4 flex flex-row justify-between items-center">
<div>
- <!-- Placeholder -->
+ <ProjectSelect
+ v-model:project="state.projectFilter"
+ :include-all="true"
+ />
</div>
<div class="flex flex-row justify-end items-center gap-x-2">
<NInput
@@ -32,28 +35,42 @@ import { NButton, NInput } from "naive-ui";
import { computed, reactive } from "vue";
import { useRouter } from "vue-router";
import BranchDataTable from "@/components/Branch/BranchDataTable.vue";
+import { ProjectSelect } from "@/components/v2";
+import { useProjectV1Store } from "@/store";
import { useSchemaDesignList } from "@/store/modules/schemaDesign";
import { getProjectAndSchemaDesignSheetId } from "@/store/modules/v1/common";
+import { UNKNOWN_ID } from "@/types";
import { SchemaDesign } from "@/types/proto/v1/schema_design_service";
interface LocalState {
searchKeyword: string;
+ projectFilter: string;
}
const router = useRouter();
const { schemaDesignList, ready } = useSchemaDesignList();
+const projectStore = useProjectV1Store();
const state = reactive<LocalState>({
searchKeyword: "",
+ projectFilter: String(UNKNOWN_ID),
});
const filteredBranches = computed(() => {
- return orderBy(schemaDesignList.value, "updateTime", "desc").filter(
- (branch) => {
+ return orderBy(schemaDesignList.value, "updateTime", "desc")
+ .filter((branch) => {
+ const [projectName] = getProjectAndSchemaDesignSheetId(branch.name);
+ const project = projectStore.getProjectByName(`projects/${projectName}`);
+ return (
+ !state.projectFilter ||
+ state.projectFilter === String(UNKNOWN_ID) ||
+ project.uid === state.projectFilter
+ );
+ })
+ .filter((branch) => {
return state.searchKeyword
? branch.title.includes(state.searchKeyword)
: true;
- }
- );
+ });
});
const handleCreateBranch = () => {