Merge pull request #363 from koddsson/master-update-tags-on-mount

Update tags on mounting ImageCard component.
This commit is contained in:
Jeffrey Morgan 2015-04-06 11:31:33 -04:00
commit d94f9d325f
2 changed files with 11 additions and 3 deletions

View File

@ -75,7 +75,7 @@ var ContainerHome = React.createClass({
body = (
<div className="details-progress">
<h3>An error occurred:</h3>
<h2>{this.props.error}</h2>
<h2>{this.props.error.statusCode} {this.props.error.reason} - {this.props.error.json}</h2>
<h3>If you feel that this error is invalid, please <a onClick={this.handleErrorClick}>file a ticket on our GitHub repo.</a></h3>
<Radial progress={100} error={true} thick={true} transparent={true}/>
</div>

View File

@ -31,11 +31,11 @@ var ImageCard = React.createClass({
handleTagOverlayClick: function (name) {
var $tagOverlay = $(this.getDOMNode()).find('.tag-overlay');
$tagOverlay.fadeIn(300);
$.get('https://registry.hub.docker.com/v1/repositories/' + name + '/tags', function (result) {
$.get('https://registry.hub.docker.com/v1/repositories/' + name + '/tags', result => {
this.setState({
tags: result
});
}.bind(this));
});
},
handleCloseTagOverlay: function () {
var $tagOverlay = $(this.getDOMNode()).find('.tag-overlay');
@ -50,6 +50,14 @@ var ImageCard = React.createClass({
}
util.exec(['open', $repoUri + this.props.image.name]);
},
componentDidMount: function() {
$.get('https://registry.hub.docker.com/v1/repositories/' + this.props.image.name + '/tags', result => {
this.setState({
tags: result,
chosenTag: result[0].name
});
});
},
render: function () {
var self = this;
var name;