Skip to content

Commit

Permalink
Device: Fix the last_seen field not showing up
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
  • Loading branch information
thgreasi authored and Balena CI committed Jul 9, 2020
1 parent d8795ec commit 7260a1a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/actions-oclif/device/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface ExtendedDevice extends Device {
dashboard_url?: string;
application_name?: string;
commit?: string;
last_seen?: string;
}

interface FlagsDef {
Expand Down Expand Up @@ -98,6 +99,7 @@ export default class DeviceCmd extends Command {
: 'N/a';

device.commit = device.is_on__commit;
device.last_seen = device.last_connectivity_event;

console.log(
getVisuals().table.vertical(device, [
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/device/device.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('balena device', function () {

const lines = cleanOutput(out);

expect(lines).to.have.lengthOf(13);
expect(lines).to.have.lengthOf(14);
expect(lines[0]).to.equal('== SPARKLING WOOD');
expect(lines[6].split(':')[1].trim()).to.equal('test app');

Expand Down Expand Up @@ -118,7 +118,7 @@ describe('balena device', function () {

const lines = cleanOutput(out);

expect(lines).to.have.lengthOf(13);
expect(lines).to.have.lengthOf(14);
expect(lines[0]).to.equal('== SPARKLING WOOD');
expect(lines[6].split(':')[1].trim()).to.equal('N/a');

Expand Down
1 change: 1 addition & 0 deletions tests/test-data/api-response/device-missing-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"is_on__commit": "18756d3386c25a044db66b89e0409804",
"note": null,
"is_online": false,
"last_connectivity_event": "2019-11-23T00:26:35.074Z",
"ip_address": "192.168.0.112",
"mac_address": null,
"os_version": "balenaOS 2.44.0+rev3",
Expand Down
1 change: 1 addition & 0 deletions tests/test-data/api-response/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"is_on__commit": "18756d3386c25a044db66b89e0409804",
"note": null,
"is_online": false,
"last_connectivity_event": "2019-11-23T00:26:35.074Z",
"ip_address": "192.168.0.112",
"mac_address": null,
"os_version": "balenaOS 2.44.0+rev3",
Expand Down

0 comments on commit 7260a1a

Please sign in to comment.