Merge pull request #876 from ubavic/fix/machine_unpair_breaks_server_ui
fix: machine unpair breaks the UI
This commit is contained in:
commit
23c4f59606
1 changed files with 7 additions and 4 deletions
|
|
@ -17,11 +17,14 @@ function pullToken (token) {
|
|||
}
|
||||
|
||||
function unpair (deviceId) {
|
||||
const sql = 'delete from devices where device_id=$1'
|
||||
const deleteMachinePings = 'delete from machine_pings where device_id=$1'
|
||||
|
||||
// TODO new-admin: We should remove all configs related to that device. This can get tricky.
|
||||
return Promise.all([db.none(sql, [deviceId]), db.none(deleteMachinePings, [deviceId])])
|
||||
return db.tx(t => {
|
||||
const q1 = t.none('DELETE FROM devices WHERE device_id=$1', [deviceId])
|
||||
const q2 = t.none('DELETE FROM machine_pings WHERE device_id=$1', [deviceId])
|
||||
const q3 = t.none('DELETE FROM machine_network_heartbeat WHERE device_id=$1', [deviceId])
|
||||
const q4 = t.none('DELETE FROM machine_network_performance WHERE device_id=$1', [deviceId])
|
||||
return Promise.all([q1, q2, q3, q4])
|
||||
})
|
||||
}
|
||||
|
||||
function pair (token, deviceId, machineModel, numOfCassettes = DEFAULT_NUMBER_OF_CASSETTES) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue