Thodoris Greasidis 2023-07-07 19:51:43 +03:00
parent f07f6b84d4
commit d78b76aceb

View File

@ -115,13 +115,14 @@ export function askLoginType() {
});
}
export function selectDeviceType() {
return getBalenaSdk()
.models.config.getDeviceTypes()
.then((deviceTypes) => {
deviceTypes = _.sortBy(deviceTypes, 'name').filter(
(dt) => dt.state !== 'DISCONTINUED',
);
export async function selectDeviceType() {
const sdk = getBalenaSdk();
let deviceTypes = await sdk.models.deviceType.getAllSupported();
if (deviceTypes.length === 0) {
// Without this open-balena users would get an empty list
// until we add a hostApps import in open-balena.
deviceTypes = await sdk.models.deviceType.getAll();
}
return getCliForm().ask({
message: 'Device Type',
type: 'list',
@ -130,7 +131,6 @@ export function selectDeviceType() {
value,
})),
});
});
}
/**