Apache Solr open-source search software
SOLR-14319: specify replica types in UI when creating a collection (#958)
Eric Pughad031d687493
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 39609fccd93..3e96a905694 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -41,7 +41,9 @@ New Features* SOLR-15853: Admin UI support for managing Paramsets and using in Queries. (Betul Ince, Eric Pugh)-* SOLR-16096: Support createNodeSet parameter when creating collecitons in Admin UI. (Eric Pugh)+* SOLR-16096: Support createNodeSet parameter when creating collections in Admin UI. (Eric Pugh)++* SOLR-14319: Add ability to specify replica types when creating collections in Admin UI. (Richard Goodman, Eric Pugh)Improvementsdiff --git a/solr/webapp/web/css/angular/collections.css b/solr/webapp/web/css/angular/collections.cssindex f6ddd052649..880a76d4c60 100644--- a/solr/webapp/web/css/angular/collections.css+++ b/solr/webapp/web/css/angular/collections.css@@ -380,3 +380,12 @@ limitations under the License.float: left;width: 65%;}++.replication-factor {+ /* some style when the element is active */+}++.replication-factor[disabled] {+ /* styles when the element is disabled */+ color: #c0c0c0;+}diff --git a/solr/webapp/web/js/angular/controllers/collections.js b/solr/webapp/web/js/angular/controllers/collections.jsindex b9187736adc..be24620abf0 100644--- a/solr/webapp/web/js/angular/controllers/collections.js+++ b/solr/webapp/web/js/angular/controllers/collections.js@@ -112,6 +112,9 @@ solrAdminApp.controller('CollectionsController',routerName: "compositeId",numShards: 1,configName: "",+ nrtReplicas: 0,+ tlogReplicas: 0,+ pullReplicas: 0,replicationFactor: 1};};@@ -154,18 +157,27 @@ solrAdminApp.controller('CollectionsController',$scope.addMessage = "Please provide a core name";} else if (false) { //@todo detect whether core exists$scope.AddMessage = "A core with that name already exists";+ } else if ( $scope.newCollection.pullReplicas > 0 && ($scope.newCollection.nrtReplicas + $scope.newCollection.tlogReplicas == 0))+ {+ $scope.addMessage = "A collection can't be made up of just PULL replicas";} else {var coll = $scope.newCollection;var params = {- name: coll.name,- "router.name": coll.routerName,- numShards: coll.numShards,- "collection.configName": coll.configName,- replicationFactor: coll.replicationFactor+ name: coll.name,+ "router.name": coll.routerName,+ numShards: coll.numShards,+ "collection.configName": coll.configName};if (coll.shards) params.shards = coll.shards;if (coll.routerField) params["router.field"] = coll.routerField;if (coll.createNodeSet) params.createNodeSet = coll.createNodeSet.join(",");+ if ($scope.replicaTypesChosen()) {+ params["nrtReplicas"] = coll.nrtReplicas;+ params["tlogReplicas"] = coll.tlogReplicas;+ params["pullReplicas"] = coll.pullReplicas;+ } else {+ params["replicationFactor"] = coll.replicationFactor;+ }Collections.add(params, function(data) {$scope.cancelAddCollection();$scope.resetMenu("collections", Constants.IS_ROOT_PAGE);@@ -283,6 +295,12 @@ solrAdminApp.controller('CollectionsController',replica.show = !replica.show;}+ $scope.replicaTypesChosen = function () {+ if ($scope.newCollection) {+ return ( $scope.newCollection.nrtReplicas + $scope.newCollection.tlogReplicas + $scope.newCollection.pullReplicas > 0 );+ }+ }+$scope.refresh();});diff --git a/solr/webapp/web/partials/collections.html b/solr/webapp/web/partials/collections.htmlindex 1fc2029a246..3f924d31055 100644--- a/solr/webapp/web/partials/collections.html+++ b/solr/webapp/web/partials/collections.html@@ -34,8 +34,13 @@ limitations under the License.<p class="clearfix"><label for="add_numShards">numShards:</label><input type="text" name="numShards" id="add_numShards" ng-model="newCollection.numShards"></p>- <p class="clearfix"><label for="add_replicationFactor">replicationFactor:</label>- <input type="text" name="replicationFactor" id="add_replicationFactor" ng-model="newCollection.replicationFactor"></p>+ <p class="clearfix replication-factor" ng-disabled="replicaTypesChosen()"><label for="add_replicationFactor">replicationFactor:</label>+ <input type="text" name="replicationFactor" id="add_replicationFactor"+ ng-model="newCollection.replicationFactor"+ ng-disabled="replicaTypesChosen()"+ class="replication-factor"+ >+ </p><p class="clearfix"><a ng-click="showAdvanced=!showAdvanced"><span id="add_advanced" ng-class="{open: showAdvanced}">Show advanced</span></a></p>@@ -65,6 +70,14 @@ limitations under the License.</select></p>+ <p>Replica Types: </p>+ <p class="clearfix"><Label for="add_nrtReplicas">nrt replicas:</Label>+ <input type="text" name="nrtReplicas" id="add_nrtReplicas" ng-model="newCollection.nrtReplicas"></p>+ <p class="clearfix"><Label for="add_tlogReplicas">tlog replicas:</Label>+ <input type="text" name="tlogReplicas" id="add_tlogReplicas" ng-model="newCollection.tlogReplicas"></p>+ <p class="clearfix"><Label for="add_pullReplicas">pull replicas:</Label>+ <input type="text" name="pullReplicas" id="add_pullReplicas" ng-model="newCollection.pullReplicas"></p>+</div><p class="clearfix note error" ng-show="addMessage"><span>{{addMessage}}</span>