ui: added 'No references' placeholder text to the blob detail aspect when there are no references to display

Change-Id: I9bd7b10ab8954c41a3b4a7c375748e087fdc77b3
This commit is contained in:
Mario Russo 2015-03-16 12:13:40 +01:00
parent a185f20f49
commit ae85a3ff4e
1 changed files with 16 additions and 8 deletions

View File

@ -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
);
},