2014-11-26 12:07:10 -04:00
|
|
|
resin = require('../resin')
|
2014-11-19 13:38:15 -04:00
|
|
|
|
2014-11-27 10:06:11 -04:00
|
|
|
exports.list = (applicationId) ->
|
2014-11-26 14:02:59 -04:00
|
|
|
resin.models.device.getAll applicationId, (error, devices) ->
|
|
|
|
resin.errors.handle(error) if error?
|
2014-11-19 13:38:15 -04:00
|
|
|
|
2014-11-26 13:26:01 -04:00
|
|
|
resin.log.out resin.ui.widgets.table.horizontal devices, (device) ->
|
2014-11-19 13:38:15 -04:00
|
|
|
device.application = device.application[0].app_name
|
2014-11-26 13:12:39 -04:00
|
|
|
device.device_type = resin.device.getDisplayName(device.device_type)
|
2014-11-19 13:38:15 -04:00
|
|
|
delete device.note
|
|
|
|
delete device.supervisor_version
|
|
|
|
delete device.uuid
|
|
|
|
delete device.download_progress
|
|
|
|
return device
|
2014-11-19 15:18:15 -04:00
|
|
|
, [ 'ID', 'Name', 'Device Type', 'Is Online', 'IP Address', 'Application', 'Status', 'Last Seen' ]
|
2014-11-19 13:38:15 -04:00
|
|
|
|
2014-11-27 11:22:48 -04:00
|
|
|
exports.remove = (id) ->
|
|
|
|
confirmArgument = resin.cli.getArgument('yes')
|
|
|
|
resin.ui.patterns.remove 'device', confirmArgument, (callback) ->
|
2014-11-26 14:02:59 -04:00
|
|
|
resin.models.device.remove(id, callback)
|
2014-11-26 12:38:02 -04:00
|
|
|
, resin.errors.handle
|
2014-11-21 14:21:47 -04:00
|
|
|
|
2014-11-27 10:06:11 -04:00
|
|
|
exports.identify = (uuid) ->
|
2014-11-26 14:02:59 -04:00
|
|
|
resin.models.device.identify uuid, (error) ->
|
|
|
|
resin.errors.handle(error) if error?
|