Merge pull request #2645 from balena-io/application-create-hostApp-based-supported-DTs

fleet/block/app create: Fetch the supported device types using the hostApps
This commit is contained in:
flowzone-app[bot] 2023-07-09 21:29:02 +00:00 committed by GitHub
commit 4df1831187
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 34 deletions

View File

@ -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,
}); })),
}); });
} }
/** /**

36
npm-shrinkwrap.json generated
View File

@ -1103,9 +1103,9 @@
} }
}, },
"node_modules/@babel/generator": { "node_modules/@babel/generator": {
"version": "7.22.5", "version": "7.22.7",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.5.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.7.tgz",
"integrity": "sha512-+lcUbnTRhd0jOewtFSedLyiPsD5tswKkbgcezOqqWFUVNEwoUTlpPOBmvhG7OXWLR4jMdv0czPGH5XbflnD1EA==", "integrity": "sha512-p+jPjMG+SI8yvIaxGgeW24u7q9+5+TGpZh8/CuB7RhBKd7RCy8FayNEFNNKrNK/eUcY/4ExQqLmyrvBXKsIcwQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.22.5", "@babel/types": "^7.22.5",
@ -1296,9 +1296,9 @@
} }
}, },
"node_modules/@babel/template/node_modules/@babel/parser": { "node_modules/@babel/template/node_modules/@babel/parser": {
"version": "7.22.6", "version": "7.22.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.6.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz",
"integrity": "sha512-EIQu22vNkceq3LbjAq7knDf/UmtI2qbcNI8GRBlijez6TpQLvSodJPYfydQmNA5buwkxxxa/PVI44jjYZ+/cLw==", "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==",
"dev": true, "dev": true,
"bin": { "bin": {
"parser": "bin/babel-parser.js" "parser": "bin/babel-parser.js"
@ -1343,9 +1343,9 @@
} }
}, },
"node_modules/@babel/traverse/node_modules/@babel/parser": { "node_modules/@babel/traverse/node_modules/@babel/parser": {
"version": "7.22.6", "version": "7.22.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.6.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz",
"integrity": "sha512-EIQu22vNkceq3LbjAq7knDf/UmtI2qbcNI8GRBlijez6TpQLvSodJPYfydQmNA5buwkxxxa/PVI44jjYZ+/cLw==", "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==",
"dev": true, "dev": true,
"bin": { "bin": {
"parser": "bin/babel-parser.js" "parser": "bin/babel-parser.js"
@ -22991,9 +22991,9 @@
} }
}, },
"@babel/generator": { "@babel/generator": {
"version": "7.22.5", "version": "7.22.7",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.5.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.7.tgz",
"integrity": "sha512-+lcUbnTRhd0jOewtFSedLyiPsD5tswKkbgcezOqqWFUVNEwoUTlpPOBmvhG7OXWLR4jMdv0czPGH5XbflnD1EA==", "integrity": "sha512-p+jPjMG+SI8yvIaxGgeW24u7q9+5+TGpZh8/CuB7RhBKd7RCy8FayNEFNNKrNK/eUcY/4ExQqLmyrvBXKsIcwQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.22.5", "@babel/types": "^7.22.5",
@ -23142,9 +23142,9 @@
}, },
"dependencies": { "dependencies": {
"@babel/parser": { "@babel/parser": {
"version": "7.22.6", "version": "7.22.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.6.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz",
"integrity": "sha512-EIQu22vNkceq3LbjAq7knDf/UmtI2qbcNI8GRBlijez6TpQLvSodJPYfydQmNA5buwkxxxa/PVI44jjYZ+/cLw==", "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==",
"dev": true "dev": true
}, },
"@babel/types": { "@babel/types": {
@ -23179,9 +23179,9 @@
}, },
"dependencies": { "dependencies": {
"@babel/parser": { "@babel/parser": {
"version": "7.22.6", "version": "7.22.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.6.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz",
"integrity": "sha512-EIQu22vNkceq3LbjAq7knDf/UmtI2qbcNI8GRBlijez6TpQLvSodJPYfydQmNA5buwkxxxa/PVI44jjYZ+/cLw==", "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==",
"dev": true "dev": true
}, },
"@babel/types": { "@babel/types": {