Skip to content

Commit

Permalink
added disconnect and connect devices on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
joyja committed May 22, 2020
1 parent 616da9b commit 1d6117f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/device/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ class Device extends Model {
return super.create(fields)
}
static async delete(selector) {
for (device of Device.instances) {
await instance.config.disconnect()
}
const deleted = await super.delete(selector)
await ModbusSource.getAll()
await Modbus.getAll()
await EthernetIPSource.getAll()
await EthernetIP.getAll()
for (device of Device.instances) {
await instance.config.connect()
}
return deleted
}
async init() {
Expand Down

0 comments on commit 1d6117f

Please sign in to comment.