Merge pull request #1208 from josepfo/fix/ciphertrace-ui-and-config
fix: notify db accounts changes and UI score color
This commit is contained in:
commit
61c4ca9ae7
2 changed files with 9 additions and 6 deletions
|
|
@ -27,10 +27,13 @@ const accountsSql = `update user_config set data = $2, valid = $3, schema_versio
|
|||
insert into user_config (type, data, valid, schema_version)
|
||||
select $1, $2, $3, $4 where $1 not in (select type from user_config)`
|
||||
function saveAccounts (accounts) {
|
||||
return loadAccounts()
|
||||
.then(currentAccounts => {
|
||||
return Promise.all([loadAccounts(), getOperatorId('middleware')])
|
||||
.then(([currentAccounts, operatorId]) => {
|
||||
const newAccounts = _.merge(currentAccounts, accounts)
|
||||
return db.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
return db.tx(t => {
|
||||
return t.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
.then(() => t.none('NOTIFY $1:name, $2', ['reload', JSON.stringify({ schema: asyncLocalStorage.getStore().get('schema'), operatorId })]))
|
||||
}).catch(console.error)
|
||||
})
|
||||
}
|
||||
function resetAccounts (schemaVersion) {
|
||||
|
|
|
|||
|
|
@ -202,10 +202,10 @@ const DetailsRow = ({ it: tx, timezone }) => {
|
|||
r={3.5}
|
||||
fill={
|
||||
it < tx.walletScore
|
||||
? !R.includes('score is above', tx.hasError ?? '')
|
||||
? R.isNil(tx.hasError)
|
||||
? primaryColor
|
||||
: errorColor
|
||||
: !R.includes('score is above', tx.hasError ?? '')
|
||||
: R.isNil(tx.hasError)
|
||||
? subheaderColor
|
||||
: offErrorColor
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ const DetailsRow = ({ it: tx, timezone }) => {
|
|||
noMargin
|
||||
className={classNames({
|
||||
[classes.bold]: true,
|
||||
[classes.error]: R.includes('score is above', tx.hasError ?? '')
|
||||
[classes.error]: !R.isNil(tx.hasError)
|
||||
})}>
|
||||
{tx.walletScore}
|
||||
</P>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue