Apache Solr open-source search software
SOLR-10146: Added button to the Admin UI 'Collection' tab for deleting an inactive shard
Jan Høydahlb2dcb47ef44a
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex ea56cbb461c..bb5a784deda 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -149,6 +149,8 @@ New Features* SOLR-8593: Integrate Apache Calcite into the SQLHandler (Kevin Risden, Cao Manh Dat, Joel Bernstein)+* SOLR-10146: Added button to the Admin UI 'Collection' tab for deleting an inactive shard (Amrit Sarkar, janhoy)+Bug Fixes----------------------diff --git a/solr/webapp/web/css/angular/collections.css b/solr/webapp/web/css/angular/collections.cssindex 7c2e0a697b8..e4b61bc257d 100644--- a/solr/webapp/web/css/angular/collections.css+++ b/solr/webapp/web/css/angular/collections.css@@ -311,6 +311,14 @@ limitations under the License.right:10px;}+#content #collections .shard h2 span.rem {+ background-image: url( ../../img/ico/cross.png );+ background-position: 100% 50%;+ cursor: pointer;+ padding-right: 21px;+ right:10px;+}+#content #collections .replica h2 span .open {background-image: url( ../../img/ico/chevron-small.png );}@@ -337,6 +345,15 @@ limitations under the License.background-image: url( ../../img/ico/tick.png );}+#content #collections .delete-shard span+{+ background-image: url( ../../img/ico/cross.png );+}+#content #collections .delete-shard button.submit span+{+ background-image: url( ../../img/ico/tick.png );+}+#content #collections #node-name .chosen-container{width: 100% !important;diff --git a/solr/webapp/web/js/angular/controllers/collections.js b/solr/webapp/web/js/angular/controllers/collections.jsindex 2bd6ab601ba..22c5e7f8747 100644--- a/solr/webapp/web/js/angular/controllers/collections.js+++ b/solr/webapp/web/js/angular/controllers/collections.js@@ -210,6 +210,20 @@ solrAdminApp.controller('CollectionsController',$scope.hideAll();replica.showRemove = !replica.showRemove;};++ $scope.toggleRemoveShard = function(shard) {+ $scope.hideAll();+ shard.showRemove = !shard.showRemove;+ };++ $scope.deleteShard = function(shard) {+ Collections.deleteShard({collection: shard.collection, shard:shard.name}, function(data) {+ shard.deleted = true;+ $timeout(function() {+ $scope.refresh();+ }, 2000);+ });+ }$scope.deleteReplica = function(replica) {Collections.deleteReplica({collection: replica.collection, shard:replica.shard, replica:replica.name}, function(data) {diff --git a/solr/webapp/web/js/angular/services.js b/solr/webapp/web/js/angular/services.jsindex 07043c36a78..a1df37e1622 100644--- a/solr/webapp/web/js/angular/services.js+++ b/solr/webapp/web/js/angular/services.js@@ -34,6 +34,7 @@ solrAdminServices.factory('System',"deleteAlias": {params:{action: "DELETEALIAS"}},"deleteReplica": {params:{action: "DELETEREPLICA"}},"addReplica": {params:{action: "ADDREPLICA"}},+ "deleteShard": {params:{action: "DELETESHARD"}},"reload": {method: "GET", params:{action:"RELOAD", core: "@core"}},"optimize": {params:{}}});diff --git a/solr/webapp/web/partials/collections.html b/solr/webapp/web/partials/collections.htmlindex 9797b9030f6..2ac12dec019 100644--- a/solr/webapp/web/partials/collections.html+++ b/solr/webapp/web/partials/collections.html@@ -215,7 +215,23 @@ limitations under the License.<div class="block" id="shard-data"><div class="content shard" ng-repeat="shard in collection.shards">- <a ng-click="toggleShard(shard)"><h2><span ng-class="{open:shard.show}">Shard: {{shard.name}}</span></h2></a>+ <a ng-click="toggleShard(shard)">+ <h2>+ <span ng-class="{open:shard.show}"><b>Shard: {{shard.name}}</b></span>+ <div style="float:right" ng-show="!shard.range || shard.state == 'inactive'"><a ng-click="toggleRemoveShard(shard)"><span class="rem"></span></a></div>+ </h2>+ </a>+ <ul ng-show="shard.showRemove">+ <li>+ <form class="delete-shard">+ <p class="clearfix"><em>Are you sure you want to delete this shard?</em></p>+ <p class="clearfix buttons">+ <button class="submit" ng-class="{success: shard.deleted}" ng-click="deleteShard(shard)"><span>Delete Shard</span></button>+ <button type="reset" class="reset" ng-click="toggleRemoveShard(shard)"><span>Cancel</span></button>+ </p>+ </form>+ </li>+ </ul><ul ng-show="shard.show"><li><ul>