Fix other charts

This commit is contained in:
Gregory Eremin 2015-03-09 23:24:33 +07:00
parent a9a74f511c
commit 95ee6c8b17
2 changed files with 11 additions and 11 deletions

View File

@ -69,7 +69,8 @@ var OrgStats = React.createClass({
render: function(){ render: function(){
return ( return (
<section className="content"> <section className="content">
<BarChart api="/api/stat/orgs/top" params={this.getParams()} items={["repo", "team", "user"]} /> <BarChart key={this.getParams().team} api="/api/stat/orgs/top"
params={this.getParams()} items={["repo", "team", "user"]} />
</section> </section>
); );
} }
@ -81,7 +82,7 @@ var TeamStats = React.createClass({
return ( return (
<section className="content"> <section className="content">
<BarChart key={this.getParams().team} api="/api/stat/teams/top" <BarChart key={this.getParams().team} api="/api/stat/teams/top"
params={this.getParams()} items={["repo", "user"]} /> params={this.getParams()} items={["repo", "user"]} />
</section> </section>
); );
} }
@ -92,7 +93,8 @@ var UserStats = React.createClass({
render: function(){ render: function(){
return ( return (
<section className="content"> <section className="content">
<BarChart api="/api/stat/users/top" params={this.getParams()} items={["repo"]} /> <BarChart key={this.getParams().team} api="/api/stat/users/top"
params={this.getParams()} items={["repo"]} />
</section> </section>
); );
} }
@ -103,7 +105,8 @@ var RepoStats = React.createClass({
render: function(){ render: function(){
return ( return (
<section className="content"> <section className="content">
<BarChart api="/api/stat/repos/top" params={this.getParams()} items={["user", "team"]} /> <BarChart key={this.getParams().team} api="/api/stat/repos/top"
params={this.getParams()} items={["user", "team"]} />
</section> </section>
); );
} }

View File

@ -3,6 +3,7 @@ var SVGNS = "http://www.w3.org/2000/svg",
var BarChart = React.createClass({ var BarChart = React.createClass({
mixins: [Router.Navigation, Router.State], mixins: [Router.Navigation, Router.State],
barHeight: 30, barHeight: 30,
barMargin: 5, barMargin: 5,
@ -64,18 +65,15 @@ var BarChart = React.createClass({
} }
}.bind(this)); }.bind(this));
s = { this.setState({
points: points, points: points,
min: min, min: min,
max: max max: max
}; });
// console.log(s);
this.setState(s);
}, },
apiParams: function() { apiParams: function() {
// Deep copy // Deep copy, but don't use jQuery.extend
// Don't use jQuery.extend
var params = JSON.parse(JSON.stringify(this.props.params)); var params = JSON.parse(JSON.stringify(this.props.params));
params['item'] = this.state.item; params['item'] = this.state.item;
return params; return params;
@ -94,7 +92,6 @@ var BarChart = React.createClass({
}, },
render: function() { render: function() {
// console.log("State:", this.state)
return ( return (
<div className="barchart-container"> <div className="barchart-container">
<div className="filters"> <div className="filters">