@@ -127,7 +127,7 @@ function Cluster() {
127
127
stop : instance_dragStop ,
128
128
} ;
129
129
130
- if ( nodesMap [ draggedNodeId ] . lastCheckInvalidProblem ( ) || nodesMap [ draggedNodeId ] . notRecentlyCheckedProblem ( ) || nodesMap [ draggedNodeId ] . isAggregate ) {
130
+ if ( nodesMap [ draggedNodeId ] . lastCheckInvalidProblem ( ) || nodesMap [ draggedNodeId ] . notRecentlyCheckedProblem ( ) ) {
131
131
instanceEl . find ( "h3" ) . click ( function ( ) {
132
132
openNodeModal ( nodesMap [ draggedNodeId ] ) ;
133
133
return false ;
@@ -343,6 +343,12 @@ function Cluster() {
343
343
// Wrong direction!
344
344
return { accept : false } ;
345
345
}
346
+ if ( node . isAggregate ) {
347
+ if ( shouldApply ) {
348
+ relocateSlaves ( node . masterNode , droppableNode , node . aggregatedInstancesPattern ) ;
349
+ }
350
+ return { accept : "warning" , type : "relocate [" + node . aggregatedInstances . length + "] < " + droppableTitle } ;
351
+ }
346
352
// the general case
347
353
if ( shouldApply ) {
348
354
relocate ( node , droppableNode ) ;
@@ -647,7 +653,8 @@ function Cluster() {
647
653
return executeMoveOperation ( message , apiUrl ) ;
648
654
}
649
655
650
- function relocateSlaves ( node , siblingNode ) {
656
+ function relocateSlaves ( node , siblingNode , pattern ) {
657
+ pattern = pattern || "" ;
651
658
var message = "<h4>relocate-slaves</h4>Are you sure you wish to relocate slaves of <code><strong>" +
652
659
node . Key . Hostname + ":" + node . Key . Port +
653
660
"</strong></code> below <code><strong>" +
@@ -656,7 +663,7 @@ function Cluster() {
656
663
"<h4>Note</h4><p>Orchestrator will try and figure out the best relocation path. This may involve multiple steps. " +
657
664
"<p>In case multiple steps are involved, failure of one may leave some instances hanging in a different location than you expected, " +
658
665
"but they would still be in a <i>valid</i> state." ;
659
- var apiUrl = "/api/relocate-slaves/" + node . Key . Hostname + "/" + node . Key . Port + "/" + siblingNode . Key . Hostname + "/" + siblingNode . Key . Port ;
666
+ var apiUrl = "/api/relocate-slaves/" + node . Key . Hostname + "/" + node . Key . Port + "/" + siblingNode . Key . Hostname + "/" + siblingNode . Key . Port + "?pattern=" + encodeURIComponent ( pattern ) ;
660
667
return executeMoveOperation ( message , apiUrl ) ;
661
668
}
662
669
@@ -850,6 +857,7 @@ function Cluster() {
850
857
return parseInt ( logFileTokens [ logFileTokens . length - 1 ] )
851
858
}
852
859
860
+ // compactInstances aggregates sibling instances of same DC such that they are visualized as a single box.
853
861
function compactInstances ( instances , instancesMap ) {
854
862
function aggregateInstances ( parentInstance , dataCenter , instances ) {
855
863
if ( ! instances ) {
@@ -867,8 +875,10 @@ function Cluster() {
867
875
aggregatedProblems [ problemType ] = [ title ] ;
868
876
}
869
877
}
878
+ var instanceFullNames = [ ] ;
870
879
instances . forEach ( function ( instance ) {
871
880
incrementProblems ( "" , instance . title )
881
+ instanceFullNames . push ( getInstanceTitle ( instance . Key . Hostname , instance . Key . Port ) ) ;
872
882
if ( instance . inMaintenanceProblem ( ) ) {
873
883
incrementProblems ( "inMaintenanceProblem" , instance . title )
874
884
}
@@ -891,6 +901,7 @@ function Cluster() {
891
901
aggergateInstance . canonicalTitle = aggergateInstance . title ;
892
902
aggergateInstance . aggregatedInstances = instances ; // includes itself
893
903
aggergateInstance . aggregatedProblems = aggregatedProblems ;
904
+ aggergateInstance . aggregatedInstancesPattern = "(" + instanceFullNames . join ( "|" ) + ")" ;
894
905
895
906
instances . forEach ( function ( instance ) {
896
907
if ( ! instance . isAggregate ) {
0 commit comments