Skip to content

Commit

Permalink
Merge pull request #399 from bitfinexcom/staging
Browse files Browse the repository at this point in the history
Release version 4.26.0
  • Loading branch information
ezewer authored Aug 29, 2024
2 parents 126e9fb + ecdce1d commit bdbc86c
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 19 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.26.0] - 2024-08-28

### Added

- Added ability to send `IPC` messages when the sync is ready. PR: [bfx-reports-framework#405](https://github.com/bitfinexcom/bfx-reports-framework/pull/405)
- Added ability to show native notifications in case another screen is displayed and the app window is not hidden with multiple workspaces mode in `Ubuntu`/`Mac`. PR: [bfx-report-electron#389](https://github.com/bitfinexcom/bfx-report-electron/pull/389)
- Added ability to show the native notification in the electron app in case the `sync` is being processed in the background with the hidden main window. There we check if the main window is invisible and show a notification otherwise don't. PR: [bfx-report-electron#390](https://github.com/bitfinexcom/bfx-report-electron/pull/390)

### Changed

- Enhanced and unified `Logins` and `Change Logs` reports column configuration getters and reduced redundant code. PR: [bfx-report-ui#840](https://github.com/bitfinexcom/bfx-report-ui/pull/840)
- Reworked and optimized the `TimeFrameSelector` component in a more performant way and reduced redundant code. PR: [bfx-report-ui#841](https://github.com/bitfinexcom/bfx-report-ui/pull/841)
- Reworked cell generation configurations more concisely and optimally for `Wallets`, `Weighted Averages` and `Concentration Risk` reports. PR: [bfx-report-ui#842](https://github.com/bitfinexcom/bfx-report-ui/pull/842)
- Reworked and optimized `LedgersCategorySelect` in a more concise and performant way. PR: [bfx-report-ui#843](https://github.com/bitfinexcom/bfx-report-ui/pull/843)
- Reworked and optimized `Movements`, `Trades`, `Orders` and `Positions` reports column configuration getters. Implemented unified `getFeeCell` and `getActionCell` helpers for better reusability. PR: [bfx-report-ui#844](https://github.com/bitfinexcom/bfx-report-ui/pull/844)
- Reworked `CandlesTimeframe` in a more performant way and improved props linting. PR: [bfx-report-ui#845](https://github.com/bitfinexcom/bfx-report-ui/pull/845)
- Enhanced and unified `Snapshots` sections column configuration getters and reduced redundant code. PR: [bfx-report-ui#846](https://github.com/bitfinexcom/bfx-report-ui/pull/846)
- Removed deprecated methods and fields without breaking the logic and UI functionality. PRs: [bfx-report#389](https://github.com/bitfinexcom/bfx-report/pull/389), [bfx-reports-framework#403](https://github.com/bitfinexcom/bfx-reports-framework/pull/403)
- Improved DB file cleanups for test coverage hooks. PRs: [bfx-report#390](https://github.com/bitfinexcom/bfx-report/pull/390), [bitfinexcom/lokue#3](https://github.com/bitfinexcom/lokue/pull/3)
- Removed unused public colls conf accessor endpoints to use the common `getAllPublicCollsConfs`/`editAllPublicCollsConfs` ones without breaking the logic and UI functionality. PR: [bfx-reports-framework#404](https://github.com/bitfinexcom/bfx-reports-framework/pull/404)
- Implemented a class for DB models to typify and unify model objects. PR: [bfx-reports-framework#406](https://github.com/bitfinexcom/bfx-reports-framework/pull/406)
- Proxied `ENet` error tester for import in electron env. PR: [bfx-reports-framework#407](https://github.com/bitfinexcom/bfx-reports-framework/pull/407)

### Fixed

- Extended network error processing. Related to these issues: [bfx-report-electron#396](https://github.com/bitfinexcom/bfx-report-electron/issues/396), [bfx-report-electron#274](https://github.com/bitfinexcom/bfx-report-electron/issues/274). PR: [bfx-report#392](https://github.com/bitfinexcom/bfx-report/pull/392)
- Improved the tax report ccy conversion by adding `6` retries with `10sec` delay for getting `pub-trades` if returns non-array. PR: [bfx-reports-framework#402](https://github.com/bitfinexcom/bfx-reports-framework/pull/402)
- Extended network error processing and prevented showing the error modal dialog. Related to these issues: [bfx-report-electron#396](https://github.com/bitfinexcom/bfx-report-electron/issues/396), [bfx-report-electron#274](https://github.com/bitfinexcom/bfx-report-electron/issues/274). PR: [bfx-report-electron#397](https://github.com/bitfinexcom/bfx-report-electron/pull/397)

## [4.25.0] - 2024-07-31

### Added
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,14 @@ npm run launch -- -aop
```

> Also, we provide [GitHub Actioins workflows](https://docs.github.com/en/actions/using-workflows/about-workflows) configs for automated building and publishing of the Electron app artifacts using the above-described scripts `./scripts/launch.sh` and `./scripts/build-release.sh`, see the corresponding file `.github/workflows/build-electron-app.yml`
## Locations of ElectronJS App files on different OSs

- Logs:
- Ubuntu: `~/.config/Bitfinex Report/logs`
- Windows: `C:\Users\$username\AppData\Roaming\Bitfinex Report\logs`
- Mac: ElectronJS logs: `~/Library/Logs/Bitfinex Report` and app logs `~/Library/Application Support/Bitfinex Report/logs`
- DB files `db-sqlite_sync_m0.db`, `db-sqlite_sync_m0.db-shm` (optional), `db-sqlite_sync_m0.db-wal` (optional):
- Ubuntu: `~/.config/Bitfinex Report`
- Windows: `C:\Users\$username\AppData\Roaming\Bitfinex Report`
- Mac: `~/Library/Application Support/Bitfinex Report`
2 changes: 1 addition & 1 deletion bfx-report-ui
2 changes: 1 addition & 1 deletion bfx-reports-framework
Submodule bfx-reports-framework updated 65 files
+1 −1 bfx-report-ui
+1 −1 package.json
+17 −35 test/3-api-filter-sync-mode-sqlite.spec.js
+0 −278 test/test-cases/api-sync-mode-sqlite-test-cases.js
+3 −0 workers/loc.api/di/app.deps.js
+1 −0 workers/loc.api/di/types.js
+8 −1 workers/loc.api/errors/index.js
+12 −0 workers/loc.api/helpers/api-errors-testers.js
+0 −54 workers/loc.api/helpers/schema.js
+3 −0 workers/loc.api/process.message.manager/process.messages.js
+6 −179 workers/loc.api/service.report.framework.js
+2 −0 workers/loc.api/sync/colls.accessors/index.js
+8 −5 workers/loc.api/sync/colls.accessors/public.colls.conf.accessors.js
+8 −0 workers/loc.api/sync/colls.accessors/public.colls.conf.names.js
+1 −1 workers/loc.api/sync/dao/dao.better.sqlite.js
+1 −1 workers/loc.api/sync/dao/helpers/get-index-creation-query.js
+3 −1 workers/loc.api/sync/dao/helpers/get-table-creation-query.js
+3 −1 workers/loc.api/sync/dao/helpers/get-trigger-creation-query.js
+37 −2 workers/loc.api/sync/progress/index.js
+1 −1 workers/loc.api/sync/schema/helpers/index.js
+13 −18 workers/loc.api/sync/schema/models/candles.js
+14 −24 workers/loc.api/sync/schema/models/change-logs.js
+10 −14 workers/loc.api/sync/schema/models/currencies.js
+28 −38 workers/loc.api/sync/schema/models/funding-credit-history.js
+27 −37 workers/loc.api/sync/schema/models/funding-loan-history.js
+26 −36 workers/loc.api/sync/schema/models/funding-offer-history.js
+18 −28 workers/loc.api/sync/schema/models/funding-trades.js
+5 −9 workers/loc.api/sync/schema/models/futures.js
+5 −9 workers/loc.api/sync/schema/models/inactive-currencies.js
+5 −9 workers/loc.api/sync/schema/models/inactive-symbols.js
+30 −40 workers/loc.api/sync/schema/models/ledgers.js
+14 −24 workers/loc.api/sync/schema/models/logins.js
+6 −10 workers/loc.api/sync/schema/models/map-symbols.js
+5 −9 workers/loc.api/sync/schema/models/margin-currency-list.js
+50 −0 workers/loc.api/sync/schema/models/model/base.model.js
+1 −1 workers/loc.api/sync/schema/models/model/common.constraints.js
+1 −1 workers/loc.api/sync/schema/models/model/common.triggers.js
+31 −0 workers/loc.api/sync/schema/models/model/db.data.types.js
+3 −3 workers/loc.api/sync/schema/models/model/db.service.field.names.js
+23 −0 workers/loc.api/sync/schema/models/model/helpers/index.js
+222 −0 workers/loc.api/sync/schema/models/model/index.js
+23 −33 workers/loc.api/sync/schema/models/movements.js
+32 −42 workers/loc.api/sync/schema/models/orders.js
+24 −34 workers/loc.api/sync/schema/models/pay-invoice-list.js
+25 −35 workers/loc.api/sync/schema/models/positions-history.js
+24 −33 workers/loc.api/sync/schema/models/positions-snapshot.js
+6 −17 workers/loc.api/sync/schema/models/progress.js
+11 −25 workers/loc.api/sync/schema/models/public-colls-conf.js
+12 −17 workers/loc.api/sync/schema/models/public-trades.js
+4 −15 workers/loc.api/sync/schema/models/scheduler.js
+15 −20 workers/loc.api/sync/schema/models/status-messages.js
+10 −27 workers/loc.api/sync/schema/models/sub-accounts.js
+5 −9 workers/loc.api/sync/schema/models/symbols.js
+4 −15 workers/loc.api/sync/schema/models/sync-mode.js
+9 −22 workers/loc.api/sync/schema/models/sync-queue.js
+19 −35 workers/loc.api/sync/schema/models/sync-user-steps.js
+10 −15 workers/loc.api/sync/schema/models/tickers-history.js
+23 −33 workers/loc.api/sync/schema/models/trades.js
+6 −19 workers/loc.api/sync/schema/models/users.js
+4 −1 workers/loc.api/sync/schema/sync-schema/candles.js
+4 −1 workers/loc.api/sync/schema/sync-schema/public-trades.js
+4 −1 workers/loc.api/sync/schema/sync-schema/status-messages.js
+4 −1 workers/loc.api/sync/schema/sync-schema/tickers-history.js
+23 −18 workers/loc.api/sync/transaction.tax.report/index.js
+0 −20 workers/loc.api/ws-transport/ws.event.emitter.js
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.25.0",
"version": "4.26.0",
"repository": "https://github.com/bitfinexcom/bfx-report-electron",
"description": "Reporting tool",
"author": "bitfinex.com",
Expand Down
3 changes: 3 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ const allowedProcessMessagesSet = _getAllowedStatesSet({
'READY_TRX_TAX_REPORT',
'ERROR_TRX_TAX_REPORT',

'READY_SYNC',
'ERROR_SYNC',

'ALL_TABLE_HAVE_BEEN_CLEARED',
'ALL_TABLE_HAVE_NOT_BEEN_CLEARED',

Expand Down
6 changes: 5 additions & 1 deletion src/error-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const cleanStack = require('clean-stack')

const isDevEnv = process.env.NODE_ENV === 'development'

const { isENetError } = require(
'../../bfx-reports-framework/workers/loc.api/helpers/api-errors-testers'
)

const log = require('./log')
const getErrorDescription = require('./get-error-description')
const showModalDialog = require('./show-modal-dialog')
Expand Down Expand Up @@ -216,8 +220,8 @@ const initLogger = () => {
* - GitHub server can't respond to the auto-update requests
*/
if (
isENetError(error) ||
/Cannot download differentially/gi.test(error) ||
/ERR_CONNECTION_REFUSED/gi.test(error) ||
/objects\.githubusercontent\.com/gi.test(error) ||
/Error: ERR_FAILED \(-2\) loading 'file:.*\.html'/gi.test(error) ||
/Failed to generate PDF/gi.test(error)
Expand Down
10 changes: 9 additions & 1 deletion src/helpers/manage-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,16 @@ const centerWindow = (win, workArea) => {
win.setBounds(boundsOpts)
}

const isWindowInvisible = (win) => {
return (
!win?.isVisible() ||
!win?.isFocused()
)
}

module.exports = {
hideWindow,
showWindow,
centerWindow
centerWindow,
isWindowInvisible
}
32 changes: 18 additions & 14 deletions src/manage-worker-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ const showMessageModalDialog = require(
const isMainWinAvailable = require(
'./helpers/is-main-win-available'
)
const { showWindow } = require('./helpers/manage-window')
const showNotification = require('./show-notification')
const {
showWindow
} = require('./helpers/manage-window')
const showTrxTaxReportNotification = require(
'./show-notification/show-trx-tax-report-notification'
)
const showSyncNotification = require(
'./show-notification/show-sync-notification'
)
const PROCESS_MESSAGES = require(
'../bfx-reports-framework/workers/loc.api/process.message.manager/process.messages'
)
Expand Down Expand Up @@ -238,19 +245,16 @@ module.exports = (ipc) => {
ipc.send({ state: PROCESS_STATES.REMOVE_ALL_TABLES })
}
if (
(
state === PROCESS_MESSAGES.READY_TRX_TAX_REPORT ||
state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT
) &&
!wins?.mainWindow?.isVisible()
state === PROCESS_MESSAGES.READY_TRX_TAX_REPORT ||
state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT
) {
const isError = state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT
const body = isError
? 'An unexpected error occurred while generating the tax report!'
: 'Your tax report is ready!'
const urgency = isError ? 'critical' : 'normal'

showNotification({ body, urgency })
showTrxTaxReportNotification(mess)
}
if (
state === PROCESS_MESSAGES.READY_SYNC ||
state === PROCESS_MESSAGES.ERROR_SYNC
) {
showSyncNotification(mess)
}
} catch (err) {
console.error(err)
Expand Down
43 changes: 43 additions & 0 deletions src/show-notification/show-sync-notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict'

const PROCESS_MESSAGES = require(
'../../bfx-reports-framework/workers/loc.api/process.message.manager/process.messages'
)
const wins = require('../windows')
const { isWindowInvisible } = require('../helpers/manage-window')
const showNotification = require('./')

const getBody = (params) => {
const {
isError,
isInterrupted
} = params ?? {}

if (isError) {
return 'Data sync completed with an error!'
}
if (isInterrupted) {
return 'Data sync interrupted!'
}

return 'Data sync completed successfully!'
}

module.exports = (mess) => {
const {
state = '',
data = {}
} = mess ?? {}

if (!isWindowInvisible(wins?.mainWindow)) {
return
}

const isError = state === PROCESS_MESSAGES.ERROR_SYNC
const isInterrupted = !!data?.isInterrupted

const body = getBody({ isError, isInterrupted })
const urgency = isError ? 'critical' : 'normal'

showNotification({ body, urgency })
}
26 changes: 26 additions & 0 deletions src/show-notification/show-trx-tax-report-notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict'

const PROCESS_MESSAGES = require(
'../../bfx-reports-framework/workers/loc.api/process.message.manager/process.messages'
)
const wins = require('../windows')
const { isWindowInvisible } = require('../helpers/manage-window')
const showNotification = require('./')

module.exports = (mess) => {
const {
state = ''
} = mess ?? {}

if (!isWindowInvisible(wins?.mainWindow)) {
return
}

const isError = state === PROCESS_MESSAGES.ERROR_TRX_TAX_REPORT
const body = isError
? 'An unexpected error occurred while generating the tax report!'
: 'Your tax report is ready!'
const urgency = isError ? 'critical' : 'normal'

showNotification({ body, urgency })
}

0 comments on commit bdbc86c

Please sign in to comment.