feat: created the rename action on the machine status page

fix: added missing 'shutdown' action on the MachineActions enum of the
gql schema

style: set the Edit icon for the rename action

style: fixed first and last action buttons spacing
This commit is contained in:
Liordino Neto 2020-10-02 17:49:11 -03:00 committed by Josh Harvey
parent 79298d5dec
commit bbf98b4d52
5 changed files with 75 additions and 23 deletions

View file

@ -88,6 +88,11 @@ function getMachineName (machineId) {
.then(it => it.name)
}
function renameMachine (rec) {
const sql = 'update devices set name=$1 where device_id=$2'
return db.none(sql, [rec.newName, rec.deviceId])
}
function resetCashOutBills (rec) {
const sql = 'update devices set cassette1=$1, cassette2=$2 where device_id=$3'
return db.none(sql, [rec.cassettes[0], rec.cassettes[1], rec.deviceId])
@ -112,6 +117,7 @@ function restartServices (rec) {
function setMachine (rec) {
switch (rec.action) {
case 'rename': return renameMachine(rec)
case 'emptyCashInBills': return emptyCashInBills(rec)
case 'resetCashOutBills': return resetCashOutBills(rec)
case 'unpair': return unpair(rec)