From 9eab0501fde1b8c5c9ee5d02240eed1dc53a4319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Sun, 5 Apr 2015 15:41:01 +0000 Subject: [PATCH 1/3] Format the error message a little bit better. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error message is actually a object and not a string so we format it a bit better with this patch. Signed-off-by: Kristján Oddsson --- src/ContainerHome.react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ContainerHome.react.js b/src/ContainerHome.react.js index de13f769c0..530e1b2668 100644 --- a/src/ContainerHome.react.js +++ b/src/ContainerHome.react.js @@ -75,7 +75,7 @@ var ContainerHome = React.createClass({ body = (

An error occurred:

-

{this.props.error}

+

{this.props.error.statusCode} {this.props.error.reason} - {this.props.error.json}

If you feel that this error is invalid, please file a ticket on our GitHub repo.

From 603b9c5952b3b0a88d07af8e3cb0d2380825c38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Sun, 5 Apr 2015 15:42:11 +0000 Subject: [PATCH 2/3] Fetch tags when a Image card has been mounted. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/ImageCard.react.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ImageCard.react.js b/src/ImageCard.react.js index db895f6e32..88f12d60fd 100644 --- a/src/ImageCard.react.js +++ b/src/ImageCard.react.js @@ -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; From 6e56c4f66500d92e0671de37b46700795b557ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Sun, 5 Apr 2015 21:08:15 +0000 Subject: [PATCH 3/3] Change normal function in to a ES6 arrow function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need for `.bind(this)` with ECMAScript6 syntax! Signed-off-by: Kristján Oddsson --- src/ImageCard.react.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ImageCard.react.js b/src/ImageCard.react.js index 88f12d60fd..659d1407e6 100644 --- a/src/ImageCard.react.js +++ b/src/ImageCard.react.js @@ -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'); @@ -51,12 +51,12 @@ 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) { + $.get('https://registry.hub.docker.com/v1/repositories/' + this.props.image.name + '/tags', result => { this.setState({ tags: result, chosenTag: result[0].name }); - }.bind(this)); + }); }, render: function () { var self = this;