Merge pull request #873 from chaotixkilla/feat-integrate-hedging-and-accounting-with-pazuz-admin

Integrate hedging and accounting with pazuz related screens
This commit is contained in:
Rafael Taranto 2021-11-17 20:34:20 +00:00 committed by GitHub
commit d138b26903
40 changed files with 761 additions and 386 deletions

View file

@ -157,18 +157,37 @@ function unpair (rec) {
}
function reboot (rec) {
return axios.post(`http://localhost:3030/reboot?device_id=${rec.deviceId}`)
return db.none('NOTIFY $1:name, $2', ['poller', JSON.stringify(
{
type: 'machineAction',
action: 'reboot',
value: _.pick(['deviceId', 'operatorId', 'action'], rec)
}
)])
}
function shutdown (rec) {
return axios.post(`http://localhost:3030/shutdown?device_id=${rec.deviceId}`)
return db.none('NOTIFY $1:name, $2', ['poller', JSON.stringify(
{
type: 'machineAction',
action: 'shutdown',
value: _.pick(['deviceId', 'operatorId', 'action'], rec)
}
)])
}
function restartServices (rec) {
return axios.post(`http://localhost:3030/restartServices?device_id=${rec.deviceId}`)
return db.none('NOTIFY $1:name, $2', ['poller', JSON.stringify(
{
type: 'machineAction',
action: 'restartServices',
value: _.pick(['deviceId', 'operatorId', 'action'], rec)
}
)])
}
function setMachine (rec) {
function setMachine (rec, operatorId) {
rec.operatorId = operatorId
switch (rec.action) {
case 'rename': return renameMachine(rec)
case 'emptyCashInBills': return emptyCashInBills(rec)