You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by up...@apache.org on 2015/09/11 00:33:29 UTC

svn commit: r1702344 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/webapp/ solr/webapp/web/ solr/webapp/web/css/angular/ solr/webapp/web/js/angular/ solr/webapp/web/js/angular/controllers/

Author: upayavira
Date: Thu Sep 10 22:33:29 2015
New Revision: 1702344

URL: http://svn.apache.org/r1702344
Log:
SOLR-7856 sort out exception handling

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/webapp/   (props changed)
    lucene/dev/branches/branch_5x/solr/webapp/web/css/angular/common.css
    lucene/dev/branches/branch_5x/solr/webapp/web/index.html
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/css/angular/common.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/css/angular/common.css?rev=1702344&r1=1702343&r2=1702344&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/css/angular/common.css (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/css/angular/common.css Thu Sep 10 22:33:29 2015
@@ -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;
+}

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/index.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/index.html?rev=1702344&r1=1702343&r2=1702344&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/index.html (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/index.html Thu Sep 10 22:33:29 2015
@@ -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">

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js?rev=1702344&r1=1702343&r2=1702344&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js Thu Sep 10 22:33:29 2015
@@ -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'
             $scope.currentCore = core;
         }
       }
+      $scope.showInitFailures = Object.keys(data.initFailures).length>0;
+      $scope.initFailures = data.initFailures;
     });
 
     System.get(function(data) {

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js?rev=1702344&r1=1702343&r2=1702344&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js Thu Sep 10 22:33:29 2015
@@ -140,17 +140,25 @@ solrAdminApp.controller('CoreAdminContro
       }
 
       $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);
+            }
           });
       };
 

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js?rev=1702344&r1=1702343&r2=1702344&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js Thu Sep 10 22:33:29 2015
@@ -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:{}}
     });
   }])