Fetch tags when a Image card has been mounted.

For images that don't have a "latest" tag (such as `google/debian`) we
fetch all the tags when the `ImageCard` component mounts and set the
chosen tag to the first one in the list (so far it seems to be the
latest tag where such a tag exists but we can add some logic here to
choose a appropriate tag if we want).

Signed-off-by: Kristján Oddsson <koddsson@gmail.com>
This commit is contained in:
Kristján Oddsson 2015-04-05 15:42:11 +00:00
parent 9eab0501fd
commit 603b9c5952
1 changed files with 8 additions and 0 deletions

View File

@ -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', function (result) {
this.setState({
tags: result,
chosenTag: result[0].name
});
}.bind(this));
},
render: function () {
var self = this;
var name;