new admin structure
This commit is contained in:
parent
7d82874916
commit
c2282e61b4
17 changed files with 5768 additions and 1204 deletions
|
|
@ -1,9 +1,8 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
const db = require('./db')
|
||||
const configManager = require('./config-manager')
|
||||
const machines = require('./admin/machines')
|
||||
const schema = require('../lamassu-schema.json')
|
||||
const logger = require('./logger')
|
||||
|
||||
function allScopes (cryptoScopes, machineScopes) {
|
||||
const scopes = []
|
||||
|
|
@ -91,8 +90,16 @@ function getGroupField (group, fieldCode) {
|
|||
return _.merge(_.pick(['cryptoScope', 'machineScope'], group), field)
|
||||
}
|
||||
|
||||
const fetchMachines = () => machines.getMachines()
|
||||
.then(machineList => machineList.map(r => r.deviceId))
|
||||
// Note: We can't use machine-loader because it relies on settings-loader,
|
||||
// which relies on this
|
||||
function getMachines () {
|
||||
return db.any('select device_id from devices')
|
||||
}
|
||||
|
||||
function fetchMachines () {
|
||||
return getMachines()
|
||||
.then(machineList => machineList.map(r => r.device_id))
|
||||
}
|
||||
|
||||
function validateFieldParameter (value, validator) {
|
||||
switch (validator.code) {
|
||||
|
|
@ -115,6 +122,8 @@ function ensureConstraints (config) {
|
|||
config.every(fieldInstance => {
|
||||
const fieldCode = fieldInstance.fieldLocator.code
|
||||
const field = pickField(fieldCode)
|
||||
if (!field) throw new Error('No such field: ' + fieldCode)
|
||||
|
||||
const fieldValue = fieldInstance.fieldValue
|
||||
|
||||
const isValid = field.fieldValidation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue