From 8aa1821890d233998bf9a549e25d73c02e85effe Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 8 Nov 2024 13:57:32 +0200 Subject: [PATCH 01/58] Improve getting parent window for export-db window --- src/export-db.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/export-db.js b/src/export-db.js index 2c7c1945..14922f8e 100644 --- a/src/export-db.js +++ b/src/export-db.js @@ -11,6 +11,8 @@ const { showLoadingWindow, hideLoadingWindow } = require('./window-creators/change-loading-win-visibility-state') +const wins = require('./window-creators/windows') +const isMainWinAvailable = require('./helpers/is-main-win-available') const { DEFAULT_ARCHIVE_DB_FILE_NAME, DB_FILE_NAME, @@ -35,7 +37,9 @@ module.exports = ({ const secretKeyPath = path.join(pathToUserData, SECRET_KEY_FILE_NAME) return async () => { - const win = BrowserWindow.getFocusedWindow() + const win = isMainWinAvailable(wins.mainWindow) + ? wins.mainWindow + : BrowserWindow.getFocusedWindow() try { const { From e27f74d90ff8942767807ea1cd53b6a2f07995f7 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 8 Nov 2024 14:07:28 +0200 Subject: [PATCH 02/58] Improve getting parent window for message modal dialog --- src/show-message-modal-dialog.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/show-message-modal-dialog.js b/src/show-message-modal-dialog.js index 7e691fb1..096d58c1 100644 --- a/src/show-message-modal-dialog.js +++ b/src/show-message-modal-dialog.js @@ -2,15 +2,21 @@ const { dialog, BrowserWindow } = require('electron') +const wins = require('./window-creators/windows') +const isMainWinAvailable = require('./helpers/is-main-win-available') + module.exports = async (win, opts = {}) => { - const _win = win && typeof win === 'object' - ? win + const defaultWin = isMainWinAvailable(wins.mainWindow) + ? wins.mainWindow : BrowserWindow.getFocusedWindow() + const parentWin = win && typeof win === 'object' + ? win + : defaultWin const { response: btnId, checkboxChecked - } = await dialog.showMessageBox(_win, { + } = await dialog.showMessageBox(parentWin, { type: 'info', buttons: ['Cancel', 'OK'], defaultId: 1, From 6b38bd3bf7b2eb81c99d2fbccab4caed12118ec6 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 8 Nov 2024 14:17:41 +0200 Subject: [PATCH 03/58] Add translation support to show-message-modal-dialog --- src/show-message-modal-dialog.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/show-message-modal-dialog.js b/src/show-message-modal-dialog.js index 096d58c1..a7ebc258 100644 --- a/src/show-message-modal-dialog.js +++ b/src/show-message-modal-dialog.js @@ -1,6 +1,7 @@ 'use strict' const { dialog, BrowserWindow } = require('electron') +const i18next = require('i18next') const wins = require('./window-creators/windows') const isMainWinAvailable = require('./helpers/is-main-win-available') @@ -18,7 +19,10 @@ module.exports = async (win, opts = {}) => { checkboxChecked } = await dialog.showMessageBox(parentWin, { type: 'info', - buttons: ['Cancel', 'OK'], + buttons: [ + i18next.t('common.showMessageModalDialog.cancelButtonText'), + i18next.t('common.showMessageModalDialog.confirmButtonText') + ], defaultId: 1, cancelId: 0, title: '', From 665b4ac6ee16958d731f5802329dd2c56a9a5d8f Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 8 Nov 2024 14:19:46 +0200 Subject: [PATCH 04/58] Add en translation for show-message-modal-dialog --- build/locales/en/translations.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index 8cebb1a4..b397e35a 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -126,6 +126,10 @@ "message": "Another version of {{productName}} is currently running. Quit it, then launch this version of the app again", "confirmButtonText": "OK" } + }, + "showMessageModalDialog": { + "confirmButtonText": "OK", + "cancelButtonText": "Cancel" } }, "menu": { From 493da195f8aed6df9c538e053f2362c022c71029 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 8 Nov 2024 14:20:09 +0200 Subject: [PATCH 05/58] Add ru translation for show-message-modal-dialog --- build/locales/ru/translations.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index aaf29b4e..a73e1964 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -126,6 +126,10 @@ "message": "В настоящее время запущена другая версия {{productName}}. Закройте ее, затем снова запустите эту версию приложения", "confirmButtonText": "OK" } + }, + "showMessageModalDialog": { + "confirmButtonText": "OK", + "cancelButtonText": "Отмена" } }, "menu": { From 2e3d08a0628ac9dafd14099ddcb943e252a85874 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 11 Nov 2024 12:34:13 +0200 Subject: [PATCH 06/58] Add translation support to show-error-modal-dialog --- src/show-error-modal-dialog.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/show-error-modal-dialog.js b/src/show-error-modal-dialog.js index e689e22e..a2d55ac1 100644 --- a/src/show-error-modal-dialog.js +++ b/src/show-error-modal-dialog.js @@ -1,5 +1,7 @@ 'use strict' +const i18next = require('i18next') + const { InvalidFilePathError, InvalidFileNameInArchiveError, @@ -14,7 +16,9 @@ const showMessageModalDialog = require('./show-message-modal-dialog') const _showErrorBox = (win, title = '', message = '') => { return showMessageModalDialog(win, { type: 'error', - buttons: ['OK'], + buttons: [ + i18next.t('common.showErrorModalDialog.confirmButtonText') + ], defaultId: 0, cancelId: 0, title, @@ -24,7 +28,7 @@ const _showErrorBox = (win, title = '', message = '') => { module.exports = async (win, title = 'Error', err) => { if (err.code === 'ENOENT') { - const message = 'No such file or directory' + const message = i18next.t('common.showErrorModalDialog.enoentErrorMessage') const content = (err.syscall && err.path) ? `${message}, ${err.syscall}: '${err.path}'` : message @@ -32,7 +36,7 @@ module.exports = async (win, title = 'Error', err) => { return _showErrorBox(win, title, content) } if (err.code === 'EACCES') { - const message = 'Permission denied' + const message = i18next.t('common.showErrorModalDialog.eaccesErrorMessage') const content = (err.syscall && err.path) ? `${message}, ${err.syscall}: '${err.path}'` : message @@ -40,12 +44,12 @@ module.exports = async (win, title = 'Error', err) => { return _showErrorBox(win, title, content) } if (err instanceof InvalidFilePathError) { - const message = 'Invalid file path' + const message = i18next.t('common.showErrorModalDialog.invalidFilePathErrorMessage') return _showErrorBox(win, title, message) } if (err instanceof InvalidFileNameInArchiveError) { - const message = 'Invalid file name in archive' + const message = i18next.t('common.showErrorModalDialog.invalidFileNameInArchErrorMessage') return _showErrorBox(win, title, message) } @@ -53,27 +57,27 @@ module.exports = async (win, title = 'Error', err) => { err instanceof DbImportingError || err instanceof InvalidFolderPathError ) { - const message = 'The database has not been imported' + const message = i18next.t('common.showErrorModalDialog.dbImportingErrorMessage') return _showErrorBox(win, title, message) } if (err instanceof DbRemovingError) { - const message = 'The database has not been removed' + const message = i18next.t('common.showErrorModalDialog.dbRemovingErrorMessage') return _showErrorBox(win, title, message) } if (err instanceof ReportsFolderChangingError) { - const message = 'The reports folder has not been changed' + const message = i18next.t('common.showErrorModalDialog.reportsFolderChangingErrorMessage') return _showErrorBox(win, title, message) } if (err instanceof SyncFrequencyChangingError) { - const message = 'The sync frequency has not been changed' + const message = i18next.t('common.showErrorModalDialog.syncFrequencyChangingErrorMessage') return _showErrorBox(win, title, message) } - const message = 'An unexpected exception occurred' + const message = i18next.t('common.showErrorModalDialog.syncFrequencyChangingErrorMessage') return _showErrorBox(win, title, message) } From 54579607c7630143086b3fca975c490e24883bda Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 11 Nov 2024 12:34:31 +0200 Subject: [PATCH 07/58] Add en translation for show-error-modal-dialog --- build/locales/en/translations.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index b397e35a..1655f50e 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -130,6 +130,18 @@ "showMessageModalDialog": { "confirmButtonText": "OK", "cancelButtonText": "Cancel" + }, + "showErrorModalDialog": { + "confirmButtonText": "OK", + "enoentErrorMessage": "No such file or directory", + "eaccesErrorMessage": "Permission denied", + "invalidFilePathErrorMessage": "Invalid file path", + "invalidFileNameInArchErrorMessage": "Invalid file name in archive", + "dbImportingErrorMessage": "The database has not been imported", + "dbRemovingErrorMessage": "The database has not been removed", + "reportsFolderChangingErrorMessage": "The reports folder has not been changed", + "syncFrequencyChangingErrorMessage": "The sync frequency has not been changed", + "unexpectedExceptionMessage": "An unexpected exception occurred" } }, "menu": { From 4f755bca1f9c046c4617acf6cf5d891cddda8a07 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 11 Nov 2024 12:34:49 +0200 Subject: [PATCH 08/58] Add ru translation for show-error-modal-dialog --- build/locales/ru/translations.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index a73e1964..d8fc411d 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -130,6 +130,18 @@ "showMessageModalDialog": { "confirmButtonText": "OK", "cancelButtonText": "Отмена" + }, + "showErrorModalDialog": { + "confirmButtonText": "OK", + "enoentErrorMessage": "Данный файл или каталог отсутствует", + "eaccesErrorMessage": "Доступ запрещен", + "invalidFilePathErrorMessage": "Неверный путь к файлу", + "invalidFileNameInArchErrorMessage": "Неверное имя файла в архиве", + "dbImportingErrorMessage": "База данных не была импортирована", + "dbRemovingErrorMessage": "База данных не была удалена", + "reportsFolderChangingErrorMessage": "Папка отчетов не была изменена", + "syncFrequencyChangingErrorMessage": "Частота синхронизации не была изменена", + "unexpectedExceptionMessage": "Произошло неожиданное исключение" } }, "menu": { From ad4b528f2c58a560ab2ebd8c1d43785e7c42623a Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 11 Nov 2024 12:55:57 +0200 Subject: [PATCH 09/58] Add translation support to export-db --- src/export-db.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/export-db.js b/src/export-db.js index 14922f8e..8ebc5e15 100644 --- a/src/export-db.js +++ b/src/export-db.js @@ -2,6 +2,7 @@ const path = require('path') const { dialog, BrowserWindow } = require('electron') +const i18next = require('i18next') const { InvalidFilePathError } = require('./errors') const { zip } = require('./archiver') @@ -48,9 +49,10 @@ module.exports = ({ } = await dialog.showSaveDialog( win, { - title: 'Database export', + title: i18next.t('common.exportDB.saveDialog.title'), defaultPath, - buttonLabel: 'Export', + buttonLabel: i18next + .t('common.exportDB.saveDialog.buttonLabel'), filters: [{ name: 'ZIP', extensions: ['zip'] }] } ) @@ -75,15 +77,21 @@ module.exports = ({ await hideLoadingWindow() await showMessageModalDialog(win, { - buttons: ['OK'], + buttons: [ + i18next.t('common.exportDB.modalDialog.confirmButtonText') + ], defaultId: 0, - title: 'Database export', - message: 'Exported successfully' + title: i18next.t('common.exportDB.modalDialog.title'), + message: i18next.t('common.exportDB.modalDialog.message') }) } catch (err) { try { await hideLoadingWindow() - await showErrorModalDialog(win, 'Database export', err) + await showErrorModalDialog( + win, + i18next.t('common.exportDB.modalDialog.title'), + err + ) } catch (err) { console.error(err) } From 4491f26d044b48ff66ef0aad33e100da4cdc2453 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 11 Nov 2024 12:56:28 +0200 Subject: [PATCH 10/58] Add en translation for export-db --- build/locales/en/translations.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index 1655f50e..f7f1f680 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -142,6 +142,17 @@ "reportsFolderChangingErrorMessage": "The reports folder has not been changed", "syncFrequencyChangingErrorMessage": "The sync frequency has not been changed", "unexpectedExceptionMessage": "An unexpected exception occurred" + }, + "exportDB": { + "saveDialog": { + "title": "Database export", + "buttonLabel": "Export" + }, + "modalDialog": { + "confirmButtonText": "OK", + "title": "Database export", + "message": "Exported successfully" + } } }, "menu": { From ebbae4b012d1ee0629181372a1d2fa63895f27da Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 11 Nov 2024 12:56:44 +0200 Subject: [PATCH 11/58] Add ru translation for export-db --- build/locales/ru/translations.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index d8fc411d..e66ca0bf 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -142,6 +142,17 @@ "reportsFolderChangingErrorMessage": "Папка отчетов не была изменена", "syncFrequencyChangingErrorMessage": "Частота синхронизации не была изменена", "unexpectedExceptionMessage": "Произошло неожиданное исключение" + }, + "exportDB": { + "saveDialog": { + "title": "Экспорт базы данных", + "buttonLabel": "Экспортировать" + }, + "modalDialog": { + "confirmButtonText": "OK", + "title": "Экспорт базы данных", + "message": "Экспортирована успешно" + } } }, "menu": { From 85148aa9115dd963c65345e266d70dce3f9d3c03 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 12 Nov 2024 11:53:28 +0200 Subject: [PATCH 12/58] Improve getting parent window for import-db window --- src/import-db.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/import-db.js b/src/import-db.js index c41b09ca..9ca42a56 100644 --- a/src/import-db.js +++ b/src/import-db.js @@ -10,7 +10,8 @@ const { unzip } = require('./archiver') const showErrorModalDialog = require('./show-error-modal-dialog') const pauseApp = require('./pause-app') const relaunch = require('./relaunch') -const { rm } = require('./helpers') +const { rm, isMainWinAvailable } = require('./helpers') +const wins = require('./window-creators/windows') const { DB_FILE_NAME, DB_SHM_FILE_NAME, @@ -39,7 +40,9 @@ module.exports = ({ pathToUserDocuments }) => { return async () => { - const win = BrowserWindow.getFocusedWindow() + const win = isMainWinAvailable(wins.mainWindow) + ? wins.mainWindow + : BrowserWindow.getFocusedWindow() try { const { From 4a08da65e4cba1a0bb8f0f66a5ebc71e7827cd83 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 12 Nov 2024 13:48:44 +0200 Subject: [PATCH 13/58] Add translation support to import-db --- src/import-db.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/import-db.js b/src/import-db.js index 9ca42a56..58e3e646 100644 --- a/src/import-db.js +++ b/src/import-db.js @@ -1,6 +1,7 @@ 'use strict' const { dialog, BrowserWindow } = require('electron') +const i18next = require('i18next') const { InvalidFilePathError, @@ -51,9 +52,10 @@ module.exports = ({ } = await dialog.showOpenDialog( win, { - title: 'Database import', + title: i18next.t('common.importDB.openDialog.title'), defaultPath: pathToUserDocuments, - buttonLabel: 'Import', + buttonLabel: i18next + .t('common.importDB.openDialog.buttonLabel'), properties: [ 'openFile', 'createDirectory', @@ -98,7 +100,11 @@ module.exports = ({ relaunch() } catch (err) { try { - await showErrorModalDialog(win, 'Database import', err) + await showErrorModalDialog( + win, + i18next.t('common.importDB.modalDialog.title'), + err + ) } catch (err) { console.error(err) } From f8543e8a93889a80808b8b542ce4cb93612deeb1 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 12 Nov 2024 13:49:03 +0200 Subject: [PATCH 14/58] Add en translation for import-db --- build/locales/en/translations.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index f7f1f680..b392f3ba 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -153,6 +153,15 @@ "title": "Database export", "message": "Exported successfully" } + }, + "importDB": { + "openDialog": { + "title": "Database import", + "buttonLabel": "Import" + }, + "modalDialog": { + "title": "Database import" + } } }, "menu": { From dd5fb945ed8ddf8be4e170f1a2ba00480348cedc Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 12 Nov 2024 13:49:20 +0200 Subject: [PATCH 15/58] Add ru translation for import-db --- build/locales/ru/translations.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index e66ca0bf..e96ab7c1 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -153,6 +153,15 @@ "title": "Экспорт базы данных", "message": "Экспортирована успешно" } + }, + "importDB": { + "openDialog": { + "title": "Импорт базы данных", + "buttonLabel": "Импортировать" + }, + "modalDialog": { + "title": "Импорт базы данных" + } } }, "menu": { From 2650a905e5db53c495f9b06b9b01e386d71c34ce Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 14 Nov 2024 09:39:08 +0200 Subject: [PATCH 16/58] Bump archiver up to 7.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 42c82aff..264e498b 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "license": "Apache-2.0", "dependencies": { - "archiver": "5.3.0", + "archiver": "7.0.1", "bfx-svc-test-helper": "git+https://github.com/bitfinexcom/bfx-svc-test-helper.git", "bittorrent-dht": "10.0.2", "changelog-parser": "3.0.1", From 7987a4d24653b68b530f88c7bc7b3c406ffa2727 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 14 Nov 2024 09:40:06 +0200 Subject: [PATCH 17/58] Fix unexpected exception message --- src/show-error-modal-dialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/show-error-modal-dialog.js b/src/show-error-modal-dialog.js index a2d55ac1..abc10392 100644 --- a/src/show-error-modal-dialog.js +++ b/src/show-error-modal-dialog.js @@ -77,7 +77,7 @@ module.exports = async (win, title = 'Error', err) => { return _showErrorBox(win, title, message) } - const message = i18next.t('common.showErrorModalDialog.syncFrequencyChangingErrorMessage') + const message = i18next.t('common.showErrorModalDialog.unexpectedExceptionMessage') return _showErrorBox(win, title, message) } From 74b8a6b3a78c9875e1b3bc06822ced72d44ad372 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 14 Nov 2024 09:43:37 +0200 Subject: [PATCH 18/58] Add ability to set progress to loading window --- .../change-loading-win-visibility-state.js | 86 ++++++++++++++----- 1 file changed, 65 insertions(+), 21 deletions(-) diff --git a/src/window-creators/change-loading-win-visibility-state.js b/src/window-creators/change-loading-win-visibility-state.js index 158a47ab..3962dd31 100644 --- a/src/window-creators/change-loading-win-visibility-state.js +++ b/src/window-creators/change-loading-win-visibility-state.js @@ -59,11 +59,12 @@ const _setParentWindow = (noParent) => { wins.loadingWindow.setParentWindow(win) } -const _runProgressLoader = (opts = {}) => { +const _runProgressLoader = (opts) => { const { win = wins.loadingWindow, - isIndeterminateMode = false - } = { ...opts } + isIndeterminateMode = false, + progress + } = opts ?? {} if ( !win || @@ -72,6 +73,20 @@ const _runProgressLoader = (opts = {}) => { ) { return } + if (Number.isFinite(progress)) { + if ( + progress >= 1 && + !isIndeterminateMode + ) { + win.setProgressBar(-0.1) + + return + } + + win.setProgressBar(progress) + + return + } if (isIndeterminateMode) { // Change to indeterminate mode when progress > 1 win.setProgressBar(1.1) @@ -83,14 +98,14 @@ const _runProgressLoader = (opts = {}) => { const duration = 3000 // ms const interval = duration / fps // ms const step = 1 / (duration / interval) - let progress = 0 + let _progress = 0 intervalMarker = setInterval(() => { - if (progress >= 1) { - progress = 0 + if (_progress >= 1) { + _progress = 0 } - progress += step + _progress += step if ( !win || @@ -102,7 +117,7 @@ const _runProgressLoader = (opts = {}) => { return } - win.setProgressBar(progress) + win.setProgressBar(_progress) }, interval).unref() } @@ -123,8 +138,14 @@ const _stopProgressLoader = ( win.setProgressBar(-0.1) } -const _setLoadingDescription = async (win, description) => { +const setLoadingDescription = async (params) => { try { + const { + win = wins.loadingWindow, + progress, + description = '' + } = params ?? {} + if ( !win || typeof win !== 'object' || @@ -134,11 +155,31 @@ const _setLoadingDescription = async (win, description) => { return } + const _progressPerc = ( + Number.isFinite(progress) && + progress > 0 + ) + ? Math.floor(progress * 100) + : null + const progressPerc = ( + Number.isFinite(_progressPerc) && + _progressPerc > 100 + ) + ? 100 + : _progressPerc + const descriptionChunk = description + ? `

${description}

` + : '

' + const progressChunk = Number.isFinite(progressPerc) + ? `

${progressPerc} %

` + : '

' + const _description = `${progressChunk}${descriptionChunk}` + const loadingDescReadyPromise = GeneralIpcChannelHandlers .onLoadingDescriptionReady() GeneralIpcChannelHandlers - .sendLoadingDescription(win, { description }) + .sendLoadingDescription(win, { description: _description }) const loadingRes = await loadingDescReadyPromise @@ -152,6 +193,7 @@ const _setLoadingDescription = async (win, description) => { const showLoadingWindow = async (opts) => { const { + progress, description = '', isRequiredToCloseAllWins = false, isNotRunProgressLoaderRequired = false, @@ -170,14 +212,18 @@ const showLoadingWindow = async (opts) => { _setParentWindow(isRequiredToCloseAllWins || noParent) - if (!isNotRunProgressLoaderRequired) { - _runProgressLoader({ isIndeterminateMode }) + const _progress = Number.isFinite(progress) + ? Math.floor(progress * 100) / 100 + : progress + + if ( + !isNotRunProgressLoaderRequired || + Number.isFinite(progress) + ) { + _runProgressLoader({ progress: _progress, isIndeterminateMode }) } - await _setLoadingDescription( - wins.loadingWindow, - description - ) + await setLoadingDescription({ progress: _progress, description }) if (!wins.loadingWindow.isVisible()) { centerWindow(wins.loadingWindow) @@ -197,10 +243,7 @@ const hideLoadingWindow = async (opts) => { } = opts ?? {} // need to empty description - await _setLoadingDescription( - wins.loadingWindow, - '' - ) + await setLoadingDescription({ description: '' }) _stopProgressLoader() if (isRequiredToShowMainWin) { @@ -224,5 +267,6 @@ const hideLoadingWindow = async (opts) => { module.exports = { showLoadingWindow, - hideLoadingWindow + hideLoadingWindow, + setLoadingDescription } From 44bc6cb2b4a7bb6e8782b454409dcf35d0bb0574 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 14 Nov 2024 09:47:19 +0200 Subject: [PATCH 19/58] Add ability to process progress handler in archiver --- src/archiver.js | 109 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 96 insertions(+), 13 deletions(-) diff --git a/src/archiver.js b/src/archiver.js index b4bb460a..6a4c86b0 100644 --- a/src/archiver.js +++ b/src/archiver.js @@ -9,17 +9,66 @@ const { InvalidFileNameInArchiveError } = require('./errors') -const zip = ( +const getTotalFilesStats = async (filePaths) => { + const promises = filePaths.map((filePath) => { + return fs.promises.stat(filePath) + }) + const stats = await Promise.all(promises) + const size = stats.reduce((size, stat) => { + return Number.isFinite(stat?.size) + ? size + stat.size + : size + }, 0) + + return { + size, + stats + } +} + +const bytesToSize = (bytes) => { + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] + + if (bytes <= 0) { + return '0 Byte' + } + + const i = Number.parseInt(Math.floor(Math.log(bytes) / Math.log(1024))) + const val = Math.round(bytes / Math.pow(1024, i), 2) + const size = sizes[i] + + return `${val} ${size}` +} + +const zip = async ( zipPath, - filePaths = [], - params = {} + filePaths, + params ) => { - return new Promise((resolve, reject) => { + const _filePaths = Array.isArray(filePaths) + ? filePaths + : [filePaths] + const { + size, + stats + } = await getTotalFilesStats(_filePaths) + + return new Promise((_resolve, _reject) => { + let interval = null + const resolve = (...args) => { + clearInterval(interval) + return _resolve(...args) + } + const reject = (err) => { + clearInterval(interval) + return _reject(err) + } + try { - const _filePaths = Array.isArray(filePaths) - ? filePaths - : [filePaths] - const { zlib } = { ...params } + const { + zlib, + progressHandler + } = params ?? {} const _params = { ...params, zlib: { @@ -36,16 +85,50 @@ const zip = ( archive.on('error', reject) archive.on('warning', reject) + if (typeof progressHandler === 'function') { + let processedBytes = 0 + + const asyncProgressHandler = async () => { + try { + if ( + !Number.isFinite(size) || + size === 0 || + !Number.isFinite(processedBytes) + ) { + return + } + + const progress = processedBytes / size + const archiveBytes = archive.pointer() + const prettyArchiveSize = bytesToSize(archiveBytes) + + await progressHandler({ + progress, + archiveBytes, + prettyArchiveSize + }) + } catch (err) { + console.debug(err) + } + } + + archive.on('progress', async (e) => { + processedBytes = e.fs.processedBytes ?? 0 + await asyncProgressHandler() + }) + interval = setInterval(asyncProgressHandler, 3000) + } + archive.pipe(output) - _filePaths.forEach((file) => { - const readStream = fs.createReadStream(file) - const name = path.basename(file) + for (const [i, filePath] of _filePaths.entries()) { + const readStream = fs.createReadStream(filePath) + const name = path.basename(filePath) readStream.on('error', reject) - archive.append(readStream, { name }) - }) + archive.append(readStream, { name, stats: stats[i] }) + } archive.finalize() } catch (err) { From f806be72483508bc2d0c5fcce6e5bd845c2948de Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 14 Nov 2024 14:24:30 +0200 Subject: [PATCH 20/58] Add progress perc to loading window for export-db module --- src/export-db.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/export-db.js b/src/export-db.js index 8ebc5e15..5cbbfc43 100644 --- a/src/export-db.js +++ b/src/export-db.js @@ -10,7 +10,8 @@ const showErrorModalDialog = require('./show-error-modal-dialog') const showMessageModalDialog = require('./show-message-modal-dialog') const { showLoadingWindow, - hideLoadingWindow + hideLoadingWindow, + setLoadingDescription } = require('./window-creators/change-loading-win-visibility-state') const wins = require('./window-creators/windows') const isMainWinAvailable = require('./helpers/is-main-win-available') @@ -67,13 +68,37 @@ module.exports = ({ throw new InvalidFilePathError() } - await showLoadingWindow() + await showLoadingWindow({ + description: i18next + .t('common.exportDB.loadingWindow.description') + }) + + const progressHandler = async (args) => { + const { + progress, + prettyArchiveSize + } = args ?? {} + + const _description = i18next.t('common.exportDB.loadingWindow.description') + const _archived = i18next.t( + 'common.exportDB.loadingWindow.archiveSize', + { prettyArchiveSize } + ) + + const archived = prettyArchiveSize + ? `
${_archived}` + : '' + const description = `${_description}${archived}` + + await setLoadingDescription({ progress, description }) + } + await zip(filePath, [ dbPath, dbShmPath, dbWalPath, secretKeyPath - ]) + ], { progressHandler }) await hideLoadingWindow() await showMessageModalDialog(win, { From aec5e7b0cefb7760168ac344abe9e42df0007f24 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 14 Nov 2024 14:25:58 +0200 Subject: [PATCH 21/58] Add en translation for export-db loading window --- build/locales/en/translations.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index b392f3ba..41ccc6c3 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -152,6 +152,10 @@ "confirmButtonText": "OK", "title": "Database export", "message": "Exported successfully" + }, + "loadingWindow": { + "description": "Exporting DB ...", + "archiveSize": "archive size {{prettyArchiveSize}}" } }, "importDB": { From fba2cec3b28fae1f816594eb16f2f67c9b68045c Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 14 Nov 2024 14:26:14 +0200 Subject: [PATCH 22/58] Add ru translation for export-db loading window --- build/locales/ru/translations.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index e96ab7c1..8c808737 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -152,6 +152,10 @@ "confirmButtonText": "OK", "title": "Экспорт базы данных", "message": "Экспортирована успешно" + }, + "loadingWindow": { + "description": "Экспортирование БД ...", + "archiveSize": "размер архива {{prettyArchiveSize}}" } }, "importDB": { From 81fe940918c360a3820aa3382f73af9bed97ae67 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 18 Nov 2024 12:40:29 +0200 Subject: [PATCH 23/58] Bump yauzl up to 3.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 264e498b..a07ec864 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "new-github-issue-url": "0.2.1", "showdown": "2.0.3", "truncate-utf8-bytes": "1.0.2", - "yauzl": "2.10.0" + "yauzl": "3.2.0" }, "devDependencies": { "@mapbox/node-pre-gyp": "1.0.11", From 6ad1e647b302d31914bca52fd7c132acc33dbba6 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 18 Nov 2024 12:40:57 +0200 Subject: [PATCH 24/58] Add ability to process progress handler when unzipping --- src/archiver.js | 129 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 93 insertions(+), 36 deletions(-) diff --git a/src/archiver.js b/src/archiver.js index 6a4c86b0..eccbffc2 100644 --- a/src/archiver.js +++ b/src/archiver.js @@ -140,15 +140,72 @@ const zip = async ( const unzip = ( zipPath, folderPath, - params = {} + params ) => { - const { extractFiles } = { ...params } - const extractedfileNames = [] - let isClosedByError = false + const { + extractFiles, + progressHandler + } = params ?? {} + return new Promise((_resolve, _reject) => { + const entryStates = [] + let totalUncompressedSize = 0 + let unzippedBytes = 0 + let lastProgressEventMts = Date.now() + + const asyncProgressHandler = async () => { + try { + if (typeof progressHandler !== 'function') { + return + } + + if ( + !Number.isFinite(totalUncompressedSize) || + totalUncompressedSize === 0 || + !Number.isFinite(unzippedBytes) + ) { + return + } + + const progress = unzippedBytes / totalUncompressedSize + const prettyUnzippedBytes = bytesToSize(unzippedBytes) + + await progressHandler({ + progress, + unzippedBytes, + prettyUnzippedBytes + }) + } catch (err) { + console.debug(err) + } + } + const resolve = (entryState) => { + if (entryState) { + entryState.isClosedSuccessfully = true + } + if ( + entryStates.some((state) => state?.isClosedWithError) || + entryStates.some((state) => !state?.isClosedSuccessfully) + ) { + return + } + + asyncProgressHandler() + + return _resolve(entryStates.map((state) => state?.entry?.fileName)) + } + const reject = (err, zipfile, entryState) => { + if (entryState) { + entryState.isClosedWithError = true + } + if (zipfile) { + zipfile.close() + } + + return _reject(err) + } - return new Promise((resolve, reject) => { try { - yauzl.open(zipPath, { lazyEntries: true }, (err, zipfile) => { + yauzl.open(zipPath, { lazyEntries: false }, (err, zipfile) => { if (err) { reject(err) @@ -156,67 +213,67 @@ const unzip = ( } zipfile.on('error', reject) - zipfile.on('end', () => { - if (isClosedByError) { - return - } - - resolve(extractedfileNames) - }) - zipfile.readEntry() - + zipfile.on('end', () => resolve()) zipfile.on('entry', (entry) => { const { fileName } = entry const filePath = path.join(folderPath, fileName) const errorMessage = yauzl.validateFileName(fileName) if (/\/$/.test(fileName)) { - zipfile.readEntry() - return } if ( Array.isArray(extractFiles) && extractFiles.every(file => file !== fileName) ) { - zipfile.readEntry() - return } + + const entryState = { + isClosedWithError: false, + isClosedSuccessfully: false, + entry + } + totalUncompressedSize += entry?.uncompressedSize ?? 0 + entryStates.push(entryState) + if (errorMessage) { - isClosedByError = true - zipfile.close() - reject(new InvalidFileNameInArchiveError(errorMessage)) + reject( + new InvalidFileNameInArchiveError(errorMessage), + zipfile, + entryState + ) return } zipfile.openReadStream(entry, (err, readStream) => { if (err) { - isClosedByError = true - zipfile.close() - reject(err) + reject(err, zipfile, entryState) return } const output = fs.createWriteStream(filePath) - output.on('close', () => { - extractedfileNames.push(fileName) - - zipfile.readEntry() - }) + output.on('close', () => resolve(entryState)) output.on('error', (err) => { - isClosedByError = true - zipfile.close() - reject(err) + reject(err, zipfile, entryState) }) readStream.on('error', (err) => { - isClosedByError = true - zipfile.close() - reject(err) + reject(err, zipfile, entryState) + }) + readStream.on('data', (chunk) => { + unzippedBytes += chunk.length + const currMts = Date.now() + + if (currMts - lastProgressEventMts < 500) { + return + } + + lastProgressEventMts = currMts + asyncProgressHandler() }) readStream.pipe(output) From a4303e924ec114b77ecbb2cd9ffa8097a7d1578c Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 18 Nov 2024 12:41:32 +0200 Subject: [PATCH 25/58] Add ability to show description when pausing app --- src/pause-app.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pause-app.js b/src/pause-app.js index 3883dd78..96d513b2 100644 --- a/src/pause-app.js +++ b/src/pause-app.js @@ -28,12 +28,16 @@ const _closeServer = () => { }) } -module.exports = async (opts = {}) => { +module.exports = async (opts) => { const { - beforeClosingServHook = () => {} - } = opts + beforeClosingServHook = () => {}, + loadingWinParams + } = opts ?? {} - await showLoadingWindow({ isRequiredToCloseAllWins: true }) + await showLoadingWindow({ + isRequiredToCloseAllWins: true, + ...loadingWinParams + }) await beforeClosingServHook() From eac8fa7b1e90e080f126f3e913ed3c2cde181924 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 18 Nov 2024 12:41:56 +0200 Subject: [PATCH 26/58] Add progress perc to loading window for import-db module --- src/import-db.js | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/import-db.js b/src/import-db.js index 58e3e646..a940a2f0 100644 --- a/src/import-db.js +++ b/src/import-db.js @@ -13,6 +13,9 @@ const pauseApp = require('./pause-app') const relaunch = require('./relaunch') const { rm, isMainWinAvailable } = require('./helpers') const wins = require('./window-creators/windows') +const { + setLoadingDescription +} = require('./window-creators/change-loading-win-visibility-state') const { DB_FILE_NAME, DB_SHM_FILE_NAME, @@ -78,7 +81,33 @@ module.exports = ({ throw new InvalidFilePathError() } - await pauseApp() + const progressHandler = async (args) => { + const { + progress, + prettyUnzippedBytes + } = args ?? {} + + const _description = i18next + .t('common.importDB.loadingWindow.description') + const _unzipped = i18next.t( + 'common.importDB.loadingWindow.unzippedBytes', + { prettyUnzippedBytes } + ) + + const unzipped = prettyUnzippedBytes + ? `
${_unzipped}` + : '' + const description = `${_description}${unzipped}` + + await setLoadingDescription({ progress, description }) + } + + await pauseApp({ + loadingWinParams: { + description: i18next + .t('common.importDB.loadingWindow.description') + } + }) await _rmDbExcludeMain(pathToUserData, DB_FILE_NAME) const extractedfileNames = await unzip( filePaths[0], @@ -89,7 +118,8 @@ module.exports = ({ DB_SHM_FILE_NAME, DB_WAL_FILE_NAME, SECRET_KEY_FILE_NAME - ] + ], + progressHandler } ) @@ -100,8 +130,11 @@ module.exports = ({ relaunch() } catch (err) { try { + const _win = isMainWinAvailable(wins.loadingWindow) + ? wins.loadingWindow + : win await showErrorModalDialog( - win, + _win, i18next.t('common.importDB.modalDialog.title'), err ) From 1acd10d8e170f8cfe02f3891c4656a67e2c67146 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 18 Nov 2024 12:42:18 +0200 Subject: [PATCH 27/58] Add en translation for import-db loading window --- build/locales/en/translations.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index 41ccc6c3..62603f97 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -165,6 +165,10 @@ }, "modalDialog": { "title": "Database import" + }, + "loadingWindow": { + "description": "Importing DB ...", + "unzippedBytes": "DB size {{prettyUnzippedBytes}}" } } }, From d4864b72a21be0695c4733f382fd5c2097f6c624 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 18 Nov 2024 12:42:40 +0200 Subject: [PATCH 28/58] Add ru translation for import-db loading window --- build/locales/ru/translations.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index 8c808737..687ba602 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -165,6 +165,10 @@ }, "modalDialog": { "title": "Импорт базы данных" + }, + "loadingWindow": { + "description": "Импортирование БД ...", + "unzippedBytes": "размер БД {{prettyUnzippedBytes}}" } } }, From 5e02c8983274308619b03ab69cdc0113736a2adb Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 19 Nov 2024 12:15:58 +0200 Subject: [PATCH 29/58] Improve getting parent window for remove-db module --- src/remove-db.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/remove-db.js b/src/remove-db.js index dd90f105..345fa3cc 100644 --- a/src/remove-db.js +++ b/src/remove-db.js @@ -1,10 +1,12 @@ 'use strict' -const electron = require('electron') +const { BrowserWindow } = require('electron') const ipcs = require('./ipcs') const showErrorModalDialog = require('./show-error-modal-dialog') const showMessageModalDialog = require('./show-message-modal-dialog') +const wins = require('./window-creators/windows') +const isMainWinAvailable = require('./helpers/is-main-win-available') const pauseApp = require('./pause-app') const relaunch = require('./relaunch') const { rm } = require('./helpers') @@ -85,7 +87,9 @@ module.exports = ({ shouldAllTablesBeCleared }) => { return async () => { - const win = electron.BrowserWindow.getFocusedWindow() + const win = isMainWinAvailable(wins.mainWindow) + ? wins.mainWindow + : BrowserWindow.getFocusedWindow() const title = shouldAllTablesBeCleared ? 'Clear all data' : 'Remove database' @@ -124,7 +128,10 @@ module.exports = ({ relaunch() } catch (err) { try { - await showErrorModalDialog(win, title, err) + const _win = isMainWinAvailable(wins.loadingWindow) + ? wins.loadingWindow + : win + await showErrorModalDialog(_win, title, err) } catch (err) { console.error(err) } From ccfd9f9324840a10a8553120424e638c6124f113 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 19 Nov 2024 12:30:04 +0200 Subject: [PATCH 30/58] Add ability to show description when pausing app --- src/remove-db.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/remove-db.js b/src/remove-db.js index 345fa3cc..c25edf3b 100644 --- a/src/remove-db.js +++ b/src/remove-db.js @@ -1,6 +1,7 @@ 'use strict' const { BrowserWindow } = require('electron') +const i18next = require('i18next') const ipcs = require('./ipcs') const showErrorModalDialog = require('./show-error-modal-dialog') @@ -118,6 +119,10 @@ module.exports = ({ } await _clearAllTables() + }, + loadingWinParams: { + description: i18next + .t('common.removeDB.loadingWindow.description') } }) From 48cc0cb30bea68994a66896ecf1f0e5a71904f3b Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 19 Nov 2024 13:41:04 +0200 Subject: [PATCH 31/58] Add translation support to remove-db --- src/remove-db.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/remove-db.js b/src/remove-db.js index c25edf3b..92db08ad 100644 --- a/src/remove-db.js +++ b/src/remove-db.js @@ -92,11 +92,11 @@ module.exports = ({ ? wins.mainWindow : BrowserWindow.getFocusedWindow() const title = shouldAllTablesBeCleared - ? 'Clear all data' - : 'Remove database' + ? i18next.t('common.removeDB.modalDialog.clearDataTitle') + : i18next.t('common.removeDB.modalDialog.removeDBTitle') const message = shouldAllTablesBeCleared - ? 'Are you sure you want to clear all data?' - : 'Are you sure you want to remove the database?' + ? i18next.t('common.removeDB.modalDialog.clearDataMessage') + : i18next.t('common.removeDB.modalDialog.removeDBMessage') try { const { From 4d0321c49e593fad6407ae41c9b091854504e5df Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 19 Nov 2024 13:45:58 +0200 Subject: [PATCH 32/58] Add en translation for remove-db --- build/locales/en/translations.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index 62603f97..2e1e27c0 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -170,6 +170,17 @@ "description": "Importing DB ...", "unzippedBytes": "DB size {{prettyUnzippedBytes}}" } + }, + "removeDB": { + "modalDialog": { + "clearDataTitle": "Clear all data", + "removeDBTitle": "Remove database", + "clearDataMessage": "Are you sure you want to clear all data?", + "removeDBMessage": "Are you sure you want to remove the database?" + }, + "loadingWindow": { + "description": "Removing DB ..." + } } }, "menu": { From ff04e741e28c26564632319410ad9a6302ae2912 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 19 Nov 2024 13:46:12 +0200 Subject: [PATCH 33/58] Add ru translation for remove-db --- build/locales/ru/translations.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index 687ba602..c19d8cba 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -170,6 +170,17 @@ "description": "Импортирование БД ...", "unzippedBytes": "размер БД {{prettyUnzippedBytes}}" } + }, + "removeDB": { + "modalDialog": { + "clearDataTitle": "Очистить все данные", + "removeDBTitle": "Удалить базу данных", + "clearDataMessage": "Вы уверены, что хотите удалить все данные?", + "removeDBMessage": "Вы уверены, что хотите удалить базу данных?" + }, + "loadingWindow": { + "description": "Удаление БД ..." + } } }, "menu": { From c01dc780fb38c99172784fb913ec1eeb8d7123e5 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 20 Nov 2024 10:44:27 +0200 Subject: [PATCH 34/58] Add translation support to manage-worker-messages for removing db --- src/manage-worker-messages.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/manage-worker-messages.js b/src/manage-worker-messages.js index 14f4e316..bcfeaf3d 100644 --- a/src/manage-worker-messages.js +++ b/src/manage-worker-messages.js @@ -93,18 +93,20 @@ module.exports = (ipc) => { await showWindow(win) const haveNotAllDbDataBeenRemoved = state === PROCESS_MESSAGES.ALL_TABLE_HAVE_NOT_BEEN_REMOVED - const messChunk = haveNotAllDbDataBeenRemoved - ? ' not' - : '' + const message = haveNotAllDbDataBeenRemoved + ? i18next.t('common.removeDB.messageModalDialog.dbDataHasNotBeenRemovedMessage') + : i18next.t('common.removeDB.messageModalDialog.dbDataHasBeenRemovedMessage') const type = haveNotAllDbDataBeenRemoved ? 'error' : 'info' await showMessageModalDialog(win, { type, - title: 'DB removing', - message: `DB data have${messChunk} been removed`, - buttons: ['OK'], + title: i18next.t('common.removeDB.messageModalDialog.dbRemovingTitle'), + message, + buttons: [ + i18next.t('common.removeDB.messageModalDialog.confirmButtonText') + ], defaultId: 0, cancelId: 0 }) @@ -219,16 +221,19 @@ module.exports = (ipc) => { } if (state === PROCESS_MESSAGES.REQUEST_SHOULD_ALL_TABLES_BE_REMOVED) { const title = data.isNotDbRestored - ? 'DB has not been restored' - : 'Remove database' + ? i18next.t('common.removeDB.messageModalDialog.dbHasNotBeenRestoredTitle') + : i18next.t('common.removeDB.messageModalDialog.removeDBTitle') const { btnId } = await showMessageModalDialog(win, { type: 'question', title, - message: 'Should all tables be removed?', - buttons: ['Cancel', 'OK'] + message: i18next.t('common.removeDB.messageModalDialog.removeDBMessage'), + buttons: [ + i18next.t('common.removeDB.messageModalDialog.cancelButtonText'), + i18next.t('common.removeDB.messageModalDialog.confirmButtonText') + ] }) if (btnId === 0) { From 8e1f5982815337470a97d4a90304f2526751942c Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 20 Nov 2024 10:45:25 +0200 Subject: [PATCH 35/58] Add en translation for manage-worker-messages --- build/locales/en/translations.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index 2e1e27c0..df8961c6 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -178,6 +178,16 @@ "clearDataMessage": "Are you sure you want to clear all data?", "removeDBMessage": "Are you sure you want to remove the database?" }, + "messageModalDialog": { + "dbRemovingTitle": "DB removing", + "dbDataHasBeenRemovedMessage": "DB data has been removed", + "dbDataHasNotBeenRemovedMessage": "DB data has not been removed", + "dbHasNotBeenRestoredTitle": "DB has not been restored", + "removeDBTitle": "Remove database", + "removeDBMessage": "Should all tables be removed?", + "confirmButtonText": "OK", + "cancelButtonText": "Cancel" + }, "loadingWindow": { "description": "Removing DB ..." } From 64b568d2204d2e5e7b9f5a5dd199872c8c644423 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 20 Nov 2024 10:45:45 +0200 Subject: [PATCH 36/58] Add ru translation for manage-worker-messages --- build/locales/ru/translations.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index c19d8cba..6f87ca44 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -178,6 +178,16 @@ "clearDataMessage": "Вы уверены, что хотите удалить все данные?", "removeDBMessage": "Вы уверены, что хотите удалить базу данных?" }, + "messageModalDialog": { + "dbRemovingTitle": "Удаление БД", + "dbDataHasBeenRemovedMessage": "Данные БД были удалены", + "dbDataHasNotBeenRemovedMessage": "Данные БД не были удалены", + "dbHasNotBeenRestoredTitle": "БД не восстановлена", + "removeDBTitle": "Удалить базу данных", + "removeDBMessage": "Следует ли удалить все таблицы?", + "confirmButtonText": "OK", + "cancelButtonText": "Отмена" + }, "loadingWindow": { "description": "Удаление БД ..." } From e1023af65b12e2984e11481378e8244df8734802 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 20 Nov 2024 10:46:32 +0200 Subject: [PATCH 37/58] Improve loading window for removing db --- build/locales/en/translations.json | 3 ++- build/locales/ru/translations.json | 3 ++- src/remove-db.js | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index df8961c6..77f80df5 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -189,7 +189,8 @@ "cancelButtonText": "Cancel" }, "loadingWindow": { - "description": "Removing DB ..." + "removingDBDescription": "Removing DB ...", + "clearingAllDataDescription": "Clearing all data ..." } } }, diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index 6f87ca44..307e80f4 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -189,7 +189,8 @@ "cancelButtonText": "Отмена" }, "loadingWindow": { - "description": "Удаление БД ..." + "removingDBDescription": "Удаление БД ...", + "clearingAllDataDescription": "Очистка всех данные ..." } } }, diff --git a/src/remove-db.js b/src/remove-db.js index 92db08ad..56830a30 100644 --- a/src/remove-db.js +++ b/src/remove-db.js @@ -121,8 +121,9 @@ module.exports = ({ await _clearAllTables() }, loadingWinParams: { - description: i18next - .t('common.removeDB.loadingWindow.description') + description: shouldAllTablesBeCleared + ? i18next.t('common.removeDB.loadingWindow.clearingAllDataDescription') + : i18next.t('common.removeDB.loadingWindow.removingDBDescription') } }) From bd3da5b7de5251b087da73fa4aec2355356f1b11 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 08:34:20 +0200 Subject: [PATCH 38/58] Add translation support to backup-db --- src/manage-worker-messages.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/manage-worker-messages.js b/src/manage-worker-messages.js index bcfeaf3d..c5a04d60 100644 --- a/src/manage-worker-messages.js +++ b/src/manage-worker-messages.js @@ -120,18 +120,20 @@ module.exports = (ipc) => { await showWindow(win) const isBackupError = state === PROCESS_MESSAGES.ERROR_BACKUP - const messChunk = isBackupError - ? ' not' - : '' + const message = isBackupError + ? i18next.t('common.backupDB.dbBackupHasNotBeenDone') + : i18next.t('common.backupDB.dbBackupHasBeenDone') const type = isBackupError ? 'error' : 'info' await showMessageModalDialog(win, { type, - title: 'DB backup', - message: `DB backup has${messChunk} been successfully`, - buttons: ['OK'], + title: i18next.t('common.backupDB.backupDBTitle'), + message, + buttons: [ + i18next.t('common.backupDB.confirmButtonText') + ], defaultId: 0, cancelId: 0 }) @@ -176,12 +178,12 @@ module.exports = (ipc) => { const type = isMigrationsError ? 'error' : 'info' - const message = isMigrationsError + const message = isMigrationsError // TODO: ? 'DВ migration failed, all data has been deleted,\nsynchronization will start from scratch' : 'DB migration completed successfully' const buttons = isMigrationsError - ? ['Cancel'] - : ['OK'] + ? ['Cancel'] // TODO: + : ['OK'] // TODO: await showMessageModalDialog(win, { type, @@ -198,9 +200,9 @@ module.exports = (ipc) => { btnId } = await showMessageModalDialog(win, { type: 'question', - title: 'The migration has failed', - message: 'What should be done?', - buttons: ['Exit', 'Try to restore DB', 'Remove DB'] + title: 'The migration has failed', // TODO: + message: 'What should be done?', // TODO: + buttons: ['Exit', 'Try to restore DB', 'Remove DB'] // TODO: }) if (btnId === 0) { From 69aed4793b0a11848313f5aca96605c3a975b67e Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 08:34:46 +0200 Subject: [PATCH 39/58] Add en translation for backup-db --- build/locales/en/translations.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index 77f80df5..d7ea0966 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -192,6 +192,12 @@ "removingDBDescription": "Removing DB ...", "clearingAllDataDescription": "Clearing all data ..." } + }, + "backupDB": { + "backupDBTitle": "DB backup", + "dbBackupHasBeenDone": "DB backup has been successfully", + "dbBackupHasNotBeenDone": "DB backup has not been successfully", + "confirmButtonText": "OK" } }, "menu": { From 2fc12227c2d05e9cbc24e4707da8da55b9b7f906 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 08:35:01 +0200 Subject: [PATCH 40/58] Add ru translation for backup-db --- build/locales/ru/translations.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index 307e80f4..d1ae9e0c 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -192,6 +192,12 @@ "removingDBDescription": "Удаление БД ...", "clearingAllDataDescription": "Очистка всех данные ..." } + }, + "backupDB": { + "backupDBTitle": "Резервное копирование БД", + "dbBackupHasBeenDone": "Резервное копирование БД успешно завершено", + "dbBackupHasNotBeenDone": "Резервное копирование БД не было успешно выполнено", + "confirmButtonText": "OK" } }, "menu": { From a28404610b885b14c7ca55e29b821db60a393183 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 09:57:19 +0200 Subject: [PATCH 41/58] Add translation support to migration-db --- src/manage-worker-messages.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/manage-worker-messages.js b/src/manage-worker-messages.js index c5a04d60..197b4a62 100644 --- a/src/manage-worker-messages.js +++ b/src/manage-worker-messages.js @@ -121,8 +121,8 @@ module.exports = (ipc) => { const isBackupError = state === PROCESS_MESSAGES.ERROR_BACKUP const message = isBackupError - ? i18next.t('common.backupDB.dbBackupHasNotBeenDone') - : i18next.t('common.backupDB.dbBackupHasBeenDone') + ? i18next.t('common.backupDB.dbBackupHasFailedMessage') + : i18next.t('common.backupDB.dbBackupHasCompletedMessage') const type = isBackupError ? 'error' : 'info' @@ -178,12 +178,12 @@ module.exports = (ipc) => { const type = isMigrationsError ? 'error' : 'info' - const message = isMigrationsError // TODO: - ? 'DВ migration failed, all data has been deleted,\nsynchronization will start from scratch' - : 'DB migration completed successfully' + const message = isMigrationsError + ? i18next.t('common.migrationDB.messageModalDialog.dbMigrationHasFailedMessage') + : i18next.t('common.migrationDB.messageModalDialog.dbMigrationHasCompletedMessage') const buttons = isMigrationsError - ? ['Cancel'] // TODO: - : ['OK'] // TODO: + ? [i18next.t('common.migrationDB.messageModalDialog.cancelButtonText')] + : [i18next.t('common.migrationDB.messageModalDialog.confirmButtonText')] await showMessageModalDialog(win, { type, @@ -200,9 +200,15 @@ module.exports = (ipc) => { btnId } = await showMessageModalDialog(win, { type: 'question', - title: 'The migration has failed', // TODO: - message: 'What should be done?', // TODO: - buttons: ['Exit', 'Try to restore DB', 'Remove DB'] // TODO: + title: i18next + .t('common.migrationDB.actionRequestModalDialog.title'), + message: i18next + .t('common.migrationDB.actionRequestModalDialog.message'), + buttons: [ + i18next.t('common.migrationDB.actionRequestModalDialog.exitButtonText'), + i18next.t('common.migrationDB.actionRequestModalDialog.restoreDBButtonText'), + i18next.t('common.migrationDB.actionRequestModalDialog.removeDBButtonText') + ] }) if (btnId === 0) { From de090638ce4f2a8b107a247c7e0b75388131c5ac Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 09:57:46 +0200 Subject: [PATCH 42/58] Add en translation for migration-db --- build/locales/en/translations.json | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index d7ea0966..34e458e9 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -195,9 +195,24 @@ }, "backupDB": { "backupDBTitle": "DB backup", - "dbBackupHasBeenDone": "DB backup has been successfully", - "dbBackupHasNotBeenDone": "DB backup has not been successfully", + "dbBackupHasCompletedMessage": "DB backup has completed successfully", + "dbBackupHasFailedMessage": "DB backup has failed", "confirmButtonText": "OK" + }, + "migrationDB": { + "messageModalDialog": { + "dbMigrationHasFailedMessage": "DВ migration has failed, all data has been deleted,\nsynchronization will start from scratch", + "dbMigrationHasCompletedMessage": "DB migration has completed successfully", + "confirmButtonText": "OK", + "cancelButtonText": "Cancel" + }, + "actionRequestModalDialog": { + "title": "The migration has failed", + "message": "What should be done?", + "exitButtonText": "Exit", + "restoreDBButtonText": "Try to restore DB", + "removeDBButtonText": "Remove DB" + } } }, "menu": { From ca425c67fc27a9cf34c2282f4d564f3bd86880cb Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 09:58:10 +0200 Subject: [PATCH 43/58] Add ru translation for migration-db --- build/locales/ru/translations.json | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index d1ae9e0c..57932624 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -195,9 +195,24 @@ }, "backupDB": { "backupDBTitle": "Резервное копирование БД", - "dbBackupHasBeenDone": "Резервное копирование БД успешно завершено", - "dbBackupHasNotBeenDone": "Резервное копирование БД не было успешно выполнено", + "dbBackupHasCompletedMessage": "Резервное копирование БД успешно завершено", + "dbBackupHasFailedMessage": "Резервное копирование БД не удалось", "confirmButtonText": "OK" + }, + "migrationDB": { + "messageModalDialog": { + "dbMigrationHasFailedMessage": "Миграция БД не удалась, все данные удалены,\nсинхронизация начнется с нуля", + "dbMigrationHasCompletedMessage": "Миграция БД успешно завершена", + "confirmButtonText": "OK", + "cancelButtonText": "Отмена" + }, + "actionRequestModalDialog": { + "title": "Миграция не удалась", + "message": "Что следует сделать?", + "exitButtonText": "Выход", + "restoreDBButtonText": "Попробовать восстановить БД", + "removeDBButtonText": "Удалить БД" + } } }, "menu": { From e602092db1199e58530024a6291ae09d6a3d317a Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 14:51:32 +0200 Subject: [PATCH 44/58] Add ability to show parent win for modal dialog --- src/show-message-modal-dialog.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/show-message-modal-dialog.js b/src/show-message-modal-dialog.js index a7ebc258..5d1a98fc 100644 --- a/src/show-message-modal-dialog.js +++ b/src/show-message-modal-dialog.js @@ -5,6 +5,9 @@ const i18next = require('i18next') const wins = require('./window-creators/windows') const isMainWinAvailable = require('./helpers/is-main-win-available') +const { + showWindow +} = require('./helpers/manage-window') module.exports = async (win, opts = {}) => { const defaultWin = isMainWinAvailable(wins.mainWindow) @@ -14,6 +17,10 @@ module.exports = async (win, opts = {}) => { ? win : defaultWin + if (opts?.shouldParentWindowBeShown) { + await showWindow(win) + } + const { response: btnId, checkboxChecked From ed071e56e386b599ddb2a9af097ac1004166f3c0 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 14:53:35 +0200 Subject: [PATCH 45/58] Fix showing modal dialogs in sequence --- src/manage-worker-messages.js | 90 ++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 33 deletions(-) diff --git a/src/manage-worker-messages.js b/src/manage-worker-messages.js index 197b4a62..58543f98 100644 --- a/src/manage-worker-messages.js +++ b/src/manage-worker-messages.js @@ -11,9 +11,6 @@ const showMessageModalDialog = require( const isMainWinAvailable = require( './helpers/is-main-win-available' ) -const { - showWindow -} = require('./helpers/manage-window') const showTrxTaxReportNotification = require( './show-notification/show-trx-tax-report-notification' ) @@ -27,17 +24,46 @@ const PROCESS_STATES = require( '../bfx-reports-framework/workers/loc.api/process.message.manager/process.states' ) -module.exports = (ipc) => { - const win = isMainWinAvailable(wins.mainWindow) - ? wins.mainWindow - : BrowserWindow.getFocusedWindow() +const modalDialogPromiseSet = new Set() + +const resolveModalDialogInSequence = async (asyncHandler) => { + let resolve = () => {} + const promise = new Promise((_resolve) => { + resolve = _resolve + }) + + const promisesForAwaiting = [...modalDialogPromiseSet] + modalDialogPromiseSet.add(promise) + await Promise.all(promisesForAwaiting) + const res = await asyncHandler() + resolve() + modalDialogPromiseSet.delete(promise) + return res +} + +const getParentWindow = () => { + if (isMainWinAvailable( + wins.mainWindow, + { shouldCheckVisibility: true } + )) { + return wins.mainWindow + } + if (isMainWinAvailable(wins.loadingWindow)) { + return wins.loadingWindow + } + + return BrowserWindow.getFocusedWindow() +} +module.exports = (ipc) => { if (!ipc) { return } ipc.on('message', async (mess) => { try { + const win = getParentWindow() + if ( !mess || typeof mess !== 'object' || @@ -61,14 +87,12 @@ module.exports = (ipc) => { state === PROCESS_MESSAGES.DB_HAS_BEEN_RESTORED || state === PROCESS_MESSAGES.DB_HAS_NOT_BEEN_RESTORED ) { - await showWindow(win) - const hasNotDbBeenRestored = state === PROCESS_MESSAGES.DB_HAS_NOT_BEEN_RESTORED const type = hasNotDbBeenRestored ? 'error' : 'info' - await showMessageModalDialog(win, { + await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type, title: i18next.t('common.restoreDB.messageModalDialog.title'), message: hasNotDbBeenRestored @@ -76,8 +100,9 @@ module.exports = (ipc) => { : i18next.t('common.restoreDB.messageModalDialog.dbRestoredMessage'), buttons: [i18next.t('common.restoreDB.messageModalDialog.confirmButtonText')], defaultId: 0, - cancelId: 0 - }) + cancelId: 0, + shouldParentWindowBeShown: true + })) // To enforce migration launch if restores prev db schema version if (data?.isNotVerSupported) { @@ -90,8 +115,6 @@ module.exports = (ipc) => { state === PROCESS_MESSAGES.ALL_TABLE_HAVE_BEEN_REMOVED || state === PROCESS_MESSAGES.ALL_TABLE_HAVE_NOT_BEEN_REMOVED ) { - await showWindow(win) - const haveNotAllDbDataBeenRemoved = state === PROCESS_MESSAGES.ALL_TABLE_HAVE_NOT_BEEN_REMOVED const message = haveNotAllDbDataBeenRemoved ? i18next.t('common.removeDB.messageModalDialog.dbDataHasNotBeenRemovedMessage') @@ -100,7 +123,7 @@ module.exports = (ipc) => { ? 'error' : 'info' - await showMessageModalDialog(win, { + await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type, title: i18next.t('common.removeDB.messageModalDialog.dbRemovingTitle'), message, @@ -108,8 +131,9 @@ module.exports = (ipc) => { i18next.t('common.removeDB.messageModalDialog.confirmButtonText') ], defaultId: 0, - cancelId: 0 - }) + cancelId: 0, + shouldParentWindowBeShown: true + })) return } @@ -117,8 +141,6 @@ module.exports = (ipc) => { state === PROCESS_MESSAGES.BACKUP_FINISHED || state === PROCESS_MESSAGES.ERROR_BACKUP ) { - await showWindow(win) - const isBackupError = state === PROCESS_MESSAGES.ERROR_BACKUP const message = isBackupError ? i18next.t('common.backupDB.dbBackupHasFailedMessage') @@ -127,7 +149,7 @@ module.exports = (ipc) => { ? 'error' : 'info' - await showMessageModalDialog(win, { + await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type, title: i18next.t('common.backupDB.backupDBTitle'), message, @@ -135,8 +157,9 @@ module.exports = (ipc) => { i18next.t('common.backupDB.confirmButtonText') ], defaultId: 0, - cancelId: 0 - }) + cancelId: 0, + shouldParentWindowBeShown: true + })) if (isBackupError) { return @@ -172,8 +195,6 @@ module.exports = (ipc) => { state === PROCESS_MESSAGES.ERROR_MIGRATIONS || state === PROCESS_MESSAGES.READY_MIGRATIONS ) { - await showWindow(win) - const isMigrationsError = state === PROCESS_MESSAGES.ERROR_MIGRATIONS const type = isMigrationsError ? 'error' @@ -185,20 +206,21 @@ module.exports = (ipc) => { ? [i18next.t('common.migrationDB.messageModalDialog.cancelButtonText')] : [i18next.t('common.migrationDB.messageModalDialog.confirmButtonText')] - await showMessageModalDialog(win, { + await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type, message, buttons, defaultId: 0, - cancelId: 0 - }) + cancelId: 0, + shouldParentWindowBeShown: true + })) return } if (state === PROCESS_MESSAGES.REQUEST_MIGRATION_HAS_FAILED_WHAT_SHOULD_BE_DONE) { const { btnId - } = await showMessageModalDialog(win, { + } = await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type: 'question', title: i18next .t('common.migrationDB.actionRequestModalDialog.title'), @@ -208,8 +230,9 @@ module.exports = (ipc) => { i18next.t('common.migrationDB.actionRequestModalDialog.exitButtonText'), i18next.t('common.migrationDB.actionRequestModalDialog.restoreDBButtonText'), i18next.t('common.migrationDB.actionRequestModalDialog.removeDBButtonText') - ] - }) + ], + shouldParentWindowBeShown: true + })) if (btnId === 0) { app.quit() @@ -234,15 +257,16 @@ module.exports = (ipc) => { const { btnId - } = await showMessageModalDialog(win, { + } = await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type: 'question', title, message: i18next.t('common.removeDB.messageModalDialog.removeDBMessage'), buttons: [ i18next.t('common.removeDB.messageModalDialog.cancelButtonText'), i18next.t('common.removeDB.messageModalDialog.confirmButtonText') - ] - }) + ], + shouldParentWindowBeShown: true + })) if (btnId === 0) { if (data.isNotDbRestored) { From 21a132c1e771ba9e0c7d6d596da815fdc9d21381 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 21 Nov 2024 14:55:01 +0200 Subject: [PATCH 46/58] Improve translations for db migration --- build/locales/en/translations.json | 2 +- build/locales/ru/translations.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index 34e458e9..e13756ff 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -201,7 +201,7 @@ }, "migrationDB": { "messageModalDialog": { - "dbMigrationHasFailedMessage": "DВ migration has failed, all data has been deleted,\nsynchronization will start from scratch", + "dbMigrationHasFailedMessage": "DВ migration has failed", "dbMigrationHasCompletedMessage": "DB migration has completed successfully", "confirmButtonText": "OK", "cancelButtonText": "Cancel" diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index 57932624..6dfd1148 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -201,7 +201,7 @@ }, "migrationDB": { "messageModalDialog": { - "dbMigrationHasFailedMessage": "Миграция БД не удалась, все данные удалены,\nсинхронизация начнется с нуля", + "dbMigrationHasFailedMessage": "Миграция БД не удалась", "dbMigrationHasCompletedMessage": "Миграция БД успешно завершена", "confirmButtonText": "OK", "cancelButtonText": "Отмена" From 59d5db53893bb81ebf2d5fb7a70e4e0b66ef788b Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 22 Nov 2024 11:20:11 +0200 Subject: [PATCH 47/58] Add translation support to show-about-modal-dialog --- src/show-about-modal-dialog.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/show-about-modal-dialog.js b/src/show-about-modal-dialog.js index 30da6bd3..3648b83b 100644 --- a/src/show-about-modal-dialog.js +++ b/src/show-about-modal-dialog.js @@ -8,6 +8,7 @@ const { BrowserWindow } = require('electron') const path = require('path') +const i18next = require('i18next') const getDebugInfo = require('./helpers/get-debug-info') @@ -32,7 +33,11 @@ module.exports = () => { title: productName, message: productName, detail, - buttons: ['Copy', 'GitHub', 'OK'], + buttons: [ + i18next.t('common.showAboutModalDialog.copyButtonText'), + i18next.t('common.showAboutModalDialog.gitHubButtonText'), + i18next.t('common.showAboutModalDialog.confirmButtonText') + ], defaultId: 2, cancelId: 2, icon: path.join(__dirname, '../build/icons/64x64.png') From 63633f1b7f07779be86fedf1f135fa8689532998 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 22 Nov 2024 11:20:41 +0200 Subject: [PATCH 48/58] Add en translation for show-about-modal-dialog --- build/locales/en/translations.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index e13756ff..2bb3f0a4 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -127,6 +127,11 @@ "confirmButtonText": "OK" } }, + "showAboutModalDialog": { + "confirmButtonText": "OK", + "copyButtonText": "Copy", + "gitHubButtonText": "Open GitHub" + }, "showMessageModalDialog": { "confirmButtonText": "OK", "cancelButtonText": "Cancel" From 9af72fb855c773137e58894a7a6c06ae2211fb0d Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 22 Nov 2024 11:21:04 +0200 Subject: [PATCH 49/58] Add ru translation for show-about-modal-dialog --- build/locales/ru/translations.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index 6dfd1148..2193cd9f 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -127,6 +127,11 @@ "confirmButtonText": "OK" } }, + "showAboutModalDialog": { + "confirmButtonText": "OK", + "copyButtonText": "Копировать", + "gitHubButtonText": "Открыть GitHub" + }, "showMessageModalDialog": { "confirmButtonText": "OK", "cancelButtonText": "Отмена" From 5563f715791fc7475ac3c3c9c19d5c4027bcc23b Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 25 Nov 2024 10:43:37 +0200 Subject: [PATCH 50/58] Fix docker desktop container user permissions breaks --- Dockerfile.linux-builder | 1 - Dockerfile.mac-builder | 1 - Dockerfile.ui-builder | 1 - Dockerfile.win-builder | 1 - 4 files changed, 4 deletions(-) diff --git a/Dockerfile.linux-builder b/Dockerfile.linux-builder index b6cd6ced..c0354e3a 100644 --- a/Dockerfile.linux-builder +++ b/Dockerfile.linux-builder @@ -14,7 +14,6 @@ RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} \ bc \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN chown root:root . COPY . . diff --git a/Dockerfile.mac-builder b/Dockerfile.mac-builder index 020628a3..ad1ea892 100644 --- a/Dockerfile.mac-builder +++ b/Dockerfile.mac-builder @@ -14,7 +14,6 @@ RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} \ bc \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN chown root:root . COPY . . diff --git a/Dockerfile.ui-builder b/Dockerfile.ui-builder index ea9b0d63..5f193211 100644 --- a/Dockerfile.ui-builder +++ b/Dockerfile.ui-builder @@ -8,7 +8,6 @@ ENV IS_DEV_ENV=${IS_DEV_ENV:-0} COPY ./scripts/helpers/install-nodejs.sh ./scripts/helpers/install-nodejs.sh RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} -RUN chown root:root . COPY . . diff --git a/Dockerfile.win-builder b/Dockerfile.win-builder index f40d6348..f8b72453 100644 --- a/Dockerfile.win-builder +++ b/Dockerfile.win-builder @@ -17,7 +17,6 @@ RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} \ bc \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN chown root:root . COPY . . From 2cbddae800119f1591680623ad8ec4be1d7d0379 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 25 Nov 2024 11:30:48 +0200 Subject: [PATCH 51/58] Bump version up to v4.31.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a07ec864..55b2c813 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report-electron", - "version": "4.30.0", + "version": "4.31.0", "repository": "https://github.com/bitfinexcom/bfx-report-electron", "description": "Reporting tool", "author": "bitfinex.com", From a30239eb6f4ee0bea25c4e91a488356d7b36328c Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 25 Nov 2024 11:31:13 +0200 Subject: [PATCH 52/58] Add changelog for v4.31.0 --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 751a2068..6b589c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.31.0] - 2024-11-27 + +### Added + +- Added translation support to the `export-db` module. PR: [bfx-report-electron#441](https://github.com/bitfinexcom/bfx-report-electron/pull/441) +- Added translation support to the `import-db` module. PR: [bfx-report-electron#442](https://github.com/bitfinexcom/bfx-report-electron/pull/442) +- Added `progress` perc to the `loading window` for the `export-db` module as it can take significant time for large DB. PR: [bfx-report-electron#445](https://github.com/bitfinexcom/bfx-report-electron/pull/445) +- Added `progress` perc to the `loading window` for the `import-db` module as it can take significant time for large DB. [bfx-report-electron#449](https://github.com/bitfinexcom/bfx-report-electron/pull/449) +- Added translation support to the `remove-db` module. PR: [bfx-report-electron#450](https://github.com/bitfinexcom/bfx-report-electron/pull/450) +- Added translation support to the `manage-worker-messages` module. Add translation support to the `backup-db` and `migration-db` modules. Fixed showing modal dialogs in sequence. PR: [bfx-report-electron#456](https://github.com/bitfinexcom/bfx-report-electron/pull/456) +- Added translation support to the `show-about-modal-dialog` module. PR: [bfx-report-electron#457](https://github.com/bitfinexcom/bfx-report-electron/pull/457) + +### Fixed + +- Fixed docker desktop container user permissions breaks. Fixed `chown`: `changing ownership of 'path-to-file': Operation not permitted` when using it in `dockerfile`. PR: [bfx-report-electron#460](https://github.com/bitfinexcom/bfx-report-electron/pull/460) + ## [4.30.0] - 2024-11-13 ### Added From bf215ccf1339d8824adeaf329a137a3b628ce58a Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 28 Nov 2024 14:51:10 +0200 Subject: [PATCH 53/58] Optimize en translation file data structure --- build/locales/en/translations.json | 416 ++++++++++++++--------------- 1 file changed, 197 insertions(+), 219 deletions(-) diff --git a/build/locales/en/translations.json b/build/locales/en/translations.json index 2bb3f0a4..750f9202 100644 --- a/build/locales/en/translations.json +++ b/build/locales/en/translations.json @@ -1,224 +1,7 @@ { "common": { - "title": "Report", - "appInitError": { - "description": "Application initialization error", - "closeBtnText": "Close" - }, - "errorManager": { - "failedToGetDocsPath": { - "title": "The OS Documents directory has been misconfigured", - "message": "This indicates that your OS `Documents` directory has been misconfigured.\n\rPlease, set it to a valid location or reset it to the default" - }, - "errorModalDialog": { - "errBoxTitle": "Bug report", - "errBoxDescription": "A new GitHub issue will be opened", - "zenityBtn": "Report and Exit", - "confirmButtonText": "Report", - "cancelButtonText": "Cancel", - "title": "Should a bug report be submitted?" - } - }, - "nativeNotification": { - "defaulTitle": "Bitfinex Report", - "defaultBody": "Notification", - "sync": { - "completedBody": "Data sync completed successfully!", - "interruptedBody": "Data sync interrupted!", - "errorBody": "Data sync completed with an error!" - }, - "trxTaxReport": { - "completedBody": "Your tax report is ready!", - "errorBody": "An unexpected error occurred while generating the tax report!" - } - }, - "autoUpdater": { - "title": "Update", - "confirmButtonText": "OK", - "cancelButtonText": "Cancel", - "loadingWindow": { - "description": "Updating..." - }, - "errorToast": { - "title": "Application update failed", - "inetIssueTitle": "Internet disconnected" - }, - "checkingForUpdateToast": { - "title": "Checking for update" - }, - "updateAvailableToast": { - "title": "An update to v{{version}} is available", - "description": "Starting download..." - }, - "updateNotAvailableToast": { - "title": "No updates available" - }, - "downloadProgressToast": { - "title": "Downloading..." - }, - "updateDownloadedToast": { - "title": "Update v{{version}} downloaded", - "description": "Should the app be updated right now?" - } - }, - "restoreDB": { - "modalDialog": { - "title": "Select DB backup file", - "confirmButtonText": "OK", - "cancelButtonText": "Cancel" - }, - "messageModalDialog": { - "title": "DB restoring", - "message": "Suitable DB backup file has not been found", - "dbRestoredMessage": "DB has been restored", - "dbNotRestoredMessage": "DB has not been restored", - "confirmButtonText": "OK" - } - }, - "showDocs": { - "modalDialog": { - "title": "User manual", - "cancelButtonText": "Close" - } - }, - "printToPDF": { - "defaultTemplate": "No data", - "pagination": { - "page": "Page", - "from": "from" - } - }, - "changeReportsFolder": { - "modalDialog": { - "title": "Change reports folder", - "buttonLabel": "Select" - } - }, - "changeSyncFrequency": { - "title": "Change sync frequency", - "timeFormatModalDialog": { - "title": "Set time format", - "confirmButtonText": "OK", - "cancelButtonText": "Cancel", - "inputOptions": { - "mins": "Mins", - "hours": "Hours", - "days": "Days" - } - }, - "timeModalDialog": { - "title": "Set sync frequency", - "confirmButtonText": "OK", - "cancelButtonText": "Cancel" - } - }, - "enforceMacOSAppLocation": { - "appLocationModalDialog": { - "message": "Move to Applications folder?", - "detail": "{{productName}} must live in the Applications folder to be able to run correctly", - "confirmButtonText": "Move to Applications folder", - "cancelButtonText": "Quit {{productName}}" - }, - "loadingWindow": { - "description": "Moving the app..." - }, - "appRunningModalDialog": { - "message": "Another version of {{productName}} is currently running. Quit it, then launch this version of the app again", - "confirmButtonText": "OK" - } - }, - "showAboutModalDialog": { - "confirmButtonText": "OK", - "copyButtonText": "Copy", - "gitHubButtonText": "Open GitHub" - }, - "showMessageModalDialog": { - "confirmButtonText": "OK", - "cancelButtonText": "Cancel" - }, - "showErrorModalDialog": { - "confirmButtonText": "OK", - "enoentErrorMessage": "No such file or directory", - "eaccesErrorMessage": "Permission denied", - "invalidFilePathErrorMessage": "Invalid file path", - "invalidFileNameInArchErrorMessage": "Invalid file name in archive", - "dbImportingErrorMessage": "The database has not been imported", - "dbRemovingErrorMessage": "The database has not been removed", - "reportsFolderChangingErrorMessage": "The reports folder has not been changed", - "syncFrequencyChangingErrorMessage": "The sync frequency has not been changed", - "unexpectedExceptionMessage": "An unexpected exception occurred" - }, - "exportDB": { - "saveDialog": { - "title": "Database export", - "buttonLabel": "Export" - }, - "modalDialog": { - "confirmButtonText": "OK", - "title": "Database export", - "message": "Exported successfully" - }, - "loadingWindow": { - "description": "Exporting DB ...", - "archiveSize": "archive size {{prettyArchiveSize}}" - } - }, - "importDB": { - "openDialog": { - "title": "Database import", - "buttonLabel": "Import" - }, - "modalDialog": { - "title": "Database import" - }, - "loadingWindow": { - "description": "Importing DB ...", - "unzippedBytes": "DB size {{prettyUnzippedBytes}}" - } - }, - "removeDB": { - "modalDialog": { - "clearDataTitle": "Clear all data", - "removeDBTitle": "Remove database", - "clearDataMessage": "Are you sure you want to clear all data?", - "removeDBMessage": "Are you sure you want to remove the database?" - }, - "messageModalDialog": { - "dbRemovingTitle": "DB removing", - "dbDataHasBeenRemovedMessage": "DB data has been removed", - "dbDataHasNotBeenRemovedMessage": "DB data has not been removed", - "dbHasNotBeenRestoredTitle": "DB has not been restored", - "removeDBTitle": "Remove database", - "removeDBMessage": "Should all tables be removed?", - "confirmButtonText": "OK", - "cancelButtonText": "Cancel" - }, - "loadingWindow": { - "removingDBDescription": "Removing DB ...", - "clearingAllDataDescription": "Clearing all data ..." - } - }, - "backupDB": { - "backupDBTitle": "DB backup", - "dbBackupHasCompletedMessage": "DB backup has completed successfully", - "dbBackupHasFailedMessage": "DB backup has failed", - "confirmButtonText": "OK" - }, - "migrationDB": { - "messageModalDialog": { - "dbMigrationHasFailedMessage": "DВ migration has failed", - "dbMigrationHasCompletedMessage": "DB migration has completed successfully", - "confirmButtonText": "OK", - "cancelButtonText": "Cancel" - }, - "actionRequestModalDialog": { - "title": "The migration has failed", - "message": "What should be done?", - "exitButtonText": "Exit", - "restoreDBButtonText": "Try to restore DB", - "removeDBButtonText": "Remove DB" - } - } + "confirmButtonText": "OK", + "cancelButtonText": "Cancel" }, "menu": { "macMainSubmenu": { @@ -270,5 +53,200 @@ "changelogLabel": "Changelog", "aboutLabel": "About {{appName}}" } + }, + "appInitError": { + "description": "Application initialization error", + "closeBtnText": "Close" + }, + "errorManager": { + "failedToGetDocsPath": { + "title": "The OS Documents directory has been misconfigured", + "message": "This indicates that your OS `Documents` directory has been misconfigured.\n\rPlease, set it to a valid location or reset it to the default" + }, + "errorModalDialog": { + "errBoxTitle": "Bug report", + "errBoxDescription": "A new GitHub issue will be opened", + "zenityBtn": "Report and Exit", + "confirmButtonText": "Report", + "title": "Should a bug report be submitted?" + } + }, + "nativeNotification": { + "defaulTitle": "Bitfinex Report", + "defaultBody": "Notification", + "sync": { + "completedBody": "Data sync completed successfully!", + "interruptedBody": "Data sync interrupted!", + "errorBody": "Data sync completed with an error!" + }, + "trxTaxReport": { + "completedBody": "Your tax report is ready!", + "errorBody": "An unexpected error occurred while generating the tax report!" + } + }, + "autoUpdater": { + "title": "Update", + "loadingWindow": { + "description": "Updating..." + }, + "errorToast": { + "title": "Application update failed", + "inetIssueTitle": "Internet disconnected" + }, + "checkingForUpdateToast": { + "title": "Checking for update" + }, + "updateAvailableToast": { + "title": "An update to v{{version}} is available", + "description": "Starting download..." + }, + "updateNotAvailableToast": { + "title": "No updates available" + }, + "downloadProgressToast": { + "title": "Downloading..." + }, + "updateDownloadedToast": { + "title": "Update v{{version}} downloaded", + "description": "Should the app be updated right now?" + } + }, + "restoreDB": { + "modalDialog": { + "title": "Select DB backup file" + }, + "messageModalDialog": { + "title": "DB restoring", + "message": "Suitable DB backup file has not been found", + "dbRestoredMessage": "DB has been restored", + "dbNotRestoredMessage": "DB has not been restored" + } + }, + "showDocs": { + "modalDialog": { + "title": "User manual", + "cancelButtonText": "Close" + } + }, + "printToPDF": { + "defaultTemplate": "No data", + "pagination": { + "page": "Page", + "from": "from" + } + }, + "changeReportsFolder": { + "modalDialog": { + "title": "Change reports folder", + "buttonLabel": "Select" + } + }, + "changeSyncFrequency": { + "title": "Change sync frequency", + "timeFormatModalDialog": { + "title": "Set time format", + "inputOptions": { + "mins": "Mins", + "hours": "Hours", + "days": "Days" + } + }, + "timeModalDialog": { + "title": "Set sync frequency" + } + }, + "enforceMacOSAppLocation": { + "appLocationModalDialog": { + "message": "Move to Applications folder?", + "detail": "{{productName}} must live in the Applications folder to be able to run correctly", + "confirmButtonText": "Move to Applications folder", + "cancelButtonText": "Quit {{productName}}" + }, + "loadingWindow": { + "description": "Moving the app..." + }, + "appRunningModalDialog": { + "message": "Another version of {{productName}} is currently running. Quit it, then launch this version of the app again" + } + }, + "showAboutModalDialog": { + "copyButtonText": "Copy", + "gitHubButtonText": "Open GitHub" + }, + "showErrorModalDialog": { + "enoentErrorMessage": "No such file or directory", + "eaccesErrorMessage": "Permission denied", + "invalidFilePathErrorMessage": "Invalid file path", + "invalidFileNameInArchErrorMessage": "Invalid file name in archive", + "dbImportingErrorMessage": "The database has not been imported", + "dbRemovingErrorMessage": "The database has not been removed", + "reportsFolderChangingErrorMessage": "The reports folder has not been changed", + "syncFrequencyChangingErrorMessage": "The sync frequency has not been changed", + "unexpectedExceptionMessage": "An unexpected exception occurred" + }, + "exportDB": { + "saveDialog": { + "title": "Database export", + "buttonLabel": "Export" + }, + "modalDialog": { + "title": "Database export", + "message": "Exported successfully" + }, + "loadingWindow": { + "description": "Exporting DB ...", + "archiveSize": "archive size {{prettyArchiveSize}}" + } + }, + "importDB": { + "openDialog": { + "title": "Database import", + "buttonLabel": "Import" + }, + "modalDialog": { + "title": "Database import" + }, + "loadingWindow": { + "description": "Importing DB ...", + "unzippedBytes": "DB size {{prettyUnzippedBytes}}" + } + }, + "removeDB": { + "modalDialog": { + "clearDataTitle": "Clear all data", + "removeDBTitle": "Remove database", + "clearDataMessage": "Are you sure you want to clear all data?", + "removeDBMessage": "Are you sure you want to remove the database?" + }, + "messageModalDialog": { + "dbRemovingTitle": "DB removing", + "dbDataHasBeenRemovedMessage": "DB data has been removed", + "dbDataHasNotBeenRemovedMessage": "DB data has not been removed", + "dbHasNotBeenRestoredTitle": "DB has not been restored", + "removeDBTitle": "Remove database", + "removeDBMessage": "Should all tables be removed?" + }, + "loadingWindow": { + "removingDBDescription": "Removing DB ...", + "clearingAllDataDescription": "Clearing all data ..." + } + }, + "backupDB": { + "backupDBTitle": "DB backup", + "dbBackupHasCompletedMessage": "DB backup has completed successfully", + "dbBackupHasFailedMessage": "DB backup has failed" + }, + "migrationDB": { + "messageModalDialog": { + "dbMigrationHasFailedMessage": "DВ migration has failed", + "dbMigrationHasCompletedMessage": "DB migration has completed successfully" + }, + "actionRequestModalDialog": { + "title": "The migration has failed", + "message": "What should be done?", + "exitButtonText": "Exit", + "restoreDBButtonText": "Try to restore DB", + "removeDBButtonText": "Remove DB" + } } } From 8d62fc24814163ea450e493421d69db9aa0e7838 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 28 Nov 2024 14:51:25 +0200 Subject: [PATCH 54/58] Optimize ru translation file data structure --- build/locales/ru/translations.json | 416 ++++++++++++++--------------- 1 file changed, 197 insertions(+), 219 deletions(-) diff --git a/build/locales/ru/translations.json b/build/locales/ru/translations.json index 2193cd9f..c04a6679 100644 --- a/build/locales/ru/translations.json +++ b/build/locales/ru/translations.json @@ -1,224 +1,7 @@ { "common": { - "title": "Отчет", - "appInitError": { - "description": "Ошибка инициализации приложения", - "closeBtnText": "Закрыть" - }, - "errorManager": { - "failedToGetDocsPath": { - "title": "Каталог Документы ОС был неправильно настроен", - "message": "Это означает, что каталог `Документы` вашей ОС был неправильно настроен.\n\rПожалуйста, укажите правильное расположение или сбросьте его до значений по умолчанию" - }, - "errorModalDialog": { - "errBoxTitle": "Отчет об ошибке", - "errBoxDescription": "Будет открыта новая проблема в GitHub", - "zenityBtn": "Отправить Отчет и Выйти", - "confirmButtonText": "Отправить Отчет", - "cancelButtonText": "Отменить", - "title": "Должен ли быть отправлен отчет об ошибке?" - } - }, - "nativeNotification": { - "defaulTitle": "Bitfinex Report", - "defaultBody": "Уведомление", - "sync": { - "completedBody": "Синхронизация данных успешно завершена!", - "interruptedBody": "Синхронизация данных прервана!", - "errorBody": "Синхронизация данных завершена с ошибкой!" - }, - "trxTaxReport": { - "completedBody": "Ваш налоговый отчет готов!", - "errorBody": "При формировании налогового отчета произошла непредвиденная ошибка!" - } - }, - "autoUpdater": { - "title": "Обновление", - "confirmButtonText": "OK", - "cancelButtonText": "Отменить", - "loadingWindow": { - "description": "Обновление..." - }, - "errorToast": { - "title": "Обновление приложения не удалось", - "inetIssueTitle": "Интернет отключен" - }, - "checkingForUpdateToast": { - "title": "Проверка обновления" - }, - "updateAvailableToast": { - "title": "Доступно обновление до версии v{{version}}", - "description": "Начинаем загрузку..." - }, - "updateNotAvailableToast": { - "title": "Нет доступных обновлений" - }, - "downloadProgressToast": { - "title": "Загрузка..." - }, - "updateDownloadedToast": { - "title": "Обновление v{{version}} загружено", - "description": "Стоит ли обновить приложение прямо сейчас?" - } - }, - "restoreDB": { - "modalDialog": { - "title": "Выберите файл резервной копии БД", - "confirmButtonText": "OK", - "cancelButtonText": "Отменить" - }, - "messageModalDialog": { - "title": "Восстановление БД", - "message": "Подходящий файл резервной копии БД не найден", - "dbRestoredMessage": "БД была восстановлена", - "dbNotRestoredMessage": "БД не была восстановлена", - "confirmButtonText": "OK" - } - }, - "showDocs": { - "modalDialog": { - "title": "Руководство пользователя", - "cancelButtonText": "Закрыть" - } - }, - "printToPDF": { - "defaultTemplate": "Нет данных", - "pagination": { - "page": "Страница", - "from": "из" - } - }, - "changeReportsFolder": { - "modalDialog": { - "title": "Изменить папку отчетов", - "buttonLabel": "Выбрать" - } - }, - "changeSyncFrequency": { - "title": "Изменить частоту синхронизации", - "timeFormatModalDialog": { - "title": "Установить формат времени", - "confirmButtonText": "OK", - "cancelButtonText": "Отмена", - "inputOptions": { - "mins": "Мин.", - "hours": "Часы", - "days": "Дни" - } - }, - "timeModalDialog": { - "title": "Установить частоту синхронизации", - "confirmButtonText": "OK", - "cancelButtonText": "Отмена" - } - }, - "enforceMacOSAppLocation": { - "appLocationModalDialog": { - "message": "Переместить в папку Приложения?", - "detail": "{{productName}} должен находиться в папке Приложения для корректной работы", - "confirmButtonText": "Переместить в папку Приложения", - "cancelButtonText": "Выйти из {{productName}}" - }, - "loadingWindow": { - "description": "Перемещение приложения..." - }, - "appRunningModalDialog": { - "message": "В настоящее время запущена другая версия {{productName}}. Закройте ее, затем снова запустите эту версию приложения", - "confirmButtonText": "OK" - } - }, - "showAboutModalDialog": { - "confirmButtonText": "OK", - "copyButtonText": "Копировать", - "gitHubButtonText": "Открыть GitHub" - }, - "showMessageModalDialog": { - "confirmButtonText": "OK", - "cancelButtonText": "Отмена" - }, - "showErrorModalDialog": { - "confirmButtonText": "OK", - "enoentErrorMessage": "Данный файл или каталог отсутствует", - "eaccesErrorMessage": "Доступ запрещен", - "invalidFilePathErrorMessage": "Неверный путь к файлу", - "invalidFileNameInArchErrorMessage": "Неверное имя файла в архиве", - "dbImportingErrorMessage": "База данных не была импортирована", - "dbRemovingErrorMessage": "База данных не была удалена", - "reportsFolderChangingErrorMessage": "Папка отчетов не была изменена", - "syncFrequencyChangingErrorMessage": "Частота синхронизации не была изменена", - "unexpectedExceptionMessage": "Произошло неожиданное исключение" - }, - "exportDB": { - "saveDialog": { - "title": "Экспорт базы данных", - "buttonLabel": "Экспортировать" - }, - "modalDialog": { - "confirmButtonText": "OK", - "title": "Экспорт базы данных", - "message": "Экспортирована успешно" - }, - "loadingWindow": { - "description": "Экспортирование БД ...", - "archiveSize": "размер архива {{prettyArchiveSize}}" - } - }, - "importDB": { - "openDialog": { - "title": "Импорт базы данных", - "buttonLabel": "Импортировать" - }, - "modalDialog": { - "title": "Импорт базы данных" - }, - "loadingWindow": { - "description": "Импортирование БД ...", - "unzippedBytes": "размер БД {{prettyUnzippedBytes}}" - } - }, - "removeDB": { - "modalDialog": { - "clearDataTitle": "Очистить все данные", - "removeDBTitle": "Удалить базу данных", - "clearDataMessage": "Вы уверены, что хотите удалить все данные?", - "removeDBMessage": "Вы уверены, что хотите удалить базу данных?" - }, - "messageModalDialog": { - "dbRemovingTitle": "Удаление БД", - "dbDataHasBeenRemovedMessage": "Данные БД были удалены", - "dbDataHasNotBeenRemovedMessage": "Данные БД не были удалены", - "dbHasNotBeenRestoredTitle": "БД не восстановлена", - "removeDBTitle": "Удалить базу данных", - "removeDBMessage": "Следует ли удалить все таблицы?", - "confirmButtonText": "OK", - "cancelButtonText": "Отмена" - }, - "loadingWindow": { - "removingDBDescription": "Удаление БД ...", - "clearingAllDataDescription": "Очистка всех данные ..." - } - }, - "backupDB": { - "backupDBTitle": "Резервное копирование БД", - "dbBackupHasCompletedMessage": "Резервное копирование БД успешно завершено", - "dbBackupHasFailedMessage": "Резервное копирование БД не удалось", - "confirmButtonText": "OK" - }, - "migrationDB": { - "messageModalDialog": { - "dbMigrationHasFailedMessage": "Миграция БД не удалась", - "dbMigrationHasCompletedMessage": "Миграция БД успешно завершена", - "confirmButtonText": "OK", - "cancelButtonText": "Отмена" - }, - "actionRequestModalDialog": { - "title": "Миграция не удалась", - "message": "Что следует сделать?", - "exitButtonText": "Выход", - "restoreDBButtonText": "Попробовать восстановить БД", - "removeDBButtonText": "Удалить БД" - } - } + "confirmButtonText": "OK", + "cancelButtonText": "Отмена" }, "menu": { "macMainSubmenu": { @@ -270,5 +53,200 @@ "changelogLabel": "Журнал Изменений", "aboutLabel": "О {{appName}}" } + }, + "appInitError": { + "description": "Ошибка инициализации приложения", + "closeBtnText": "Закрыть" + }, + "errorManager": { + "failedToGetDocsPath": { + "title": "Каталог Документы ОС был неправильно настроен", + "message": "Это означает, что каталог `Документы` вашей ОС был неправильно настроен.\n\rПожалуйста, укажите правильное расположение или сбросьте его до значений по умолчанию" + }, + "errorModalDialog": { + "errBoxTitle": "Отчет об ошибке", + "errBoxDescription": "Будет открыта новая проблема в GitHub", + "zenityBtn": "Отправить Отчет и Выйти", + "confirmButtonText": "Отправить Отчет", + "title": "Должен ли быть отправлен отчет об ошибке?" + } + }, + "nativeNotification": { + "defaulTitle": "Bitfinex Report", + "defaultBody": "Уведомление", + "sync": { + "completedBody": "Синхронизация данных успешно завершена!", + "interruptedBody": "Синхронизация данных прервана!", + "errorBody": "Синхронизация данных завершена с ошибкой!" + }, + "trxTaxReport": { + "completedBody": "Ваш налоговый отчет готов!", + "errorBody": "При формировании налогового отчета произошла непредвиденная ошибка!" + } + }, + "autoUpdater": { + "title": "Обновление", + "loadingWindow": { + "description": "Обновление..." + }, + "errorToast": { + "title": "Обновление приложения не удалось", + "inetIssueTitle": "Интернет отключен" + }, + "checkingForUpdateToast": { + "title": "Проверка обновления" + }, + "updateAvailableToast": { + "title": "Доступно обновление до версии v{{version}}", + "description": "Начинаем загрузку..." + }, + "updateNotAvailableToast": { + "title": "Нет доступных обновлений" + }, + "downloadProgressToast": { + "title": "Загрузка..." + }, + "updateDownloadedToast": { + "title": "Обновление v{{version}} загружено", + "description": "Стоит ли обновить приложение прямо сейчас?" + } + }, + "restoreDB": { + "modalDialog": { + "title": "Выберите файл резервной копии БД" + }, + "messageModalDialog": { + "title": "Восстановление БД", + "message": "Подходящий файл резервной копии БД не найден", + "dbRestoredMessage": "БД была восстановлена", + "dbNotRestoredMessage": "БД не была восстановлена" + } + }, + "showDocs": { + "modalDialog": { + "title": "Руководство пользователя", + "cancelButtonText": "Закрыть" + } + }, + "printToPDF": { + "defaultTemplate": "Нет данных", + "pagination": { + "page": "Страница", + "from": "из" + } + }, + "changeReportsFolder": { + "modalDialog": { + "title": "Изменить папку отчетов", + "buttonLabel": "Выбрать" + } + }, + "changeSyncFrequency": { + "title": "Изменить частоту синхронизации", + "timeFormatModalDialog": { + "title": "Установить формат времени", + "inputOptions": { + "mins": "Мин.", + "hours": "Часы", + "days": "Дни" + } + }, + "timeModalDialog": { + "title": "Установить частоту синхронизации" + } + }, + "enforceMacOSAppLocation": { + "appLocationModalDialog": { + "message": "Переместить в папку Приложения?", + "detail": "{{productName}} должен находиться в папке Приложения для корректной работы", + "confirmButtonText": "Переместить в папку Приложения", + "cancelButtonText": "Выйти из {{productName}}" + }, + "loadingWindow": { + "description": "Перемещение приложения..." + }, + "appRunningModalDialog": { + "message": "В настоящее время запущена другая версия {{productName}}. Закройте ее, затем снова запустите эту версию приложения" + } + }, + "showAboutModalDialog": { + "copyButtonText": "Копировать", + "gitHubButtonText": "Открыть GitHub" + }, + "showErrorModalDialog": { + "enoentErrorMessage": "Данный файл или каталог отсутствует", + "eaccesErrorMessage": "Доступ запрещен", + "invalidFilePathErrorMessage": "Неверный путь к файлу", + "invalidFileNameInArchErrorMessage": "Неверное имя файла в архиве", + "dbImportingErrorMessage": "База данных не была импортирована", + "dbRemovingErrorMessage": "База данных не была удалена", + "reportsFolderChangingErrorMessage": "Папка отчетов не была изменена", + "syncFrequencyChangingErrorMessage": "Частота синхронизации не была изменена", + "unexpectedExceptionMessage": "Произошло неожиданное исключение" + }, + "exportDB": { + "saveDialog": { + "title": "Экспорт базы данных", + "buttonLabel": "Экспортировать" + }, + "modalDialog": { + "title": "Экспорт базы данных", + "message": "Экспортирована успешно" + }, + "loadingWindow": { + "description": "Экспортирование БД ...", + "archiveSize": "размер архива {{prettyArchiveSize}}" + } + }, + "importDB": { + "openDialog": { + "title": "Импорт базы данных", + "buttonLabel": "Импортировать" + }, + "modalDialog": { + "title": "Импорт базы данных" + }, + "loadingWindow": { + "description": "Импортирование БД ...", + "unzippedBytes": "размер БД {{prettyUnzippedBytes}}" + } + }, + "removeDB": { + "modalDialog": { + "clearDataTitle": "Очистить все данные", + "removeDBTitle": "Удалить базу данных", + "clearDataMessage": "Вы уверены, что хотите удалить все данные?", + "removeDBMessage": "Вы уверены, что хотите удалить базу данных?" + }, + "messageModalDialog": { + "dbRemovingTitle": "Удаление БД", + "dbDataHasBeenRemovedMessage": "Данные БД были удалены", + "dbDataHasNotBeenRemovedMessage": "Данные БД не были удалены", + "dbHasNotBeenRestoredTitle": "БД не восстановлена", + "removeDBTitle": "Удалить базу данных", + "removeDBMessage": "Следует ли удалить все таблицы?" + }, + "loadingWindow": { + "removingDBDescription": "Удаление БД ...", + "clearingAllDataDescription": "Очистка всех данные ..." + } + }, + "backupDB": { + "backupDBTitle": "Резервное копирование БД", + "dbBackupHasCompletedMessage": "Резервное копирование БД успешно завершено", + "dbBackupHasFailedMessage": "Резервное копирование БД не удалось" + }, + "migrationDB": { + "messageModalDialog": { + "dbMigrationHasFailedMessage": "Миграция БД не удалась", + "dbMigrationHasCompletedMessage": "Миграция БД успешно завершена" + }, + "actionRequestModalDialog": { + "title": "Миграция не удалась", + "message": "Что следует сделать?", + "exitButtonText": "Выход", + "restoreDBButtonText": "Попробовать восстановить БД", + "removeDBButtonText": "Удалить БД" + } } } From 2e6eacf10c7fc3d5fe737dea44e7bb27f7e6d263 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 28 Nov 2024 14:51:51 +0200 Subject: [PATCH 55/58] Change translation file data structure usage --- src/auto-updater/index.js | 26 +++++----- src/change-reports-folder.js | 6 +-- src/change-sync-frequency.js | 20 +++---- src/enforce-macos-app-location.js | 14 ++--- src/error-manager/get-error-description.js | 4 +- src/error-manager/index.js | 4 +- src/error-manager/show-modal-dialog.js | 12 ++--- src/export-db.js | 18 +++---- src/import-db.js | 12 ++--- src/manage-worker-messages.js | 52 +++++++++---------- src/print-to-pdf/index.js | 4 +- src/remove-db.js | 12 ++--- src/restore-db/index.js | 12 ++--- src/show-about-modal-dialog.js | 6 +-- src/show-docs/index.js | 4 +- src/show-error-modal-dialog.js | 20 +++---- src/show-message-modal-dialog.js | 4 +- src/show-notification/index.js | 4 +- .../show-sync-notification.js | 6 +-- .../show-trx-tax-report-notification.js | 4 +- .../layouts/app-init-error.html | 4 +- 21 files changed, 124 insertions(+), 124 deletions(-) diff --git a/src/auto-updater/index.js b/src/auto-updater/index.js index 9d407abc..da768b15 100644 --- a/src/auto-updater/index.js +++ b/src/auto-updater/index.js @@ -141,11 +141,11 @@ const _fireToast = ( backdrop: 'rgba(0,0,0,0.0)', icon: 'info', - title: i18next.t('common.autoUpdater.title'), + title: i18next.t('autoUpdater.title'), showConfirmButton: true, showCancelButton: false, - confirmButtonText: i18next.t('common.autoUpdater.confirmButtonText'), - cancelButtonText: i18next.t('common.autoUpdater.cancelButtonText'), + confirmButtonText: i18next.t('common.confirmButtonText'), + cancelButtonText: i18next.t('common.cancelButtonText'), timerProgressBar: false, ...opts, @@ -268,7 +268,7 @@ const _autoUpdaterFactory = () => { autoUpdater.addInstallingUpdateEventHandler(() => { return showLoadingWindow({ - description: i18next.t('common.autoUpdater.loadingWindow.description'), + description: i18next.t('autoUpdater.loadingWindow.description'), isRequiredToCloseAllWins: true }) }) @@ -318,7 +318,7 @@ const _autoUpdaterFactory = () => { /ERR_INTERNET_DISCONNECTED/gi.test(err.toString()) ) { await _fireToast({ - title: i18next.t('common.autoUpdater.errorToast.inetIssueTitle'), + title: i18next.t('autoUpdater.errorToast.inetIssueTitle'), icon: 'error', timer: 60000 }) @@ -327,7 +327,7 @@ const _autoUpdaterFactory = () => { } await _fireToast({ - title: i18next.t('common.autoUpdater.errorToast.title'), + title: i18next.t('autoUpdater.errorToast.title'), icon: 'error', timer: 60000 }) @@ -343,7 +343,7 @@ const _autoUpdaterFactory = () => { await _fireToast( { - title: i18next.t('common.autoUpdater.checkingForUpdateToast.title'), + title: i18next.t('autoUpdater.checkingForUpdateToast.title'), type: 'warning', timer: 10000 }, @@ -364,10 +364,10 @@ const _autoUpdaterFactory = () => { const { value, dismiss } = await _fireToast( { title: i18next.t( - 'common.autoUpdater.updateAvailableToast.title', + 'autoUpdater.updateAvailableToast.title', { version } ), - text: i18next.t('common.autoUpdater.updateAvailableToast.description'), + text: i18next.t('autoUpdater.updateAvailableToast.description'), icon: 'info', timer: 10000 } @@ -402,7 +402,7 @@ const _autoUpdaterFactory = () => { await _fireToast( { - title: i18next.t('common.autoUpdater.updateNotAvailableToast.title'), + title: i18next.t('autoUpdater.updateNotAvailableToast.title'), icon: 'success', timer: 10000 } @@ -425,7 +425,7 @@ const _autoUpdaterFactory = () => { await _fireToast( { - title: i18next.t('common.autoUpdater.downloadProgressToast.title'), + title: i18next.t('autoUpdater.downloadProgressToast.title'), icon: 'info' }, { @@ -458,10 +458,10 @@ const _autoUpdaterFactory = () => { const { value } = await _fireToast( { title: i18next.t( - 'common.autoUpdater.updateDownloadedToast.title', + 'autoUpdater.updateDownloadedToast.title', { version } ), - text: i18next.t('common.autoUpdater.updateDownloadedToast.description'), + text: i18next.t('autoUpdater.updateDownloadedToast.description'), icon: 'question', timer: 60000, showCancelButton: true diff --git a/src/change-reports-folder.js b/src/change-reports-folder.js index 7cd937e7..385df935 100644 --- a/src/change-reports-folder.js +++ b/src/change-reports-folder.js @@ -29,9 +29,9 @@ module.exports = ({ pathToUserDocuments }) => { } = await dialog.showOpenDialog( win, { - title: i18next.t('common.changeReportsFolder.modalDialog.title'), + title: i18next.t('changeReportsFolder.modalDialog.title'), defaultPath: pathToUserDocuments, - buttonLabel: i18next.t('common.changeReportsFolder.modalDialog.buttonLabel'), + buttonLabel: i18next.t('changeReportsFolder.modalDialog.buttonLabel'), properties: [ 'openDirectory', 'createDirectory', @@ -70,7 +70,7 @@ module.exports = ({ pathToUserDocuments }) => { try { await showErrorModalDialog( win, - i18next.t('common.changeReportsFolder.modalDialog.title'), + i18next.t('changeReportsFolder.modalDialog.title'), err ) } catch (err) { diff --git a/src/change-sync-frequency.js b/src/change-sync-frequency.js index 6efd196b..ef0bf9b2 100644 --- a/src/change-sync-frequency.js +++ b/src/change-sync-frequency.js @@ -130,7 +130,7 @@ module.exports = () => { } const timeFormatAlertOptions = { - title: i18next.t('common.changeSyncFrequency.timeFormatModalDialog.title'), + title: i18next.t('changeSyncFrequency.timeFormatModalDialog.title'), icon: 'question', customClass: getAlertCustomClassObj({ title: 'titleColor', @@ -140,20 +140,20 @@ module.exports = () => { focusConfirm: true, showCancelButton: true, confirmButtonText: i18next - .t('common.changeSyncFrequency.timeFormatModalDialog.confirmButtonText'), + .t('common.confirmButtonText'), cancelButtonText: i18next - .t('common.changeSyncFrequency.timeFormatModalDialog.cancelButtonText'), + .t('common.cancelButtonText'), progressSteps: [1, 2], currentProgressStep: 0, input: 'radio', inputValue: 'hours', inputOptions: { mins: i18next - .t('common.changeSyncFrequency.timeFormatModalDialog.inputOptions.mins'), + .t('changeSyncFrequency.timeFormatModalDialog.inputOptions.mins'), hours: i18next - .t('common.changeSyncFrequency.timeFormatModalDialog.inputOptions.hours'), + .t('changeSyncFrequency.timeFormatModalDialog.inputOptions.hours'), days: i18next - .t('common.changeSyncFrequency.timeFormatModalDialog.inputOptions.days') + .t('changeSyncFrequency.timeFormatModalDialog.inputOptions.days') }, willOpen: () => { if (!timeFormatAlert.browserWindow) return @@ -162,7 +162,7 @@ module.exports = () => { } } const alertOptions = { - title: i18next.t('common.changeSyncFrequency.timeModalDialog.title'), + title: i18next.t('changeSyncFrequency.timeModalDialog.title'), icon: 'question', customClass: getAlertCustomClassObj({ title: 'titleColor', @@ -172,9 +172,9 @@ module.exports = () => { focusConfirm: true, showCancelButton: true, confirmButtonText: i18next - .t('common.changeSyncFrequency.timeModalDialog.confirmButtonText'), + .t('common.confirmButtonText'), cancelButtonText: i18next - .t('common.changeSyncFrequency.timeModalDialog.cancelButtonText'), + .t('common.cancelButtonText'), progressSteps: [1, 2], currentProgressStep: 1, input: 'range', @@ -295,7 +295,7 @@ module.exports = () => { try { await showErrorModalDialog( win, - i18next.t('common.changeSyncFrequency.title'), + i18next.t('changeSyncFrequency.title'), err ) } catch (err) { diff --git a/src/enforce-macos-app-location.js b/src/enforce-macos-app-location.js index bd9b0996..7c83ce37 100644 --- a/src/enforce-macos-app-location.js +++ b/src/enforce-macos-app-location.js @@ -24,15 +24,15 @@ module.exports = async () => { const clickedButtonIndex = dialog.showMessageBoxSync({ type: 'error', message: i18next - .t('common.enforceMacOSAppLocation.appLocationModalDialog.message'), + .t('enforceMacOSAppLocation.appLocationModalDialog.message'), detail: i18next.t( - 'common.enforceMacOSAppLocation.appLocationModalDialog.detail', + 'enforceMacOSAppLocation.appLocationModalDialog.detail', { productName } ), buttons: [ - i18next.t('common.enforceMacOSAppLocation.appLocationModalDialog.confirmButtonText'), + i18next.t('enforceMacOSAppLocation.appLocationModalDialog.confirmButtonText'), i18next.t( - 'common.enforceMacOSAppLocation.appLocationModalDialog.cancelButtonText', + 'enforceMacOSAppLocation.appLocationModalDialog.cancelButtonText', { productName } ) ], @@ -48,7 +48,7 @@ module.exports = async () => { await showLoadingWindow({ description: i18next - .t('common.enforceMacOSAppLocation.loadingWindow.description'), + .t('enforceMacOSAppLocation.loadingWindow.description'), isRequiredToCloseAllWins: true, isIndeterminateMode: true }) @@ -59,11 +59,11 @@ module.exports = async () => { dialog.showMessageBoxSync({ type: 'error', message: i18next.t( - 'common.enforceMacOSAppLocation.appRunningModalDialog.message', + 'enforceMacOSAppLocation.appRunningModalDialog.message', { productName } ), buttons: [ - i18next.t('common.enforceMacOSAppLocation.appRunningModalDialog.confirmButtonText') + i18next.t('common.confirmButtonText') ] }) diff --git a/src/error-manager/get-error-description.js b/src/error-manager/get-error-description.js index f1c650c8..6693cc6e 100644 --- a/src/error-manager/get-error-description.js +++ b/src/error-manager/get-error-description.js @@ -9,8 +9,8 @@ module.exports = (params) => { const title = '[BUG REPORT]' const description = 'Bug report' - const errBoxTitle = i18next.t('common.errorManager.errorModalDialog.errBoxTitle') - const errBoxDescription = i18next.t('common.errorManager.errorModalDialog.errBoxDescription') + const errBoxTitle = i18next.t('errorManager.errorModalDialog.errBoxTitle') + const errBoxDescription = i18next.t('errorManager.errorModalDialog.errBoxDescription') if ( error && diff --git a/src/error-manager/index.js b/src/error-manager/index.js index 2d1a665f..38ada6a9 100644 --- a/src/error-manager/index.js +++ b/src/error-manager/index.js @@ -216,8 +216,8 @@ const initLogger = () => { const error = message.data.join(os.EOL) if (/Failed to get 'documents' path/gi.test(error)) { - const title = i18next.t('common.errorManager.failedToGetDocsPath.title') - const msg = i18next.t('common.errorManager.failedToGetDocsPath.message') + const title = i18next.t('errorManager.failedToGetDocsPath.title') + const msg = i18next.t('errorManager.failedToGetDocsPath.message') showModalDialog({ errBoxTitle: title, diff --git a/src/error-manager/show-modal-dialog.js b/src/error-manager/show-modal-dialog.js index 7c7f6f27..7183f7bf 100644 --- a/src/error-manager/show-modal-dialog.js +++ b/src/error-manager/show-modal-dialog.js @@ -54,7 +54,7 @@ const converter = new Converter({ const _fireAlert = (params) => { const { - title = i18next.t('common.errorManager.errorModalDialog.title'), + title = i18next.t('errorManager.errorModalDialog.title'), html = '', parentWin, hasNoParentWin @@ -112,9 +112,9 @@ const _fireAlert = (params) => { icon: 'question', focusConfirm: true, showConfirmButton: true, - confirmButtonText: i18next.t('common.errorManager.errorModalDialog.confirmButtonText'), + confirmButtonText: i18next.t('errorManager.errorModalDialog.confirmButtonText'), showCancelButton: true, - cancelButtonText: i18next.t('common.errorManager.errorModalDialog.cancelButtonText'), + cancelButtonText: i18next.t('common.cancelButtonText'), timerProgressBar: false, ...params, @@ -177,18 +177,18 @@ module.exports = async (params) => { * before the translation init */ errBoxTitle = i18next.t( - 'common.errorManager.errorModalDialog.errBoxTitle', + 'errorManager.errorModalDialog.errBoxTitle', 'Bug report' ), errBoxDescription = i18next.t( - 'common.errorManager.errorModalDialog.errBoxDescription', + 'errorManager.errorModalDialog.errBoxDescription', 'A new GitHub issue will be opened' ), mdIssue, alertOpts = {} } = params ?? {} const zenityBtn = i18next.t( - 'common.errorManager.errorModalDialog.zenityBtn', + 'errorManager.errorModalDialog.zenityBtn', 'Report and Exit' ) diff --git a/src/export-db.js b/src/export-db.js index 5cbbfc43..572a2ffa 100644 --- a/src/export-db.js +++ b/src/export-db.js @@ -50,10 +50,10 @@ module.exports = ({ } = await dialog.showSaveDialog( win, { - title: i18next.t('common.exportDB.saveDialog.title'), + title: i18next.t('exportDB.saveDialog.title'), defaultPath, buttonLabel: i18next - .t('common.exportDB.saveDialog.buttonLabel'), + .t('exportDB.saveDialog.buttonLabel'), filters: [{ name: 'ZIP', extensions: ['zip'] }] } ) @@ -70,7 +70,7 @@ module.exports = ({ await showLoadingWindow({ description: i18next - .t('common.exportDB.loadingWindow.description') + .t('exportDB.loadingWindow.description') }) const progressHandler = async (args) => { @@ -79,9 +79,9 @@ module.exports = ({ prettyArchiveSize } = args ?? {} - const _description = i18next.t('common.exportDB.loadingWindow.description') + const _description = i18next.t('exportDB.loadingWindow.description') const _archived = i18next.t( - 'common.exportDB.loadingWindow.archiveSize', + 'exportDB.loadingWindow.archiveSize', { prettyArchiveSize } ) @@ -103,18 +103,18 @@ module.exports = ({ await showMessageModalDialog(win, { buttons: [ - i18next.t('common.exportDB.modalDialog.confirmButtonText') + i18next.t('common.confirmButtonText') ], defaultId: 0, - title: i18next.t('common.exportDB.modalDialog.title'), - message: i18next.t('common.exportDB.modalDialog.message') + title: i18next.t('exportDB.modalDialog.title'), + message: i18next.t('exportDB.modalDialog.message') }) } catch (err) { try { await hideLoadingWindow() await showErrorModalDialog( win, - i18next.t('common.exportDB.modalDialog.title'), + i18next.t('exportDB.modalDialog.title'), err ) } catch (err) { diff --git a/src/import-db.js b/src/import-db.js index a940a2f0..2ad6f92a 100644 --- a/src/import-db.js +++ b/src/import-db.js @@ -55,10 +55,10 @@ module.exports = ({ } = await dialog.showOpenDialog( win, { - title: i18next.t('common.importDB.openDialog.title'), + title: i18next.t('importDB.openDialog.title'), defaultPath: pathToUserDocuments, buttonLabel: i18next - .t('common.importDB.openDialog.buttonLabel'), + .t('importDB.openDialog.buttonLabel'), properties: [ 'openFile', 'createDirectory', @@ -88,9 +88,9 @@ module.exports = ({ } = args ?? {} const _description = i18next - .t('common.importDB.loadingWindow.description') + .t('importDB.loadingWindow.description') const _unzipped = i18next.t( - 'common.importDB.loadingWindow.unzippedBytes', + 'importDB.loadingWindow.unzippedBytes', { prettyUnzippedBytes } ) @@ -105,7 +105,7 @@ module.exports = ({ await pauseApp({ loadingWinParams: { description: i18next - .t('common.importDB.loadingWindow.description') + .t('importDB.loadingWindow.description') } }) await _rmDbExcludeMain(pathToUserData, DB_FILE_NAME) @@ -135,7 +135,7 @@ module.exports = ({ : win await showErrorModalDialog( _win, - i18next.t('common.importDB.modalDialog.title'), + i18next.t('importDB.modalDialog.title'), err ) } catch (err) { diff --git a/src/manage-worker-messages.js b/src/manage-worker-messages.js index 58543f98..e42a497a 100644 --- a/src/manage-worker-messages.js +++ b/src/manage-worker-messages.js @@ -94,11 +94,11 @@ module.exports = (ipc) => { await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type, - title: i18next.t('common.restoreDB.messageModalDialog.title'), + title: i18next.t('restoreDB.messageModalDialog.title'), message: hasNotDbBeenRestored - ? i18next.t('common.restoreDB.messageModalDialog.dbNotRestoredMessage') - : i18next.t('common.restoreDB.messageModalDialog.dbRestoredMessage'), - buttons: [i18next.t('common.restoreDB.messageModalDialog.confirmButtonText')], + ? i18next.t('restoreDB.messageModalDialog.dbNotRestoredMessage') + : i18next.t('restoreDB.messageModalDialog.dbRestoredMessage'), + buttons: [i18next.t('common.confirmButtonText')], defaultId: 0, cancelId: 0, shouldParentWindowBeShown: true @@ -117,18 +117,18 @@ module.exports = (ipc) => { ) { const haveNotAllDbDataBeenRemoved = state === PROCESS_MESSAGES.ALL_TABLE_HAVE_NOT_BEEN_REMOVED const message = haveNotAllDbDataBeenRemoved - ? i18next.t('common.removeDB.messageModalDialog.dbDataHasNotBeenRemovedMessage') - : i18next.t('common.removeDB.messageModalDialog.dbDataHasBeenRemovedMessage') + ? i18next.t('removeDB.messageModalDialog.dbDataHasNotBeenRemovedMessage') + : i18next.t('removeDB.messageModalDialog.dbDataHasBeenRemovedMessage') const type = haveNotAllDbDataBeenRemoved ? 'error' : 'info' await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type, - title: i18next.t('common.removeDB.messageModalDialog.dbRemovingTitle'), + title: i18next.t('removeDB.messageModalDialog.dbRemovingTitle'), message, buttons: [ - i18next.t('common.removeDB.messageModalDialog.confirmButtonText') + i18next.t('common.confirmButtonText') ], defaultId: 0, cancelId: 0, @@ -143,18 +143,18 @@ module.exports = (ipc) => { ) { const isBackupError = state === PROCESS_MESSAGES.ERROR_BACKUP const message = isBackupError - ? i18next.t('common.backupDB.dbBackupHasFailedMessage') - : i18next.t('common.backupDB.dbBackupHasCompletedMessage') + ? i18next.t('backupDB.dbBackupHasFailedMessage') + : i18next.t('backupDB.dbBackupHasCompletedMessage') const type = isBackupError ? 'error' : 'info' await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type, - title: i18next.t('common.backupDB.backupDBTitle'), + title: i18next.t('backupDB.backupDBTitle'), message, buttons: [ - i18next.t('common.backupDB.confirmButtonText') + i18next.t('common.confirmButtonText') ], defaultId: 0, cancelId: 0, @@ -200,11 +200,11 @@ module.exports = (ipc) => { ? 'error' : 'info' const message = isMigrationsError - ? i18next.t('common.migrationDB.messageModalDialog.dbMigrationHasFailedMessage') - : i18next.t('common.migrationDB.messageModalDialog.dbMigrationHasCompletedMessage') + ? i18next.t('migrationDB.messageModalDialog.dbMigrationHasFailedMessage') + : i18next.t('migrationDB.messageModalDialog.dbMigrationHasCompletedMessage') const buttons = isMigrationsError - ? [i18next.t('common.migrationDB.messageModalDialog.cancelButtonText')] - : [i18next.t('common.migrationDB.messageModalDialog.confirmButtonText')] + ? [i18next.t('common.cancelButtonText')] + : [i18next.t('common.confirmButtonText')] await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type, @@ -223,13 +223,13 @@ module.exports = (ipc) => { } = await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type: 'question', title: i18next - .t('common.migrationDB.actionRequestModalDialog.title'), + .t('migrationDB.actionRequestModalDialog.title'), message: i18next - .t('common.migrationDB.actionRequestModalDialog.message'), + .t('migrationDB.actionRequestModalDialog.message'), buttons: [ - i18next.t('common.migrationDB.actionRequestModalDialog.exitButtonText'), - i18next.t('common.migrationDB.actionRequestModalDialog.restoreDBButtonText'), - i18next.t('common.migrationDB.actionRequestModalDialog.removeDBButtonText') + i18next.t('migrationDB.actionRequestModalDialog.exitButtonText'), + i18next.t('migrationDB.actionRequestModalDialog.restoreDBButtonText'), + i18next.t('migrationDB.actionRequestModalDialog.removeDBButtonText') ], shouldParentWindowBeShown: true })) @@ -252,18 +252,18 @@ module.exports = (ipc) => { } if (state === PROCESS_MESSAGES.REQUEST_SHOULD_ALL_TABLES_BE_REMOVED) { const title = data.isNotDbRestored - ? i18next.t('common.removeDB.messageModalDialog.dbHasNotBeenRestoredTitle') - : i18next.t('common.removeDB.messageModalDialog.removeDBTitle') + ? i18next.t('removeDB.messageModalDialog.dbHasNotBeenRestoredTitle') + : i18next.t('removeDB.messageModalDialog.removeDBTitle') const { btnId } = await resolveModalDialogInSequence(() => showMessageModalDialog(win, { type: 'question', title, - message: i18next.t('common.removeDB.messageModalDialog.removeDBMessage'), + message: i18next.t('removeDB.messageModalDialog.removeDBMessage'), buttons: [ - i18next.t('common.removeDB.messageModalDialog.cancelButtonText'), - i18next.t('common.removeDB.messageModalDialog.confirmButtonText') + i18next.t('common.cancelButtonText'), + i18next.t('common.confirmButtonText') ], shouldParentWindowBeShown: true })) diff --git a/src/print-to-pdf/index.js b/src/print-to-pdf/index.js index 272e82e7..c5de3e83 100644 --- a/src/print-to-pdf/index.js +++ b/src/print-to-pdf/index.js @@ -26,7 +26,7 @@ module.exports = () => { const { templateFilePath, - template = i18next.t('common.printToPDF.defaultTemplate'), + template = i18next.t('printToPDF.defaultTemplate'), format = 'portrait', orientation = 'Letter', uid = null @@ -74,7 +74,7 @@ module.exports = () => { font-weight: 400; font-size: 8px; "> - ${i18next.t('common.printToPDF.pagination.page')} ${i18next.t('common.printToPDF.pagination.from')} + ${i18next.t('printToPDF.pagination.page')} ${i18next.t('printToPDF.pagination.from')} ` }) diff --git a/src/remove-db.js b/src/remove-db.js index 56830a30..dd0063e8 100644 --- a/src/remove-db.js +++ b/src/remove-db.js @@ -92,11 +92,11 @@ module.exports = ({ ? wins.mainWindow : BrowserWindow.getFocusedWindow() const title = shouldAllTablesBeCleared - ? i18next.t('common.removeDB.modalDialog.clearDataTitle') - : i18next.t('common.removeDB.modalDialog.removeDBTitle') + ? i18next.t('removeDB.modalDialog.clearDataTitle') + : i18next.t('removeDB.modalDialog.removeDBTitle') const message = shouldAllTablesBeCleared - ? i18next.t('common.removeDB.modalDialog.clearDataMessage') - : i18next.t('common.removeDB.modalDialog.removeDBMessage') + ? i18next.t('removeDB.modalDialog.clearDataMessage') + : i18next.t('removeDB.modalDialog.removeDBMessage') try { const { @@ -122,8 +122,8 @@ module.exports = ({ }, loadingWinParams: { description: shouldAllTablesBeCleared - ? i18next.t('common.removeDB.loadingWindow.clearingAllDataDescription') - : i18next.t('common.removeDB.loadingWindow.removingDBDescription') + ? i18next.t('removeDB.loadingWindow.clearingAllDataDescription') + : i18next.t('removeDB.loadingWindow.removingDBDescription') } }) diff --git a/src/restore-db/index.js b/src/restore-db/index.js index 206f6373..dcd95d5e 100644 --- a/src/restore-db/index.js +++ b/src/restore-db/index.js @@ -56,7 +56,7 @@ const sound = { freq: 'F2', type: 'triange', duration: 1.5 } const _fireAlert = (params) => { const { - title = i18next.t('common.restoreDB.modalDialog.title'), + title = i18next.t('restoreDB.modalDialog.title'), backupFilesMetadata } = params const win = wins.mainWindow @@ -119,8 +119,8 @@ const _fireAlert = (params) => { showConfirmButton: true, focusCancel: true, showCancelButton: true, - confirmButtonText: i18next.t('common.restoreDB.modalDialog.confirmButtonText'), - cancelButtonText: i18next.t('common.restoreDB.modalDialog.cancelButtonText'), + confirmButtonText: i18next.t('common.confirmButtonText'), + cancelButtonText: i18next.t('common.cancelButtonText'), timerProgressBar: false, input: 'radio', @@ -237,9 +237,9 @@ module.exports = () => { ) { await showMessageModalDialog(wins.mainWindow, { type: 'warning', - title: i18next.t('common.restoreDB.messageModalDialog.title'), - message: i18next.t('common.restoreDB.messageModalDialog.message'), - buttons: [i18next.t('common.restoreDB.messageModalDialog.confirmButtonText')], + title: i18next.t('restoreDB.messageModalDialog.title'), + message: i18next.t('restoreDB.messageModalDialog.message'), + buttons: [i18next.t('common.confirmButtonText')], defaultId: 0, cancelId: 0 }) diff --git a/src/show-about-modal-dialog.js b/src/show-about-modal-dialog.js index 3648b83b..38c94125 100644 --- a/src/show-about-modal-dialog.js +++ b/src/show-about-modal-dialog.js @@ -34,9 +34,9 @@ module.exports = () => { message: productName, detail, buttons: [ - i18next.t('common.showAboutModalDialog.copyButtonText'), - i18next.t('common.showAboutModalDialog.gitHubButtonText'), - i18next.t('common.showAboutModalDialog.confirmButtonText') + i18next.t('showAboutModalDialog.copyButtonText'), + i18next.t('showAboutModalDialog.gitHubButtonText'), + i18next.t('common.confirmButtonText') ], defaultId: 2, cancelId: 2, diff --git a/src/show-docs/index.js b/src/show-docs/index.js index b49f6150..3f0ad639 100644 --- a/src/show-docs/index.js +++ b/src/show-docs/index.js @@ -56,7 +56,7 @@ const converter = new Converter({ const _fireAlert = (params) => { const { type = 'info', - title = i18next.t('common.showDocs.modalDialog.title'), + title = i18next.t('showDocs.modalDialog.title'), html } = params const win = wins.mainWindow @@ -109,7 +109,7 @@ const _fireAlert = (params) => { showConfirmButton: false, focusCancel: true, showCancelButton: true, - cancelButtonText: i18next.t('common.showDocs.modalDialog.cancelButtonText'), + cancelButtonText: i18next.t('showDocs.modalDialog.cancelButtonText'), timerProgressBar: false, willOpen: () => { diff --git a/src/show-error-modal-dialog.js b/src/show-error-modal-dialog.js index abc10392..aefadd53 100644 --- a/src/show-error-modal-dialog.js +++ b/src/show-error-modal-dialog.js @@ -17,7 +17,7 @@ const _showErrorBox = (win, title = '', message = '') => { return showMessageModalDialog(win, { type: 'error', buttons: [ - i18next.t('common.showErrorModalDialog.confirmButtonText') + i18next.t('common.confirmButtonText') ], defaultId: 0, cancelId: 0, @@ -28,7 +28,7 @@ const _showErrorBox = (win, title = '', message = '') => { module.exports = async (win, title = 'Error', err) => { if (err.code === 'ENOENT') { - const message = i18next.t('common.showErrorModalDialog.enoentErrorMessage') + const message = i18next.t('showErrorModalDialog.enoentErrorMessage') const content = (err.syscall && err.path) ? `${message}, ${err.syscall}: '${err.path}'` : message @@ -36,7 +36,7 @@ module.exports = async (win, title = 'Error', err) => { return _showErrorBox(win, title, content) } if (err.code === 'EACCES') { - const message = i18next.t('common.showErrorModalDialog.eaccesErrorMessage') + const message = i18next.t('showErrorModalDialog.eaccesErrorMessage') const content = (err.syscall && err.path) ? `${message}, ${err.syscall}: '${err.path}'` : message @@ -44,12 +44,12 @@ module.exports = async (win, title = 'Error', err) => { return _showErrorBox(win, title, content) } if (err instanceof InvalidFilePathError) { - const message = i18next.t('common.showErrorModalDialog.invalidFilePathErrorMessage') + const message = i18next.t('showErrorModalDialog.invalidFilePathErrorMessage') return _showErrorBox(win, title, message) } if (err instanceof InvalidFileNameInArchiveError) { - const message = i18next.t('common.showErrorModalDialog.invalidFileNameInArchErrorMessage') + const message = i18next.t('showErrorModalDialog.invalidFileNameInArchErrorMessage') return _showErrorBox(win, title, message) } @@ -57,27 +57,27 @@ module.exports = async (win, title = 'Error', err) => { err instanceof DbImportingError || err instanceof InvalidFolderPathError ) { - const message = i18next.t('common.showErrorModalDialog.dbImportingErrorMessage') + const message = i18next.t('showErrorModalDialog.dbImportingErrorMessage') return _showErrorBox(win, title, message) } if (err instanceof DbRemovingError) { - const message = i18next.t('common.showErrorModalDialog.dbRemovingErrorMessage') + const message = i18next.t('showErrorModalDialog.dbRemovingErrorMessage') return _showErrorBox(win, title, message) } if (err instanceof ReportsFolderChangingError) { - const message = i18next.t('common.showErrorModalDialog.reportsFolderChangingErrorMessage') + const message = i18next.t('showErrorModalDialog.reportsFolderChangingErrorMessage') return _showErrorBox(win, title, message) } if (err instanceof SyncFrequencyChangingError) { - const message = i18next.t('common.showErrorModalDialog.syncFrequencyChangingErrorMessage') + const message = i18next.t('showErrorModalDialog.syncFrequencyChangingErrorMessage') return _showErrorBox(win, title, message) } - const message = i18next.t('common.showErrorModalDialog.unexpectedExceptionMessage') + const message = i18next.t('showErrorModalDialog.unexpectedExceptionMessage') return _showErrorBox(win, title, message) } diff --git a/src/show-message-modal-dialog.js b/src/show-message-modal-dialog.js index 5d1a98fc..9153cd6e 100644 --- a/src/show-message-modal-dialog.js +++ b/src/show-message-modal-dialog.js @@ -27,8 +27,8 @@ module.exports = async (win, opts = {}) => { } = await dialog.showMessageBox(parentWin, { type: 'info', buttons: [ - i18next.t('common.showMessageModalDialog.cancelButtonText'), - i18next.t('common.showMessageModalDialog.confirmButtonText') + i18next.t('common.cancelButtonText'), + i18next.t('common.confirmButtonText') ], defaultId: 1, cancelId: 0, diff --git a/src/show-notification/index.js b/src/show-notification/index.js index 659874ac..1f1107f9 100644 --- a/src/show-notification/index.js +++ b/src/show-notification/index.js @@ -12,8 +12,8 @@ module.exports = (params) => { } const notification = new Notification({ - title: i18next.t('common.nativeNotification.defaulTitle'), - body: i18next.t('common.nativeNotification.defaultBody'), + title: i18next.t('nativeNotification.defaulTitle'), + body: i18next.t('nativeNotification.defaultBody'), silent: false, timeoutType: 'never', urgency: 'normal', diff --git a/src/show-notification/show-sync-notification.js b/src/show-notification/show-sync-notification.js index 22158926..1a2c0adc 100644 --- a/src/show-notification/show-sync-notification.js +++ b/src/show-notification/show-sync-notification.js @@ -16,13 +16,13 @@ const getBody = (params) => { } = params ?? {} if (isError) { - return i18next.t('common.nativeNotification.sync.errorBody') + return i18next.t('nativeNotification.sync.errorBody') } if (isInterrupted) { - return i18next.t('common.nativeNotification.sync.interruptedBody') + return i18next.t('nativeNotification.sync.interruptedBody') } - return i18next.t('common.nativeNotification.sync.completedBody') + return i18next.t('nativeNotification.sync.completedBody') } module.exports = (mess) => { diff --git a/src/show-notification/show-trx-tax-report-notification.js b/src/show-notification/show-trx-tax-report-notification.js index 64e202d6..fd88377a 100644 --- a/src/show-notification/show-trx-tax-report-notification.js +++ b/src/show-notification/show-trx-tax-report-notification.js @@ -20,8 +20,8 @@ module.exports = (mess) => { const isError = state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT const body = isError - ? i18next.t('common.nativeNotification.trxTaxReport.errorBody') - : i18next.t('common.nativeNotification.trxTaxReport.completedBody') + ? i18next.t('nativeNotification.trxTaxReport.errorBody') + : i18next.t('nativeNotification.trxTaxReport.completedBody') const urgency = isError ? 'critical' : 'normal' showNotification({ body, urgency }) diff --git a/src/window-creators/layouts/app-init-error.html b/src/window-creators/layouts/app-init-error.html index f64bff5c..3fa209ae 100644 --- a/src/window-creators/layouts/app-init-error.html +++ b/src/window-creators/layouts/app-init-error.html @@ -120,11 +120,11 @@ try { description = await window.bfxReportElectronApi?.translate({ - key: 'common.appInitError.description', + key: 'appInitError.description', opts: { defaultValue: defaultDescription } }) ?? defaultDescription closeBtnText = await window.bfxReportElectronApi?.translate({ - key: 'common.appInitError.closeBtnText', + key: 'appInitError.closeBtnText', opts: { defaultValue: defaultCloseBtnText } }) ?? defaultCloseBtnText From e7f24a4b9276080d1d3271f1cf2dd8cb9ebcd93e Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 2 Dec 2024 11:32:23 +0200 Subject: [PATCH 56/58] Extend changelog for v4.31.0 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b589c0b..ed3be378 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,9 +19,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added translation support to the `manage-worker-messages` module. Add translation support to the `backup-db` and `migration-db` modules. Fixed showing modal dialogs in sequence. PR: [bfx-report-electron#456](https://github.com/bitfinexcom/bfx-report-electron/pull/456) - Added translation support to the `show-about-modal-dialog` module. PR: [bfx-report-electron#457](https://github.com/bitfinexcom/bfx-report-electron/pull/457) +### Changed + +- Optimized electron translation file data structure to prevent some common duplication and redundant nesting for easier support. PR: [bfx-report-electron#468](https://github.com/bitfinexcom/bfx-report-electron/pull/468) +- Reworked and optimized the `TimeRangePreservePref` component in a more performant way and reduced redundant code. PR: [bfx-report-ui#885](https://github.com/bitfinexcom/bfx-report-ui/pull/885) +- Extended data logging by showing public request params to simplify debugging BFX API issues. PR: [bfx-report#414](https://github.com/bitfinexcom/bfx-report/pull/414) +- Removed `language` schema param check and added `en` fallback language to prevent returning the translation key `key.nestedKey.etc` if a value is missing for a certain language and added the ability to try to take one from the default `en` translation file. PR: [bfx-report#415](https://github.com/bitfinexcom/bfx-report/pull/415) + ### Fixed - Fixed docker desktop container user permissions breaks. Fixed `chown`: `changing ownership of 'path-to-file': Operation not permitted` when using it in `dockerfile`. PR: [bfx-report-electron#460](https://github.com/bitfinexcom/bfx-report-electron/pull/460) +- Fixed error metadata processing for logging. PRs: [bfx-report#418](https://github.com/bitfinexcom/bfx-report/pull/418), [bfx-reports-framework#428](https://github.com/bitfinexcom/bfx-reports-framework/pull/428) ## [4.30.0] - 2024-11-13 From ae33c35a7b5097343366463d6e642a1002b130dd Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 5 Dec 2024 08:24:40 +0200 Subject: [PATCH 57/58] Update sub-modules --- bfx-report-ui | 2 +- bfx-reports-framework | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bfx-report-ui b/bfx-report-ui index 3a0e0812..bb304084 160000 --- a/bfx-report-ui +++ b/bfx-report-ui @@ -1 +1 @@ -Subproject commit 3a0e08123ba4b55ad378fa38defe41024d0de4b5 +Subproject commit bb304084e04f316d74ef6c40618feefcf6c12d09 diff --git a/bfx-reports-framework b/bfx-reports-framework index a6a782ee..43421486 160000 --- a/bfx-reports-framework +++ b/bfx-reports-framework @@ -1 +1 @@ -Subproject commit a6a782ee0284f8f4bd3205b415f59080e037820e +Subproject commit 4342148668bdffd30e790fc338ac736d32aa9fbc From 27ac52e131169433da7910e8fafe671f57416a43 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 5 Dec 2024 08:27:20 +0200 Subject: [PATCH 58/58] Update changelog for v4.31.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed3be378..3e7cdccd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [4.31.0] - 2024-11-27 +## [4.31.0] - 2024-12-04 ### Added