mirror of https://github.com/embarklabs/embark.git
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
let async = require('async');
|
|
|
|
let Monitor = require('./monitor.js');
|
|
let Console = require('./console.js');
|
|
|
|
class Dashboard {
|
|
constructor(options) {
|
|
this.logger = options.logger;
|
|
this.events = options.events;
|
|
this.plugins = options.plugins;
|
|
this.version = options.version;
|
|
this.env = options.env;
|
|
this.contractsConfig = options.contractsConfig;
|
|
}
|
|
|
|
start(done) {
|
|
let console, monitor;
|
|
let self = this;
|
|
|
|
async.waterfall([
|
|
function startConsole(callback) {
|
|
console = new Console({
|
|
events: self.events,
|
|
plugins: self.plugins,
|
|
version: self.version,
|
|
contractsConfig: self.contractsConfig
|
|
});
|
|
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;
|