Move patterns to resin/ui

This commit is contained in:
Juan Cruz Viotti 2014-11-26 13:27:57 -04:00
parent 67ade4bf12
commit 3db13f6329
6 changed files with 7 additions and 10 deletions

View File

@ -1,7 +1,6 @@
_ = require('lodash')
async = require('async')
resin = require('../resin')
patterns = require('../patterns/patterns')
authHooks = require('../hooks/auth')
config = require('../config')
@ -60,7 +59,7 @@ exports.restart = authHooks.failIfNotLoggedIn (id) ->
resin.server.post("/application/#{id}/restart", resin.errors.handle)
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
patterns.remove 'application', program.parent.yes, (callback) ->
resin.ui.patterns.remove 'application', program.parent.yes, (callback) ->
resin.models.application.remove(id).then ->
return callback()
.catch(callback)

View File

@ -1,5 +1,4 @@
resin = require('../resin')
patterns = require('../patterns/patterns')
authHooks = require('../hooks/auth')
config = require('../config')
@ -19,7 +18,7 @@ exports.list = authHooks.failIfNotLoggedIn (applicationId) ->
.catch(resin.errors.handle)
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
patterns.remove 'device', program.parent.yes, (callback) ->
resin.ui.patterns.remove 'device', program.parent.yes, (callback) ->
resin.models.device.remove(id).then ->
return callback()
.catch(callback)

View File

@ -1,5 +1,4 @@
_ = require('lodash')
patterns = require('../patterns/patterns')
resin = require('../resin')
authHooks = require('../hooks/auth')
@ -23,7 +22,7 @@ exports.list = authHooks.failIfNotLoggedIn (program) ->
.catch(resin.errors.handle)
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
patterns.remove 'environment variable', program.parent.yes, (callback) ->
resin.ui.patterns.remove 'environment variable', program.parent.yes, (callback) ->
resin.models.environmentVariables.remove(id).then ->
return callback()
.catch(callback)

View File

@ -1,7 +1,6 @@
_ = require('lodash')
resin = require('../resin')
authHooks = require('../hooks/auth')
patterns = require('../patterns/patterns')
helpers = require('../helpers/helpers')
config = require('../config')
@ -29,6 +28,6 @@ exports.info = authHooks.failIfNotLoggedIn (id) ->
resin.log.out(resin.ui.widgets.table.vertical(key, _.identity, [ 'ID', 'Title', 'Public Key' ]))
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
patterns.remove 'key', program.parent.yes, (callback) ->
resin.ui.patterns.remove 'key', program.parent.yes, (callback) ->
resin.server.delete("/user/keys/#{id}", callback)
, resin.errors.handle

View File

@ -1,2 +1,3 @@
module.exports =
widgets: require('./widgets/widgets')
patterns: require('./patterns/patterns')

View File

@ -1,5 +1,5 @@
async = require('async')
resin = require('../resin')
widgets = require('../widgets/widgets')
exports.remove = (name, confirmAttribute, deleteFunction, outerCallback) ->
async.waterfall([
@ -8,7 +8,7 @@ exports.remove = (name, confirmAttribute, deleteFunction, outerCallback) ->
if confirmAttribute
return callback(null, true)
resin.ui.widgets.confirmRemoval(name, callback)
widgets.confirmRemoval(name, callback)
(confirmed, callback) ->
return callback() if not confirmed