This repository has been archived by the owner on Mar 4, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d37356
commit 248e2d1
Showing
12 changed files
with
346 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
--- | ||
extends: | ||
- "formidable/configurations/es6-node" | ||
- "formidable/configurations/es5-node" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"use strict"; | ||
const dashboardAgent = require("./lib/dashboard-agent"); | ||
var dashboardAgent = require("./lib/dashboard-agent"); | ||
|
||
module.exports = dashboardAgent(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
"use strict"; | ||
|
||
const pkg = require("../package.json"); | ||
var pkg = require("../package.json"); | ||
|
||
module.exports = { | ||
PORT: 9838, | ||
PORT_KEY: `${pkg.name}_PORT`, | ||
PORT_KEY: pkg.name + "_PORT", | ||
BLOCKED_THRESHOLD: 10, | ||
BLOCKED_THRESHOLD_KEY: `${pkg.name}_BLOCKED_THRESHOLD` | ||
BLOCKED_THRESHOLD_KEY: pkg.name + "_BLOCKED_THRESHOLD" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,63 @@ | ||
"use strict"; | ||
|
||
const _ = require("lodash"); | ||
const blessed = require("blessed"); | ||
|
||
const StreamView = require("./views/stream-view"); | ||
const EventLoopView = require("./views/eventloop-view"); | ||
const MemoryView = require("./views/memory-view"); | ||
const CpuView = require("./views/cpu-view"); | ||
const EventEmitter = require("events"); | ||
|
||
class Dashboard { | ||
|
||
constructor(options) { | ||
this.screen = blessed.screen({ | ||
smartCSR: true, | ||
title: `${options.appName}` | ||
}); | ||
|
||
this.screen.key(["escape", "q", "C-c"], () => { | ||
process.exit(0); // eslint-disable-line no-process-exit | ||
}); | ||
|
||
this.eventPump = new EventEmitter(); | ||
this._createView(); | ||
|
||
} | ||
|
||
onEvent(event) { | ||
this.eventPump.emit(event.type, event.data); | ||
this.screen.render(); | ||
} | ||
var _ = require("lodash"); | ||
var blessed = require("blessed"); | ||
|
||
var StreamView = require("./views/stream-view"); | ||
var EventLoopView = require("./views/eventloop-view"); | ||
var MemoryView = require("./views/memory-view"); | ||
var CpuView = require("./views/cpu-view"); | ||
var EventEmitter = require("events"); | ||
|
||
function Dashboard(options) { | ||
this.screen = blessed.screen({ | ||
smartCSR: true, | ||
title: options.appName | ||
}); | ||
|
||
this.screen.key(["escape", "q", "C-c"], function () { | ||
process.exit(0); // eslint-disable-line no-process-exit | ||
}); | ||
|
||
this.eventPump = new EventEmitter(); | ||
this._createView(); | ||
} | ||
|
||
_createView() { | ||
// fixes weird scrolling issue | ||
const container = blessed.box({}); | ||
this.screen.append(container); | ||
Dashboard.prototype.onEvent = function (event) { | ||
this.eventPump.emit(event.type, event.data); | ||
this.screen.render(); | ||
}; | ||
|
||
const stdoutView = new StreamView({ | ||
parent: container, | ||
label: "stdout", | ||
color: "green" | ||
}); | ||
Dashboard.prototype._createView = function () { | ||
// fixes weird scrolling issue | ||
var container = blessed.box({}); | ||
this.screen.append(container); | ||
|
||
this.eventPump.addListener("stdout", stdoutView.onEvent.bind(stdoutView)); | ||
var stdoutView = new StreamView({ | ||
parent: container, | ||
label: "stdout", | ||
color: "green" | ||
}); | ||
|
||
const stderrView = new StreamView({ | ||
parent: container, | ||
label: "stderr", | ||
color: "red", | ||
top: "50%" | ||
}); | ||
this.eventPump.addListener("stdout", stdoutView.onEvent.bind(stdoutView)); | ||
|
||
this.eventPump.addListener("stderr", stderrView.onEvent.bind(stderrView)); | ||
var stderrView = new StreamView({ | ||
parent: container, | ||
label: "stderr", | ||
color: "red", | ||
top: "50%" | ||
}); | ||
|
||
const metrics = [MemoryView, CpuView, EventLoopView]; | ||
this.eventPump.addListener("stderr", stderrView.onEvent.bind(stderrView)); | ||
|
||
_.each(metrics, (Metric) => { | ||
const view = new Metric({ parent: this.screen }); | ||
this.eventPump.addListener("metrics", view.onEvent.bind(view)); | ||
}); | ||
var metrics = [MemoryView, CpuView, EventLoopView]; | ||
|
||
this.screen.render(); | ||
} | ||
_.each(metrics, function (Metric) { | ||
var view = new Metric({ parent: this.screen }); | ||
this.eventPump.addListener("metrics", view.onEvent.bind(view)); | ||
}.bind(this)); | ||
|
||
} | ||
this.screen.render(); | ||
}; | ||
|
||
module.exports = Dashboard; |
Oops, something went wrong.