|
@@ -12,17 +12,21 @@ var Application = React.createClass({
|
|
|
this.refs.modalAdd.openModal();
|
|
this.refs.modalAdd.openModal();
|
|
|
},
|
|
},
|
|
|
getInitialState: function () {
|
|
getInitialState: function () {
|
|
|
- return { data: [] };
|
|
|
|
|
|
|
+ return { data: [], busy: false };
|
|
|
},
|
|
},
|
|
|
componentDidMount: function () {
|
|
componentDidMount: function () {
|
|
|
var that = this;
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
+ that.setState({ data: [], busy: true });
|
|
|
|
|
+
|
|
|
Core.thingsGet('', function (error, result) {
|
|
Core.thingsGet('', function (error, result) {
|
|
|
if (error) return console.error(error);
|
|
if (error) return console.error(error);
|
|
|
- that.setState({ data: result });
|
|
|
|
|
|
|
+ that.setState({ data: result, busy: false });
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
render: function () {
|
|
render: function () {
|
|
|
|
|
+ var things = this.state.busy ? <center><i className="spinner"></i></center> : <ThingList data={this.state.data}/>;
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
<NewThing ref="modalAdd"/>
|
|
<NewThing ref="modalAdd"/>
|
|
@@ -44,7 +48,7 @@ var Application = React.createClass({
|
|
|
<div className="row">
|
|
<div className="row">
|
|
|
<div className="col-md-2"></div>
|
|
<div className="col-md-2"></div>
|
|
|
<div className="col-md-8">
|
|
<div className="col-md-8">
|
|
|
- <ThingList data={this.state.data}/>
|
|
|
|
|
|
|
+ {things}
|
|
|
</div>
|
|
</div>
|
|
|
<div className="col-md-2"></div>
|
|
<div className="col-md-2"></div>
|
|
|
</div>
|
|
</div>
|