Apache Solr open-source search software
SOLR-7856 sort out exception handling
Upayaviraba44c41918c0
diff --git a/solr/webapp/web/css/angular/common.css b/solr/webapp/web/css/angular/common.cssindex 9cc7a18957e..4bdd4bbadd3 100644--- a/solr/webapp/web/css/angular/common.css+++ b/solr/webapp/web/css/angular/common.css@@ -352,6 +352,18 @@ uldisplay: 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;+}diff --git a/solr/webapp/web/index.html b/solr/webapp/web/index.htmlindex 7a44b56a634..1184828d445 100644--- a/solr/webapp/web/index.html+++ b/solr/webapp/web/index.html@@ -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">diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.jsindex 7882289baa6..fbb487bd92b 100644--- a/solr/webapp/web/js/angular/app.js+++ b/solr/webapp/web/js/angular/app.js@@ -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) {diff --git a/solr/webapp/web/js/angular/controllers/cores.js b/solr/webapp/web/js/angular/controllers/cores.jsindex 5dc2d72196e..36765ade0eb 100644--- a/solr/webapp/web/js/angular/controllers/cores.js+++ b/solr/webapp/web/js/angular/controllers/cores.js@@ -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);+ }});};diff --git a/solr/webapp/web/js/angular/services.js b/solr/webapp/web/js/angular/services.jsindex 4498912b079..9789b642e4b 100644--- a/solr/webapp/web/js/angular/services.js+++ b/solr/webapp/web/js/angular/services.js@@ -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:{}}});}])