@@ -11,12 +11,14 @@ $(document).ready(function () {
11
11
} ;
12
12
13
13
$ . get ( "/api/clusters-info" , function ( clusters ) {
14
- $ . get ( "/api/problems" , function ( problemInstances ) {
15
- if ( problemInstances == null ) {
16
- problemInstances = [ ] ;
17
- }
18
- normalizeInstances ( problemInstances , [ ] ) ;
19
- displayClusters ( clusters , problemInstances ) ;
14
+ $ . get ( "/api/replication-analysis" , function ( replicationAnalysis ) {
15
+ $ . get ( "/api/problems" , function ( problemInstances ) {
16
+ if ( problemInstances == null ) {
17
+ problemInstances = [ ] ;
18
+ }
19
+ normalizeInstances ( problemInstances , [ ] ) ;
20
+ displayClusters ( clusters , replicationAnalysis , problemInstances ) ;
21
+ } , "json" ) ;
20
22
} , "json" ) ;
21
23
} , "json" ) ;
22
24
function sortByCountInstances ( cluster1 , cluster2 ) {
@@ -27,15 +29,26 @@ $(document).ready(function () {
27
29
return cluster1 . ClusterName . localeCompare ( cluster2 . ClusterName ) ;
28
30
}
29
31
30
- function displayClusters ( clusters , problemInstances ) {
32
+ function displayClusters ( clusters , replicationAnalysis , problemInstances ) {
31
33
hideLoader ( ) ;
32
34
33
35
clusters . sort ( sortByCountInstances ) ;
34
36
var clustersProblems = { } ;
35
37
clusters . forEach ( function ( cluster ) {
36
38
clustersProblems [ cluster . ClusterName ] = { } ;
37
39
} ) ;
38
-
40
+
41
+ var clustersAnalysisProblems = { } ;
42
+ replicationAnalysis . Details . forEach ( function ( analysisEntry ) {
43
+ if ( ! ( analysisEntry . Analysis in interestingAnalysis ) ) {
44
+ return ;
45
+ }
46
+ if ( ! clustersAnalysisProblems [ analysisEntry . ClusterDetails . ClusterName ] ) {
47
+ clustersAnalysisProblems [ analysisEntry . ClusterDetails . ClusterName ] = [ ] ;
48
+ }
49
+ clustersAnalysisProblems [ analysisEntry . ClusterDetails . ClusterName ] . push ( analysisEntry ) ;
50
+ } ) ;
51
+
39
52
function addInstancesBadge ( clusterName , count , badgeClass , title ) {
40
53
$ ( "#clusters [data-cluster-name='" + clusterName + "'].popover" ) . find ( ".popover-content .pull-right" ) . append ( '<span class="badge ' + badgeClass + '" title="' + title + '">' + count + '</span> ' ) ;
41
54
}
@@ -77,18 +90,20 @@ $(document).ready(function () {
77
90
popoverElement . find ( "h3 .pull-left" ) . prepend ( '<a href="/web/cluster/alias/' + encodeURIComponent ( cluster . ClusterAlias ) + '"><strong>' + cluster . ClusterAlias + '</strong></a><br/>' ) ;
78
91
compactClusterUri = '/web/cluster/alias/' + encodeURIComponent ( cluster . ClusterAlias ) + '?compact=true' ;
79
92
}
93
+ if ( clustersAnalysisProblems [ cluster . ClusterName ] ) {
94
+ clustersAnalysisProblems [ cluster . ClusterName ] . forEach ( function ( analysisEntry ) {
95
+ console . log ( analysisEntry )
96
+ popoverElement . find ( "h3 .pull-left" ) . prepend ( '<span class="glyphicon glyphicon-exclamation-sign text-danger" title="' + analysisEntry . Analysis + ': ' + getInstanceTitle ( analysisEntry . AnalyzedInstanceKey . Hostname , analysisEntry . AnalyzedInstanceKey . Port ) + '"></span>' ) ;
97
+ } ) ;
98
+
99
+ }
80
100
popoverElement . find ( "h3 .pull-right" ) . append ( '<a href="' + compactClusterUri + '"><span class="glyphicon glyphicon-compressed" title="Compact display"></span></a>' ) ;
81
101
if ( cluster . HasAutomatedIntermediateMasterRecovery === true ) {
82
102
popoverElement . find ( "h3 .pull-right" ) . prepend ( '<span class="glyphicon glyphicon-heart-empty text-info" title="Automated intermediate master recovery for this cluster ENABLED"></span>' ) ;
83
103
}
84
104
if ( cluster . HasAutomatedMasterRecovery === true ) {
85
105
popoverElement . find ( "h3 .pull-right" ) . prepend ( '<span class="glyphicon glyphicon-heart text-info" title="Automated master recovery for this cluster ENABLED"></span>' ) ;
86
106
}
87
-
88
-
89
-
90
-
91
-
92
107
93
108
var contentHtml = ''
94
109
+ '<div>Instances: <div class="pull-right"></div></div>'
0 commit comments