mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 14:37:47 +00:00
Show parsed device status in device command
This commit is contained in:
parent
dd382158dd
commit
35bba04b16
@ -60,12 +60,12 @@ limitations under the License.
|
||||
visuals = require('resin-cli-visuals');
|
||||
events = require('resin-cli-events');
|
||||
return resin.models.device.get(params.uuid).then(function(device) {
|
||||
if (device.last_seen == null) {
|
||||
device.last_seen = 'Not seen';
|
||||
}
|
||||
console.log(visuals.table.vertical(device, ["$" + device.name + "$", 'id', 'device_type', 'is_online', 'ip_address', 'application_name', 'status', 'last_seen', 'uuid', 'commit', 'supervisor_version', 'is_web_accessible', 'note']));
|
||||
return events.send('device.open', {
|
||||
device: device.uuid
|
||||
return resin.models.device.getStatus(device).then(function(status) {
|
||||
device.status = status;
|
||||
console.log(visuals.table.vertical(device, ["$" + device.name + "$", 'id', 'device_type', 'status', 'is_online', 'ip_address', 'application_name', 'last_seen', 'uuid', 'commit', 'supervisor_version', 'is_web_accessible', 'note']));
|
||||
return events.send('device.open', {
|
||||
device: device.uuid
|
||||
});
|
||||
});
|
||||
}).nodeify(done);
|
||||
}
|
||||
|
@ -79,27 +79,26 @@ exports.info =
|
||||
|
||||
resin.models.device.get(params.uuid).then (device) ->
|
||||
|
||||
# TODO: We should outsource this logic and probably
|
||||
# other last_seen edge cases to either Resin CLI Visuals
|
||||
# or have it parsed appropriately in the SDK.
|
||||
device.last_seen ?= 'Not seen'
|
||||
resin.models.device.getStatus(device).then (status) ->
|
||||
device.status = status
|
||||
|
||||
console.log visuals.table.vertical device, [
|
||||
"$#{device.name}$"
|
||||
'id'
|
||||
'device_type'
|
||||
'is_online'
|
||||
'ip_address'
|
||||
'application_name'
|
||||
'status'
|
||||
'last_seen'
|
||||
'uuid'
|
||||
'commit'
|
||||
'supervisor_version'
|
||||
'is_web_accessible'
|
||||
'note'
|
||||
]
|
||||
events.send('device.open', device: device.uuid)
|
||||
console.log visuals.table.vertical device, [
|
||||
"$#{device.name}$"
|
||||
'id'
|
||||
'device_type'
|
||||
'status'
|
||||
'is_online'
|
||||
'ip_address'
|
||||
'application_name'
|
||||
'last_seen'
|
||||
'uuid'
|
||||
'commit'
|
||||
'supervisor_version'
|
||||
'is_web_accessible'
|
||||
'note'
|
||||
]
|
||||
|
||||
events.send('device.open', device: device.uuid)
|
||||
.nodeify(done)
|
||||
|
||||
exports.register =
|
||||
|
@ -51,7 +51,7 @@
|
||||
"resin-device-init": "^2.0.0",
|
||||
"resin-image-manager": "^3.2.6",
|
||||
"resin-pine": "^1.3.0",
|
||||
"resin-sdk": "^5.0.1",
|
||||
"resin-sdk": "^5.1.0",
|
||||
"resin-settings-client": "^3.1.0",
|
||||
"resin-vcs": "^2.0.0",
|
||||
"rimraf": "^2.4.3",
|
||||
|
Loading…
Reference in New Issue
Block a user