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;
}
.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
{
margin-left: 150px;
@ -722,3 +734,16 @@ pre.syntax .tex .formula
-webkit-box-shadow: 1px 1px 0 #d8d8d8;
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 class="header-message" id="init-failures" ng-show="initFailures">
<div class="header-message" id="init-failures" ng-show="showInitFailures">
<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>
</div>
@ -113,11 +115,8 @@ limitations under the License.
<p>Continuing to load data...</p>
</div>
</div>
<div id="http-exception" class="header-message" ng-show="exception">
<h2>Exception</h2>
<p>{{exception}}</p>
<a ng-click="hideException()">hide exception</a>
<div id="http-exception" class="header-message" ng-repeat="(url, exception) in exceptions">
<div class="exception">{{exception.msg}}</div>
</div>
<div id="content-wrapper">

View File

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

View File

@ -140,17 +140,25 @@ solrAdminApp.controller('CoreAdminController',
}
$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},
function(successData) {
$scope.reloadSuccess = true;
$timeout(function() {$scope.reloadSuccess=false}, 1000);
},
function(failureData) {
$scope.reloadFailure = true;
$timeout(function() {$scope.reloadFailure=false}, 1000);
$scope.selectedCore = null;
$scope.refresh();
$location.path("/~cores");
function(data) {
if (data.error) {
$scope.reloadFailure = true;
$timeout(function() {
$scope.reloadFailure = false;
$route.reload();
}, 1000);
} else {
$scope.reloadSuccess = true;
$timeout(function () {
$scope.reloadSuccess = false;
$route.reload();
}, 1000);
}
});
};

View File

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