SOLR-8137 Do not allow swapping with same core in AngularUI

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1707282 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Upayavira 2015-10-07 12:51:49 +00:00
parent 2bd051c8de
commit c7deed16f0
2 changed files with 14 additions and 6 deletions

View File

@ -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;
}
});
};

View File

@ -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">