Merge pull request #364 from resin-io/feature/sync-filter-offline-devices

resin sync: filter out offline devices in interactive choosing dialog
This commit is contained in:
Juan Cruz Viotti 2016-07-07 13:14:57 -04:00 committed by GitHub
commit b4c89e812c
2 changed files with 4 additions and 0 deletions

View File

@ -197,6 +197,8 @@ limitations under the License.
return resin.models.device.getAllByApplication(applicationName);
}
return resin.models.device.getAll();
}).filter(function(device) {
return device.is_online;
}).then(function(devices) {
if (_.isEmpty(devices)) {
throw new Error('You don\'t have any devices');

View File

@ -155,6 +155,8 @@ exports.inferOrSelectDevice = (applicationName) ->
if applicationName?
return resin.models.device.getAllByApplication(applicationName)
return resin.models.device.getAll()
.filter (device) ->
device.is_online
.then (devices) ->
if _.isEmpty(devices)
throw new Error('You don\'t have any devices')