Merge pull request #1721 from siiky/refactor/lam-1163/avoid-unnecessary-version-bumps
LAM-1163 Avoid unnecessary version bumps in l-s
This commit is contained in:
commit
f5dd813464
27 changed files with 141 additions and 272 deletions
|
|
@ -92,7 +92,7 @@ function loadLatestConfig (filterSchemaVersion = true) {
|
||||||
order by id desc
|
order by id desc
|
||||||
limit 1`
|
limit 1`
|
||||||
|
|
||||||
return db.one(sql, ['config', configValidate.SETTINGS_LOADER_SCHEMA_VERSION])
|
return db.oneOrNone(sql, ['config', configValidate.SETTINGS_LOADER_SCHEMA_VERSION])
|
||||||
.then(row => row.data.config)
|
.then(row => row.data.config)
|
||||||
.then(configValidate.validate)
|
.then(configValidate.validate)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
@ -240,6 +240,7 @@ module.exports = {
|
||||||
loadRecentConfig,
|
loadRecentConfig,
|
||||||
load,
|
load,
|
||||||
loadLatest,
|
loadLatest,
|
||||||
|
loadLatestConfig,
|
||||||
save,
|
save,
|
||||||
loadFixture,
|
loadFixture,
|
||||||
mergeValues,
|
mergeValues,
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ function post (machineTx, pi) {
|
||||||
let addressReuse = false
|
let addressReuse = false
|
||||||
let walletScore = {}
|
let walletScore = {}
|
||||||
|
|
||||||
const promises = [settingsLoader.loadLatest()]
|
const promises = [settingsLoader.loadLatestConfig()]
|
||||||
|
|
||||||
const isFirstPost = !r.tx.fiat || r.tx.fiat.isZero()
|
const isFirstPost = !r.tx.fiat || r.tx.fiat.isZero()
|
||||||
if (isFirstPost) {
|
if (isFirstPost) {
|
||||||
|
|
@ -44,7 +44,7 @@ function post (machineTx, pi) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(promises)
|
return Promise.all(promises)
|
||||||
.then(([{ config }, blacklistItems = false, isReusedAddress = false, fetchedWalletScore = null]) => {
|
.then(([config, blacklistItems = false, isReusedAddress = false, fetchedWalletScore = null]) => {
|
||||||
const rejectAddressReuse = configManager.getCompliance(config).rejectAddressReuse
|
const rejectAddressReuse = configManager.getCompliance(config).rejectAddressReuse
|
||||||
|
|
||||||
walletScore = fetchedWalletScore
|
walletScore = fetchedWalletScore
|
||||||
|
|
|
||||||
|
|
@ -474,8 +474,4 @@ function migrate (config, accounts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = { migrate }
|
||||||
migrateConfig,
|
|
||||||
migrateAccounts,
|
|
||||||
migrate
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ const nmd = require('nano-markdown')
|
||||||
|
|
||||||
const plugins = require('../plugins')
|
const plugins = require('../plugins')
|
||||||
const configManager = require('../new-config-manager')
|
const configManager = require('../new-config-manager')
|
||||||
|
const settingsLoader = require('../new-settings-loader')
|
||||||
const { batchGetCustomInfoRequest, getCustomInfoRequests } = require('../new-admin/services/customInfoRequests')
|
const { batchGetCustomInfoRequest, getCustomInfoRequests } = require('../new-admin/services/customInfoRequests')
|
||||||
const state = require('../middlewares/state')
|
const state = require('../middlewares/state')
|
||||||
const { getMachine } = require('../machine-loader')
|
const { getMachine } = require('../machine-loader')
|
||||||
|
|
@ -323,8 +324,7 @@ const terms = (parent, { currentConfigVersion, currentHash }, { deviceId, settin
|
||||||
const isHashNew = hash !== currentHash
|
const isHashNew = hash !== currentHash
|
||||||
const text = isHashNew ? latestTerms.text : null
|
const text = isHashNew ? latestTerms.text : null
|
||||||
|
|
||||||
return plugins(settings, deviceId)
|
return settingsLoader.fetchCurrentConfigVersion()
|
||||||
.fetchCurrentConfigVersion()
|
|
||||||
.catch(() => null)
|
.catch(() => null)
|
||||||
.then(configVersion => isHashNew || _.isNil(currentConfigVersion) || currentConfigVersion < configVersion)
|
.then(configVersion => isHashNew || _.isNil(currentConfigVersion) || currentConfigVersion < configVersion)
|
||||||
.then(isVersionNew => isVersionNew ? _.omit(['text'], latestTerms) : null)
|
.then(isVersionNew => isVersionNew ? _.omit(['text'], latestTerms) : null)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ type OperatorInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MachineInfo {
|
type MachineInfo {
|
||||||
deviceId: String!
|
deviceId: String! @deprecated(reason: "unused by the machine")
|
||||||
deviceName: String
|
deviceName: String
|
||||||
numberOfCassettes: Int
|
numberOfCassettes: Int
|
||||||
numberOfRecyclers: Int
|
numberOfRecyclers: Int
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ const pairing = require('./pairing')
|
||||||
const { checkPings, checkStuckScreen } = require('./notifier')
|
const { checkPings, checkStuckScreen } = require('./notifier')
|
||||||
const dbm = require('./postgresql_interface')
|
const dbm = require('./postgresql_interface')
|
||||||
const configManager = require('./new-config-manager')
|
const configManager = require('./new-config-manager')
|
||||||
const settingsLoader = require('./new-settings-loader')
|
|
||||||
const notifierUtils = require('./notifier/utils')
|
const notifierUtils = require('./notifier/utils')
|
||||||
const notifierQueries = require('./notifier/queries')
|
const notifierQueries = require('./notifier/queries')
|
||||||
const { ApolloError } = require('apollo-server-errors');
|
const { ApolloError } = require('apollo-server-errors');
|
||||||
|
|
@ -94,9 +93,7 @@ function getUnpairedMachines () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConfig (defaultConfig) {
|
function getConfig (defaultConfig) {
|
||||||
if (defaultConfig) return Promise.resolve(defaultConfig)
|
return defaultConfig ? Promise.resolve(defaultConfig) : loadLatestConfig()
|
||||||
|
|
||||||
return settingsLoader.loadLatest().config
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStatus = (ping, stuck) => {
|
const getStatus = (ping, stuck) => {
|
||||||
|
|
@ -529,7 +526,6 @@ module.exports = {
|
||||||
updateNetworkHeartbeat,
|
updateNetworkHeartbeat,
|
||||||
getNetworkPerformance,
|
getNetworkPerformance,
|
||||||
getNetworkHeartbeat,
|
getNetworkHeartbeat,
|
||||||
getConfig,
|
|
||||||
getMachineIds,
|
getMachineIds,
|
||||||
emptyMachineUnits,
|
emptyMachineUnits,
|
||||||
refillMachineUnits,
|
refillMachineUnits,
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,7 @@ const resolvers = {
|
||||||
},
|
},
|
||||||
Mutation: {
|
Mutation: {
|
||||||
saveAccounts: (...[, { accounts }]) => settingsLoader.saveAccounts(accounts),
|
saveAccounts: (...[, { accounts }]) => settingsLoader.saveAccounts(accounts),
|
||||||
// resetAccounts: (...[, { schemaVersion }]) => settingsLoader.resetAccounts(schemaVersion),
|
|
||||||
saveConfig: (...[, { config }]) => settingsLoader.saveConfig(config),
|
saveConfig: (...[, { config }]) => settingsLoader.saveConfig(config),
|
||||||
// resetConfig: (...[, { schemaVersion }]) => settingsLoader.resetConfig(schemaVersion),
|
|
||||||
// migrateConfigAndAccounts: () => settingsLoader.migrate()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,7 @@ const typeDef = gql`
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
saveAccounts(accounts: JSONObject): JSONObject @auth
|
saveAccounts(accounts: JSONObject): JSONObject @auth
|
||||||
# resetAccounts(schemaVersion: Int): JSONObject @auth
|
|
||||||
saveConfig(config: JSONObject): JSONObject @auth
|
saveConfig(config: JSONObject): JSONObject @auth
|
||||||
# resetConfig(schemaVersion: Int): JSONObject @auth
|
|
||||||
# migrateConfigAndAccounts: JSONObject @auth
|
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,17 @@ const addTermsHash = configs => {
|
||||||
)(terms)
|
)(terms)
|
||||||
}
|
}
|
||||||
|
|
||||||
const accountsSql = `update user_config set data = $2, valid = $3, schema_version = $4 where type = $1;
|
const notifyReload = (dbOrTx, operatorId) =>
|
||||||
insert into user_config (type, data, valid, schema_version)
|
dbOrTx.none(
|
||||||
select $1, $2, $3, $4 where $1 not in (select type from user_config)`
|
'NOTIFY $1:name, $2',
|
||||||
|
['reload', JSON.stringify({ schema: asyncLocalStorage.getStore().get('schema'), operatorId })]
|
||||||
|
)
|
||||||
|
|
||||||
function saveAccounts (accounts) {
|
function saveAccounts (accounts) {
|
||||||
|
const accountsSql = `UPDATE user_config SET data = $1, valid = TRUE, schema_version = $2 WHERE type = 'accounts';
|
||||||
|
INSERT INTO user_config (type, data, valid, schema_version)
|
||||||
|
SELECT 'accounts', $1, TRUE, $2 WHERE 'accounts' NOT IN (SELECT type FROM user_config)`
|
||||||
|
|
||||||
return Promise.all([loadAccounts(), getOperatorId('middleware')])
|
return Promise.all([loadAccounts(), getOperatorId('middleware')])
|
||||||
.then(([currentAccounts, operatorId]) => {
|
.then(([currentAccounts, operatorId]) => {
|
||||||
const newAccounts = _.merge(currentAccounts, accounts)
|
const newAccounts = _.merge(currentAccounts, accounts)
|
||||||
|
|
@ -73,32 +80,21 @@ function saveAccounts (accounts) {
|
||||||
newAccounts.elliptic.enabled = false
|
newAccounts.elliptic.enabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
return db.tx(t => {
|
return db.tx(t =>
|
||||||
return t.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
t.none(accountsSql, [{ accounts: newAccounts }, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||||
.then(() => t.none('NOTIFY $1:name, $2', ['reload', JSON.stringify({ schema: asyncLocalStorage.getStore().get('schema'), operatorId })]))
|
.then(() => notifyReload(t, operatorId))
|
||||||
}).catch(console.error)
|
).catch(console.error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function resetAccounts (schemaVersion) {
|
|
||||||
return db.none(
|
|
||||||
accountsSql,
|
|
||||||
[
|
|
||||||
'accounts',
|
|
||||||
{ accounts: NEW_SETTINGS_LOADER_SCHEMA_VERSION ? {} : [] },
|
|
||||||
true,
|
|
||||||
schemaVersion
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadAccounts (schemaVersion) {
|
function loadAccounts (schemaVersion) {
|
||||||
const sql = `select data
|
const sql = `SELECT data
|
||||||
from user_config
|
FROM user_config
|
||||||
where type=$1
|
WHERE type = $1
|
||||||
and schema_version=$2
|
AND schema_version = $2
|
||||||
and valid
|
AND valid
|
||||||
order by id desc
|
ORDER BY id DESC
|
||||||
limit 1`
|
LIMIT 1`
|
||||||
|
|
||||||
return db.oneOrNone(sql, ['accounts', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
return db.oneOrNone(sql, ['accounts', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||||
.then(_.compose(_.defaultTo({}), _.get('data.accounts')))
|
.then(_.compose(_.defaultTo({}), _.get('data.accounts')))
|
||||||
|
|
@ -116,15 +112,20 @@ function showAccounts (schemaVersion) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const configSql = 'insert into user_config (type, data, valid, schema_version) values ($1, $2, $3, $4)'
|
const insertConfigRow = (dbOrTx, data) =>
|
||||||
|
dbOrTx.none(
|
||||||
|
"INSERT INTO user_config (type, data, valid, schema_version) VALUES ('config', $1, TRUE, $2)",
|
||||||
|
[data, NEW_SETTINGS_LOADER_SCHEMA_VERSION]
|
||||||
|
)
|
||||||
|
|
||||||
function saveConfig (config) {
|
function saveConfig (config) {
|
||||||
return Promise.all([loadLatestConfigOrNone(), getOperatorId('middleware')])
|
return Promise.all([loadLatestConfigOrNone(), getOperatorId('middleware')])
|
||||||
.then(([currentConfig, operatorId]) => {
|
.then(([currentConfig, operatorId]) => {
|
||||||
const newConfig = addTermsHash(_.assign(currentConfig, config))
|
const newConfig = addTermsHash(_.assign(currentConfig, config))
|
||||||
return db.tx(t => {
|
return db.tx(t =>
|
||||||
return t.none(configSql, ['config', { config: newConfig }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
insertConfigRow(t, { config: newConfig })
|
||||||
.then(() => t.none('NOTIFY $1:name, $2', ['reload', JSON.stringify({ schema: asyncLocalStorage.getStore().get('schema'), operatorId })]))
|
.then(() => notifyReload(t, operatorId))
|
||||||
}).catch(console.error)
|
).catch(console.error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,10 +133,10 @@ function removeFromConfig (fields) {
|
||||||
return Promise.all([loadLatestConfigOrNone(), getOperatorId('middleware')])
|
return Promise.all([loadLatestConfigOrNone(), getOperatorId('middleware')])
|
||||||
.then(([currentConfig, operatorId]) => {
|
.then(([currentConfig, operatorId]) => {
|
||||||
const newConfig = _.omit(fields, currentConfig)
|
const newConfig = _.omit(fields, currentConfig)
|
||||||
return db.tx(t => {
|
return db.tx(t =>
|
||||||
return t.none(configSql, ['config', { config: newConfig }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
insertConfigRow(t, { config: newConfig })
|
||||||
.then(() => t.none('NOTIFY $1:name, $2', ['reload', JSON.stringify({ schema: asyncLocalStorage.getStore().get('schema'), operatorId })]))
|
.then(() => notifyReload(t, operatorId))
|
||||||
}).catch(console.error)
|
).catch(console.error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,23 +144,11 @@ function migrationSaveConfig (config) {
|
||||||
return loadLatestConfigOrNone()
|
return loadLatestConfigOrNone()
|
||||||
.then(currentConfig => {
|
.then(currentConfig => {
|
||||||
const newConfig = _.assign(currentConfig, config)
|
const newConfig = _.assign(currentConfig, config)
|
||||||
return db.none(configSql, ['config', { config: newConfig }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
return insertConfigRow(db, { config: newConfig })
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetConfig (schemaVersion) {
|
|
||||||
return db.none(
|
|
||||||
configSql,
|
|
||||||
[
|
|
||||||
'config',
|
|
||||||
{ config: schemaVersion === NEW_SETTINGS_LOADER_SCHEMA_VERSION ? {} : [] },
|
|
||||||
true,
|
|
||||||
schemaVersion
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadLatest (schemaVersion) {
|
function loadLatest (schemaVersion) {
|
||||||
return Promise.all([loadLatestConfigOrNoneReturningVersion(schemaVersion), loadAccounts(schemaVersion)])
|
return Promise.all([loadLatestConfigOrNoneReturningVersion(schemaVersion), loadAccounts(schemaVersion)])
|
||||||
.then(([configObj, accounts]) => ({
|
.then(([configObj, accounts]) => ({
|
||||||
|
|
@ -170,15 +159,15 @@ function loadLatest (schemaVersion) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLatestConfig () {
|
function loadLatestConfig () {
|
||||||
const sql = `select data
|
const sql = `SELECT data
|
||||||
from user_config
|
FROM user_config
|
||||||
where type=$1
|
WHERE type = 'config'
|
||||||
and schema_version=$2
|
AND schema_version = $1
|
||||||
and valid
|
AND valid
|
||||||
order by id desc
|
ORDER BY id DESC
|
||||||
limit 1`
|
LIMIT 1`
|
||||||
|
|
||||||
return db.one(sql, ['config', NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
return db.oneOrNone(sql, [NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||||
.then(row => row ? row.data.config : {})
|
.then(row => row ? row.data.config : {})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
throw err
|
throw err
|
||||||
|
|
@ -186,38 +175,39 @@ function loadLatestConfig () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLatestConfigOrNoneReturningVersion (schemaVersion) {
|
function loadLatestConfigOrNoneReturningVersion (schemaVersion) {
|
||||||
const sql = `select data, id
|
const sql = `SELECT data, id
|
||||||
from user_config
|
FROM user_config
|
||||||
where type=$1
|
WHERE type = 'config'
|
||||||
and schema_version=$2
|
AND schema_version = $1
|
||||||
order by id desc
|
AND valid
|
||||||
limit 1`
|
ORDER BY id DESC
|
||||||
|
LIMIT 1`
|
||||||
|
|
||||||
return db.oneOrNone(sql, ['config', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
return db.oneOrNone(sql, [schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||||
.then(row => row ? { config: row.data.config, version: row.id } : {})
|
.then(row => row ? { config: row.data.config, version: row.id } : {})
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLatestConfigOrNone (schemaVersion) {
|
function loadLatestConfigOrNone (schemaVersion) {
|
||||||
const sql = `select data
|
const sql = `SELECT data
|
||||||
from user_config
|
FROM user_config
|
||||||
where type=$1
|
WHERE type = 'config'
|
||||||
and schema_version=$2
|
AND schema_version = $1
|
||||||
order by id desc
|
ORDER BY id DESC
|
||||||
limit 1`
|
LIMIT 1`
|
||||||
|
|
||||||
return db.oneOrNone(sql, ['config', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
return db.oneOrNone(sql, [schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||||
.then(row => row ? row.data.config : {})
|
.then(row => row ? row.data.config : {})
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadConfig (versionId) {
|
function loadConfig (versionId) {
|
||||||
const sql = `select data
|
const sql = `SELECT data
|
||||||
from user_config
|
FROM user_config
|
||||||
where id=$1
|
WHERE id = $1
|
||||||
and type=$2
|
AND type = 'config'
|
||||||
and schema_version=$3
|
AND schema_version = $2
|
||||||
and valid`
|
AND valid`
|
||||||
|
|
||||||
return db.one(sql, [versionId, 'config', NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
return db.one(sql, [versionId, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||||
.then(row => row.data.config)
|
.then(row => row.data.config)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err.name === 'QueryResultError') {
|
if (err.name === 'QueryResultError') {
|
||||||
|
|
@ -238,29 +228,25 @@ function load (versionId) {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrate () {
|
const fetchCurrentConfigVersion = () => {
|
||||||
return loadLatest(OLD_SETTINGS_LOADER_SCHEMA_VERSION)
|
const sql = `SELECT id FROM user_config
|
||||||
.then(res => {
|
WHERE type = 'config'
|
||||||
const migrated = migration.migrate(res.config, res.accounts)
|
AND valid
|
||||||
saveConfig(migrated.config)
|
ORDER BY id DESC
|
||||||
saveAccounts(migrated.accounts)
|
LIMIT 1`
|
||||||
|
return db.one(sql).then(row => row.id)
|
||||||
return migrated
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
saveConfig,
|
saveConfig,
|
||||||
migrationSaveConfig,
|
migrationSaveConfig,
|
||||||
resetConfig,
|
|
||||||
saveAccounts,
|
saveAccounts,
|
||||||
resetAccounts,
|
|
||||||
loadAccounts,
|
loadAccounts,
|
||||||
showAccounts,
|
showAccounts,
|
||||||
loadLatest,
|
loadLatest,
|
||||||
loadLatestConfig,
|
loadLatestConfig,
|
||||||
loadLatestConfigOrNone,
|
loadLatestConfigOrNone,
|
||||||
load,
|
load,
|
||||||
migrate,
|
removeFromConfig,
|
||||||
removeFromConfig
|
fetchCurrentConfigVersion,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,8 @@ function checkStuckScreen (deviceEvents, machine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function transactionNotify (tx, rec) {
|
function transactionNotify (tx, rec) {
|
||||||
return settingsLoader.loadLatest().then(settings => {
|
return settingsLoader.loadLatestConfig().then(config => {
|
||||||
const notifSettings = configManager.getGlobalNotifications(settings.config)
|
const notifSettings = configManager.getGlobalNotifications(config)
|
||||||
const highValueTx = tx.fiat.gt(notifSettings.highValueTransaction || Infinity)
|
const highValueTx = tx.fiat.gt(notifSettings.highValueTransaction || Infinity)
|
||||||
const isCashOut = tx.direction === 'cashOut'
|
const isCashOut = tx.direction === 'cashOut'
|
||||||
|
|
||||||
|
|
@ -147,7 +147,7 @@ function transactionNotify (tx, rec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// alert through sms or email any transaction or high value transaction, if SMS || email alerts are enabled
|
// alert through sms or email any transaction or high value transaction, if SMS || email alerts are enabled
|
||||||
const walletSettings = configManager.getWalletSettings(tx.cryptoCode, settings.config)
|
const walletSettings = configManager.getWalletSettings(tx.cryptoCode, config)
|
||||||
const zeroConfLimit = walletSettings.zeroConfLimit || 0
|
const zeroConfLimit = walletSettings.zeroConfLimit || 0
|
||||||
const zeroConf = isCashOut && tx.fiat.lte(zeroConfLimit)
|
const zeroConf = isCashOut && tx.fiat.lte(zeroConfLimit)
|
||||||
const notificationsEnabled = notifSettings.sms.transactions || notifSettings.email.transactions
|
const notificationsEnabled = notifSettings.sms.transactions || notifSettings.email.transactions
|
||||||
|
|
@ -308,8 +308,8 @@ function cashboxNotify (deviceId) {
|
||||||
|
|
||||||
// for notification center, check if type of notification is active before calling the respective notify function
|
// for notification center, check if type of notification is active before calling the respective notify function
|
||||||
const notifyIfActive = (type, fnName, ...args) => {
|
const notifyIfActive = (type, fnName, ...args) => {
|
||||||
return settingsLoader.loadLatest().then(settings => {
|
return settingsLoader.loadLatestConfig().then(config => {
|
||||||
const notificationSettings = configManager.getGlobalNotifications(settings.config).notificationCenter
|
const notificationSettings = configManager.getGlobalNotifications(config).notificationCenter
|
||||||
if (!notificationCenter[fnName]) return Promise.reject(new Error(`Notification function ${fnName} for type ${type} does not exist`))
|
if (!notificationCenter[fnName]) return Promise.reject(new Error(`Notification function ${fnName} for type ${type} does not exist`))
|
||||||
if (!(notificationSettings.active && notificationSettings[type])) return Promise.resolve()
|
if (!(notificationSettings.active && notificationSettings[type])) return Promise.resolve()
|
||||||
return notificationCenter[fnName](...args)
|
return notificationCenter[fnName](...args)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ const logger = require('./logger')
|
||||||
const logs = require('./logs')
|
const logs = require('./logs')
|
||||||
const T = require('./time')
|
const T = require('./time')
|
||||||
const configManager = require('./new-config-manager')
|
const configManager = require('./new-config-manager')
|
||||||
|
const settingsLoader = require('./new-settings-loader')
|
||||||
const ticker = require('./ticker')
|
const ticker = require('./ticker')
|
||||||
const wallet = require('./wallet')
|
const wallet = require('./wallet')
|
||||||
const walletScoring = require('./wallet-scoring')
|
const walletScoring = require('./wallet-scoring')
|
||||||
|
|
@ -237,17 +238,6 @@ function plugins (settings, deviceId) {
|
||||||
.then(([cassettes, recyclers]) => ({ cassettes: cassettes.cassettes, recyclers: recyclers.recyclers }))
|
.then(([cassettes, recyclers]) => ({ cassettes: cassettes.cassettes, recyclers: recyclers.recyclers }))
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchCurrentConfigVersion () {
|
|
||||||
const sql = `select id from user_config
|
|
||||||
where type=$1
|
|
||||||
and valid
|
|
||||||
order by id desc
|
|
||||||
limit 1`
|
|
||||||
|
|
||||||
return db.one(sql, ['config'])
|
|
||||||
.then(row => row.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapCoinSettings (coinParams) {
|
function mapCoinSettings (coinParams) {
|
||||||
const [ cryptoCode, cryptoNetwork ] = coinParams
|
const [ cryptoCode, cryptoNetwork ] = coinParams
|
||||||
const commissions = configManager.getCommissions(cryptoCode, deviceId, settings.config)
|
const commissions = configManager.getCommissions(cryptoCode, deviceId, settings.config)
|
||||||
|
|
@ -289,7 +279,7 @@ function plugins (settings, deviceId) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
buildAvailableCassettes(),
|
buildAvailableCassettes(),
|
||||||
buildAvailableRecyclers(),
|
buildAvailableRecyclers(),
|
||||||
fetchCurrentConfigVersion(),
|
settingsLoader.fetchCurrentConfigVersion(),
|
||||||
millisecondsToMinutes(getTimezoneOffset(localeConfig.timezone)),
|
millisecondsToMinutes(getTimezoneOffset(localeConfig.timezone)),
|
||||||
loyalty.getNumberOfAvailablePromoCodes(),
|
loyalty.getNumberOfAvailablePromoCodes(),
|
||||||
Promise.all(supportsBatchingPromise),
|
Promise.all(supportsBatchingPromise),
|
||||||
|
|
@ -1032,7 +1022,6 @@ function plugins (settings, deviceId) {
|
||||||
sell,
|
sell,
|
||||||
getNotificationConfig,
|
getNotificationConfig,
|
||||||
notifyOperator,
|
notifyOperator,
|
||||||
fetchCurrentConfigVersion,
|
|
||||||
pruneMachinesHeartbeat,
|
pruneMachinesHeartbeat,
|
||||||
rateAddress,
|
rateAddress,
|
||||||
isWalletScoringEnabled,
|
isWalletScoringEnabled,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const nmd = require('nano-markdown')
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
const configManager = require('../new-config-manager')
|
const configManager = require('../new-config-manager')
|
||||||
const plugins = require('../plugins')
|
const settingsLoader = require('../new-settings-loader')
|
||||||
|
|
||||||
const createTerms = terms => (terms.active && terms.text) ? ({
|
const createTerms = terms => (terms.active && terms.text) ? ({
|
||||||
delay: terms.delay,
|
delay: terms.delay,
|
||||||
|
|
@ -18,15 +18,10 @@ const createTerms = terms => (terms.active && terms.text) ? ({
|
||||||
|
|
||||||
function getTermsConditions (req, res, next) {
|
function getTermsConditions (req, res, next) {
|
||||||
const deviceId = req.deviceId
|
const deviceId = req.deviceId
|
||||||
const settings = req.settings
|
const { config } = req.settings
|
||||||
|
const terms = configManager.getTermsConditions(config)
|
||||||
const terms = configManager.getTermsConditions(settings.config)
|
return settingsLoader.fetchCurrentConfigVersion()
|
||||||
|
.then(version => res.json({ terms: createTerms(terms), version }))
|
||||||
const pi = plugins(settings, deviceId)
|
|
||||||
|
|
||||||
return pi.fetchCurrentConfigVersion().then(version => {
|
|
||||||
return res.json({ terms: createTerms(terms), version })
|
|
||||||
})
|
|
||||||
.catch(next)
|
.catch(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ const configManager = require('../lib/new-config-manager')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
return db.tx(async t => {
|
return db.tx(async t => {
|
||||||
const settingsPromise = settingsLoader.loadLatest()
|
const settingsPromise = settingsLoader.loadLatestConfig()
|
||||||
const machinesPromise = t.any('SELECT device_id FROM devices')
|
const machinesPromise = t.any('SELECT device_id FROM devices')
|
||||||
const [{ config }, machines] = await Promise.all([settingsPromise, machinesPromise])
|
const [config, machines] = await Promise.all([settingsPromise, machinesPromise])
|
||||||
const cryptoCodes = configManager.getCryptosFromWalletNamespace(config)
|
const cryptoCodes = configManager.getCryptosFromWalletNamespace(config)
|
||||||
|
|
||||||
const deviceIds = _.map(_.get('device_id'))(machines)
|
const deviceIds = _.map(_.get('device_id'))(machines)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const settingsLoader = require('../lib/new-settings-loader')
|
||||||
const configManager = require('../lib/new-config-manager')
|
const configManager = require('../lib/new-config-manager')
|
||||||
|
|
||||||
exports.up = async function (next) {
|
exports.up = async function (next) {
|
||||||
const { config } = await settingsLoader.loadLatest()
|
const config = await settingsLoader.loadLatestConfig()
|
||||||
const cryptoCodes = configManager.getCryptosFromWalletNamespace(config)
|
const cryptoCodes = configManager.getCryptosFromWalletNamespace(config)
|
||||||
_.forEach(cryptoCode => {
|
_.forEach(cryptoCode => {
|
||||||
const key = `wallets_${cryptoCode}_zeroConf`
|
const key = `wallets_${cryptoCode}_zeroConf`
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const { migrationSaveConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { migrationSaveConfig, loadLatestConfig } = require('../lib/new-settings-loader')
|
||||||
const CASSETTE_MAX_CAPACITY = 500
|
const CASSETTE_MAX_CAPACITY = 500
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
return loadLatest()
|
return loadLatestConfig()
|
||||||
.then(({ config }) => {
|
.then(config => {
|
||||||
const fiatBalance1 = config.notifications_fiatBalanceCassette1
|
const fiatBalance1 = config.notifications_fiatBalanceCassette1
|
||||||
const fiatBalance2 = config.notifications_fiatBalanceCassette2
|
const fiatBalance2 = config.notifications_fiatBalanceCassette2
|
||||||
const fiatBalance3 = config.notifications_fiatBalanceCassette3
|
const fiatBalance3 = config.notifications_fiatBalanceCassette3
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ const _ = require('lodash/fp')
|
||||||
const settingsLoader = require('../lib/new-settings-loader')
|
const settingsLoader = require('../lib/new-settings-loader')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
settingsLoader.loadLatest()
|
settingsLoader.loadLatestConfig()
|
||||||
.then(({ config }) => {
|
.then(config => {
|
||||||
if (!_.isEmpty(config))
|
if (!_.isEmpty(config))
|
||||||
config.locale_timezone = '0:0'
|
config.locale_timezone = '0:0'
|
||||||
return settingsLoader.migrationSaveConfig(config)
|
return settingsLoader.migrationSaveConfig(config)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
const db = require('./db')
|
const db = require('./db')
|
||||||
const { migrationSaveConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { migrationSaveConfig } = require('../lib/new-settings-loader')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
const sql = [
|
const sql = [
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
const { migrationSaveConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { migrationSaveConfig, loadLatestConfig } = require('../lib/new-settings-loader')
|
||||||
const { getCryptosFromWalletNamespace } = require('../lib/new-config-manager.js')
|
const { getCryptosFromWalletNamespace } = require('../lib/new-config-manager.js')
|
||||||
const { utils: coinUtils } = require('@lamassu/coins')
|
const { utils: coinUtils } = require('@lamassu/coins')
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
loadLatest()
|
loadLatestConfig()
|
||||||
.then(settings => {
|
.then(config => {
|
||||||
const newSettings = {}
|
const newSettings = {}
|
||||||
const activeCryptos = getCryptosFromWalletNamespace(settings.config)
|
const activeCryptos = getCryptosFromWalletNamespace(config)
|
||||||
if (!activeCryptos.length) return Promise.resolve()
|
if (!activeCryptos.length) return Promise.resolve()
|
||||||
_.map(crypto => {
|
_.map(crypto => {
|
||||||
const defaultUnit = _.head(_.keys(coinUtils.getCryptoCurrency(crypto).units))
|
const defaultUnit = _.head(_.keys(coinUtils.getCryptoCurrency(crypto).units))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
var db = require('./db')
|
var db = require('./db')
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const { migrationSaveConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { migrationSaveConfig, loadLatestConfig } = require('../lib/new-settings-loader')
|
||||||
const { getMachineIds } = require('../lib/machine-loader')
|
const { getMachineIds } = require('../lib/machine-loader')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
|
|
@ -25,16 +25,16 @@ exports.up = function (next) {
|
||||||
ADD COLUMN denomination_4 INTEGER`
|
ADD COLUMN denomination_4 INTEGER`
|
||||||
]
|
]
|
||||||
|
|
||||||
return Promise.all([loadLatest(), getMachineIds()])
|
return Promise.all([loadLatestConfig(), getMachineIds()])
|
||||||
.then(([config, machineIds]) => {
|
.then(([config, machineIds]) => {
|
||||||
const newConfig = _.reduce((acc, value) => {
|
const newConfig = _.reduce((acc, value) => {
|
||||||
const deviceId = value.device_id
|
const deviceId = value.device_id
|
||||||
if (_.includes(`cashOut_${deviceId}_top`, _.keys(config.config))) {
|
if (_.includes(`cashOut_${deviceId}_top`, _.keys(config))) {
|
||||||
acc[`cashOut_${deviceId}_cassette1`] = config.config[`cashOut_${deviceId}_top`]
|
acc[`cashOut_${deviceId}_cassette1`] = config[`cashOut_${deviceId}_top`]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_.includes(`cashOut_${deviceId}_bottom`, _.keys(config.config))) {
|
if (_.includes(`cashOut_${deviceId}_bottom`, _.keys(config))) {
|
||||||
acc[`cashOut_${deviceId}_cassette2`] = config.config[`cashOut_${deviceId}_bottom`]
|
acc[`cashOut_${deviceId}_cassette2`] = config[`cashOut_${deviceId}_bottom`]
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc
|
return acc
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,14 @@
|
||||||
const uuid = require('uuid')
|
const uuid = require('uuid')
|
||||||
const { saveConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { saveConfig } = require('../lib/new-settings-loader')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
const newConfig = {}
|
const newConfig = {
|
||||||
return loadLatest()
|
wallets_advanced_feeMultiplier: '1',
|
||||||
.then(config => {
|
wallets_advanced_cryptoUnits: 'full',
|
||||||
newConfig[`wallets_advanced_feeMultiplier`] = '1'
|
wallets_advanced_allowTransactionBatching: false,
|
||||||
newConfig[`wallets_advanced_cryptoUnits`] = 'full'
|
wallets_advanced_id: uuid.v4(),
|
||||||
newConfig[`wallets_advanced_allowTransactionBatching`] = false
|
}
|
||||||
newConfig[`wallets_advanced_id`] = uuid.v4()
|
|
||||||
return saveConfig(newConfig)
|
return saveConfig(newConfig)
|
||||||
})
|
|
||||||
.then(next)
|
.then(next)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
return next(err)
|
return next(err)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const { saveConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { saveConfig, loadLatestConfig } = require('../lib/new-settings-loader')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
const newConfig = {}
|
return loadLatestConfig()
|
||||||
return loadLatest()
|
|
||||||
.then(config => {
|
.then(config => {
|
||||||
if (!_.isNil(config.config.locale_timezone)) return
|
if (!_.isNil(config.locale_timezone)) return
|
||||||
newConfig[`locale_timezone`] = 'GMT'
|
const newConfig = { locale_timezone: 'GMT' }
|
||||||
return saveConfig(newConfig)
|
return saveConfig(newConfig)
|
||||||
})
|
})
|
||||||
.then(next)
|
.then(next)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
const { saveConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { saveConfig, loadLatestConfig } = require('../lib/new-settings-loader')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
const newConfig = {}
|
return loadLatestConfig()
|
||||||
return loadLatest()
|
|
||||||
.then(config => {
|
.then(config => {
|
||||||
if (config.config.locale_timezone === "0:0") {
|
if (config.locale_timezone === "0:0") {
|
||||||
newConfig[`locale_timezone`] = 'GMT'
|
const newConfig = { locale_timezone: 'GMT' }
|
||||||
return saveConfig(newConfig)
|
return saveConfig(newConfig)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
const { removeFromConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { removeFromConfig, loadLatestConfig } = require('../lib/new-settings-loader')
|
||||||
const { getCryptosFromWalletNamespace } = require('../lib/new-config-manager.js')
|
const { getCryptosFromWalletNamespace } = require('../lib/new-config-manager.js')
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
loadLatest()
|
loadLatestConfig()
|
||||||
.then(settings => {
|
.then(config => {
|
||||||
const configuredCryptos = getCryptosFromWalletNamespace(settings.config)
|
const configuredCryptos = getCryptosFromWalletNamespace(config)
|
||||||
if (!configuredCryptos.length) return Promise.resolve()
|
if (!configuredCryptos.length) return Promise.resolve()
|
||||||
|
|
||||||
return removeFromConfig(_.map(it => `wallets_${it}_cryptoUnits`, configuredCryptos))
|
return removeFromConfig(_.map(it => `wallets_${it}_cryptoUnits`, configuredCryptos))
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
|
|
||||||
const { saveConfig, loadLatest } = require('../lib/new-settings-loader')
|
const { saveConfig, loadLatestConfig } = require('../lib/new-settings-loader')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
const newConfig = {}
|
return loadLatestConfig()
|
||||||
return loadLatest()
|
|
||||||
.then(config => {
|
.then(config => {
|
||||||
if (!_.isNil(config.config.wallets_ETH_zeroConfLimit) && config.config.wallets_ETH_zeroConfLimit !== 0) {
|
if (!_.isNil(config.wallets_ETH_zeroConfLimit) && config.wallets_ETH_zeroConfLimit !== 0) {
|
||||||
newConfig[`wallets_ETH_zeroConfLimit`] = 0
|
const newConfig = { wallets_ETH_zeroConfLimit: 0 }
|
||||||
return saveConfig(newConfig)
|
return saveConfig(newConfig)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ module.exports = {migrateNames}
|
||||||
function migrateNames () {
|
function migrateNames () {
|
||||||
const cs = new pgp.helpers.ColumnSet(['?device_id', 'name'], {table: 'devices'})
|
const cs = new pgp.helpers.ColumnSet(['?device_id', 'name'], {table: 'devices'})
|
||||||
|
|
||||||
return settingsLoader.loadLatest(false)
|
return settingsLoader.loadLatestConfig(false)
|
||||||
.then(r => machineLoader.getMachineNames(r.config))
|
.then(config => machineLoader.getMachineNames(config))
|
||||||
.then(_.map(r => ({device_id: r.deviceId, name: r.name})))
|
.then(_.map(r => ({device_id: r.deviceId, name: r.name})))
|
||||||
.then(data => pgp.helpers.update(data, cs) + ' WHERE t.device_id=v.device_id')
|
.then(data => pgp.helpers.update(data, cs) + ' WHERE t.device_id=v.device_id')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
import { useMutation } from '@apollo/react-hooks'
|
|
||||||
import { Box } from '@material-ui/core'
|
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
|
||||||
import gql from 'graphql-tag'
|
|
||||||
import React, { useState } from 'react'
|
|
||||||
|
|
||||||
import Title from 'src/components/Title'
|
|
||||||
import { Button } from 'src/components/buttons'
|
|
||||||
|
|
||||||
const styles = {
|
|
||||||
button: {
|
|
||||||
marginBottom: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const useStyles = makeStyles(styles)
|
|
||||||
|
|
||||||
const RESET = gql`
|
|
||||||
mutation Reset($schemaVersion: Int) {
|
|
||||||
resetConfig(schemaVersion: $schemaVersion)
|
|
||||||
resetAccounts(schemaVersion: $schemaVersion)
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const MIGRATE = gql`
|
|
||||||
mutation Migrate {
|
|
||||||
migrateConfigAndAccounts
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const OLD_SCHEMA_VERSION = 1
|
|
||||||
const NEW_SCHEMA_VERSION = 2
|
|
||||||
|
|
||||||
const ConfigMigration = () => {
|
|
||||||
const [loading, setLoading] = useState(false)
|
|
||||||
const [reset] = useMutation(RESET, {
|
|
||||||
onCompleted: () => setLoading(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
const [migrate] = useMutation(MIGRATE, {
|
|
||||||
onCompleted: () => setLoading(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const innerReset = schemaVersion => {
|
|
||||||
setLoading(true)
|
|
||||||
reset({ variables: { schemaVersion } })
|
|
||||||
}
|
|
||||||
|
|
||||||
const innerMigrate = () => {
|
|
||||||
setLoading(true)
|
|
||||||
migrate()
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Title>Config Migration</Title>
|
|
||||||
<Box display="flex" alignItems="center" flexDirection="column">
|
|
||||||
<Button
|
|
||||||
className={classes.button}
|
|
||||||
disabled={loading}
|
|
||||||
onClick={() => innerReset(OLD_SCHEMA_VERSION)}>
|
|
||||||
Reset old admin
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
className={classes.button}
|
|
||||||
disabled={loading}
|
|
||||||
onClick={() => innerReset(NEW_SCHEMA_VERSION)}>
|
|
||||||
Reset new admin
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
className={classes.button}
|
|
||||||
disabled={loading}
|
|
||||||
onClick={() => innerMigrate()}>
|
|
||||||
Migrate
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ConfigMigration
|
|
||||||
|
|
@ -143,7 +143,6 @@ const Routes = () => {
|
||||||
<PrivateRoute path="/machines" component={Machines} />
|
<PrivateRoute path="/machines" component={Machines} />
|
||||||
<PrivateRoute path="/wizard" component={Wizard} />
|
<PrivateRoute path="/wizard" component={Wizard} />
|
||||||
<PublicRoute path="/register" component={Register} />
|
<PublicRoute path="/register" component={Register} />
|
||||||
{/* <PublicRoute path="/configmigration" component={ConfigMigration} /> */}
|
|
||||||
<PublicRoute path="/login" restricted component={Login} />
|
<PublicRoute path="/login" restricted component={Login} />
|
||||||
<PublicRoute path="/resetpassword" component={ResetPassword} />
|
<PublicRoute path="/resetpassword" component={ResetPassword} />
|
||||||
<PublicRoute path="/reset2fa" component={Reset2FA} />
|
<PublicRoute path="/reset2fa" component={Reset2FA} />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue