mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +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,22 +115,22 @@ export function askLoginType() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectDeviceType() {
|
export async function selectDeviceType() {
|
||||||
return getBalenaSdk()
|
const sdk = getBalenaSdk();
|
||||||
.models.config.getDeviceTypes()
|
let deviceTypes = await sdk.models.deviceType.getAllSupported();
|
||||||
.then((deviceTypes) => {
|
if (deviceTypes.length === 0) {
|
||||||
deviceTypes = _.sortBy(deviceTypes, 'name').filter(
|
// Without this open-balena users would get an empty list
|
||||||
(dt) => dt.state !== 'DISCONTINUED',
|
// until we add a hostApps import in open-balena.
|
||||||
);
|
deviceTypes = await sdk.models.deviceType.getAll();
|
||||||
return getCliForm().ask({
|
}
|
||||||
message: 'Device Type',
|
return getCliForm().ask({
|
||||||
type: 'list',
|
message: 'Device Type',
|
||||||
choices: _.map(deviceTypes, ({ slug: value, name }) => ({
|
type: 'list',
|
||||||
name,
|
choices: _.map(deviceTypes, ({ slug: value, name }) => ({
|
||||||
value,
|
name,
|
||||||
})),
|
value,
|
||||||
});
|
})),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user