const BaseDetailsView = function BaseDetailsView(options) { BaseView.call(this, options); this.screen = options.parent.screen; this.node = blessed.box(this.layoutConfig); this.parent.append(this.node); this.refreshContent(); this.recalculatePosition(); }
initScreen () { this.screen = blessed.screen({ title: this.title, fullUnicode: true, dockBorders: true, smartCSR: true }) // initialize 12x12 grid // eslint-disable-next-line new-cap this.grid = new contrib.grid({ rows: 12, cols: 12, hideBorder: true, screen: this.screen }) }
// watch for key events on the main container; not the screen // this allows for more granular key bindings in other views this.container.key(["left", "right"], _.throttle((ch, key) => { const delta = key.name === "left" ? -1 : 1; const target = (this.currentLayout + delta + this.layouts.length) % this.layouts.length; this._showLayout(target); }, THROTTLE_TIMEOUT));
render () { // var grid = new contrib.grid({rows: 12, cols: 12, screen: this.screen}) // grid.set(row, col, rowSpan, colSpan, obj, opts) // var map = grid.set(0, 0, 4, 4, this.widgetsRepository.get('containerInfo').widget) // var box = grid.set(4, 4, 4, 4, blessed.box, {content: 'My Box'}) // console.log(this.widgetsRepository.get('containerInfo').widget) this.screen.render() }
const Dashboard = function Dashboard(options) { this.options = options || {}; this.settings = this.options.settings; this.screen = blessed.screen({ smartCSR: true, title: options.appName }); this.logProvider = new LogProvider(this.screen); this.metricsProvider = new MetricsProvider(this.screen); this._createViews(); this._configureKeys(); this.screen.render(); }
teardown () { this.screen.destroy() }
this.screen.key("C-c", () => { process.kill(process.pid, "SIGINT"); });
this.container.key(["q", "S-q"], () => { process.exit(0); // eslint-disable-line no-process-exit });