mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-08 03:44:13 +00:00
Show device types when selecting applications
Some CLI commans prompt to select an existing application, presending a dropdown with all the application names, however it's hard to remember which application belon to which device type, which makes it easier to select the wrong application.
This commit is contained in:
parent
65646d1206
commit
e08c3752f9
@ -52,7 +52,12 @@
|
||||
return form.ask({
|
||||
message: 'Select an application',
|
||||
type: 'list',
|
||||
choices: _.pluck(applications, 'app_name')
|
||||
choices: _.map(applications, function(application) {
|
||||
return {
|
||||
name: application.app_name + " (" + application.device_type + ")",
|
||||
value: application.app_name
|
||||
};
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -63,7 +68,12 @@
|
||||
return;
|
||||
}
|
||||
return resin.models.application.getAll().then(function(applications) {
|
||||
applications = _.pluck(applications, 'app_name');
|
||||
applications = _.map(applications, function(application) {
|
||||
return {
|
||||
name: application.app_name + " (" + application.device_type + ")",
|
||||
value: application.app_name
|
||||
};
|
||||
});
|
||||
applications.unshift({
|
||||
name: 'Create a new application',
|
||||
value: null
|
||||
|
@ -35,13 +35,22 @@ exports.selectApplication = (filter) ->
|
||||
return form.ask
|
||||
message: 'Select an application'
|
||||
type: 'list'
|
||||
choices: _.pluck(applications, 'app_name')
|
||||
choices: _.map applications, (application) ->
|
||||
return {
|
||||
name: "#{application.app_name} (#{application.device_type})"
|
||||
value: application.app_name
|
||||
}
|
||||
|
||||
exports.selectOrCreateApplication = ->
|
||||
resin.models.application.hasAny().then (hasAnyApplications) ->
|
||||
return if not hasAnyApplications
|
||||
resin.models.application.getAll().then (applications) ->
|
||||
applications = _.pluck(applications, 'app_name')
|
||||
applications = _.map applications, (application) ->
|
||||
return {
|
||||
name: "#{application.app_name} (#{application.device_type})"
|
||||
value: application.app_name
|
||||
}
|
||||
|
||||
applications.unshift
|
||||
name: 'Create a new application'
|
||||
value: null
|
||||
|
Loading…
x
Reference in New Issue
Block a user