From 336edfc93f32b902adb505593bb3890465b446e0 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sun, 31 Oct 2021 09:40:54 +0100 Subject: [PATCH] compare DB: diff view --- packages/web/package.json | 6 ++- packages/web/public/index.html | 1 + packages/web/rollup.config.js | 4 ++ packages/web/src/elements/DiffView.svelte | 37 +++++++++++++++ packages/web/src/tabs/CompareModelTab.svelte | 22 +++++++-- packages/web/src/utility/computeDiffRows.ts | 7 +++ yarn.lock | 47 +++++++++++++++++--- 7 files changed, 112 insertions(+), 12 deletions(-) create mode 100644 packages/web/src/elements/DiffView.svelte diff --git a/packages/web/package.json b/packages/web/package.json index 6fb18471..3d94243f 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -49,5 +49,9 @@ "tslib": "^2.3.1", "typescript": "^4.4.3", "uuid": "^3.4.0" + }, + "dependencies": { + "diff": "^5.0.0", + "diff2html": "^3.4.13" } -} \ No newline at end of file +} diff --git a/packages/web/public/index.html b/packages/web/public/index.html index 1a4b3dfc..5d2c9c41 100644 --- a/packages/web/public/index.html +++ b/packages/web/public/index.html @@ -19,6 +19,7 @@ + diff --git a/packages/web/rollup.config.js b/packages/web/rollup.config.js index bd142e58..19ab3d99 100644 --- a/packages/web/rollup.config.js +++ b/packages/web/rollup.config.js @@ -51,6 +51,10 @@ export default { src: '../../node_modules/@mdi/font/fonts/*', dest: 'public/build/fonts/', }, + { + src: '../../node_modules/diff2html/bundles/css/diff2html.min.css', + dest: 'public/build/', + }, ], }), diff --git a/packages/web/src/elements/DiffView.svelte b/packages/web/src/elements/DiffView.svelte new file mode 100644 index 00000000..3a1cfa25 --- /dev/null +++ b/packages/web/src/elements/DiffView.svelte @@ -0,0 +1,37 @@ + + +
+ {@html diffHtml} +
+ + diff --git a/packages/web/src/tabs/CompareModelTab.svelte b/packages/web/src/tabs/CompareModelTab.svelte index f8e9efac..7fc9308a 100644 --- a/packages/web/src/tabs/CompareModelTab.svelte +++ b/packages/web/src/tabs/CompareModelTab.svelte @@ -7,6 +7,7 @@ import _ from 'lodash'; import { derived, writable } from 'svelte/store'; + import DiffView from '../elements/DiffView.svelte'; import ScrollableTableControl from '../elements/ScrollableTableControl.svelte'; import TabControl from '../elements/TabControl.svelte'; import TableControl from '../elements/TableControl.svelte'; @@ -19,7 +20,7 @@ import SqlEditor from '../query/SqlEditor.svelte'; import useEditorData from '../query/useEditorData'; import { extensions } from '../stores'; - import { computeDbDiffRows, computeTableDiffColumns } from '../utility/computeDiffRows'; + import { computeDbDiffRows, computeTableDiffColumns, getCreateTableScript } from '../utility/computeDiffRows'; import { useConnectionInfo, useDatabaseInfo } from '../utility/metadataLoaders'; export let tabid; @@ -144,20 +145,33 @@ - + + + + +