mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 15:02:22 +00:00
Implement device info command
This commit is contained in:
parent
199635b311
commit
4d0ecbdc4c
@ -14,6 +14,30 @@ exports.list = (applicationId) ->
|
|||||||
return device
|
return device
|
||||||
, [ 'ID', 'Name', 'Device Type', 'Is Online', 'IP Address', 'Application', 'Status', 'Last Seen' ]
|
, [ 'ID', 'Name', 'Device Type', 'Is Online', 'IP Address', 'Application', 'Status', 'Last Seen' ]
|
||||||
|
|
||||||
|
exports.info = (deviceId) ->
|
||||||
|
resin.models.device.get deviceId, (error, device) ->
|
||||||
|
resin.errors.handle(error) if error?
|
||||||
|
|
||||||
|
resin.log.out resin.ui.widgets.table.vertical device, (device) ->
|
||||||
|
device.device_type = resin.device.getDisplayName(device.device_type)
|
||||||
|
device.application = device.application[0].app_name
|
||||||
|
return device
|
||||||
|
, [
|
||||||
|
'ID'
|
||||||
|
'Name'
|
||||||
|
'Device Type'
|
||||||
|
'Is Online'
|
||||||
|
'IP Address'
|
||||||
|
'Application'
|
||||||
|
'Status'
|
||||||
|
'Last Seen'
|
||||||
|
'UUID'
|
||||||
|
'Commit'
|
||||||
|
'Supervisor Version'
|
||||||
|
'Is Web Accessible'
|
||||||
|
'Note'
|
||||||
|
]
|
||||||
|
|
||||||
exports.remove = (id) ->
|
exports.remove = (id) ->
|
||||||
confirmArgument = resin.cli.getArgument('yes')
|
confirmArgument = resin.cli.getArgument('yes')
|
||||||
resin.ui.patterns.remove 'device', confirmArgument, (callback) ->
|
resin.ui.patterns.remove 'device', confirmArgument, (callback) ->
|
||||||
|
@ -36,6 +36,22 @@ exports.getAllByApplication = (applicationId, callback) ->
|
|||||||
.catch (error) ->
|
.catch (error) ->
|
||||||
return callback(error)
|
return callback(error)
|
||||||
|
|
||||||
|
exports.get = (deviceId, callback) ->
|
||||||
|
return canvas.get
|
||||||
|
resource: 'device'
|
||||||
|
id: deviceId
|
||||||
|
options:
|
||||||
|
expand: 'application'
|
||||||
|
|
||||||
|
.then (device) ->
|
||||||
|
if not device?
|
||||||
|
return callback(new errors.NotFound("device #{id}"))
|
||||||
|
|
||||||
|
return callback(null, device)
|
||||||
|
|
||||||
|
.catch (error) ->
|
||||||
|
return callback(error)
|
||||||
|
|
||||||
exports.remove = (id, callback) ->
|
exports.remove = (id, callback) ->
|
||||||
return canvas.delete
|
return canvas.delete
|
||||||
resource: 'device'
|
resource: 'device'
|
||||||
|
Loading…
Reference in New Issue
Block a user