Permalink
Browse files

issue41: add support for movePrimary cmd

  • Loading branch information...
1 parent 6745df2 commit 8e25513734fe0e1867d5f6d813508039efd4bc27 @agirbal committed Nov 16, 2011
Showing with 16 additions and 0 deletions.
  1. +5 −0 resource/xml/JMongoBrowser.xml
  2. +11 −0 src/org/mongo/jmongob/DbPanel.java
@@ -200,6 +200,11 @@
</Menu>
<Menu id="sharding">
<MenuItem id="enableSharding" call="enableSharding"/>
+ <MenuItem id="movePrimary" call="movePrimary">
+ <FormDialog>
+ <TextField id="mvpToShard" label="To Shard" nonEmpty="true" toolTipText="Name of the new primary shard for this database"/>
+ </FormDialog>
+ </MenuItem>
<MenuItem id="shardingInfo" call="shardingInfo"/>
</Menu>
<Menu id="GridFS" label="GridFS">
@@ -72,6 +72,8 @@
createCollCount,
createCollAutoIndex,
enableSharding,
+ movePrimary,
+ mvpToShard,
shardingInfo,
profile,
profileLevel,
@@ -466,6 +468,15 @@ public void shardingInfo() {
final DBCollection col = config.getCollection("databases");
CollectionPanel.doFind(col, new BasicDBObject("_id", db.getName()), null, null, 0, 0, 0, false);
}
+
+ public void movePrimary() {
+ Mongo m = getDbNode().getMongoNode().getMongo();
+ DB admin = m.getDB("admin");
+ String shard = getStringFieldValue(Item.mvpToShard);
+ DBObject cmd = new BasicDBObject("movePrimary", getDbNode().getDb().getName());
+ cmd.put("to", shard);
+ new DocView(id, "Move Primary", admin, cmd, null, this, null).addToTabbedDiv();
+ }
public void findJSFunction() {
final DB db = getDbNode().getDb();

0 comments on commit 8e25513

Please sign in to comment.