Apache Solr open-source search software
SOLR-8137 Do not allow swapping with same core in AngularUI
Upayavirac7deed16f00d
diff --git a/solr/webapp/web/js/angular/controllers/cores.js b/solr/webapp/web/js/angular/controllers/cores.jsindex 36765ade0eb..58ae19950e7 100644--- a/solr/webapp/web/js/angular/controllers/cores.js+++ b/solr/webapp/web/js/angular/controllers/cores.js@@ -23,20 +23,28 @@ solrAdminApp.controller('CoreAdminController',$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;}});};diff --git a/solr/webapp/web/partials/cores.html b/solr/webapp/web/partials/cores.htmlindex 7e41540f719..a605006f79d 100644--- a/solr/webapp/web/partials/cores.html+++ b/solr/webapp/web/partials/cores.html@@ -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">