From fb1c2c61fb0cfadbea9ffc9ea8b4c1dcbd916907 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 16 Feb 2023 17:25:54 +0100 Subject: [PATCH] duplicator improvements --- packages/datalib/src/DataDuplicator.ts | 8 +++ packages/tools/src/schemaEditorTools.ts | 2 +- .../web/src/tabs/DataDuplicatorTab.svelte | 61 +++++++++++++++++-- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/packages/datalib/src/DataDuplicator.ts b/packages/datalib/src/DataDuplicator.ts index faa47570..e15bb0dc 100644 --- a/packages/datalib/src/DataDuplicator.ts +++ b/packages/datalib/src/DataDuplicator.ts @@ -91,6 +91,7 @@ class DuplicatorItemHolder { let inserted = 0; let mapped = 0; let missing = 0; + let lastLogged = new Date(); const writeStream = createAsyncWriteStream(this.duplicator.stream, { processItem: async chunk => { @@ -146,6 +147,13 @@ class DuplicatorItemHolder { break; } } + + if (new Date().getTime() - lastLogged.getTime() > 5000) { + logger.info( + `Duplicating ${this.item.name} in progress, inserted ${inserted} rows, mapped ${mapped} rows, missing ${missing} rows` + ); + lastLogged = new Date(); + } // this.idMap[oldId] = newId; }, }); diff --git a/packages/tools/src/schemaEditorTools.ts b/packages/tools/src/schemaEditorTools.ts index b3a4b8f8..18e09519 100644 --- a/packages/tools/src/schemaEditorTools.ts +++ b/packages/tools/src/schemaEditorTools.ts @@ -129,7 +129,7 @@ export function editorAddColumn(table: TableInfo, column: EditorColumnInfo, addD if (addDataCommand && column.defaultValue) { defineDataCommand(res, () => ({ type: 'setField', - field: column.columnName, + newField: column.columnName, value: parseSqlDefaultValue(column.defaultValue), })); } diff --git a/packages/web/src/tabs/DataDuplicatorTab.svelte b/packages/web/src/tabs/DataDuplicatorTab.svelte index 9e7390c2..3a1ab4d9 100644 --- a/packages/web/src/tabs/DataDuplicatorTab.svelte +++ b/packages/web/src/tabs/DataDuplicatorTab.svelte @@ -12,6 +12,16 @@ testEnabled: () => getCurrentEditor()?.canRun(), onClick: () => getCurrentEditor().run(), }); + registerCommand({ + id: 'dataDuplicator.kill', + category: 'Data duplicator', + icon: 'icon close', + name: 'Kill', + toolbar: true, + isRelatedToTab: true, + testEnabled: () => getCurrentEditor()?.canKill(), + onClick: () => getCurrentEditor().kill(), + }); - +
@@ -185,6 +229,12 @@ +
+ Check all + | + Uncheck all +
+ +