Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: add fullscreen button to diff viewer (#10822)
boojack125c69b55539
diff --git a/frontend/src/bbkit/BBModal.vue b/frontend/src/bbkit/BBModal.vueindex 0e83d61780..a5960e56a4 100644--- a/frontend/src/bbkit/BBModal.vue+++ b/frontend/src/bbkit/BBModal.vue@@ -163,6 +163,6 @@ export default defineComponent({}.modal-container {- @apply px-4 max-h-screen overflow-auto w-full;+ @apply px-4 max-h-screen overflow-auto w-full h-full;}</style>diff --git a/frontend/src/components/SyncDatabaseSchema/DiffViewPanel.vue b/frontend/src/components/SyncDatabaseSchema/DiffViewPanel.vueindex ffe43484e5..0fd4d67ce7 100644--- a/frontend/src/components/SyncDatabaseSchema/DiffViewPanel.vue+++ b/frontend/src/components/SyncDatabaseSchema/DiffViewPanel.vue@@ -11,33 +11,13 @@<div class="flex-1 w-full flex flex-col gap-y-2 overflow-hidden"><template v-if="tab === 'diff'">- <div class="w-full flex flex-row justify-between items-center">- <span>{{ previewSchemaChangeMessage }}</span>- <div class="space-x-2 shrink-0">- <NButton size="small" @click="handleNavigatorClick('previous')">- <template #icon>- <ArrowUpIcon class="w-5 h-auto" />- </template>- </NButton>- <NButton size="small" @click="handleNavigatorClick('next')">- <template #icon>- <ArrowDownIcon class="w-5 h-auto" />- </template>- </NButton>- </div>- </div>- <div+ <SchemaDiffViewerv-if="shouldShowDiff"- class="w-full flex-1 overflow-y-scroll border"- >- <DiffEditor- ref="diffEditorRef"- class="h-full"- :original="targetDatabaseSchema"- :modified="displayOnlySourceDatabaseSchema"- :readonly="true"- />- </div>+ :title="previewSchemaChangeMessage"+ :original="targetDatabaseSchema"+ :modified="displayOnlySourceDatabaseSchema"+ :show-fullscreen="true"+ /><divv-elseclass="w-full flex-1 border flex items-center justify-center"@@ -77,12 +57,12 @@</template><script lang="ts" setup>-import { ArrowDownIcon, ArrowUpIcon } from "lucide-vue-next";-import { NButton, NTabs, NTab } from "naive-ui";+import { NTabs, NTab } from "naive-ui";import { ref } from "vue";-import { DiffEditor, MonacoEditor } from "@/components/MonacoEditor";+import { MonacoEditor } from "@/components/MonacoEditor";import { dialectOfEngineV1 } from "@/types";import { Engine } from "@/types/proto/v1/common";+import SchemaDiffViewer from "./SchemaDiffViewer.vue";defineProps<{statement: string;@@ -101,12 +81,7 @@ defineEmits<{(event: "copy-statement"): void;}>();-const diffEditorRef = ref<InstanceType<typeof DiffEditor>>();const tab = ref<"diff" | "ddl">("diff");--const handleNavigatorClick = (target: "next" | "previous") => {- diffEditorRef?.value?.diffEditor?.editor?.goToDiff(target);-};</script><style lang="postcss">diff --git a/frontend/src/components/SyncDatabaseSchema/SchemaDiffViewer.vue b/frontend/src/components/SyncDatabaseSchema/SchemaDiffViewer.vuenew file mode 100644index 0000000000..d59000c1c6--- /dev/null+++ b/frontend/src/components/SyncDatabaseSchema/SchemaDiffViewer.vue@@ -0,0 +1,67 @@+<template>+ <div class="w-full h-full flex flex-col gap-2">+ <div class="w-full flex flex-row justify-between items-center">+ <span>{{ title }}</span>+ <div class="space-x-2 shrink-0">+ <NButton size="small" @click="handleNavigatorClick('previous')">+ <template #icon>+ <ArrowUpIcon class="w-5 h-auto" />+ </template>+ </NButton>+ <NButton size="small" @click="handleNavigatorClick('next')">+ <template #icon>+ <ArrowDownIcon class="w-5 h-auto" />+ </template>+ </NButton>+ <NButton+ v-if="showFullscreen"+ size="small"+ @click="showFullscreenModal = true"+ >+ <template #icon>+ <Maximize2Icon class="w-5 h-auto" />+ </template>+ </NButton>+ </div>+ </div>+ <div class="w-full flex-1 overflow-y-scroll border">+ <DiffEditor+ ref="diffEditorRef"+ class="h-full"+ :original="original"+ :modified="modified"+ :readonly="true"+ />+ </div>+ </div>++ <SchemaDiffViewerModal+ v-if="showFullscreenModal"+ :title="title"+ :original="original"+ :modified="modified"+ @close="showFullscreenModal = false"+ />+</template>++<script lang="ts" setup>+import { ArrowDownIcon, ArrowUpIcon, Maximize2Icon } from "lucide-vue-next";+import { NButton } from "naive-ui";+import { ref } from "vue";+import { DiffEditor } from "@/components/MonacoEditor";+import SchemaDiffViewerModal from "./SchemaDiffViewerModal.vue";++defineProps<{+ title: string;+ original: string;+ modified: string;+ showFullscreen?: boolean;+}>();++const showFullscreenModal = ref(false);+const diffEditorRef = ref<InstanceType<typeof DiffEditor>>();++const handleNavigatorClick = (target: "next" | "previous") => {+ diffEditorRef?.value?.diffEditor?.editor?.goToDiff(target);+};+</script>diff --git a/frontend/src/components/SyncDatabaseSchema/SchemaDiffViewerModal.vue b/frontend/src/components/SyncDatabaseSchema/SchemaDiffViewerModal.vuenew file mode 100644index 0000000000..e8fc1f2754--- /dev/null+++ b/frontend/src/components/SyncDatabaseSchema/SchemaDiffViewerModal.vue@@ -0,0 +1,15 @@+<template>+ <BBModal :title="title" class="w-full h-screen">+ <SchemaDiffViewer :title="''" :original="original" :modified="modified" />+ </BBModal>+</template>++<script lang="ts" setup>+import SchemaDiffViewer from "./SchemaDiffViewer.vue";++defineProps<{+ title: string;+ original: string;+ modified: string;+}>();+</script>diff --git a/frontend/src/components/SyncDatabaseSchema/TargetDatabasesSelectPanel.vue b/frontend/src/components/SyncDatabaseSchema/TargetDatabasesSelectPanel.vueindex aa06a50dde..98d884eeea 100644--- a/frontend/src/components/SyncDatabaseSchema/TargetDatabasesSelectPanel.vue+++ b/frontend/src/components/SyncDatabaseSchema/TargetDatabasesSelectPanel.vue@@ -82,16 +82,13 @@><div class="radio text-sm flex justify-start md:flex-1"><NCheckbox+ :class="database.syncState !== State.ACTIVE && 'opacity-40'":checked="isDatabaseSelected(database.uid)"+ :label="database.databaseName"@update:checked="(checked) => toggleDatabaseSelected(database.uid, checked)"/>- <span- class="font-medium ml-2 text-main"- :class="database.syncState !== State.ACTIVE && 'opacity-40'"- >{{ database.databaseName }}</span- ></div><divclass="flex items-center gap-x-1 textinfolabel ml-6 pl-0 md:ml-0 md:pl-0 md:justify-end"