From a6f66807889e9e7b665df09bc4208de501e9df4d Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 2 Jun 2022 08:40:05 +0200 Subject: [PATCH] full refresh model can be called from command --- packages/api/src/controllers/databaseConnections.js | 4 ++-- packages/api/src/proc/databaseConnectionProcess.js | 5 +++-- packages/web/src/commands/changeDatabaseStatusCommand.ts | 8 +++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/api/src/controllers/databaseConnections.js b/packages/api/src/controllers/databaseConnections.js index 7e6360f9..1078d441 100644 --- a/packages/api/src/controllers/databaseConnections.js +++ b/packages/api/src/controllers/databaseConnections.js @@ -271,9 +271,9 @@ module.exports = { }, syncModel_meta: true, - async syncModel({ conid, database }) { + async syncModel({ conid, database, isFullRefresh }) { const conn = await this.ensureOpened(conid, database); - conn.subprocess.send({ msgtype: 'syncModel' }); + conn.subprocess.send({ msgtype: 'syncModel', isFullRefresh }); return { status: 'ok' }; }, diff --git a/packages/api/src/proc/databaseConnectionProcess.js b/packages/api/src/proc/databaseConnectionProcess.js index 0412721d..afde7372 100644 --- a/packages/api/src/proc/databaseConnectionProcess.js +++ b/packages/api/src/proc/databaseConnectionProcess.js @@ -79,9 +79,10 @@ async function handleIncrementalRefresh(forceSend) { resolveAnalysedPromises(); } -function handleSyncModel() { +function handleSyncModel({ isFullRefresh }) { if (loadingModel) return; - handleIncrementalRefresh(); + if (isFullRefresh) handleFullRefresh(); + else handleIncrementalRefresh(); } function setStatus(status) { diff --git a/packages/web/src/commands/changeDatabaseStatusCommand.ts b/packages/web/src/commands/changeDatabaseStatusCommand.ts index ad2cce07..0d71a7ef 100644 --- a/packages/web/src/commands/changeDatabaseStatusCommand.ts +++ b/packages/web/src/commands/changeDatabaseStatusCommand.ts @@ -18,11 +18,17 @@ registerCommand({ }; return [ { - text: 'Sync model', + text: 'Sync model (incremental)', onClick: () => { apiCall('database-connections/sync-model', dbid); }, }, + { + text: 'Sync model (full)', + onClick: () => { + apiCall('database-connections/sync-model', { ...dbid, isFullRefresh: true }); + }, + }, { text: 'Reopen', onClick: () => {