mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 06:33:28 +00:00
fleet/block/app create: Fetch the supported device types using the hostApps
Change-type: patch See: https://balena.zulipchat.com/#narrow/stream/360838-balena-io.2Fos.2Fdevices/topic/state.20field.20in.20device-type.2Ejson See: https://balena.fibery.io/Organisation/Improvements-849#Improvements/Stop-relying-on-device-types-v1-device-type.json-for-unrelated-things-257
This commit is contained in:
parent
f07f6b84d4
commit
d78b76aceb
@ -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,
|
||||
})),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user