mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 10:46:34 +00:00
Merge pull request #269 from resin-io/jviotti/feature/device-type-in-app-list
Show device types when selecting applications
This commit is contained in:
commit
b881e23c1c
@ -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…
Reference in New Issue
Block a user