Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from bitfinexcom:master #39

Merged
merged 15 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 8 additions & 2 deletions src/auto-updater/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 ||
Expand Down
11 changes: 9 additions & 2 deletions src/changelog-manager/manage-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
38 changes: 32 additions & 6 deletions src/changelog-manager/show-changelog.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
'use strict'

const { Menu } = require('electron')
const path = require('path')
const parseChangelog = require('changelog-parser')
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
Expand All @@ -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
Expand All @@ -33,7 +48,12 @@ module.exports = async (params = {}) => {
!mdEntry?.title ||
!mdEntry?.body
) {
return true
disableShowChangelogMenuItem()

return {
error: null,
isShown: false
}
}

const mdTitle = `# ${mdEntries.title}`
Expand All @@ -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
}
}
}
37 changes: 20 additions & 17 deletions src/create-menu.js → src/create-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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' },
Expand All @@ -161,6 +163,7 @@ module.exports = ({
},
{
label: 'Changelog',
id: MENU_ITEM_IDS.SHOW_CHANGE_LOG_MENU_ITEM,
click: () => showChangelog()
},
...(isMac
Expand Down
8 changes: 8 additions & 0 deletions src/create-menu/menu.item.ids.js
Original file line number Diff line number Diff line change
@@ -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'
}
4 changes: 3 additions & 1 deletion src/error-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = () => {
Expand Down
Loading