You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/03/06 11:02:15 UTC

[11/15] lucene-solr:feature/autoscaling: SOLR-10146: Added button to the Admin UI 'Collection' tab for deleting an inactive shard

SOLR-10146: Added button to the Admin UI 'Collection' tab for deleting an inactive shard


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b2dcb47e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b2dcb47e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b2dcb47e

Branch: refs/heads/feature/autoscaling
Commit: b2dcb47ef44a814c670b5cf2a53c0d6c52810d84
Parents: 59433bb
Author: Jan H�ydahl <ja...@apache.org>
Authored: Sun Mar 5 00:04:49 2017 +0100
Committer: Jan H�ydahl <ja...@apache.org>
Committed: Sun Mar 5 00:04:49 2017 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                  |  2 ++
 solr/webapp/web/css/angular/collections.css       | 17 +++++++++++++++++
 .../web/js/angular/controllers/collections.js     | 14 ++++++++++++++
 solr/webapp/web/js/angular/services.js            |  1 +
 solr/webapp/web/partials/collections.html         | 18 +++++++++++++++++-
 5 files changed, 51 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b2dcb47e/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index ea56cbb..bb5a784 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
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b2dcb47e/solr/webapp/web/css/angular/collections.css
----------------------------------------------------------------------
diff --git a/solr/webapp/web/css/angular/collections.css b/solr/webapp/web/css/angular/collections.css
index 7c2e0a6..e4b61bc 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;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b2dcb47e/solr/webapp/web/js/angular/controllers/collections.js
----------------------------------------------------------------------
diff --git a/solr/webapp/web/js/angular/controllers/collections.js b/solr/webapp/web/js/angular/controllers/collections.js
index 2bd6ab6..22c5e7f 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) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b2dcb47e/solr/webapp/web/js/angular/services.js
----------------------------------------------------------------------
diff --git a/solr/webapp/web/js/angular/services.js b/solr/webapp/web/js/angular/services.js
index 07043c3..a1df37e 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:{}}
     });

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b2dcb47e/solr/webapp/web/partials/collections.html
----------------------------------------------------------------------
diff --git a/solr/webapp/web/partials/collections.html b/solr/webapp/web/partials/collections.html
index 9797b90..2ac12de 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>