mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-07 11:31:15 +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({
|
return form.ask({
|
||||||
message: 'Select an application',
|
message: 'Select an application',
|
||||||
type: 'list',
|
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;
|
||||||
}
|
}
|
||||||
return resin.models.application.getAll().then(function(applications) {
|
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({
|
applications.unshift({
|
||||||
name: 'Create a new application',
|
name: 'Create a new application',
|
||||||
value: null
|
value: null
|
||||||
|
@ -35,13 +35,22 @@ exports.selectApplication = (filter) ->
|
|||||||
return form.ask
|
return form.ask
|
||||||
message: 'Select an application'
|
message: 'Select an application'
|
||||||
type: 'list'
|
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 = ->
|
exports.selectOrCreateApplication = ->
|
||||||
resin.models.application.hasAny().then (hasAnyApplications) ->
|
resin.models.application.hasAny().then (hasAnyApplications) ->
|
||||||
return if not hasAnyApplications
|
return if not hasAnyApplications
|
||||||
resin.models.application.getAll().then (applications) ->
|
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
|
applications.unshift
|
||||||
name: 'Create a new application'
|
name: 'Create a new application'
|
||||||
value: null
|
value: null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user