check window size in dashboard instead of index

This commit is contained in:
Iuri Matias 2018-06-01 13:19:48 -04:00
parent 60c687aa41
commit 07e58bcd04
2 changed files with 12 additions and 6 deletions

View File

@ -1,16 +1,28 @@
let async = require('async');
let windowSize = require('window-size');
let Monitor = require('./monitor.js');
let Console = require('./console.js');
class Dashboard {
constructor(options) {
const self = this;
this.logger = options.logger;
this.events = options.events;
this.plugins = options.plugins;
this.version = options.version;
this.env = options.env;
this.contractsConfig = options.contractsConfig;
this.events.on('firstDeploymentDone', this.checkWindowSize.bind(this));
this.events.on('outputDone', this.checkWindowSize.bind(this));
}
checkWindowSize() {
let size = windowSize.get();
if (size.height < 40 || size.width < 118) {
this.logger.warn(__("tip: you can resize the terminal or disable the dashboard with") + " embark run --nodashboard".bold.underline);
}
}
start(done) {

View File

@ -68,7 +68,6 @@ class Embark {
let self = this;
self.context = options.context || [constants.contexts.run, constants.contexts.build];
let Dashboard = require('./dashboard/dashboard.js');
let windowSize = require('window-size');
let engine = new Engine({
env: options.env,
@ -153,11 +152,6 @@ class Embark {
engine.logger.info(err.stack);
} else {
engine.events.emit('firstDeploymentDone');
let size = windowSize.get();
if (size.height < 40 || size.width < 118) {
engine.logger.warn(__("tip: you can resize the terminal or disable the dashboard with") + " embark run --nodashboard".bold.underline);
}
}
});
}