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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1429254 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Matheis 2013-01-05 10:50:24 +00:00
parent 01d27847bf
commit 449296da9d
4 changed files with 49 additions and 17 deletions

View File

@ -218,6 +218,8 @@ Optimizations
* SOLR-4262: Replication Icon on Dashboard does not reflect Master-/Slave- * SOLR-4262: Replication Icon on Dashboard does not reflect Master-/Slave-
State (steffkes) State (steffkes)
* SOLR-4264: Missing Error-Screen on UI's Cloud-Page (steffkes)
Bug Fixes Bug Fixes
---------------------- ----------------------

View File

@ -18,7 +18,7 @@
{ {
background-color: #f00; background-color: #f00;
background-image: url( ../../img/ico/construction.png ); background-image: url( ../../img/ico/construction.png );
background-position: 10px 50%; background-position: 10px 12px;
color: #fff; color: #fff;
font-weight: bold; font-weight: bold;
margin-bottom: 20px; margin-bottom: 20px;
@ -26,6 +26,13 @@
padding-left: 35px; padding-left: 35px;
} }
#content #cloud #error .msg
{
font-style: italic;
font-weight: normal;
margin-top: 10px;
}
#content #cloud #debug #content #cloud #debug
{ {
background-color: #fff; background-color: #fff;

View File

@ -9359,7 +9359,9 @@ jQuery.extend({
} }
done( 0, statusText ); done( 0, statusText );
return this; return this;
} },
url : s.url
}; };
// Callback for when everything is done // Callback for when everything is done

View File

@ -15,6 +15,27 @@
limitations under the License. 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 init_debug = function( cloud_element )
{ {
var debug_element = $( '#debug', 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 ) error : zk_error,
{
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>' );
},
complete : function( xhr, text_status ) complete : function( xhr, text_status )
{ {
} }
@ -710,8 +719,20 @@ sammy.get
} }
); );
$( 'a[href="' + context.path + '"]', navigation_element ) $.ajax
.trigger( 'activate' ); (
{
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
}
);
} }
); );