mirror of https://github.com/docker/docs.git
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:
parent
9eab0501fd
commit
603b9c5952
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue