Skip to content

Commit

Permalink
Merge pull request #128 from bitfinexcom/beta
Browse files Browse the repository at this point in the history
Release version 1.6.2
  • Loading branch information
ezewer authored Dec 17, 2021
2 parents 332b468 + 2f22ef9 commit f41a127
Show file tree
Hide file tree
Showing 27 changed files with 988 additions and 220 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock=false
save-exact=true
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Added ability to `backup/restore` DB
- Added ability to track server worker errors
- Added `changelog` file and flow to show one in the modal dialog after the app was updated

### Fixed

- Fixed snapshots tickers. The issue is the following: when taking a snapshot of wallets it's not showing the correspondent tickers as to represent crypto in fiat equivalent
- Fixed error manager

### Changed

- Updated electron version up to `13.6.3`

## [3.6.1] - 2021-11-03

### Fixed

- Fixed `account summary` response for sub-account
- Fixed issue with app crashing on `Start Snapshot` and related `React` errors

### Added

- Added `win/loss` vs `account balance` report
- Added `Show Unrealized Profits` selectors to `Average Win/Loss` and `Account Balance` sections
7 changes: 4 additions & 3 deletions Dockerfile.win-builder
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ ENV NODE_VERSION 14.16.0

COPY ./scripts/install-nodejs.sh ./scripts/install-nodejs.sh

RUN ./scripts/install-nodejs.sh $NODE_VERSION \
&& wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key -O Release.key \
&& apt-key add - < Release.key \
RUN ./scripts/install-nodejs.sh $NODE_VERSION \
# Remove the `Wine` source entry to resolve
# the release key expiration issue for `apt-get update`
&& sed -i '/Wine/d' /etc/apt/sources.list \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
p7zip-full \
Expand Down
13 changes: 12 additions & 1 deletion docs/user-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ First time opening the App or Syncing an account users would need to wait the pr
> - Tools:
> - Export DB
> - Import DB
> - Restore DB
> - Backup DB
> - Remove DB
> - Clear all data
> - Change reports folder
Expand All @@ -407,6 +409,7 @@ First time opening the App or Syncing an account users would need to wait the pr
> - Open new GitHub issue
> - Check for update
> - User manual
> - Changelog
> - About
</details>
Expand All @@ -418,9 +421,17 @@ First time opening the App or Syncing an account users would need to wait the pr
> - If a user wishes to upgrade between report versions, change the computer or replicate a report on another computer, without syncing their data again, there is an option added to import/export the reports DB.
By pressing the `ALT` key, a menu will pop up on the top with the respective tools relating to do the export/import task.
> - If it becomes necessary to clear all confidential data, it is possible to completely delete the database files using the menu bar item `Tools`->`Remove DB`.
> Also has ability to drop all data except users login information to be able to login using the menu bar item `Tools`->`Clear all data`.
> - Also has ability to drop all data except users login information to be able to login using the menu bar item `Tools`->`Clear all data`.
> After it the app would be launched except exporting case
> In addition to the above, there is an option to restore the DB from previously saved backups:
> - when a new version of the app is published DB structure might be changed
> - in this case, the corresponding DB backup would be saved to keep users data safe
> - if DB migration to a new version has some trouble would restore the previous DB version from the made backups
> - also, available an option into the menu bar to be able to restore DB from the selected backup `Tools`->`Restore DB` and make a new backup file `Tools`->`Backup DB`
> - backups store in the same place where the main DB is placed, in a separated folder `backups/`
> - stores only two last versions of backup files (e.g. `backup_v26_TIMESTAMP.db` and `backup_v25_TIMESTAMP.db`). And not more than two backup files of the last DB version (e.g. `backup_v26_2021-11-05T00-00-00.000Z.db` and `backup_v26_2021-09-05T00-00-00.000Z.db`) for cases when user wants to store more than one backup file for current supported DB schema. Taking into account the previously described, max number of backup files might be three
</details>

