mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-20 17:33:18 +00:00
ssh,tunnel: Fetch the fleet & devices in one request
Change-type: patch
This commit is contained in:
parent
81f4aae7d2
commit
861d4f33b7
@ -317,6 +317,12 @@ export async function getOnlineTargetDeviceUuid(
|
||||
const { getApplication } = await import('./sdk');
|
||||
return await getApplication(sdk, fleetOrDevice, {
|
||||
$select: ['id', 'slug'],
|
||||
$expand: {
|
||||
owns__device: {
|
||||
$select: ['device_name', 'uuid'],
|
||||
$filter: { is_online: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
const { BalenaApplicationNotFound } = await import('balena-errors');
|
||||
@ -329,10 +335,7 @@ export async function getOnlineTargetDeviceUuid(
|
||||
})();
|
||||
|
||||
// App found, load its devices
|
||||
const devices = await sdk.models.device.getAllByApplication(application.id, {
|
||||
$select: ['device_name', 'uuid'],
|
||||
$filter: { is_online: true },
|
||||
});
|
||||
const devices = application.owns__device;
|
||||
|
||||
// Throw if no devices online
|
||||
if (_.isEmpty(devices)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user