diff --git a/dashboard/jsx/app.jsx b/dashboard/jsx/app.jsx new file mode 100644 index 0000000..8e75c93 --- /dev/null +++ b/dashboard/jsx/app.jsx @@ -0,0 +1,65 @@ +var Dashboard = React.createClass({ + getInitialState: function() { + return {}; + }, + + componentDidMount: function() { + this.reload(); + }, + + reload: function() { + getURL("http://127.0.0.1:6464/stats.json", {}, function(resp) { + this.setState(resp); + setTimeout(this.reload, 5000); + }.bind(this)); + }, + + renderDaemons: function() { + var daemons = []; + for (name in this.state) { + daemons.push(); + } + + return daemons; + }, + + render: function() { + return ( +
{this.renderDaemons()}
+ ); + } +}); + +var Daemon = React.createClass({ + decode: function(point) { + return { + timestamp: point[0], + processed: point[1], + errors: point[2], + min: point[3], + mean: point[4], + p95: point[5], + max: point[6], + stddev: point[7], + } + }, + + render: function() { + var last = this.decode(this.props.points[this.props.points.length - 1]); + return ( +
+

{this.props.name}

+
+
processed:
{last.processed}
+
errors:
{last.errors}
+
min:
{formatDuration(last.min)}
+
max:
{formatDuration(last.max)}
+
mean:
{formatDuration(last.mean)}
+
95%:
{formatDuration(last.p95)}
+
+
+ ); + } +}); + +ReactDOM.render(, document.getElementById("app"));