<details>
Expand Down
47 changes: 24 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
{
"name": "bfx-report-electron",
"version": "3.6.1",
"version": "3.6.2",
"repository": "https://github.com/bitfinexcom/bfx-report-electron",
"description": "Reporting tool",
"author": "bitfinex.com",
"main": "index.js",
"license": "Apache-2.0",
"dependencies": {
"archiver": "^3.1.1",
"async": "^2.6.1",
"archiver": "5.3.0",
"bfx-svc-test-helper": "git+https://github.com/bitfinexcom/bfx-svc-test-helper.git",
"bittorrent-dht": "^8.4.0",
"clean-stack": "^3.0.1",
"cron-validate": "^1.4.2",
"ed25519-supercop": "^2.0.1",
"bittorrent-dht": "10.0.2",
"changelog-parser": "2.8.0",
"clean-stack": "3.0.1",
"compare-versions": "4.1.1",
"cron-validate": "1.4.3",
"ed25519-supercop": "2.0.1",
"electron-alert": "0.1.13",
"electron-log": "^4.3.2",
"electron-root-path": "^1.0.16",
"electron-serve": "^1.0.0",
"electron-log": "4.4.1",
"electron-root-path": "1.0.16",
"electron-serve": "1.1.0",
"electron-updater": "4.3.8",
"extract-zip": "^2.0.1",
"find-free-port": "^2.0.0",
"github-markdown-css": "^4.0.0",
"extract-zip": "2.0.1",
"find-free-port": "2.0.0",
"github-markdown-css": "4.0.0",
"grenache-grape": "git+https://github.com/bitfinexcom/grenache-grape.git",
"js-yaml": "^4.0.0",
"lodash": "^4.17.15",
"new-github-issue-url": "^0.2.1",
"showdown": "^1.9.1",
"truncate-utf8-bytes": "^1.0.2",
"yauzl": "^2.10.0"
"js-yaml": "4.1.0",
"lodash": "4.17.21",
"new-github-issue-url": "0.2.1",
"showdown": "1.9.1",
"truncate-utf8-bytes": "1.0.2",
"yauzl": "2.10.0"
},
"devDependencies": {
"app-builder-bin": "^3.5.13",
"electron": "13.4.0",
"@mapbox/node-pre-gyp": "1.0.6",
"app-builder-bin": "4.1.0",
"electron": "13.6.3",
"electron-builder": "22.11.7",
"node-gyp": "7.1.2",
"node-pre-gyp": "^0.11.0",
"standard": "^16.0.3"
"standard": "16.0.4"
},
"standard": {
"globals": [
Expand Down
86 changes: 65 additions & 21 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { pick } = require('lodash')
const { fork } = require('child_process')
const path = require('path')
const EventEmitter = require('events')
Expand All @@ -13,6 +14,13 @@ const pathToConfFacs = path.join(pathToConfDir, 'facs')
const pathToConfFacsGrc = path.join(pathToConfFacs, 'grc.config.json')
const confFacsGrc = require(pathToConfFacsGrc)

const PROCESS_MESSAGES = require(
'./bfx-reports-framework/workers/loc.api/process.message.manager/process.messages'
)
const PROCESS_STATES = require(
'./bfx-reports-framework/workers/loc.api/process.message.manager/process.states'
)

if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production'
process.send = process.send || (() => {})
process.env.NODE_CONFIG_DIR = pathToExpressConfDir
Expand All @@ -33,8 +41,59 @@ const {

const emitter = new EventEmitter()

let isMigrationsReady = false
let isMigrationsError = false
const _getAllowedStatesSet = ({
allStates,
availableStates
}) => {
const pickedStates = pick(
allStates,
availableStates
)

return new Set(Object.values(pickedStates))
}

const allowedProcessMessagesSet = _getAllowedStatesSet({
allStates: PROCESS_MESSAGES,
availableStates: [
'ERROR_WORKER',

'READY_MIGRATIONS',
'ERROR_MIGRATIONS',

'ALL_TABLE_HAVE_BEEN_CLEARED',
'ALL_TABLE_HAVE_NOT_BEEN_CLEARED',

'ALL_TABLE_HAVE_BEEN_REMOVED',
'ALL_TABLE_HAVE_NOT_BEEN_REMOVED',

'BACKUP_PROGRESS',
'BACKUP_FINISHED',
'ERROR_BACKUP',

'DB_HAS_BEEN_RESTORED',
'DB_HAS_NOT_BEEN_RESTORED',

'REQUEST_MIGRATION_HAS_FAILED_WHAT_SHOULD_BE_DONE',
'REQUEST_SHOULD_ALL_TABLES_BE_REMOVED',

'RESPONSE_GET_BACKUP_FILES_METADATA'
]
})
const allowedProcessStatesSet = _getAllowedStatesSet({
allStates: PROCESS_STATES,
availableStates: [
'CLEAR_ALL_TABLES',
'REMOVE_ALL_TABLES',

'RESTORE_DB',
'BACKUP_DB',

'RESPONSE_MIGRATION_HAS_FAILED_WHAT_SHOULD_BE_DONE',

'REQUEST_GET_BACKUP_FILES_METADATA'
]
})

;(async () => {
try {
Expand Down Expand Up @@ -135,10 +194,7 @@ let isMigrationsError = false
ipc.on('message', (mess) => {
const { state } = { ...mess }

if (
state !== 'all-tables-have-been-cleared' &&
state !== 'all-tables-have-not-been-cleared'
) {
if (!allowedProcessMessagesSet.has(state)) {
return
}

Expand All @@ -147,7 +203,7 @@ let isMigrationsError = false
process.on('message', (mess) => {
const { state } = { ...mess }

if (state !== 'clear-all-tables') {
if (!allowedProcessStatesSet.has(state)) {
return
}

Expand All @@ -156,18 +212,10 @@ let isMigrationsError = false

const announcePromise = grapes.onAnnounce('rest:report:api')
const ipcReadyPromise = new Promise((resolve, reject) => {
ipc.once('error', reject)

const handlerMess = (mess) => {
const { state } = { ...mess }

if (state === 'error:migrations') {
isMigrationsError = true
}
if (state === 'ready:migrations') {
isMigrationsReady = true
}
if (state !== 'ready:worker') {
if (state !== PROCESS_MESSAGES.READY_WORKER) {
return
}

Expand Down Expand Up @@ -217,11 +265,7 @@ emitter.once('ready:grapes-worker', () => {
})

emitter.once('ready:server', () => {
process.send({
state: 'ready:server',
isMigrationsError,
isMigrationsReady
})
process.send({ state: 'ready:server' })
})

module.exports = emitter
17 changes: 5 additions & 12 deletions src/auto-updater/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const {
showLoadingWindow,
hideLoadingWindow
} = require('../change-loading-win-visibility-state')
const {
closeAlert
} = require('../modal-dialog-src/utils')

const fontsStyle = fs.readFileSync(path.join(
__dirname, '../../bfx-report-ui/build/fonts/roboto.css'
Expand Down Expand Up @@ -53,16 +56,6 @@ const _sendProgress = (progress) => {
)
}

const _closeToast = (toast) => {
if (
!toast ||
!toast.browserWindow
) return

toast.browserWindow.hide()
toast.browserWindow.destroy()
}

const _fireToast = (
opts = {},
hooks = {}
Expand All @@ -72,7 +65,7 @@ const _fireToast = (
onAfterClose = () => {}
} = { ...hooks }

_closeToast(toast)
closeAlert(toast)

const height = 44
const win = wins.mainWindow
Expand All @@ -88,7 +81,7 @@ const _fireToast = (
const alert = new Alert([fonts, style, script])
toast = alert

const _closeAlert = () => _closeToast(alert)
const _closeAlert = () => closeAlert(alert)

win.once('closed', _closeAlert)

Expand Down
29 changes: 29 additions & 0 deletions src/backup-db/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict'

const { app } = require('electron')

const ipcs = require('../ipcs')
const isMainWinAvailable = require(
'../helpers/is-main-win-available'
)

const PROCESS_STATES = require(
'../../bfx-reports-framework/workers/loc.api/process.message.manager/process.states'
)

module.exports = () => {
return () => {
try {
if (
!app.isReady() ||
!isMainWinAvailable()
) {
return
}

ipcs.serverIpc.send({ state: PROCESS_STATES.BACKUP_DB })
} catch (err) {
console.error(err)
}
}
}
9 changes: 9 additions & 0 deletions src/changelog-manager/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict'

const showChangelog = require('./show-changelog')
const manageChangelog = require('./manage-changelog')

module.exports = {
showChangelog,
manageChangelog
}
Loading

0 comments on commit f41a127

Please sign in to comment.