Skip to content

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

chore(frontend): changelist branch detail panel improvements (#8652)

Liu Jidaa108f1db27
diff --git a/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchBaseline.vue b/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchBaseline.vue
new file mode 100644
index 0000000000..dc9405b13c
--- /dev/null
+++ b/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchBaseline.vue
@@ -0,0 +1,68 @@
+<template>
+ <div class="flex flex-row justify-start items-center opacity-80">
+ <span class="mr-4 shrink-0"
+ >{{ $t("schema-designer.baseline-version") }}:</span
+ >
+ <DatabaseInfo
+ class="flex-nowrap mr-4 shrink-0"
+ :database="baselineDatabase"
+ />
+ <div v-if="!isLoadingChangeHistory" class="shrink-0 flex-nowrap">
+ <NTooltip v-if="changeHistory" trigger="hover">
+ <template #trigger>@{{ changeHistory.version }}</template>
+ <div class="w-full flex flex-row justify-start items-center">
+ <span class="block pr-2 w-full max-w-[32rem] truncate">
+ {{ changeHistory.version }} -
+ {{ changeHistory.description }}
+ </span>
+ <span class="opacity-60">
+ {{ humanizeDate(changeHistory.updateTime) }}
+ </span>
+ </div>
+ </NTooltip>
+ <div v-else>
+ {{ "Previously latest schema" }}
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { asyncComputed } from "@vueuse/core";
+import { computed, ref } from "vue";
+import DatabaseInfo from "@/components/DatabaseInfo.vue";
+import { useChangeHistoryStore, useDatabaseV1Store } from "@/store";
+import { UNKNOWN_ID } from "@/types";
+import { SchemaDesign } from "@/types/proto/v1/schema_design_service";
+
+const props = defineProps<{
+ branch: SchemaDesign;
+}>();
+
+const isLoadingChangeHistory = ref(false);
+
+const baselineDatabase = computed(() => {
+ return useDatabaseV1Store().getDatabaseByName(props.branch.baselineDatabase);
+});
+
+const changeHistoryName = computed(() => {
+ const { branch } = props;
+ if (!branch) return undefined;
+ const id = branch.baselineChangeHistoryId;
+ if (!id || id === String(UNKNOWN_ID)) return undefined;
+ const name = `${baselineDatabase.value.name}/changeHistories/${id}`;
+ return name;
+});
+
+const changeHistory = asyncComputed(
+ async () => {
+ const name = changeHistoryName.value;
+ if (!name) return undefined;
+ return await useChangeHistoryStore().getOrFetchChangeHistoryByName(name);
+ },
+ undefined,
+ {
+ evaluating: isLoadingChangeHistory,
+ }
+);
+</script>
diff --git a/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue b/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue
index 2cf803bcbd..71efe0ef4c 100644
--- a/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue
+++ b/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue
@@ -4,14 +4,19 @@
:title="title"
style="width: 75vw; max-width: calc(100vw - 8rem)"
>
- <SchemaEditorV1
- v-if="editorBindings"
- :readonly="true"
- :project="editorBindings.project"
- :resource-type="'branch'"
- :databases="editorBindings.databases"
- :branches="editorBindings.branches"
- />
+ <div class="h-full flex flex-col gap-y-2">
+ <div class="w-full flex flex-row justify-between items-center gap-2">
+ <BranchBaseline v-if="branch" :branch="branch" />
+ </div>
+ <SchemaDesignEditor
+ v-if="editorBindings"
+ class="flex-1"
+ :readonly="true"
+ :project="editorBindings.project"
+ :branch="editorBindings.branch"
+ :hide-s-q-l-check-button="true"
+ />
+ </div>
</DrawerContent>
</Drawer>
</template>
@@ -19,10 +24,11 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
-import SchemaEditorV1 from "@/components/SchemaEditorV1/index.vue";
+import SchemaDesignEditor from "@/components/Branch/SchemaDesignEditor.vue";
import { Drawer, DrawerContent } from "@/components/v2";
import { useDatabaseV1Store } from "@/store";
import { useSchemaDesignStore } from "@/store/modules/schemaDesign";
+import BranchBaseline from "./BranchBaseline.vue";
const props = defineProps<{
branchName?: string;
@@ -56,9 +62,7 @@ const editorBindings = computed(() => {
return {
readonly: true,
project,
- resourceType: "branch",
- databases: [db],
- branches: [branch.value],
+ branch: branch.value,
};
});