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/07/12 23:44:23 UTC

svn commit: r1690538 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/webapp/ solr/webapp/web/js/angular/controllers/cores.js solr/webapp/web/partials/cores.html

Author: upayavira
Date: Sun Jul 12 21:44:23 2015
New Revision: 1690538

URL: http://svn.apache.org/r1690538
Log:
SOLR-7783 - AngularUI core admin optimize fixes

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/js/angular/controllers/cores.js
    lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html

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=1690538&r1=1690537&r2=1690538&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 Sun Jul 12 21:44:23 2015
@@ -17,14 +17,13 @@
 
 // @todo test optimize (delete stuff, watch button appear, test button/form)
 solrAdminApp.controller('CoreAdminController',
-  ['$scope', '$routeParams', '$location', '$timeout', 'Cores',
-    function($scope, $routeParams, $location, $timeout, Cores){
+  ['$scope', '$routeParams', '$location', '$timeout', 'Cores', 'Update',
+    function($scope, $routeParams, $location, $timeout, Cores, Update){
       $scope.resetMenu("cores");
       $scope.currentCore = $routeParams.core;
       $scope.refresh = function() {
         Cores.get(function(data) {
           var coreCount = 0;
-          // @todo mark 'current' core in navigation with 'current' style
           for (_obj in data.status) coreCount++;
           $scope.hasCores = coreCount >0;
           if (!$scope.currentCore && coreCount==0) {
@@ -165,6 +164,17 @@ solrAdminApp.controller('CoreAdminContro
       };
 
       $scope.optimizeCore = function() {
+        Update.optimize({core: $scope.currentCore},
+          function(successData) {
+            $scope.optimizeSuccess = true;
+            $timeout(function() {$scope.optimizeSuccess=false}, 1000);
+            $scope.refresh();
+          },
+          function(failureData) {
+            $scope.optimizeFailure = true;
+            $timeout(function () {$scope.optimizeFailure=false}, 1000);
+            $scope.refresh();
+          });
       };
 
       $scope.refresh();

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html?rev=1690538&r1=1690537&r2=1690538&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html Sun Jul 12 21:44:23 2015
@@ -29,7 +29,8 @@ limitations under the License.
       <button id="swap" class="action requires-core" ng-click="showSwapCores()"><span>Swap</span></button>
       <button id="reload" class="requires-core" ng-click="reloadCore()"
          ng-class="{success: reloadSuccess, warn: reloadFailure}"><span>Reload</span></button>
-      <button id="optimize" class="requires-core" ng-click="optimizeCore()" ng-show="core.hasDeletions"><span>Optimize</span></button>
+      <button id="optimize" class="requires-core" ng-click="optimizeCore()" ng-show="core.index.hasDeletions || optimizeSuccess"
+         ng-class="{success: optimizeSuccess, warn: optimizeFailure}"><span>Optimize</span></button>
       </span>
       <div class="action add" data-rel="add" ng-show="showAdd" style="display:block;left:0px;">
 
@@ -199,7 +200,7 @@ limitations under the License.
 
             <li class="optimized"><dl class="clearfix">
               <dt><span>optimized:</span></dt>
-                <dd class="ico" ng-class="core.index.hasDeletions ? 'ico-1' : 'ico-0'"><span></span></dd>
+                <dd class="ico" ng-class="core.index.hasDeletions ? 'ico-0' : 'ico-1'"><span></span></dd>
             </dl></li>
 
             <li class="current"><dl class="clearfix">