Skip to content

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

chore: add view full params when list change histories (#6989)

boojackb6f56cc29a0c
diff --git a/frontend/src/views/SyncDatabaseSchema/index.vue b/frontend/src/views/SyncDatabaseSchema/index.vue
index 3bb41e4244..31ab0add71 100644
--- a/frontend/src/views/SyncDatabaseSchema/index.vue
+++ b/frontend/src/views/SyncDatabaseSchema/index.vue
@@ -129,7 +129,7 @@
<SelectTargetDatabasesView
ref="targetDatabaseViewRef"
:project-id="state.projectId!"
- :source-schema="state.sourceSchema as any"
+ :source-schema="fullViewSourceSchema as any"
/>
</template>
</BBStepTab>
@@ -164,6 +164,7 @@ import { InstanceV1EngineIcon } from "@/components/v2";
import { instanceV1Name } from "@/utils";
import {
ChangeHistory,
+ ChangeHistoryView,
ChangeHistory_Type,
} from "@/types/proto/v1/database_service";
@@ -199,6 +200,7 @@ const projectStore = useProjectV1Store();
const databaseStore = useDatabaseV1Store();
const changeHistoryStore = useChangeHistoryStore();
const subscriptionV1Store = useSubscriptionV1Store();
+const fullViewChangeHistoryCache = ref<Map<string, ChangeHistory>>(new Map());
const targetDatabaseViewRef =
ref<InstanceType<typeof SelectTargetDatabasesView>>();
const state = reactive<LocalState>({
@@ -207,6 +209,30 @@ const state = reactive<LocalState>({
showFeatureModal: false,
});
+const prepareFullViewChangeHistory = async () => {
+ const changeHistory = state.sourceSchema.changeHistory;
+ if (!changeHistory || changeHistory.uid === String(UNKNOWN_ID)) {
+ return;
+ }
+
+ const cache = fullViewChangeHistoryCache.value.get(changeHistory.name);
+ if (!cache) {
+ const fullViewChangeHistory = await changeHistoryStore.fetchChangeHistory({
+ name: changeHistory.name,
+ view: ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL,
+ });
+ fullViewChangeHistoryCache.value.set(
+ fullViewChangeHistory.name,
+ fullViewChangeHistory
+ );
+ }
+};
+
+watch(() => state.sourceSchema.changeHistory, prepareFullViewChangeHistory, {
+ immediate: true,
+ deep: true,
+});
+
const isValidId = (id: any): id is string => {
if (isNull(id) || isUndefined(id) || String(id) === String(UNKNOWN_ID)) {
return false;
@@ -244,6 +270,16 @@ const stepTabList = computed(() => {
];
});
+const fullViewSourceSchema = computed(() => {
+ const fullViewChangeHistory = fullViewChangeHistoryCache.value.get(
+ state.sourceSchema.changeHistory?.name || ""
+ );
+ return {
+ ...state.sourceSchema,
+ changeHistory: fullViewChangeHistory || state.sourceSchema.changeHistory,
+ };
+});
+
const allowNext = computed(() => {
if (state.currentStep === SELECT_SOURCE_DATABASE) {
return (