mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-19 08:36:15 +00:00
Prepare for field based retrieval of device overall_status
Change-type: patch Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
This commit is contained in:
parent
45f131ec93
commit
3207a2922a
@ -69,13 +69,19 @@ export default class DeviceCmd extends Command {
|
||||
|
||||
const balena = getBalenaSdk();
|
||||
|
||||
const device: ExtendedDevice = await balena.models.device.get(
|
||||
params.uuid,
|
||||
expandForAppName,
|
||||
);
|
||||
|
||||
const deviceStatus = await balena.models.device.getStatus(device.uuid);
|
||||
device.status = deviceStatus;
|
||||
const [device, overallStatus] = await Promise.all([
|
||||
balena.models.device.get(params.uuid, expandForAppName) as Promise<
|
||||
ExtendedDevice
|
||||
>,
|
||||
// TODO: drop this and add `overall_status` to a $select in the above
|
||||
// pine query once the overall_status field is moved to open-balena-api.
|
||||
// See: https://github.com/balena-io/open-balena-api/issues/338
|
||||
balena.models.device
|
||||
.get(params.uuid, { $select: 'overall_status' })
|
||||
.then(({ overall_status }) => overall_status)
|
||||
.catchReturn(''),
|
||||
]);
|
||||
device.status = overallStatus;
|
||||
|
||||
device.dashboard_url = balena.models.device.getDashboardUrl(device.uuid);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user