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/10/07 14:51:49 UTC

svn commit: r1707282 - in /lucene/dev/trunk/solr/webapp/web: js/angular/controllers/cores.js partials/cores.html

Author: upayavira
Date: Wed Oct  7 12:51:49 2015
New Revision: 1707282

URL: http://svn.apache.org/viewvc?rev=1707282&view=rev
Log:
SOLR-8137 Do not allow swapping with same core in AngularUI

Modified:
    lucene/dev/trunk/solr/webapp/web/js/angular/controllers/cores.js
    lucene/dev/trunk/solr/webapp/web/partials/cores.html

Modified: lucene/dev/trunk/solr/webapp/web/js/angular/controllers/cores.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/angular/controllers/cores.js?rev=1707282&r1=1707281&r2=1707282&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/angular/controllers/cores.js (original)
+++ lucene/dev/trunk/solr/webapp/web/js/angular/controllers/cores.js Wed Oct  7 12:51:49 2015
@@ -23,20 +23,28 @@ solrAdminApp.controller('CoreAdminContro
       $scope.refresh = function() {
         Cores.get(function(data) {
           var coreCount = 0;
-          for (_obj in data.status) coreCount++;
+          var cores = data.status;
+          for (_obj in cores) coreCount++;
           $scope.hasCores = coreCount >0;
           if (!$scope.selectedCore && coreCount==0) {
             $scope.showAddCore();
             return;
           } else if (!$scope.selectedCore) {
-            for (firstCore in data.status) break;
+            for (firstCore in cores) break;
             $scope.selectedCore = firstCore;
             $location.path("/~cores/" + $scope.selectedCore).replace();
           }
-          $scope.core = data.status[$scope.selectedCore];
+          $scope.core = cores[$scope.selectedCore];
           $scope.corelist = [];
-          for (var core in data.status) {
-             $scope.corelist.push(data.status[core]);
+          $scope.otherCorelist = [];
+          for (var core in cores) {
+             $scope.corelist.push(cores[core]);
+            if (cores[core] != $scope.core) {
+              $scope.otherCorelist.push(cores[core]);
+            }
+          }
+          if ($scope.otherCorelist.length>0) {
+            $scope.swapOther = $scope.otherCorelist[0].name;
           }
         });
       };

Modified: lucene/dev/trunk/solr/webapp/web/partials/cores.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/partials/cores.html?rev=1707282&r1=1707281&r2=1707282&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/partials/cores.html (original)
+++ lucene/dev/trunk/solr/webapp/web/partials/cores.html Wed Oct  7 12:51:49 2015
@@ -109,7 +109,7 @@ limitations under the License.
           <input type="text" id="swap_core" name="core" ng-model="selectedCore" readonly="readonly"></p>
 
           <p class="clearfix"><label for="swap_other">and:</label>
-          <select name="other" ng-model="swapOther" ng-options="core.name as core.name for core in corelist" class="other">
+          <select name="other" ng-model="swapOther" ng-options="core.name as core.name for core in otherCorelist" class="other">
           </select></p>
 
           <p class="clearfix note error" ng-show="swapMessage">