mirror of https://github.com/docker/docs.git
add loading after button press
This commit is contained in:
parent
4ddfc22245
commit
c1a442223b
|
@ -1,3 +1,4 @@
|
||||||
|
var _ = require('underscore');
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var React = require('react/addons');
|
var React = require('react/addons');
|
||||||
var RetinaImage = require('react-retina-image');
|
var RetinaImage = require('react-retina-image');
|
||||||
|
@ -14,9 +15,13 @@ var NewContainer = React.createClass({
|
||||||
loading: false,
|
loading: false,
|
||||||
tags: {},
|
tags: {},
|
||||||
active: null,
|
active: null,
|
||||||
|
creating: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentDidMount: function () {
|
componentDidMount: function () {
|
||||||
|
this.setState({
|
||||||
|
creating: []
|
||||||
|
});
|
||||||
this.refs.searchInput.getDOMNode().focus();
|
this.refs.searchInput.getDOMNode().focus();
|
||||||
ContainerStore.on(ContainerStore.CLIENT_RECOMMENDED_EVENT, this.update);
|
ContainerStore.on(ContainerStore.CLIENT_RECOMMENDED_EVENT, this.update);
|
||||||
},
|
},
|
||||||
|
@ -126,6 +131,12 @@ var NewContainer = React.createClass({
|
||||||
} else {
|
} else {
|
||||||
imgsrc = 'https://kitematic.com/recommended/kitematic_html.png';
|
imgsrc = 'https://kitematic.com/recommended/kitematic_html.png';
|
||||||
}
|
}
|
||||||
|
var action;
|
||||||
|
if (_.find(self.state.creating, r.name)) {
|
||||||
|
action = <RetinaImage src="loading.png"/>;
|
||||||
|
} else {
|
||||||
|
action = <a className="btn btn-action" onClick={self.handleClick.bind(self, r.name)}>Create</a>;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div key={r.name} className="image-item">
|
<div key={r.name} className="image-item">
|
||||||
<div className="logo" style={logoStyle}>
|
<div className="logo" style={logoStyle}>
|
||||||
|
@ -148,7 +159,7 @@ var NewContainer = React.createClass({
|
||||||
<span className="text">latest</span>
|
<span className="text">latest</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="action">
|
<div className="action">
|
||||||
<a className="btn btn-action" onClick={self.handleClick.bind(self, r.name)}>Create</a>
|
{action}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue