2b41283a91
* adding columnify and ember-cli-cjs-transform * add yargs-parser * remove vendored yargs-parser tokenizer and use cjs transform to import it from actual yargs-parser * add clear command that clears the log, but maintains history * make codemirror have no gutter and be auto-height when rendered in the console output log * add fullscreen command and hook up fullscreen toggle button * hook up copy button
29 lines
656 B
JavaScript
29 lines
656 B
JavaScript
import Ember from 'ember';
|
|
import columnify from 'columnify';
|
|
const { computed } = Ember;
|
|
|
|
export function stringifyObjectValues(data) {
|
|
Object.keys(data).forEach(item => {
|
|
let val = data[item];
|
|
if (typeof val !== 'string') {
|
|
val = JSON.stringify(val);
|
|
}
|
|
data[item] = val;
|
|
});
|
|
}
|
|
|
|
export default Ember.Component.extend({
|
|
content: null,
|
|
columns: computed('content', function() {
|
|
let data = this.get('content');
|
|
stringifyObjectValues(data);
|
|
|
|
return columnify(data, {
|
|
preserveNewLines: true,
|
|
headingTransform: function(heading) {
|
|
return Ember.String.capitalize(heading);
|
|
},
|
|
});
|
|
}),
|
|
});
|