mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-23 15:32:22 +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',
|
||||
action: function(params, options, done) {
|
||||
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);
|
||||
}
|
||||
};
|
||||
@ -78,7 +78,7 @@
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
(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');
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
|
||||
form = require('resin-cli-form');
|
||||
|
||||
drivelist = require('drivelist');
|
||||
|
||||
tmp.setGracefulCleanup();
|
||||
|
||||
commandOptions = require('./command-options');
|
||||
@ -54,7 +56,7 @@
|
||||
if (error != null) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
@ -70,7 +72,7 @@
|
||||
if (device.last_seen == null) {
|
||||
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);
|
||||
}
|
||||
};
|
||||
@ -306,8 +308,8 @@
|
||||
if (process.env.DEBUG) {
|
||||
console.log(results.config);
|
||||
}
|
||||
bar = new visuals.widgets.Progress('Downloading Device OS');
|
||||
spinner = new visuals.widgets.Spinner('Downloading Device OS (size unknown)');
|
||||
bar = new visuals.Progress('Downloading Device OS');
|
||||
spinner = new visuals.Spinner('Downloading Device OS (size unknown)');
|
||||
return manager.configure(results.manifest, results.config, function(error, imagePath, removeCallback) {
|
||||
spinner.stop();
|
||||
return callback(error, imagePath, removeCallback);
|
||||
@ -321,7 +323,7 @@
|
||||
}, function(configuredImagePath, removeCallback, callback) {
|
||||
var bar;
|
||||
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({
|
||||
device: params.device,
|
||||
image: configuredImagePath,
|
||||
|
@ -23,7 +23,7 @@
|
||||
if (_.isEmpty(removableDrives)) {
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -40,7 +40,7 @@
|
||||
isSystemVariable = resin.models.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();
|
||||
}
|
||||
], done);
|
||||
|
@ -33,7 +33,7 @@
|
||||
}
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
@ -26,7 +26,7 @@
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
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);
|
||||
}
|
||||
};
|
||||
@ -40,7 +40,7 @@
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
@ -27,7 +27,7 @@
|
||||
console.log('You don\'t have any plugins yet');
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ exports.list =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin.models.application.getAll().then (applications) ->
|
||||
console.log visuals.widgets.table.horizontal applications, [
|
||||
console.log visuals.table.horizontal applications, [
|
||||
'id'
|
||||
'app_name'
|
||||
'device_type'
|
||||
@ -100,9 +100,9 @@ exports.info =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
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'
|
||||
'app_name'
|
||||
'device_type'
|
||||
'git_repository'
|
||||
'commit'
|
||||
|
@ -14,6 +14,7 @@ pine = require('resin-pine')
|
||||
tmp = require('tmp')
|
||||
deviceConfig = require('resin-device-config')
|
||||
form = require('resin-cli-form')
|
||||
drivelist = require('drivelist')
|
||||
|
||||
# Cleanup the temporary files even when an uncaught exception occurs
|
||||
tmp.setGracefulCleanup()
|
||||
@ -45,7 +46,7 @@ exports.list =
|
||||
|
||||
getFunction (error, devices) ->
|
||||
return done(error) if error?
|
||||
console.log visuals.widgets.table.horizontal devices, [
|
||||
console.log visuals.table.horizontal devices, [
|
||||
'id'
|
||||
'name'
|
||||
'device_type'
|
||||
@ -76,9 +77,9 @@ exports.info =
|
||||
# or have it parsed appropriately in the SDK.
|
||||
device.last_seen ?= 'Not seen'
|
||||
|
||||
console.log visuals.widgets.table.vertical device, [
|
||||
console.log visuals.table.vertical device, [
|
||||
"$#{device.name}$"
|
||||
'id'
|
||||
'name'
|
||||
'device_type'
|
||||
'is_online'
|
||||
'ip_address'
|
||||
@ -384,8 +385,8 @@ exports.init =
|
||||
if process.env.DEBUG
|
||||
console.log(results.config)
|
||||
|
||||
bar = new visuals.widgets.Progress('Downloading Device OS')
|
||||
spinner = new visuals.widgets.Spinner('Downloading Device OS (size unknown)')
|
||||
bar = new visuals.Progress('Downloading Device OS')
|
||||
spinner = new visuals.Spinner('Downloading Device OS (size unknown)')
|
||||
|
||||
manager.configure results.manifest, results.config, (error, imagePath, removeCallback) ->
|
||||
spinner.stop()
|
||||
@ -399,7 +400,7 @@ exports.init =
|
||||
(configuredImagePath, removeCallback, callback) ->
|
||||
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
|
||||
device: params.device
|
||||
image: configuredImagePath
|
||||
|
@ -23,7 +23,7 @@ exports.list =
|
||||
if _.isEmpty(removableDrives)
|
||||
return done(new Error('No removable devices available'))
|
||||
|
||||
console.log visuals.widgets.table.horizontal removableDrives, [
|
||||
console.log visuals.table.horizontal removableDrives, [
|
||||
'device'
|
||||
'description'
|
||||
'size'
|
||||
|
@ -50,7 +50,7 @@ exports.list =
|
||||
isSystemVariable = resin.models.environmentVariables.isSystemVariable
|
||||
environmentVariables = _.reject(environmentVariables, isSystemVariable)
|
||||
|
||||
console.log visuals.widgets.table.horizontal environmentVariables, [
|
||||
console.log visuals.table.horizontal environmentVariables, [
|
||||
'id'
|
||||
'name'
|
||||
'value'
|
||||
|
@ -27,11 +27,9 @@ exports.list =
|
||||
example.author ?= 'Unknown'
|
||||
return example
|
||||
|
||||
console.log visuals.widgets.table.horizontal examplesData, [
|
||||
'id'
|
||||
console.log visuals.table.horizontal examplesData, [
|
||||
'name'
|
||||
'display_name'
|
||||
'repository'
|
||||
'author'
|
||||
]
|
||||
|
||||
@ -54,9 +52,8 @@ exports.info =
|
||||
|
||||
example.author ?= 'Unknown'
|
||||
|
||||
console.log visuals.widgets.table.vertical example, [
|
||||
'name'
|
||||
'display_name'
|
||||
console.log visuals.table.vertical example, [
|
||||
"$#{example.display_name}$"
|
||||
'description'
|
||||
'author'
|
||||
'repository'
|
||||
|
@ -21,7 +21,7 @@ exports.list =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
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)
|
||||
|
||||
SSH_KEY_WIDTH = 43
|
||||
@ -39,7 +39,7 @@ exports.info =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
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)
|
||||
|
||||
exports.remove =
|
||||
|
@ -24,7 +24,7 @@ exports.list =
|
||||
console.log('You don\'t have any plugins yet')
|
||||
return done()
|
||||
|
||||
console.log visuals.widgets.table.horizontal resinPlugins, [
|
||||
console.log visuals.table.horizontal resinPlugins, [
|
||||
'name'
|
||||
'version'
|
||||
'description'
|
||||
|
Loading…
Reference in New Issue
Block a user