@@ -61,9 +61,11 @@ $(document).ready(function() {
6161 }
6262 analysisEntry . StructureAnalysis = analysisEntry . StructureAnalysis || [ ] ;
6363 analysisEntry . StructureAnalysis . forEach ( function ( structureAnalysis ) {
64- analysisEntry . Analysis = structureAnalysis ;
65- analysisEntry . IsStructureAnalysis = true ;
66- clustersAnalysisProblems [ analysisEntry . ClusterDetails . ClusterName ] . push ( analysisEntry ) ;
64+ // We don't need a deep clone. Shallow copy is enough.
65+ const analysisEntryClone = { ...analysisEntry } ;
66+ analysisEntryClone . Analysis = structureAnalysis ;
67+ analysisEntryClone . IsStructureAnalysis = true ;
68+ clustersAnalysisProblems [ analysisEntryClone . ClusterDetails . ClusterName ] . push ( analysisEntryClone ) ;
6769 } ) ;
6870 } ) ;
6971
@@ -112,18 +114,46 @@ $(document).ready(function() {
112114 compactClusterUri = appUrl ( '/web/cluster/alias/' + encodeURIComponent ( cluster . ClusterAlias ) + '?compact=true' ) ;
113115 }
114116 if ( clustersAnalysisProblems [ cluster . ClusterName ] ) {
115- clustersAnalysisProblems [ cluster . ClusterName ] . forEach ( function ( analysisEntry ) {
116- var analysisLabel = "text-danger" ;
117- if ( analysisEntry . IsStructureAnalysis ) {
118- analysisLabel = "text-warning" ;
119- }
117+ var mutedMsg = ""
118+ var mutedCnt = 0
119+ var warningMsg = ""
120+ var warningCnt = 0
121+ var dangerMsg = ""
122+ var dangerCnt = 0
123+
124+ clustersAnalysisProblems [ cluster . ClusterName ] . forEach ( function ( analysisEntry ) {
125+ var msg = analysisEntry . Analysis + ': ' + getInstanceTitle ( analysisEntry . AnalyzedInstanceKey . Hostname , analysisEntry . AnalyzedInstanceKey . Port )
126+
120127 var hasDowntime = analysisEntry . IsDowntimed || analysisEntry . IsReplicasDowntimed
121128 if ( hasDowntime ) {
122- analysisLabel = "text-muted" ;
129+ mutedMsg = mutedMsg . concat ( msg , '\n' ) ;
130+ mutedCnt ++ ;
131+ } else if ( analysisEntry . IsStructureAnalysis ) {
132+ warningMsg = warningMsg . concat ( msg , '\n' ) ;
133+ warningCnt ++ ;
134+ } else {
135+ dangerMsg = dangerMsg . concat ( msg , '\n' ) ;
136+ dangerCnt ++ ;
123137 }
124- popoverElement . find ( "h3 .pull-left" ) . prepend ( '<span class="glyphicon glyphicon-exclamation-sign ' + analysisLabel + '" title="' + analysisEntry . Analysis + ': ' + getInstanceTitle ( analysisEntry . AnalyzedInstanceKey . Hostname , analysisEntry . AnalyzedInstanceKey . Port ) + '"></span>' ) ;
125138 } ) ;
126-
139+ if ( mutedCnt > 0 ) {
140+ if ( mutedCnt > 1 ) {
141+ popoverElement . find ( "h3 .pull-left" ) . prepend ( '<span class="overlay-counter">' + mutedCnt + ' </span>' ) ;
142+ }
143+ popoverElement . find ( "h3 .pull-left" ) . prepend ( '<span class="glyphicon glyphicon-exclamation-sign text-muted"' + ' title="' + mutedMsg + '"></span>' ) ;
144+ }
145+ if ( warningCnt > 0 ) {
146+ if ( warningCnt > 1 ) {
147+ popoverElement . find ( "h3 .pull-left" ) . prepend ( '<span class="overlay-counter">' + warningCnt + ' </span>' ) ;
148+ }
149+ popoverElement . find ( "h3 .pull-left" ) . prepend ( '<span class="glyphicon glyphicon-exclamation-sign text-warning"' + ' title="' + warningMsg + '"></span>' ) ;
150+ }
151+ if ( dangerCnt > 0 ) {
152+ if ( dangerCnt > 1 ) {
153+ popoverElement . find ( "h3 .pull-left" ) . prepend ( '<span class="overlay-counter">' + dangerCnt + ' </span>' ) ;
154+ }
155+ popoverElement . find ( "h3 .pull-left" ) . prepend ( '<span class="glyphicon glyphicon-exclamation-sign text-danger"' + ' title="' + dangerMsg + '"></span>' ) ;
156+ }
127157 }
128158 popoverElement . find ( "h3 .pull-right" ) . append ( '<a href="' + compactClusterUri + '"><span class="glyphicon glyphicon-compressed" title="Compact display"></span></a>' ) ;
129159 if ( cluster . HasAutomatedIntermediateMasterRecovery === true ) {
0 commit comments