This is an automated email from the ASF dual-hosted git repository. epugh pushed a commit to branch solr-paramset-impl in repository https://gitbox.apache.org/repos/asf/solr.git
commit a82b1061d7b419f7a172997ad968314152080b18 Author: [email protected] <[email protected]> AuthorDate: Wed Jun 29 07:21:26 2022 -0600 rework the chosen dropdown, now logic working --- .../webapp/web/js/angular/controllers/paramsets.js | 24 +++++++++-------- solr/webapp/web/partials/paramsets.html | 30 +++++++++++----------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/solr/webapp/web/js/angular/controllers/paramsets.js b/solr/webapp/web/js/angular/controllers/paramsets.js index df25b72c094..9486073f18f 100644 --- a/solr/webapp/web/js/angular/controllers/paramsets.js +++ b/solr/webapp/web/js/angular/controllers/paramsets.js @@ -23,7 +23,7 @@ solrAdminApp.controller('ParamSetsController', $scope.resetMenu("paramsets", Constants.IS_COLLECTION_PAGE); - $scope.sampleCommand = { + $scope.sampleAPICommand = { "set": { "myQueries": { "defType": "edismax", @@ -33,13 +33,9 @@ solrAdminApp.controller('ParamSetsController', } } - $scope.showHelp = function (id) { - if ($scope.helpId && ($scope.helpId === id || id === '')) { - delete $scope.helpId; - } else { - $scope.helpId = id; - } - }; + $scope.selectParamset = function() { + $scope.getParamsets(true); + } $scope.getParamsets = function (isSelected) { $scope.refresh(); @@ -59,7 +55,14 @@ solrAdminApp.controller('ParamSetsController', delete success.$resolved; $scope.response = JSON.stringify(success, null, ' '); if (isSelected) { - $scope.selectedParamsetList = success.response.params ? Object.keys(success.response.params) : []; + var apiPayload = { + "set": success.response.params + }; + // remove json key that is defined as "", it can't be submitted via the API. + var paramsetName = Object.keys(apiPayload.set)[0]; + delete apiPayload.set[paramsetName][""] + + $scope.paramsetContent = JSON.stringify(apiPayload, null, ' '); } else { $scope.paramsetList = success.response.params ? Object.keys(success.response.params) : []; } @@ -70,9 +73,10 @@ solrAdminApp.controller('ParamSetsController', } } $scope.getParamsets(); + $scope.refresh = function () { $scope.paramsetContent = ""; - $scope.placeholder = JSON.stringify($scope.sampleCommand, null, ' '); + $scope.placeholder = JSON.stringify($scope.sampleAPICommand, null, ' '); }; $scope.refresh(); diff --git a/solr/webapp/web/partials/paramsets.html b/solr/webapp/web/partials/paramsets.html index b05707adc65..699dbaff032 100644 --- a/solr/webapp/web/partials/paramsets.html +++ b/solr/webapp/web/partials/paramsets.html @@ -20,21 +20,21 @@ <div id="paramsets" class="clearfix"> <div id="form"> <form> + <div id="paramset-name-container"> - <label for="paramsetName"> - <a rel="help">Paramset Name</a> - </label> - <select ng-model="name" - ng-options="item for item in paramsetList" - name="paramsetName" - chosen - style="width:100%" - id="paramsetName" - title="ParamSetName" - data-placeholder="Please select paramset"></select> + + <label for="paramsetName"> + <a rel="help">Paramsets</a> + </label> + <select id="paramsetName" + ng-model="name" + chosen + data-placeholder="Please select ..." + ng-change="selectParamset()" + ng-options="item for item in paramsetList"><option value=""></option></select> + </div> - <button type="submit" ng-click="getParamsets(true)" id="get-paramset">Get Paramset</button> <div> <form> @@ -45,8 +45,8 @@ </label> </form> <div ng-switch="switch.showSample"> - <div ng-switch-when="true"> - <pre class="syntax language-json"><code ng-bind-html="placeholder | highlight:'json' | unsafe"></code></pre> + <div id="sample-paramset" ng-switch-when="true"> + <pre class="syntax language-json"><code ng-bind-html="placeholder | highlight:'json' | unsafe"></code></pre> </div> </div> @@ -56,7 +56,7 @@ <label for="paramset"> Paramset(s) JSON </label> - <textarea ng-model="paramsetContent" name="paramsets" id="paramset" title="The Paramset" rows="10" + <textarea ng-model="paramsetContent" name="paramsets" id="paramset" title="Request Parameters API Payload" rows="10" cols="65"></textarea> <p> <a href="https://solr.apache.org/guide/solr/latest/configuration-guide/request-parameters-api.html" target="_out">syntax help</a>
