mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 22:47:48 +00:00
Move table to widget module
This commit is contained in:
parent
bc11b305b2
commit
ce8b11004c
@ -1,6 +1,5 @@
|
|||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
async = require('async')
|
async = require('async')
|
||||||
table = require('../table/table')
|
|
||||||
resin = require('../resin')
|
resin = require('../resin')
|
||||||
widgets = require('../widgets/widgets')
|
widgets = require('../widgets/widgets')
|
||||||
patterns = require('../patterns/patterns')
|
patterns = require('../patterns/patterns')
|
||||||
@ -34,7 +33,7 @@ exports.create = authHooks.failIfNotLoggedIn (name, program) ->
|
|||||||
exports.list = authHooks.failIfNotLoggedIn ->
|
exports.list = authHooks.failIfNotLoggedIn ->
|
||||||
resin.models.application.getAll().then (applications) ->
|
resin.models.application.getAll().then (applications) ->
|
||||||
|
|
||||||
resin.log.out table.horizontal applications, (application) ->
|
resin.log.out widgets.table.horizontal applications, (application) ->
|
||||||
application.device_type = resin.device.getDisplayName(application.device_type)
|
application.device_type = resin.device.getDisplayName(application.device_type)
|
||||||
application['Online Devices'] = _.where(application.device, is_online: 1).length
|
application['Online Devices'] = _.where(application.device, is_online: 1).length
|
||||||
application['All Devices'] = application.device?.length or 0
|
application['All Devices'] = application.device?.length or 0
|
||||||
@ -48,7 +47,7 @@ exports.list = authHooks.failIfNotLoggedIn ->
|
|||||||
exports.info = authHooks.failIfNotLoggedIn (id) ->
|
exports.info = authHooks.failIfNotLoggedIn (id) ->
|
||||||
resin.models.application.get(id).then (application) ->
|
resin.models.application.get(id).then (application) ->
|
||||||
|
|
||||||
resin.log.out table.vertical application, (application) ->
|
resin.log.out widgets.table.vertical application, (application) ->
|
||||||
application.device_type = resin.device.getDisplayName(application.device_type)
|
application.device_type = resin.device.getDisplayName(application.device_type)
|
||||||
delete application.device
|
delete application.device
|
||||||
return application
|
return application
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
table = require('../table/table')
|
|
||||||
resin = require('../resin')
|
resin = require('../resin')
|
||||||
widgets = require('../widgets/widgets')
|
widgets = require('../widgets/widgets')
|
||||||
patterns = require('../patterns/patterns')
|
patterns = require('../patterns/patterns')
|
||||||
@ -8,7 +7,7 @@ config = require('../config')
|
|||||||
exports.list = authHooks.failIfNotLoggedIn (applicationId) ->
|
exports.list = authHooks.failIfNotLoggedIn (applicationId) ->
|
||||||
resin.models.device.getAll(applicationId).then (devices) ->
|
resin.models.device.getAll(applicationId).then (devices) ->
|
||||||
|
|
||||||
resin.log.out table.horizontal devices, (device) ->
|
resin.log.out widgets.table.horizontal devices, (device) ->
|
||||||
device.application = device.application[0].app_name
|
device.application = device.application[0].app_name
|
||||||
device.device_type = resin.device.getDisplayName(device.device_type)
|
device.device_type = resin.device.getDisplayName(device.device_type)
|
||||||
delete device.note
|
delete device.note
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
table = require('../table/table')
|
widgets = require('../widgets/widgets')
|
||||||
patterns = require('../patterns/patterns')
|
patterns = require('../patterns/patterns')
|
||||||
resin = require('../resin')
|
resin = require('../resin')
|
||||||
authHooks = require('../hooks/auth')
|
authHooks = require('../hooks/auth')
|
||||||
@ -20,7 +20,7 @@ exports.list = authHooks.failIfNotLoggedIn (program) ->
|
|||||||
if not program.parent.verbose?
|
if not program.parent.verbose?
|
||||||
environmentVariables = _.reject(environmentVariables, isSystemVariable)
|
environmentVariables = _.reject(environmentVariables, isSystemVariable)
|
||||||
|
|
||||||
resin.log.out(table.horizontal(environmentVariables))
|
resin.log.out(widgets.table.horizontal(environmentVariables))
|
||||||
.catch(resin.errors.handle)
|
.catch(resin.errors.handle)
|
||||||
|
|
||||||
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
|
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
|
||||||
|
@ -2,14 +2,14 @@ _ = require('lodash')
|
|||||||
resin = require('../resin')
|
resin = require('../resin')
|
||||||
authHooks = require('../hooks/auth')
|
authHooks = require('../hooks/auth')
|
||||||
patterns = require('../patterns/patterns')
|
patterns = require('../patterns/patterns')
|
||||||
table = require('../table/table')
|
widgets = require('../widgets/widgets')
|
||||||
helpers = require('../helpers/helpers')
|
helpers = require('../helpers/helpers')
|
||||||
config = require('../config')
|
config = require('../config')
|
||||||
|
|
||||||
exports.list = authHooks.failIfNotLoggedIn ->
|
exports.list = authHooks.failIfNotLoggedIn ->
|
||||||
resin.server.get config.urls.keys, (error, response, keys) ->
|
resin.server.get config.urls.keys, (error, response, keys) ->
|
||||||
resin.errors.handle(error) if error?
|
resin.errors.handle(error) if error?
|
||||||
resin.log.out table.horizontal keys, (key) ->
|
resin.log.out widgets.table.horizontal keys, (key) ->
|
||||||
delete key.public_key
|
delete key.public_key
|
||||||
return key
|
return key
|
||||||
, [ 'ID', 'Title' ]
|
, [ 'ID', 'Title' ]
|
||||||
@ -27,7 +27,7 @@ exports.info = authHooks.failIfNotLoggedIn (id) ->
|
|||||||
resin.errors.handle(new resin.errors.NotFound("key #{id}"))
|
resin.errors.handle(new resin.errors.NotFound("key #{id}"))
|
||||||
|
|
||||||
key.public_key = '\n' + helpers.formatLongString(key.public_key, config.sshKeyWidth)
|
key.public_key = '\n' + helpers.formatLongString(key.public_key, config.sshKeyWidth)
|
||||||
resin.log.out(table.vertical(key, _.identity, [ 'ID', 'Title', 'Public Key' ]))
|
resin.log.out(widgets.table.vertical(key, _.identity, [ 'ID', 'Title', 'Public Key' ]))
|
||||||
|
|
||||||
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
|
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
|
||||||
patterns.remove 'key', program.parent.yes, (callback) ->
|
patterns.remove 'key', program.parent.yes, (callback) ->
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
inquirer = require('inquirer')
|
inquirer = require('inquirer')
|
||||||
|
|
||||||
|
exports.table = require('./table/table')
|
||||||
|
|
||||||
exports.login = (callback) ->
|
exports.login = (callback) ->
|
||||||
inquirer.prompt([
|
inquirer.prompt([
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user