2017-03-29 17:50:05 +00:00
|
|
|
let async = require('async');
|
2017-02-20 23:02:17 +00:00
|
|
|
|
2017-03-29 17:50:05 +00:00
|
|
|
let Monitor = require('./monitor.js');
|
|
|
|
let Console = require('./console.js');
|
2017-02-20 23:02:17 +00:00
|
|
|
|
2017-03-29 17:50:05 +00:00
|
|
|
let Dashboard = function(options) {
|
2017-02-20 23:02:17 +00:00
|
|
|
this.logger = options.logger;
|
|
|
|
this.plugins = options.plugins;
|
|
|
|
this.version = options.version;
|
|
|
|
this.env = options.env;
|
|
|
|
};
|
|
|
|
|
|
|
|
Dashboard.prototype.start = function(done) {
|
2017-03-29 17:50:05 +00:00
|
|
|
let console, monitor;
|
|
|
|
let self = this;
|
2017-02-20 23:02:17 +00:00
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
function startConsole(callback) {
|
|
|
|
console = new Console({plugins: self.plugins, version: self.version});
|
|
|
|
callback();
|
|
|
|
},
|
|
|
|
function startMonitor(callback) {
|
|
|
|
monitor = new Monitor({env: self.env, console: console});
|
|
|
|
self.logger.logFunction = monitor.logEntry;
|
|
|
|
self.logger.contractsState = monitor.setContracts;
|
|
|
|
self.logger.setStatus = monitor.setStatus.bind(monitor);
|
|
|
|
|
|
|
|
self.logger.info('========================'.bold.green);
|
|
|
|
self.logger.info(('Welcome to Embark ' + self.version).yellow.bold);
|
|
|
|
self.logger.info('========================'.bold.green);
|
|
|
|
|
|
|
|
// TODO: do this after monitor is rendered
|
|
|
|
callback();
|
|
|
|
}
|
|
|
|
], function() {
|
|
|
|
self.console = console;
|
|
|
|
self.monitor = monitor;
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Dashboard;
|