You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2022/08/02 12:55:45 UTC
[solr] branch branch_9x updated: SOLR-14319: specify replica types in UI when creating a collection (#958)
This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 60bc5dc1c64 SOLR-14319: specify replica types in UI when creating a collection (#958)
60bc5dc1c64 is described below
commit 60bc5dc1c64781a4698d196d24ba778186632a4d
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Tue Aug 2 08:54:39 2022 -0400
SOLR-14319: specify replica types in UI when creating a collection (#958)
---
solr/CHANGES.txt | 4 +++-
solr/webapp/web/css/angular/collections.css | 9 +++++++
.../web/js/angular/controllers/collections.js | 28 ++++++++++++++++++----
solr/webapp/web/partials/collections.html | 17 +++++++++++--
4 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index eaa4d70bdef..ebf22e12d76 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -19,7 +19,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)
Improvements
diff --git a/solr/webapp/web/css/angular/collections.css b/solr/webapp/web/css/angular/collections.css
index 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.js
index 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.html
index 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>