1. Fix for error message not showing up when you switched the parameter in the temporal vis & there happens to be no data available for that parameter for that organization.

This commit is contained in:
cdtank 2011-04-13 14:23:55 +00:00
parent ae43216396
commit e76fb35492
3 changed files with 30 additions and 8 deletions

View file

@ -71,7 +71,7 @@
--> -->
<entry key="entity_comparison"> <entry key="entity_comparison">
<ref bean="entity_comparison"></ref> <ref bean="pub_temporal"></ref>
</entry> </entry>
@ -84,7 +84,7 @@
</entry> </entry>
<entry key="entity_grant_count"> <entry key="entity_grant_count">
<ref bean="entity_grant_count"></ref> <ref bean="grant_temporal"></ref>
</entry> </entry>
<entry key="grant_temporal"> <entry key="grant_temporal">

View file

@ -30,6 +30,8 @@ $(document).ready(function() {
var selectedDataURL; var selectedDataURL;
var oldParameter = currentParameter;
$.each(COMPARISON_PARAMETERS_INFO, function(index, parameter) { $.each(COMPARISON_PARAMETERS_INFO, function(index, parameter) {
if (parameter.value === selectedValue) { if (parameter.value === selectedValue) {
@ -58,12 +60,30 @@ $(document).ready(function() {
success: function (data) { success: function (data) {
if (data.error) { if (data.error) {
options.bodyContainer.remove(); options.bodyContainer.hide();
/*
* When we reload data we would be reusing the already generated "error container" div.
* So below is used to replace text taht is specific to the errors that would have caused
* due to the original parameters.
* */
var alternateVisInfo = COMPARISON_PARAMETERS_INFO[currentParameter].value
+ " Temporal Graph&nbsp;"
+ '<span id="noPubsOrGrants-span">|&nbsp;'
+ '<a href="' + COMPARISON_PARAMETERS_INFO[oldParameter].viewLink + '">'
+ 'view ' + COMPARISON_PARAMETERS_INFO[oldParameter].pluralName + ' temporal graph</a></span>'
options.errorContainer.find("#alternative-vis-info").html(alternateVisInfo);
options.errorContainer
.find("#comparison-parameter-unavailable-label")
.text(COMPARISON_PARAMETERS_INFO[currentParameter].pluralName);
options.errorContainer.show(); options.errorContainer.show();
options.responseContainer.unblock(); options.responseContainer.unblock();
} else { } else {
options.bodyContainer.show(); options.bodyContainer.show();
options.errorContainer.remove(); options.errorContainer.hide();
temporalGraphProcessor.redoTemporalGraphRenderProcess(graphContainer, data); temporalGraphProcessor.redoTemporalGraphRenderProcess(graphContainer, data);
options.responseContainer.unblock(); options.responseContainer.unblock();
} }
@ -342,12 +362,12 @@ function getTemporalGraphData(temporalGraphDataURL,
success: function (data) { success: function (data) {
if (data.error) { if (data.error) {
graphBodyDIV.remove(); graphBodyDIV.hide();
errorBodyDIV.show(); errorBodyDIV.show();
visContainerDIV.unblock(); visContainerDIV.unblock();
} else { } else {
graphBodyDIV.show(); graphBodyDIV.show();
errorBodyDIV.remove(); errorBodyDIV.hide();
temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, data); temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, data);
visContainerDIV.unblock(); visContainerDIV.unblock();
} }

View file

@ -9,11 +9,13 @@
<h1 id="noPubsOrGrants-header">${organizationLabel}</h1> <h1 id="noPubsOrGrants-header">${organizationLabel}</h1>
<h3>${textForCurrentEntityComparisonType?capitalize} Temporal Graph <h3 id="alternative-vis-info">${textForCurrentEntityComparisonType?capitalize} Temporal Graph
<span id="noPubsOrGrants-span">|&nbsp;<a href="${temporalGraphURL}">view ${textForOtherEntityComparisonType} temporal graph</a></span> <span id="noPubsOrGrants-span">|&nbsp;<a href="${temporalGraphURL}">view ${textForOtherEntityComparisonType} temporal graph</a></span>
</h3> </h3>
<div id="error-body"> <div id="error-body">
<p>This organization has neither sub-organizations nor people with ${textForCurrentEntityComparisonType} in the system. Please visit the full ${organizationLabel} <a href="${organizationVivoProfileURL}">profile page</a> for a more complete overview.</p> <p>This organization has neither sub-organizations nor people with
<span id="comparison-parameter-unavailable-label">${textForCurrentEntityComparisonType}</span> in the system.
Please visit the full ${organizationLabel} <a href="${organizationVivoProfileURL}">profile page</a> for a more complete overview.</p>
</div> </div>
</div> </div>