From ae85a3ff4e3369ceb03e7ecdcec0a892fd0db106 Mon Sep 17 00:00:00 2001 From: Mario Russo Date: Mon, 16 Mar 2015 12:13:40 +0100 Subject: [PATCH] ui: added 'No references' placeholder text to the blob detail aspect when there are no references to display Change-Id: I9bd7b10ab8954c41a3b4a7c375748e087fdc77b3 --- server/camlistored/ui/blob_detail.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/server/camlistored/ui/blob_detail.js b/server/camlistored/ui/blob_detail.js index 7a81b32a2..8a2445c78 100644 --- a/server/camlistored/ui/blob_detail.js +++ b/server/camlistored/ui/blob_detail.js @@ -68,15 +68,21 @@ cam.BlobDetail = React.createClass({ this.getSection_("Blob content", this.state.content), this.getSection_("Indexer metadata", this.props.meta), this.getSection_("Mutation claims", this.state.claims), - this.getReferences_(this.state.refs) + this.getReferencesSection_(this.state.refs) ); }, - getReferences_: function(refs) { - var content = 'Loading...'; + getReferencesSection_: function(refs) { + if (!refs) { + return this.getReferencesBlock_("Loading..."); + } - if (refs) { - content = React.DOM.ul( + if (refs.length <= 0) { + return this.getReferencesBlock_("No references"); + } + + return this.getReferencesBlock_( + React.DOM.ul( null, refs.map(function(blobref) { return React.DOM.li( @@ -89,14 +95,16 @@ cam.BlobDetail = React.createClass({ ) ); }, this) - ); - } + ) + ); + }, + getReferencesBlock_: function(content) { return React.DOM.div( { key: 'References', }, - this.getHeader_('Referenced by'), + this.getHeader_("Referenced by"), content ); },