SOLR-7856 sort out exception handling

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1702343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Upayavira 2015-09-10 22:32:46 +00:00
parent c3a19e0979
commit ba44c41918
5 changed files with 61 additions and 20 deletions

View File

@ -352,6 +352,18 @@ ul
display: none; display: none;
} }
.exception
{
background-color: #f00;
background-image: url( ../../img/ico/construction.png );
background-position: 10px 50%;
color: #fff;
font-weight: bold;
margin-bottom: 20px;
padding: 10px;
padding-left: 35px;
}
#content-wrapper #content-wrapper
{ {
margin-left: 150px; margin-left: 150px;
@ -722,3 +734,16 @@ pre.syntax .tex .formula
-webkit-box-shadow: 1px 1px 0 #d8d8d8; -webkit-box-shadow: 1px 1px 0 #d8d8d8;
color: #333; color: #333;
} }
.exception .show-exception {
margin-top: 4px;
display: block;
position: absolute;
right: 10px;
top: 7px;
color: #fff;
}
#exception .show-exception a:hover {
color: #333;
}

View File

@ -90,10 +90,12 @@ limitations under the License.
<div id="main" class="clearfix"> <div id="main" class="clearfix">
<div class="header-message" id="init-failures" ng-show="initFailures"> <div class="header-message" id="init-failures" ng-show="showInitFailures">
<h2>SolrCore Initialization Failures</h2> <h2>SolrCore Initialization Failures</h2>
<ul></ul> <ul>
<li ng-repeat="(core,error) in initFailures"><strong>{{core}}:</strong> {{error}}</li>
</ul>
<p>Please check your logs for more information</p> <p>Please check your logs for more information</p>
</div> </div>
@ -113,11 +115,8 @@ limitations under the License.
<p>Continuing to load data...</p> <p>Continuing to load data...</p>
</div> </div>
</div> </div>
<div id="http-exception" class="header-message" ng-repeat="(url, exception) in exceptions">
<div id="http-exception" class="header-message" ng-show="exception"> <div class="exception">{{exception.msg}}</div>
<h2>Exception</h2>
<p>{{exception}}</p>
<a ng-click="hideException()">hide exception</a>
</div> </div>
<div id="content-wrapper"> <div id="content-wrapper">

View File

@ -265,6 +265,9 @@ solrAdminApp.config([
if (activeRequests == 0) { if (activeRequests == 0) {
$rootScope.$broadcast('loadingStatusActive'); $rootScope.$broadcast('loadingStatusActive');
} }
if ($rootScope.exceptions[config.url]) {
delete $rootScope.exceptions[config.url];
}
activeRequests++; activeRequests++;
config.timeout = 10000; config.timeout = 10000;
return config || $q.when(config); return config || $q.when(config);
@ -302,7 +305,7 @@ solrAdminApp.config([
var result = $http(rejection.config); var result = $http(rejection.config);
return result; return result;
} else { } else {
$rootScope.exception = rejection; $rootScope.exceptions[rejection.config.url] = rejection.data.error;
} }
return $q.reject(rejection); return $q.reject(rejection);
} }
@ -330,7 +333,11 @@ solrAdminApp.config([
solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $location, Cores, Collections, System, Ping, Constants) { solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $location, Cores, Collections, System, Ping, Constants) {
$rootScope.hideException = function() {delete $rootScope.exception}; $rootScope.exceptions={};
$rootScope.toggleException = function() {
$scope.showException=!$scope.showException;
};
$scope.refresh = function() { $scope.refresh = function() {
$scope.cores = []; $scope.cores = [];
@ -350,6 +357,8 @@ solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $
$scope.currentCore = core; $scope.currentCore = core;
} }
} }
$scope.showInitFailures = Object.keys(data.initFailures).length>0;
$scope.initFailures = data.initFailures;
}); });
System.get(function(data) { System.get(function(data) {

View File

@ -140,17 +140,25 @@ solrAdminApp.controller('CoreAdminController',
} }
$scope.reloadCore = function() { $scope.reloadCore = function() {
if ($scope.initFailures[$scope.selectedCore]) {
delete $scope.initFailures[$scope.selectedCore];
$scope.showInitFailures = Object.keys(data.initFailures).length>0;
}
Cores.reload({core: $scope.selectedCore}, Cores.reload({core: $scope.selectedCore},
function(successData) { function(data) {
$scope.reloadSuccess = true; if (data.error) {
$timeout(function() {$scope.reloadSuccess=false}, 1000); $scope.reloadFailure = true;
}, $timeout(function() {
function(failureData) { $scope.reloadFailure = false;
$scope.reloadFailure = true; $route.reload();
$timeout(function() {$scope.reloadFailure=false}, 1000); }, 1000);
$scope.selectedCore = null; } else {
$scope.refresh(); $scope.reloadSuccess = true;
$location.path("/~cores"); $timeout(function () {
$scope.reloadSuccess = false;
$route.reload();
}, 1000);
}
}); });
}; };

View File

@ -31,7 +31,7 @@ solrAdminServices.factory('System',
"unload": {params:{action: "UNLOAD", core: "@core"}}, "unload": {params:{action: "UNLOAD", core: "@core"}},
"rename": {params:{action: "RENAME"}}, "rename": {params:{action: "RENAME"}},
"swap": {params:{}}, "swap": {params:{}},
"reload": {method: "GET", params:{action:"RELOAD", core: "@core"}}, "reload": {method: "GET", params:{action:"RELOAD", core: "@core", doNotIntercept: "true"}},
"optimize": {params:{}} "optimize": {params:{}}
}); });
}]) }])