mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-03 02:43:25 +00:00
Reuse Light Monitor
This commit is contained in:
parent
e8d5ee05cd
commit
d7c4f9fc8b
@ -1,42 +1,16 @@
|
|||||||
let blessed = require("neo-blessed");
|
let blessed = require("neo-blessed");
|
||||||
let CommandHistory = require('./command_history.js');
|
let LightMonitor = require('./light_monitor');
|
||||||
|
|
||||||
class Monitor {
|
class Monitor extends LightMonitor {
|
||||||
constructor(_options) {
|
constructor(_options) {
|
||||||
let options = _options || {};
|
super(_options);
|
||||||
this.env = options.env;
|
|
||||||
this.console = options.console;
|
|
||||||
this.history = new CommandHistory();
|
|
||||||
this.events = options.events;
|
|
||||||
|
|
||||||
this.color = options.color || "green";
|
|
||||||
this.minimal = options.minimal || false;
|
|
||||||
|
|
||||||
this.screen = blessed.screen({
|
|
||||||
smartCSR: true,
|
|
||||||
title: options.title || ("Embark " + options.version),
|
|
||||||
dockBorders: false,
|
|
||||||
fullUnicode: true,
|
|
||||||
autoPadding: true
|
|
||||||
});
|
|
||||||
|
|
||||||
this.layoutLog();
|
|
||||||
this.layoutStatus();
|
this.layoutStatus();
|
||||||
this.layoutModules();
|
this.layoutModules();
|
||||||
this.layoutCmd();
|
|
||||||
|
|
||||||
this.screen.key(["C-c"], function () {
|
|
||||||
process.exit(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.logEntry = this.logEntry.bind(this);
|
|
||||||
this.setContracts = this.setContracts.bind(this);
|
this.setContracts = this.setContracts.bind(this);
|
||||||
this.availableServices = this.availableServices.bind(this);
|
this.availableServices = this.availableServices.bind(this);
|
||||||
|
|
||||||
this.status.setContent(this.env.green);
|
this.status.setContent(this.env.green);
|
||||||
|
|
||||||
this.screen.render();
|
|
||||||
this.input.focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
availableServices(_services) {
|
availableServices(_services) {
|
||||||
@ -77,11 +51,6 @@ class Monitor {
|
|||||||
this.screen.render();
|
this.screen.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
logEntry() {
|
|
||||||
this.logText.log(...arguments);
|
|
||||||
this.screen.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
layoutLog() {
|
layoutLog() {
|
||||||
this.log = blessed.box({
|
this.log = blessed.box({
|
||||||
label: __("Logs"),
|
label: __("Logs"),
|
||||||
@ -164,49 +133,7 @@ class Monitor {
|
|||||||
this.screen.append(this.modules);
|
this.screen.append(this.modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutAssets() {
|
|
||||||
this.assets = blessed.box({
|
|
||||||
label: __("Asset Pipeline"),
|
|
||||||
tags: true,
|
|
||||||
padding: 1,
|
|
||||||
width: "50%",
|
|
||||||
height: "55%",
|
|
||||||
left: "50%",
|
|
||||||
top: "42%",
|
|
||||||
border: {
|
|
||||||
type: "line"
|
|
||||||
},
|
|
||||||
style: {
|
|
||||||
fg: -1,
|
|
||||||
border: {
|
|
||||||
fg: this.color
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.assetTable = blessed.table({
|
|
||||||
parent: this.assets,
|
|
||||||
height: "100%",
|
|
||||||
width: "100%-5",
|
|
||||||
align: "left",
|
|
||||||
pad: 1,
|
|
||||||
scrollable: true,
|
|
||||||
alwaysScroll: true,
|
|
||||||
scrollbar: {
|
|
||||||
ch: " ",
|
|
||||||
inverse: true
|
|
||||||
},
|
|
||||||
keys: false,
|
|
||||||
vi: false,
|
|
||||||
mouse: true,
|
|
||||||
data: [["Name", "Size"]]
|
|
||||||
});
|
|
||||||
|
|
||||||
this.screen.append(this.assets);
|
|
||||||
}
|
|
||||||
|
|
||||||
layoutStatus() {
|
layoutStatus() {
|
||||||
|
|
||||||
this.wrapper = blessed.layout({
|
this.wrapper = blessed.layout({
|
||||||
width: "25%",
|
width: "25%",
|
||||||
height: "42%",
|
height: "42%",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user