mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-23 23:42:24 +00:00
Merge pull request #124 from resin-io/integrate-new-resin-visuals-functionality
Integrate new resin-cli-visuals functionality
This commit is contained in:
commit
0bb0e6ea4b
@ -66,7 +66,7 @@
|
|||||||
permission: 'user',
|
permission: 'user',
|
||||||
action: function(params, options, done) {
|
action: function(params, options, done) {
|
||||||
return resin.models.application.getAll().then(function(applications) {
|
return resin.models.application.getAll().then(function(applications) {
|
||||||
return console.log(visuals.widgets.table.horizontal(applications, ['id', 'app_name', 'device_type', 'online_devices', 'devices_length']));
|
return console.log(visuals.table.horizontal(applications, ['id', 'app_name', 'device_type', 'online_devices', 'devices_length']));
|
||||||
}).nodeify(done);
|
}).nodeify(done);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -78,7 +78,7 @@
|
|||||||
permission: 'user',
|
permission: 'user',
|
||||||
action: function(params, options, done) {
|
action: function(params, options, done) {
|
||||||
return resin.models.application.get(params.name).then(function(application) {
|
return resin.models.application.get(params.name).then(function(application) {
|
||||||
return console.log(visuals.widgets.table.vertical(application, ['id', 'app_name', 'device_type', 'git_repository', 'commit']));
|
return console.log(visuals.table.vertical(application, ["$" + application.app_name + "$", 'id', 'device_type', 'git_repository', 'commit']));
|
||||||
}).nodeify(done);
|
}).nodeify(done);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var _, async, capitano, commandOptions, deviceConfig, form, fse, image, inject, manager, path, pine, registerDevice, resin, tmp, vcs, visuals;
|
var _, async, capitano, commandOptions, deviceConfig, drivelist, form, fse, image, inject, manager, path, pine, registerDevice, resin, tmp, vcs, visuals;
|
||||||
|
|
||||||
fse = require('fs-extra');
|
fse = require('fs-extra');
|
||||||
|
|
||||||
@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
form = require('resin-cli-form');
|
form = require('resin-cli-form');
|
||||||
|
|
||||||
|
drivelist = require('drivelist');
|
||||||
|
|
||||||
tmp.setGracefulCleanup();
|
tmp.setGracefulCleanup();
|
||||||
|
|
||||||
commandOptions = require('./command-options');
|
commandOptions = require('./command-options');
|
||||||
@ -54,7 +56,7 @@
|
|||||||
if (error != null) {
|
if (error != null) {
|
||||||
return done(error);
|
return done(error);
|
||||||
}
|
}
|
||||||
console.log(visuals.widgets.table.horizontal(devices, ['id', 'name', 'device_type', 'is_online', 'application_name', 'status', 'last_seen']));
|
console.log(visuals.table.horizontal(devices, ['id', 'name', 'device_type', 'is_online', 'application_name', 'status', 'last_seen']));
|
||||||
return done(null, devices);
|
return done(null, devices);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -70,7 +72,7 @@
|
|||||||
if (device.last_seen == null) {
|
if (device.last_seen == null) {
|
||||||
device.last_seen = 'Not seen';
|
device.last_seen = 'Not seen';
|
||||||
}
|
}
|
||||||
return console.log(visuals.widgets.table.vertical(device, ['id', 'name', 'device_type', 'is_online', 'ip_address', 'application_name', 'status', 'last_seen', 'uuid', 'commit', 'supervisor_version', 'is_web_accessible', 'note']));
|
return console.log(visuals.table.vertical(device, ["$" + device.name + "$", 'id', 'device_type', 'is_online', 'ip_address', 'application_name', 'status', 'last_seen', 'uuid', 'commit', 'supervisor_version', 'is_web_accessible', 'note']));
|
||||||
}).nodeify(done);
|
}).nodeify(done);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -306,8 +308,8 @@
|
|||||||
if (process.env.DEBUG) {
|
if (process.env.DEBUG) {
|
||||||
console.log(results.config);
|
console.log(results.config);
|
||||||
}
|
}
|
||||||
bar = new visuals.widgets.Progress('Downloading Device OS');
|
bar = new visuals.Progress('Downloading Device OS');
|
||||||
spinner = new visuals.widgets.Spinner('Downloading Device OS (size unknown)');
|
spinner = new visuals.Spinner('Downloading Device OS (size unknown)');
|
||||||
return manager.configure(results.manifest, results.config, function(error, imagePath, removeCallback) {
|
return manager.configure(results.manifest, results.config, function(error, imagePath, removeCallback) {
|
||||||
spinner.stop();
|
spinner.stop();
|
||||||
return callback(error, imagePath, removeCallback);
|
return callback(error, imagePath, removeCallback);
|
||||||
@ -321,7 +323,7 @@
|
|||||||
}, function(configuredImagePath, removeCallback, callback) {
|
}, function(configuredImagePath, removeCallback, callback) {
|
||||||
var bar;
|
var bar;
|
||||||
console.info('Attempting to write operating system image to drive');
|
console.info('Attempting to write operating system image to drive');
|
||||||
bar = new visuals.widgets.Progress('Writing Device OS');
|
bar = new visuals.Progress('Writing Device OS');
|
||||||
return image.write({
|
return image.write({
|
||||||
device: params.device,
|
device: params.device,
|
||||||
image: configuredImagePath,
|
image: configuredImagePath,
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
if (_.isEmpty(removableDrives)) {
|
if (_.isEmpty(removableDrives)) {
|
||||||
return done(new Error('No removable devices available'));
|
return done(new Error('No removable devices available'));
|
||||||
}
|
}
|
||||||
console.log(visuals.widgets.table.horizontal(removableDrives, ['device', 'description', 'size']));
|
console.log(visuals.table.horizontal(removableDrives, ['device', 'description', 'size']));
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
isSystemVariable = resin.models.environmentVariables.isSystemVariable;
|
isSystemVariable = resin.models.environmentVariables.isSystemVariable;
|
||||||
environmentVariables = _.reject(environmentVariables, isSystemVariable);
|
environmentVariables = _.reject(environmentVariables, isSystemVariable);
|
||||||
}
|
}
|
||||||
console.log(visuals.widgets.table.horizontal(environmentVariables, ['id', 'name', 'value']));
|
console.log(visuals.table.horizontal(environmentVariables, ['id', 'name', 'value']));
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
], done);
|
], done);
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
return example;
|
return example;
|
||||||
});
|
});
|
||||||
return console.log(visuals.widgets.table.horizontal(examplesData, ['id', 'name', 'display_name', 'repository', 'author']));
|
return console.log(visuals.table.horizontal(examplesData, ['name', 'display_name', 'author']));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,7 +53,7 @@
|
|||||||
if (example.author == null) {
|
if (example.author == null) {
|
||||||
example.author = 'Unknown';
|
example.author = 'Unknown';
|
||||||
}
|
}
|
||||||
console.log(visuals.widgets.table.vertical(example, ['name', 'display_name', 'description', 'author', 'repository']));
|
console.log(visuals.table.vertical(example, ["$" + example.display_name + "$", 'description', 'author', 'repository']));
|
||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
permission: 'user',
|
permission: 'user',
|
||||||
action: function(params, options, done) {
|
action: function(params, options, done) {
|
||||||
return resin.models.key.getAll().then(function(keys) {
|
return resin.models.key.getAll().then(function(keys) {
|
||||||
return console.log(visuals.widgets.table.horizontal(keys, ['id', 'title']));
|
return console.log(visuals.table.horizontal(keys, ['id', 'title']));
|
||||||
}).nodeify(done);
|
}).nodeify(done);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -40,7 +40,7 @@
|
|||||||
permission: 'user',
|
permission: 'user',
|
||||||
action: function(params, options, done) {
|
action: function(params, options, done) {
|
||||||
return resin.models.key.get(params.id).then(function(key) {
|
return resin.models.key.get(params.id).then(function(key) {
|
||||||
return console.log(visuals.widgets.table.vertical(key, ['id', 'title', 'public_key']));
|
return console.log(visuals.table.vertical(key, ['id', 'title', 'public_key']));
|
||||||
}).nodeify(done);
|
}).nodeify(done);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
console.log('You don\'t have any plugins yet');
|
console.log('You don\'t have any plugins yet');
|
||||||
return done();
|
return done();
|
||||||
}
|
}
|
||||||
console.log(visuals.widgets.table.horizontal(resinPlugins, ['name', 'version', 'description', 'license']));
|
console.log(visuals.table.horizontal(resinPlugins, ['name', 'version', 'description', 'license']));
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ exports.list =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
resin.models.application.getAll().then (applications) ->
|
resin.models.application.getAll().then (applications) ->
|
||||||
console.log visuals.widgets.table.horizontal applications, [
|
console.log visuals.table.horizontal applications, [
|
||||||
'id'
|
'id'
|
||||||
'app_name'
|
'app_name'
|
||||||
'device_type'
|
'device_type'
|
||||||
@ -100,9 +100,9 @@ exports.info =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
resin.models.application.get(params.name).then (application) ->
|
resin.models.application.get(params.name).then (application) ->
|
||||||
console.log visuals.widgets.table.vertical application, [
|
console.log visuals.table.vertical application, [
|
||||||
|
"$#{application.app_name}$"
|
||||||
'id'
|
'id'
|
||||||
'app_name'
|
|
||||||
'device_type'
|
'device_type'
|
||||||
'git_repository'
|
'git_repository'
|
||||||
'commit'
|
'commit'
|
||||||
|
@ -14,6 +14,7 @@ pine = require('resin-pine')
|
|||||||
tmp = require('tmp')
|
tmp = require('tmp')
|
||||||
deviceConfig = require('resin-device-config')
|
deviceConfig = require('resin-device-config')
|
||||||
form = require('resin-cli-form')
|
form = require('resin-cli-form')
|
||||||
|
drivelist = require('drivelist')
|
||||||
|
|
||||||
# Cleanup the temporary files even when an uncaught exception occurs
|
# Cleanup the temporary files even when an uncaught exception occurs
|
||||||
tmp.setGracefulCleanup()
|
tmp.setGracefulCleanup()
|
||||||
@ -45,7 +46,7 @@ exports.list =
|
|||||||
|
|
||||||
getFunction (error, devices) ->
|
getFunction (error, devices) ->
|
||||||
return done(error) if error?
|
return done(error) if error?
|
||||||
console.log visuals.widgets.table.horizontal devices, [
|
console.log visuals.table.horizontal devices, [
|
||||||
'id'
|
'id'
|
||||||
'name'
|
'name'
|
||||||
'device_type'
|
'device_type'
|
||||||
@ -76,9 +77,9 @@ exports.info =
|
|||||||
# or have it parsed appropriately in the SDK.
|
# or have it parsed appropriately in the SDK.
|
||||||
device.last_seen ?= 'Not seen'
|
device.last_seen ?= 'Not seen'
|
||||||
|
|
||||||
console.log visuals.widgets.table.vertical device, [
|
console.log visuals.table.vertical device, [
|
||||||
|
"$#{device.name}$"
|
||||||
'id'
|
'id'
|
||||||
'name'
|
|
||||||
'device_type'
|
'device_type'
|
||||||
'is_online'
|
'is_online'
|
||||||
'ip_address'
|
'ip_address'
|
||||||
@ -384,8 +385,8 @@ exports.init =
|
|||||||
if process.env.DEBUG
|
if process.env.DEBUG
|
||||||
console.log(results.config)
|
console.log(results.config)
|
||||||
|
|
||||||
bar = new visuals.widgets.Progress('Downloading Device OS')
|
bar = new visuals.Progress('Downloading Device OS')
|
||||||
spinner = new visuals.widgets.Spinner('Downloading Device OS (size unknown)')
|
spinner = new visuals.Spinner('Downloading Device OS (size unknown)')
|
||||||
|
|
||||||
manager.configure results.manifest, results.config, (error, imagePath, removeCallback) ->
|
manager.configure results.manifest, results.config, (error, imagePath, removeCallback) ->
|
||||||
spinner.stop()
|
spinner.stop()
|
||||||
@ -399,7 +400,7 @@ exports.init =
|
|||||||
(configuredImagePath, removeCallback, callback) ->
|
(configuredImagePath, removeCallback, callback) ->
|
||||||
console.info('Attempting to write operating system image to drive')
|
console.info('Attempting to write operating system image to drive')
|
||||||
|
|
||||||
bar = new visuals.widgets.Progress('Writing Device OS')
|
bar = new visuals.Progress('Writing Device OS')
|
||||||
image.write
|
image.write
|
||||||
device: params.device
|
device: params.device
|
||||||
image: configuredImagePath
|
image: configuredImagePath
|
||||||
|
@ -23,7 +23,7 @@ exports.list =
|
|||||||
if _.isEmpty(removableDrives)
|
if _.isEmpty(removableDrives)
|
||||||
return done(new Error('No removable devices available'))
|
return done(new Error('No removable devices available'))
|
||||||
|
|
||||||
console.log visuals.widgets.table.horizontal removableDrives, [
|
console.log visuals.table.horizontal removableDrives, [
|
||||||
'device'
|
'device'
|
||||||
'description'
|
'description'
|
||||||
'size'
|
'size'
|
||||||
|
@ -50,7 +50,7 @@ exports.list =
|
|||||||
isSystemVariable = resin.models.environmentVariables.isSystemVariable
|
isSystemVariable = resin.models.environmentVariables.isSystemVariable
|
||||||
environmentVariables = _.reject(environmentVariables, isSystemVariable)
|
environmentVariables = _.reject(environmentVariables, isSystemVariable)
|
||||||
|
|
||||||
console.log visuals.widgets.table.horizontal environmentVariables, [
|
console.log visuals.table.horizontal environmentVariables, [
|
||||||
'id'
|
'id'
|
||||||
'name'
|
'name'
|
||||||
'value'
|
'value'
|
||||||
|
@ -27,11 +27,9 @@ exports.list =
|
|||||||
example.author ?= 'Unknown'
|
example.author ?= 'Unknown'
|
||||||
return example
|
return example
|
||||||
|
|
||||||
console.log visuals.widgets.table.horizontal examplesData, [
|
console.log visuals.table.horizontal examplesData, [
|
||||||
'id'
|
|
||||||
'name'
|
'name'
|
||||||
'display_name'
|
'display_name'
|
||||||
'repository'
|
|
||||||
'author'
|
'author'
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -54,9 +52,8 @@ exports.info =
|
|||||||
|
|
||||||
example.author ?= 'Unknown'
|
example.author ?= 'Unknown'
|
||||||
|
|
||||||
console.log visuals.widgets.table.vertical example, [
|
console.log visuals.table.vertical example, [
|
||||||
'name'
|
"$#{example.display_name}$"
|
||||||
'display_name'
|
|
||||||
'description'
|
'description'
|
||||||
'author'
|
'author'
|
||||||
'repository'
|
'repository'
|
||||||
|
@ -21,7 +21,7 @@ exports.list =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
resin.models.key.getAll().then (keys) ->
|
resin.models.key.getAll().then (keys) ->
|
||||||
console.log visuals.widgets.table.horizontal keys, [ 'id', 'title' ]
|
console.log visuals.table.horizontal keys, [ 'id', 'title' ]
|
||||||
.nodeify(done)
|
.nodeify(done)
|
||||||
|
|
||||||
SSH_KEY_WIDTH = 43
|
SSH_KEY_WIDTH = 43
|
||||||
@ -39,7 +39,7 @@ exports.info =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
resin.models.key.get(params.id).then (key) ->
|
resin.models.key.get(params.id).then (key) ->
|
||||||
console.log(visuals.widgets.table.vertical(key, [ 'id', 'title', 'public_key' ]))
|
console.log visuals.table.vertical key, [ 'id', 'title', 'public_key' ]
|
||||||
.nodeify(done)
|
.nodeify(done)
|
||||||
|
|
||||||
exports.remove =
|
exports.remove =
|
||||||
|
@ -24,7 +24,7 @@ exports.list =
|
|||||||
console.log('You don\'t have any plugins yet')
|
console.log('You don\'t have any plugins yet')
|
||||||
return done()
|
return done()
|
||||||
|
|
||||||
console.log visuals.widgets.table.horizontal resinPlugins, [
|
console.log visuals.table.horizontal resinPlugins, [
|
||||||
'name'
|
'name'
|
||||||
'version'
|
'version'
|
||||||
'description'
|
'description'
|
||||||
|
Loading…
Reference in New Issue
Block a user