Cleanup code
This commit is contained in:
parent
6563736fae
commit
1a1e062712
3
Makefile
3
Makefile
|
@ -7,6 +7,9 @@ jsx: check-react
|
||||||
jsx --extension jsx server/static/ server/static/
|
jsx --extension jsx server/static/ server/static/
|
||||||
rm -rf server/static/.module-cache
|
rm -rf server/static/.module-cache
|
||||||
|
|
||||||
|
watch:
|
||||||
|
jsx --watch --extension jsx server/static/ server/static/
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
find . -name '.DS_Store' | xargs rm -f
|
find . -name '.DS_Store' | xargs rm -f
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ thead tr {
|
||||||
.title {
|
.title {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 350px;
|
width: 350px;
|
||||||
|
max-width: 350px;
|
||||||
}
|
}
|
||||||
.name {
|
.name {
|
||||||
max-width: 350px;
|
max-width: 350px;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
var Chart = React.createClass({
|
var Chart = React.createClass({
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {pointsIn: [], pointsOut: []};
|
return {
|
||||||
|
pointsIn: [],
|
||||||
|
pointsOut: []
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
@ -26,7 +29,10 @@ var Chart = React.createClass({
|
||||||
pointsOut.push(pointOut);
|
pointsOut.push(pointOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({pointsIn: pointsIn, pointsOut: pointsOut});
|
this.setState({
|
||||||
|
pointsIn: pointsIn,
|
||||||
|
pointsOut: pointsOut
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
calcMaxDouble: function(a, b) {
|
calcMaxDouble: function(a, b) {
|
||||||
|
@ -59,11 +65,14 @@ var Chart = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var viewBox = [0, 0, this.props.width, this.props.height].join(' ');
|
var viewBox = [0, 0, this.props.width, this.props.height].join(' '),
|
||||||
|
dIn = this.buildPathD(this.state.pointsIn),
|
||||||
|
dOut = this.buildPathD(this.state.pointsOut);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg className="chart" viewBox={viewBox}>
|
<svg className="chart" viewBox={viewBox}>
|
||||||
<path className="in" d={this.buildPathD(this.state.pointsIn)} />
|
<path className="in" d={dIn} />
|
||||||
<path className="out" d={this.buildPathD(this.state.pointsOut)} />
|
<path className="out" d={dOut} />
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -110,6 +119,7 @@ var QueuesList = React.createClass({
|
||||||
if (meta.subscriptions === 0) {
|
if (meta.subscriptions === 0) {
|
||||||
subscriptionsClasses.push('zero');
|
subscriptionsClasses.push('zero');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr key={name}>
|
<tr key={name}>
|
||||||
<td className="title">
|
<td className="title">
|
||||||
|
@ -162,7 +172,8 @@ var Dashboard = React.createClass({
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
var xhr = new XMLHttpRequest()
|
var xhr = new XMLHttpRequest()
|
||||||
self = this;
|
self = this;
|
||||||
xhr.open('GET', '/status?rates=please', true);
|
|
||||||
|
xhr.open('GET', this.props.api, true);
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
|
|
|
@ -13,7 +13,10 @@
|
||||||
<div id="dashboard"></div>
|
<div id="dashboard"></div>
|
||||||
<script>
|
<script>
|
||||||
React.render(
|
React.render(
|
||||||
React.createElement(Dashboard, {api: "http://127.0.0.1:{{.port}}/status", interval: 1000}),
|
React.createElement(Dashboard, {
|
||||||
|
api: "http://127.0.0.1:{{.port}}/status?rates=please",
|
||||||
|
interval: 1000
|
||||||
|
}),
|
||||||
document.getElementById('dashboard')
|
document.getElementById('dashboard')
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue