diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1941df0c..1bb4fddc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,14 @@ jobs: - name: Setup configs and install deps run: ./scripts/setup.sh -u - name: Run tests - run: npm test -- -- --reporter=json --reporter-option output=test-report.json + uses: nick-fields/retry@v3 + continue-on-error: false + with: + timeout_minutes: 20 + retry_wait_seconds: 10 + max_attempts: 3 + retry_on: any + command: npm test -- -- --reporter=json --reporter-option output=test-report.json - uses: actions/upload-artifact@v4 if: success() || failure() with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b420393..c50cd2a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.24.0] - 2024-05-08 + +### Added + +- Added `3` retries for the test run before it fails, increased timeouts for mocha hooks. PRs: [bfx-report#368](https://github.com/bitfinexcom/bfx-report/pull/368), [bfx-report-electron#374](https://github.com/bitfinexcom/bfx-report-electron/pull/374), [bfx-reports-framework#372](https://github.com/bitfinexcom/bfx-reports-framework/pull/372), [bfx-reports-framework#374](https://github.com/bitfinexcom/bfx-reports-framework/pull/374) +- Implemented the possibility to `Reset Column Widths` via the context menu (right click) on column headers. PR: [bfx-report-ui#808](https://github.com/bitfinexcom/bfx-report-ui/pull/808) +- Implemented the possibility to customize (1-7 days range supported) authorization token TTL via the `Preferences` menu in the app. PR: [bfx-report-ui#809](https://github.com/bitfinexcom/bfx-report-ui/pull/809) + +### Changed + +- Disabled the `Changelog` menu option if the description of the current version is not available. PR: [bfx-report-electron#373](https://github.com/bitfinexcom/bfx-report-electron/pull/373) +- Enhanced `sub-account` ledger balance recalc to prevent setting non-recalced balances. Prevented `funding trades` sync issue when `end` less than `start`. Related to this issue: [bfx-report-electron#375](https://github.com/bitfinexcom/bfx-report-electron/issues/375). PR: [bfx-reports-framework#375](https://github.com/bitfinexcom/bfx-reports-framework/pull/375) +- Enhanced default column widths calculation flow using dynamic calculated average and widths multipliers based on the column types. PR: [bfx-report-ui#810](https://github.com/bitfinexcom/bfx-report-ui/pull/810) + +### Security + +- Resolved `dependabot` dependency updates, bumped `ejs` from `3.1.9` to `3.1.10`. PR: [bfx-report-ui#813](https://github.com/bitfinexcom/bfx-report-ui/pull/813) + ## [4.23.0] - 2024-04-17 ### Added diff --git a/bfx-report-ui b/bfx-report-ui index 49972f84..b14ccb94 160000 --- a/bfx-report-ui +++ b/bfx-report-ui @@ -1 +1 @@ -Subproject commit 49972f84980a59b9bc9481ca8865959b4ff2abb1 +Subproject commit b14ccb94004977332f8f6838bda0d43c6f0d3914 diff --git a/bfx-reports-framework b/bfx-reports-framework index 7821574c..50dc1b4c 160000 --- a/bfx-reports-framework +++ b/bfx-reports-framework @@ -1 +1 @@ -Subproject commit 7821574c713456968fe08436add4139ed57b675a +Subproject commit 50dc1b4cb4f1840e818077c28c861f518756c2fc diff --git a/package.json b/package.json index 461fb426..b68b511d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report-electron", - "version": "4.23.0", + "version": "4.24.0", "repository": "https://github.com/bitfinexcom/bfx-report-electron", "description": "Reporting tool", "author": "bitfinex.com", diff --git a/src/auto-updater/index.js b/src/auto-updater/index.js index 178e806b..6be6aad8 100644 --- a/src/auto-updater/index.js +++ b/src/auto-updater/index.js @@ -28,6 +28,8 @@ const { addOnceProcEventHandler } = require('../window-event-manager') +const MENU_ITEM_IDS = require('../create-menu/menu.item.ids') + const isAutoUpdateDisabled = parseEnvValToBool(process.env.IS_AUTO_UPDATE_DISABLED) const fontsStyle = fs.readFileSync(path.join( @@ -219,8 +221,12 @@ const _switchMenuItem = (opts = {}) => { isCheckMenuItemDisabled, isInstallMenuItemVisible } = { ...opts } - const checkMenuItem = _getUpdateMenuItemById('CHECK_UPDATE_MENU_ITEM') - const installMenuItem = _getUpdateMenuItemById('INSTALL_UPDATE_MENU_ITEM') + const checkMenuItem = _getUpdateMenuItemById( + MENU_ITEM_IDS.CHECK_UPDATE_MENU_ITEM + ) + const installMenuItem = _getUpdateMenuItemById( + MENU_ITEM_IDS.INSTALL_UPDATE_MENU_ITEM + ) if ( !checkMenuItem || diff --git a/src/changelog-manager/manage-changelog.js b/src/changelog-manager/manage-changelog.js index a09f029f..5dc481b7 100644 --- a/src/changelog-manager/manage-changelog.js +++ b/src/changelog-manager/manage-changelog.js @@ -23,14 +23,21 @@ module.exports = async () => { return } - const isShown = await showChangelog({ version }) + const { + error, + isShown + } = await showChangelog({ version }) + + if (!isShown) { + return + } const isSaved = await configsKeeper .saveConfigs({ shownChangelogVer: version }) if ( isSaved && - isShown + !error ) { return } diff --git a/src/changelog-manager/show-changelog.js b/src/changelog-manager/show-changelog.js index ae362b47..ea0d265e 100644 --- a/src/changelog-manager/show-changelog.js +++ b/src/changelog-manager/show-changelog.js @@ -1,5 +1,6 @@ 'use strict' +const { Menu } = require('electron') const path = require('path') const parseChangelog = require('changelog-parser') const { rootPath } = require('electron-root-path') @@ -7,8 +8,17 @@ const { rootPath } = require('electron-root-path') const getDebugInfo = require('../helpers/get-debug-info') const showDocs = require('../show-docs') +const MENU_ITEM_IDS = require('../create-menu/menu.item.ids') + const changelogPath = path.join(rootPath, 'CHANGELOG.md') +const disableShowChangelogMenuItem = () => { + const menuItem = Menu.getApplicationMenu() + ?.getMenuItemById(MENU_ITEM_IDS.SHOW_CHANGE_LOG_MENU_ITEM) ?? {} + + menuItem.enabled = false +} + module.exports = async (params = {}) => { try { const version = params?.version ?? getDebugInfo()?.version @@ -23,7 +33,12 @@ module.exports = async (params = {}) => { !Array.isArray(mdEntries?.versions) || mdEntries?.versions.length === 0 ) { - return true + disableShowChangelogMenuItem() + + return { + error: null, + isShown: false + } } const mdEntry = mdEntries.versions @@ -33,7 +48,12 @@ module.exports = async (params = {}) => { !mdEntry?.title || !mdEntry?.body ) { - return true + disableShowChangelogMenuItem() + + return { + error: null, + isShown: false + } } const mdTitle = `# ${mdEntries.title}` @@ -45,10 +65,16 @@ module.exports = async (params = {}) => { mdDoc }) - return true - } catch (err) { - console.error(err) + return { + error: null, + isShown: true + } + } catch (error) { + console.error(error) - return false + return { + error, + isShown: false + } } } diff --git a/src/create-menu.js b/src/create-menu/index.js similarity index 79% rename from src/create-menu.js rename to src/create-menu/index.js index 3c5f237b..6537b876 100644 --- a/src/create-menu.js +++ b/src/create-menu/index.js @@ -5,23 +5,25 @@ const electron = require('electron') const { app, Menu } = electron const isMac = process.platform === 'darwin' -const exportDB = require('./export-db') -const importDB = require('./import-db') -const removeDB = require('./remove-db') -const restoreDB = require('./restore-db') -const backupDB = require('./backup-db') -const changeReportsFolder = require('./change-reports-folder') -const changeSyncFrequency = require('./change-sync-frequency') -const triggerElectronLoad = require('./trigger-electron-load') -const showAboutModalDialog = require('./show-about-modal-dialog') +const exportDB = require('../export-db') +const importDB = require('../import-db') +const removeDB = require('../remove-db') +const restoreDB = require('../restore-db') +const backupDB = require('../backup-db') +const changeReportsFolder = require('../change-reports-folder') +const changeSyncFrequency = require('../change-sync-frequency') +const triggerElectronLoad = require('../trigger-electron-load') +const showAboutModalDialog = require('../show-about-modal-dialog') const { checkForUpdates, quitAndInstall -} = require('./auto-updater') -const { manageNewGithubIssue } = require('./error-manager') -const showDocs = require('./show-docs') -const { showChangelog } = require('./changelog-manager') -const parseEnvValToBool = require('./helpers/parse-env-val-to-bool') +} = require('../auto-updater') +const { manageNewGithubIssue } = require('../error-manager') +const showDocs = require('../show-docs') +const { showChangelog } = require('../changelog-manager') +const parseEnvValToBool = require('../helpers/parse-env-val-to-bool') + +const MENU_ITEM_IDS = require('./menu.item.ids') const isAutoUpdateDisabled = parseEnvValToBool(process.env.IS_AUTO_UPDATE_DISABLED) @@ -137,20 +139,20 @@ module.exports = ({ submenu: [ { label: 'Open new GitHub issue', - id: 'REPORT_BUG_MENU_ITEM', + id: MENU_ITEM_IDS.REPORT_BUG_MENU_ITEM, click: manageNewGithubIssue }, { type: 'separator' }, { label: 'Check for updates', enabled: !isAutoUpdateDisabled, - id: 'CHECK_UPDATE_MENU_ITEM', + id: MENU_ITEM_IDS.CHECK_UPDATE_MENU_ITEM, click: checkForUpdates() }, { label: 'Quit and install updates', visible: false, - id: 'INSTALL_UPDATE_MENU_ITEM', + id: MENU_ITEM_IDS.INSTALL_UPDATE_MENU_ITEM, click: quitAndInstall() }, { type: 'separator' }, @@ -161,6 +163,7 @@ module.exports = ({ }, { label: 'Changelog', + id: MENU_ITEM_IDS.SHOW_CHANGE_LOG_MENU_ITEM, click: () => showChangelog() }, ...(isMac diff --git a/src/create-menu/menu.item.ids.js b/src/create-menu/menu.item.ids.js new file mode 100644 index 00000000..c9cbb151 --- /dev/null +++ b/src/create-menu/menu.item.ids.js @@ -0,0 +1,8 @@ +'use strict' + +module.exports = { + REPORT_BUG_MENU_ITEM: 'REPORT_BUG_MENU_ITEM', + CHECK_UPDATE_MENU_ITEM: 'CHECK_UPDATE_MENU_ITEM', + INSTALL_UPDATE_MENU_ITEM: 'INSTALL_UPDATE_MENU_ITEM', + SHOW_CHANGE_LOG_MENU_ITEM: 'SHOW_CHANGE_LOG_MENU_ITEM' +} diff --git a/src/error-manager/index.js b/src/error-manager/index.js index 5a82a4bf..976dc411 100644 --- a/src/error-manager/index.js +++ b/src/error-manager/index.js @@ -14,6 +14,8 @@ const openNewGithubIssue = require('./open-new-github-issue') const collectLogs = require('./collect-logs') const getDebugInfo = require('../helpers/get-debug-info') +const MENU_ITEM_IDS = require('../create-menu/menu.item.ids') + let _isLocked = false let _isIssueAutoManagerLocked = false let caughtError @@ -97,7 +99,7 @@ const _getReportBugMenuItem = () => { return {} } - return menu.getMenuItemById('REPORT_BUG_MENU_ITEM') || {} + return menu.getMenuItemById(MENU_ITEM_IDS.REPORT_BUG_MENU_ITEM) || {} } const _lockIssueManager = () => {