From a05b7620128fdc755b2804d4b7467aaa3bd83865 Mon Sep 17 00:00:00 2001 From: Abhinav Dangeti Date: Mon, 28 Feb 2022 14:18:25 -0700 Subject: [PATCH] MB-51251: Set UI element `numPIndexes` correctly + Use indexPartitions if available, check maxPartitionsPerPIndex otherwise .. because indexPartitions takes precedence over maxPartitionsPerPIndex. + Set numPIndexes to 1 if neither of the two settings are available, and this will work alongside .. https://review.couchbase.org/c/ns_server/+/171539 Change-Id: If41429c7ae98e329cd46666523b2b74031cc740b Reviewed-on: https://review.couchbase.org/c/cbft/+/171543 Well-Formed: Build Bot Reviewed-by: Reviewed-by: Sreekanth Sivasankaran Tested-by: Abhinav Dangeti --- ns_server_static/fts/static/util.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ns_server_static/fts/static/util.js b/ns_server_static/fts/static/util.js index 62215725..42077117 100644 --- a/ns_server_static/fts/static/util.js +++ b/ns_server_static/fts/static/util.js @@ -134,11 +134,9 @@ function blevePIndexInitController(initKind, indexParams, indexUI, if (angular.isDefined(newPlanParamsObj["indexPartitions"])) { $scope.numPIndexes = newPlanParamsObj["indexPartitions"]; - } - if ($scope.numPIndexes == 0) { - // Initialize maxPartitionsPerPIndex to the vbucket count; - // and indexPartitions to 1. - var maxPartitionsPerPIndex = $scope.vbuckets; + } else if (angular.isDefined(newPlanParamsObj["maxPartitionsPerPIndex"])) { + $scope.numPIndexes = Math.ceil($scope.vbuckets/newPlanParamsObj["maxPartitionsPerPIndex"]); + } else { $scope.numPIndexes = 1; } } catch (e) {