mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-19 11:16:38 +00:00
Auto-merge for PR #879 via VersionBot
Update SDK for device commands, so we show new device dashboard URLs
This commit is contained in:
commit
7bea2c26b8
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
|
|||||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## v7.4.1 - 2018-05-24
|
||||||
|
|
||||||
|
* Update SDK in resin device(s) to ensure the dashboard URL is correct #879 [Tim Perry]
|
||||||
|
|
||||||
## v7.4.0 - 2018-05-10
|
## v7.4.0 - 2018-05-10
|
||||||
|
|
||||||
* Add push command which starts a build on remote resin servers #868 [Cameron Diver]
|
* Add push command which starts a build on remote resin servers #868 [Cameron Diver]
|
||||||
|
@ -18,6 +18,10 @@ commandOptions = require('./command-options')
|
|||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
{ normalizeUuidProp } = require('../utils/normalization')
|
{ normalizeUuidProp } = require('../utils/normalization')
|
||||||
|
|
||||||
|
expandForAppName = {
|
||||||
|
$expand: belongs_to__application: $select: 'app_name'
|
||||||
|
}
|
||||||
|
|
||||||
exports.list =
|
exports.list =
|
||||||
signature: 'devices'
|
signature: 'devices'
|
||||||
description: 'list all devices'
|
description: 'list all devices'
|
||||||
@ -38,23 +42,25 @@ exports.list =
|
|||||||
primary: true
|
primary: true
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
visuals = require('resin-cli-visuals')
|
visuals = require('resin-cli-visuals')
|
||||||
|
|
||||||
Promise.try ->
|
Promise.try ->
|
||||||
if options.application?
|
if options.application?
|
||||||
return resin.models.device.getAllByApplication(options.application)
|
return resin.models.device.getAllByApplication(options.application, expandForAppName)
|
||||||
return resin.models.device.getAll()
|
return resin.models.device.getAll(expandForAppName)
|
||||||
|
|
||||||
.tap (devices) ->
|
.tap (devices) ->
|
||||||
devices = _.map devices, (device) ->
|
devices = _.map devices, (device) ->
|
||||||
|
device.dashboard_url = resin.models.device.getDashboardUrl(device.uuid)
|
||||||
|
device.application_name = device.belongs_to__application[0].app_name
|
||||||
device.uuid = device.uuid.slice(0, 7)
|
device.uuid = device.uuid.slice(0, 7)
|
||||||
return device
|
return device
|
||||||
|
|
||||||
console.log visuals.table.horizontal devices, [
|
console.log visuals.table.horizontal devices, [
|
||||||
'id'
|
'id'
|
||||||
'uuid'
|
'uuid'
|
||||||
'name'
|
'device_name'
|
||||||
'device_type'
|
'device_type'
|
||||||
'application_name'
|
'application_name'
|
||||||
'status'
|
'status'
|
||||||
@ -79,16 +85,19 @@ exports.info =
|
|||||||
primary: true
|
primary: true
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
visuals = require('resin-cli-visuals')
|
visuals = require('resin-cli-visuals')
|
||||||
|
|
||||||
resin.models.device.get(params.uuid).then (device) ->
|
resin.models.device.get(params.uuid, expandForAppName)
|
||||||
|
.then (device) ->
|
||||||
resin.models.device.getStatus(device).then (status) ->
|
resin.models.device.getStatus(device).then (status) ->
|
||||||
device.status = status
|
device.status = status
|
||||||
|
device.dashboard_url = resin.models.device.getDashboardUrl(device.uuid)
|
||||||
|
device.application_name = device.belongs_to__application[0].app_name
|
||||||
|
device.commit = device.is_on__commit
|
||||||
|
|
||||||
console.log visuals.table.vertical device, [
|
console.log visuals.table.vertical device, [
|
||||||
"$#{device.name}$"
|
"$#{device.device_name}$"
|
||||||
'id'
|
'id'
|
||||||
'device_type'
|
'device_type'
|
||||||
'status'
|
'status'
|
||||||
@ -117,7 +126,7 @@ exports.supported =
|
|||||||
$ resin devices supported
|
$ resin devices supported
|
||||||
'''
|
'''
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
visuals = require('resin-cli-visuals')
|
visuals = require('resin-cli-visuals')
|
||||||
|
|
||||||
resin.models.config.getDeviceTypes().then (deviceTypes) ->
|
resin.models.config.getDeviceTypes().then (deviceTypes) ->
|
||||||
@ -153,7 +162,7 @@ exports.register =
|
|||||||
]
|
]
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
|
|
||||||
Promise.join(
|
Promise.join(
|
||||||
resin.models.application.get(params.application)
|
resin.models.application.get(params.application)
|
||||||
@ -188,7 +197,7 @@ exports.remove =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
patterns = require('../utils/patterns')
|
patterns = require('../utils/patterns')
|
||||||
|
|
||||||
patterns.confirm(options.yes, 'Are you sure you want to delete the device?').then ->
|
patterns.confirm(options.yes, 'Are you sure you want to delete the device?').then ->
|
||||||
@ -210,7 +219,7 @@ exports.identify =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
resin.models.device.identify(params.uuid).nodeify(done)
|
resin.models.device.identify(params.uuid).nodeify(done)
|
||||||
|
|
||||||
exports.reboot =
|
exports.reboot =
|
||||||
@ -227,7 +236,7 @@ exports.reboot =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
resin.models.device.reboot(params.uuid, options).nodeify(done)
|
resin.models.device.reboot(params.uuid, options).nodeify(done)
|
||||||
|
|
||||||
exports.shutdown =
|
exports.shutdown =
|
||||||
@ -244,7 +253,7 @@ exports.shutdown =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
resin.models.device.shutdown(params.uuid, options).nodeify(done)
|
resin.models.device.shutdown(params.uuid, options).nodeify(done)
|
||||||
|
|
||||||
exports.enableDeviceUrl =
|
exports.enableDeviceUrl =
|
||||||
@ -260,7 +269,7 @@ exports.enableDeviceUrl =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
resin.models.device.enableDeviceUrl(params.uuid).nodeify(done)
|
resin.models.device.enableDeviceUrl(params.uuid).nodeify(done)
|
||||||
|
|
||||||
exports.disableDeviceUrl =
|
exports.disableDeviceUrl =
|
||||||
@ -276,7 +285,7 @@ exports.disableDeviceUrl =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
resin.models.device.disableDeviceUrl(params.uuid).nodeify(done)
|
resin.models.device.disableDeviceUrl(params.uuid).nodeify(done)
|
||||||
|
|
||||||
exports.getDeviceUrl =
|
exports.getDeviceUrl =
|
||||||
@ -292,7 +301,7 @@ exports.getDeviceUrl =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
resin.models.device.getDeviceUrl(params.uuid).then (url) ->
|
resin.models.device.getDeviceUrl(params.uuid).then (url) ->
|
||||||
console.log(url)
|
console.log(url)
|
||||||
.nodeify(done)
|
.nodeify(done)
|
||||||
@ -310,7 +319,7 @@ exports.hasDeviceUrl =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
resin.models.device.hasDeviceUrl(params.uuid).then (hasDeviceUrl) ->
|
resin.models.device.hasDeviceUrl(params.uuid).then (hasDeviceUrl) ->
|
||||||
console.log(hasDeviceUrl)
|
console.log(hasDeviceUrl)
|
||||||
.nodeify(done)
|
.nodeify(done)
|
||||||
@ -332,7 +341,7 @@ exports.rename =
|
|||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
form = require('resin-cli-form')
|
form = require('resin-cli-form')
|
||||||
|
|
||||||
Promise.try ->
|
Promise.try ->
|
||||||
@ -362,14 +371,14 @@ exports.move =
|
|||||||
options: [ commandOptions.optionalApplication ]
|
options: [ commandOptions.optionalApplication ]
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
normalizeUuidProp(params)
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
patterns = require('../utils/patterns')
|
patterns = require('../utils/patterns')
|
||||||
|
|
||||||
resin.models.device.get(params.uuid).then (device) ->
|
resin.models.device.get(params.uuid, expandForAppName).then (device) ->
|
||||||
return options.application or patterns.selectApplication (application) ->
|
return options.application or patterns.selectApplication (application) ->
|
||||||
return _.every [
|
return _.every [
|
||||||
application.device_type is device.device_type
|
application.device_type is device.device_type
|
||||||
device.application_name isnt application.app_name
|
device.belongs_to__application[0].app_name isnt application.app_name
|
||||||
]
|
]
|
||||||
.tap (application) ->
|
.tap (application) ->
|
||||||
return resin.models.device.move(params.uuid, application)
|
return resin.models.device.move(params.uuid, application)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "resin-cli",
|
"name": "resin-cli",
|
||||||
"version": "7.4.0",
|
"version": "7.4.1",
|
||||||
"description": "The official resin.io CLI tool",
|
"description": "The official resin.io CLI tool",
|
||||||
"main": "./build/actions/index.js",
|
"main": "./build/actions/index.js",
|
||||||
"homepage": "https://github.com/resin-io/resin-cli",
|
"homepage": "https://github.com/resin-io/resin-cli",
|
||||||
|
Loading…
Reference in New Issue
Block a user