Skip to content

Apache Lucene open-source search software

SOLR-4264: Missing Error-Screen on UI's Cloud-Page

Stefan Matheis449296da9df7
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e09b3b10892..b22ac3cdeae 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -218,6 +218,8 @@ Optimizations
* SOLR-4262: Replication Icon on Dashboard does not reflect Master-/Slave-
State (steffkes)
+* SOLR-4264: Missing Error-Screen on UI's Cloud-Page (steffkes)
+
Bug Fixes
----------------------
diff --git a/solr/webapp/web/css/styles/cloud.css b/solr/webapp/web/css/styles/cloud.css
index ef0c963045a..b3708576da2 100644
--- a/solr/webapp/web/css/styles/cloud.css
+++ b/solr/webapp/web/css/styles/cloud.css
@@ -18,7 +18,7 @@
{
background-color: #f00;
background-image: url( ../../img/ico/construction.png );
- background-position: 10px 50%;
+ background-position: 10px 12px;
color: #fff;
font-weight: bold;
margin-bottom: 20px;
@@ -26,6 +26,13 @@
padding-left: 35px;
}
+#content #cloud #error .msg
+{
+ font-style: italic;
+ font-weight: normal;
+ margin-top: 10px;
+}
+
#content #cloud #debug
{
background-color: #fff;
diff --git a/solr/webapp/web/js/require.js b/solr/webapp/web/js/require.js
index ff858849258..1846b2efcd4 100644
--- a/solr/webapp/web/js/require.js
+++ b/solr/webapp/web/js/require.js
@@ -9359,7 +9359,9 @@ jQuery.extend({
}
done( 0, statusText );
return this;
- }
+ },
+
+ url : s.url
};
// Callback for when everything is done
diff --git a/solr/webapp/web/js/scripts/cloud.js b/solr/webapp/web/js/scripts/cloud.js
index 5a3083be632..dc4420c59bc 100644
--- a/solr/webapp/web/js/scripts/cloud.js
+++ b/solr/webapp/web/js/scripts/cloud.js
@@ -15,6 +15,27 @@
limitations under the License.
*/
+var zk_error = function zk_error( xhr, text_status, error_thrown )
+{
+ var zk = null;
+ try
+ {
+ eval( 'zk = ' + xhr.responseText + ';' );
+ }
+ catch( e ) {}
+
+ var message = '<p class="txt">Loading of "<code>' + xhr.url + '</code>" '
+ + 'failed (HTTP-Status <code>' + xhr.status + '</code>)</p>' + "\n";
+
+ if( zk.error )
+ {
+ message += '<p class="msg">"' + zk.error.esc() + '"</p>' + "\n";
+ }
+
+ this.closest( '#cloud' )
+ .html( '<div class="block" id="error">' + message + '</div>' );
+};
+
var init_debug = function( cloud_element )
{
var debug_element = $( '#debug', cloud_element );
@@ -633,19 +654,7 @@ var init_tree = function( tree_element )
}
);
},
- error : function( xhr, text_status, error_thrown )
- {
- var message = 'Loading of <code>' + app.config.zookeeper_path + '</code> failed with "' + text_status + '" '
- + '(<code>' + error_thrown.message + '</code>)';
-
- if( 200 !== xhr.status )
- {
- message = 'Loading of <code>' + app.config.zookeeper_path + '</code> failed with HTTP-Status ' + xhr.status + ' ';
- }
-
- this
- .html( '<div class="block" id="error">' + message + '</div>' );
- },
+ error : zk_error,
complete : function( xhr, text_status )
{
}
@@ -710,8 +719,20 @@ sammy.get
}
);
- $( 'a[href="' + context.path + '"]', navigation_element )
- .trigger( 'activate' );
+ $.ajax
+ (
+ {
+ url : app.config.solr_path + '/zookeeper?wt=json',
+ dataType : 'json',
+ context : cloud_element,
+ success : function( response, text_status, xhr )
+ {
+ $( 'a[href="' + context.path + '"]', navigation_element )
+ .trigger( 'activate' );
+ },
+ error : zk_error
+ }
+ );
}
);