actions/app: Drop resin-sdk-preconfigured

Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
This commit is contained in:
Thodoris Greasidis 2018-10-19 13:14:08 +02:00
parent 73455b4264
commit ca9247fb19

View File

@ -44,7 +44,8 @@ exports.create =
] ]
permission: 'user' permission: 'user'
action: (params, options, done) -> action: (params, options, done) ->
resin = require('resin-sdk-preconfigured') resin = require('resin-sdk').fromSharedOptions()
patterns = require('../utils/patterns') patterns = require('../utils/patterns')
# Validate the the application name is available # Validate the the application name is available
@ -57,7 +58,10 @@ exports.create =
.then -> .then ->
return options.type or patterns.selectDeviceType() return options.type or patterns.selectDeviceType()
.then (deviceType) -> .then (deviceType) ->
return resin.models.application.create(params.name, deviceType) return resin.models.application.create({
name: params.name
deviceType
})
.then (application) -> .then (application) ->
console.info("Application created: #{application.app_name} (#{application.device_type}, id #{application.id})") console.info("Application created: #{application.app_name} (#{application.device_type}, id #{application.id})")
.nodeify(done) .nodeify(done)
@ -78,7 +82,7 @@ exports.list =
permission: 'user' permission: 'user'
primary: true primary: true
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.application.getAll().then (applications) -> resin.models.application.getAll().then (applications) ->
@ -104,7 +108,7 @@ exports.info =
permission: 'user' permission: 'user'
primary: true primary: true
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.application.get(params.name).then (application) -> resin.models.application.get(params.name).then (application) ->
@ -129,7 +133,7 @@ exports.restart =
''' '''
permission: 'user' permission: 'user'
action: (params, options, done) -> action: (params, options, done) ->
resin = require('resin-sdk-preconfigured') resin = require('resin-sdk').fromSharedOptions()
resin.models.application.restart(params.name).nodeify(done) resin.models.application.restart(params.name).nodeify(done)
exports.remove = exports.remove =
@ -149,7 +153,7 @@ exports.remove =
options: [ commandOptions.yes ] options: [ commandOptions.yes ]
permission: 'user' permission: 'user'
action: (params, options, done) -> action: (params, options, done) ->
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 application?').then -> patterns.confirm(options.yes, 'Are you sure you want to delete the application?').then ->