Skip to content

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

chore: use page instead of drawer for change history detail (#14280)

boojackae51c38466af
diff --git a/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue b/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
index 946d00283e..47c1279ecc 100644
--- a/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
+++ b/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
@@ -55,7 +55,10 @@
<span class="textlabel"
>{{ $t("common.created-at") }}&nbsp;-&nbsp;</span
>
- {{ humanizeDate(getDateForPbTimestamp(changeHistory.createTime)) }} by
+ {{
+ humanizeDate(getDateForPbTimestamp(changeHistory.createTime))
+ }}
+ by
{{ `version ${changeHistory.releaseVersion}` }}
</dd>
</dl>
@@ -283,7 +286,7 @@
import { useTitle } from "@vueuse/core";
import { ChevronDownIcon } from "lucide-vue-next";
import { NButton, NSwitch } from "naive-ui";
-import { computed, reactive, watch, ref } from "vue";
+import { computed, reactive, watch, ref, unref } from "vue";
import { BBModal, BBSpin } from "@/bbkit";
import ChangeHistoryStatusIcon from "@/components/ChangeHistory/ChangeHistoryStatusIcon.vue";
import { DiffEditor, MonacoEditor } from "@/components/MonacoEditor";
@@ -292,10 +295,11 @@ import {
pushNotification,
useChangeHistoryStore,
useDBSchemaV1Store,
- useDatabaseV1Store,
useUserStore,
useSettingV1Store,
+ useDatabaseV1ByName,
} from "@/store";
+import { getDateForPbTimestamp } from "@/types";
import type { AffectedTable } from "@/types/changeHistory";
import { Engine } from "@/types/proto/v1/common";
import type { ChangeHistory } from "@/types/proto/v1/database_service";
@@ -317,7 +321,6 @@ import {
extractChangeHistoryUID,
} from "@/utils";
import NoPermissionPlaceholder from "../misc/NoPermissionPlaceholder.vue";
-import { getDateForPbTimestamp } from "@/types";
interface LocalState {
showDiff: boolean;
@@ -337,16 +340,12 @@ const state = reactive<LocalState>({
loading: false,
});
-const databaseStore = useDatabaseV1Store();
const dbSchemaStore = useDBSchemaV1Store();
const settingStore = useSettingV1Store();
const changeHistoryStore = useChangeHistoryStore();
const selectedAffectedTable = ref<AffectedTable | undefined>();
-// eslint-disable-next-line vue/no-dupe-keys
-const database = computed(() => {
- return databaseStore.getDatabaseByName(changeHistoryParent.value);
-});
+const { database } = useDatabaseV1ByName(props.database);
const hasPermission = computed(() =>
hasProjectPermissionV2(database.value.projectEntity, "bb.changeHistories.get")
@@ -358,12 +357,8 @@ const classificationConfig = computed(() => {
);
});
-const changeHistoryParent = computed(() => {
- return props.database;
-});
-
const changeHistoryName = computed(() => {
- return `${changeHistoryParent.value}/changeHistories/${props.changeHistoryId}`;
+ return `${props.database}/changeHistories/${props.changeHistoryId}`;
});
const affectedTables = computed(() => {
@@ -378,16 +373,15 @@ const showSchemaSnapshot = computed(() => {
});
watch(
- [changeHistoryParent, changeHistoryName],
- async ([parent, name]) => {
- const database = await databaseStore.getOrFetchDatabaseByName(parent);
+ [database.value.name, changeHistoryName],
+ async ([_, name]) => {
await Promise.all([
dbSchemaStore.getOrFetchDatabaseMetadata({
- database: database.name,
+ database: database.value.name,
skipCache: false,
}),
changeHistoryStore.getOrFetchChangeHistoryByName(
- name,
+ unref(name),
ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL
),
]);
@@ -410,7 +404,7 @@ const handleAffectedTableClick = (affectedTable: AffectedTable): void => {
// get all change histories before (include) the one of given id, ordered by descending version.
const prevChangeHistoryList = computed(() => {
const changeHistoryList = changeHistoryStore.changeHistoryListByDatabase(
- changeHistoryParent.value
+ database.value.name
);
// The returned change history list has been ordered by `id` DESC or (`namespace` ASC, `sequence` DESC) .
diff --git a/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue b/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue
index 19b6b30377..a4440bdde3 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue
@@ -15,6 +15,7 @@ import { Drawer, DrawerContent } from "@/components/v2";
import { useChangeHistoryStore } from "@/store";
import { extractChangeHistoryUID, extractDatabaseResourceName } from "@/utils";
import ChangeHistoryDetail from "@/views/ChangeHistoryDetail.vue";
+import { provideChangelistDetailContext } from "../context";
const props = defineProps<{
changeHistoryName?: string;
@@ -24,6 +25,8 @@ defineEmits<{
(event: "close"): void;
}>();
+const { project } = provideChangelistDetailContext();
+
const changeHistory = computed(() => {
const { changeHistoryName } = props;
if (!changeHistoryName) {
@@ -40,6 +43,7 @@ const detailBindings = computed(() => {
changeHistory.value.name
);
return {
+ project: project.value.name,
instance,
database,
changeHistoryId: extractChangeHistoryUID(changeHistory.value.name),
diff --git a/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue b/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue
index 6644a60525..9d1e9e0245 100644
--- a/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue
+++ b/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue
@@ -99,30 +99,12 @@
"
:loading="loading"
:change-histories="list"
- :custom-click="true"
:show-selection="true"
- @row-click="(id: string) => (state.selectedChangeHistoryId = id)"
/>
</template>
</PagedChangeHistoryTable>
</div>
- <Drawer
- :show="!!state.selectedChangeHistoryId"
- @close="state.selectedChangeHistoryId = ''"
- >
- <DrawerContent
- class="w-[80vw] max-w-[100vw] relative"
- :title="$t('change-history.self')"
- >
- <ChangeHistoryDetail
- :instance="database.instance"
- :database="database.name"
- :change-history-id="state.selectedChangeHistoryId"
- />
- </DrawerContent>
- </Drawer>
-
<BBAlert
v-model:show="state.showBaselineModal"
data-label="bb-change-history-establish-baseline-alert"
@@ -150,14 +132,12 @@ import { useRouter } from "vue-router";
import { BBAlert, BBSpin } from "@/bbkit";
import {
ChangeHistoryDataTable,
- ChangeHistoryDetail,
PagedChangeHistoryTable,
ChangeTypeSelect,
AffectedTablesSelect,
} from "@/components/ChangeHistory";
import { useDatabaseDetailContext } from "@/components/Database/context";
import { TooltipButton } from "@/components/v2";
-import { Drawer, DrawerContent } from "@/components/v2";
import {
PROJECT_V1_ROUTE_ISSUE_DETAIL,
PROJECT_V1_ROUTE_SYNC_SCHEMA,
@@ -181,7 +161,6 @@ interface LocalState {
isExporting: boolean;
selectedAffectedTables: Table[];
selectedChangeType?: string;
- selectedChangeHistoryId: string;
}
const props = defineProps<{
@@ -199,7 +178,6 @@ const state = reactive<LocalState>({
selectedChangeHistoryNameList: [],
isExporting: false,
selectedAffectedTables: [],
- selectedChangeHistoryId: "",
});
const { allowAlterSchema } = useDatabaseDetailContext();
diff --git a/frontend/src/views/ChangeHistoryDetail.vue b/frontend/src/views/ChangeHistoryDetail.vue
index 698da637b4..45945c2ada 100644
--- a/frontend/src/views/ChangeHistoryDetail.vue
+++ b/frontend/src/views/ChangeHistoryDetail.vue
@@ -1,17 +1,42 @@
<template>
+ <NBreadcrumb class="mb-4">
+ <NBreadcrumbItem @click="router.push(`/${props.project}/databases`)">
+ {{ $t("common.databases") }}
+ </NBreadcrumbItem>
+ <NBreadcrumbItem @click="router.push(databaseV1Url(database))">
+ {{ database.databaseName }}
+ </NBreadcrumbItem>
+ <NBreadcrumbItem
+ @click="`${router.push(databaseV1Url(database))}#change-history`"
+ >
+ {{ $t("change-history.self") }}
+ </NBreadcrumbItem>
+ <NBreadcrumbItem :clickable="false">
+ {{ changeHistoryId }}
+ </NBreadcrumbItem>
+ </NBreadcrumb>
<ChangeHistoryDetail
:instance="instance"
- :database="database"
+ :database="database.name"
:change-history-id="changeHistoryId"
/>
</template>
<script lang="ts" setup>
+import { NBreadcrumb, NBreadcrumbItem } from "naive-ui";
+import { useRouter } from "vue-router";
import { ChangeHistoryDetail } from "@/components/ChangeHistory";
+import { useDatabaseV1ByName } from "@/store";
+import { databaseV1Url } from "@/utils";
-defineProps<{
+const props = defineProps<{
+ project: string;
instance: string;
database: string;
changeHistoryId: string;
}>();
+
+const router = useRouter();
+
+const { database } = useDatabaseV1ByName(props.database);
</script>