Skip to content

Commit

Permalink
clusters page (aka dashboard) indicates replication analysis problems
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomi-noach committed Oct 30, 2015
1 parent 0e5d058 commit 6b666d2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
set -e

RELEASE_VERSION="1.4.473"
RELEASE_VERSION="1.4.474"
TOPDIR=/tmp/orchestrator-release
export RELEASE_VERSION TOPDIR

Expand Down
4 changes: 4 additions & 0 deletions resources/public/css/orchestrator.css
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ body {
color: #31708f;
}

#clusters .instance h3 .pull-left > .glyphicon {
margin-right: 2px;
}

#instance_problems {
z-index: 10;
position: absolute;
Expand Down
41 changes: 28 additions & 13 deletions resources/public/js/clusters.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ $(document).ready(function () {
};

$.get("/api/clusters-info", function (clusters) {
$.get("/api/problems", function (problemInstances) {
if (problemInstances == null) {
problemInstances = [];
}
normalizeInstances(problemInstances, []);
displayClusters(clusters, problemInstances);
$.get("/api/replication-analysis", function (replicationAnalysis) {
$.get("/api/problems", function (problemInstances) {
if (problemInstances == null) {
problemInstances = [];
}
normalizeInstances(problemInstances, []);
displayClusters(clusters, replicationAnalysis, problemInstances);
}, "json");
}, "json");
}, "json");
function sortByCountInstances(cluster1, cluster2) {
Expand All @@ -27,15 +29,26 @@ $(document).ready(function () {
return cluster1.ClusterName.localeCompare(cluster2.ClusterName);
}

function displayClusters(clusters, problemInstances) {
function displayClusters(clusters, replicationAnalysis, problemInstances) {
hideLoader();

clusters.sort(sortByCountInstances);
var clustersProblems = {};
clusters.forEach(function (cluster) {
clustersProblems[cluster.ClusterName] = {};
});


var clustersAnalysisProblems = {};
replicationAnalysis.Details.forEach(function (analysisEntry) {
if (!(analysisEntry.Analysis in interestingAnalysis)) {
return;
}
if (!clustersAnalysisProblems[analysisEntry.ClusterDetails.ClusterName]) {
clustersAnalysisProblems[analysisEntry.ClusterDetails.ClusterName] = [];
}
clustersAnalysisProblems[analysisEntry.ClusterDetails.ClusterName].push(analysisEntry);
});

function addInstancesBadge(clusterName, count, badgeClass, title) {
$("#clusters [data-cluster-name='" + clusterName + "'].popover").find(".popover-content .pull-right").append('<span class="badge '+badgeClass+'" title="' + title + '">' + count + '</span> ');
}
Expand Down Expand Up @@ -77,18 +90,20 @@ $(document).ready(function () {
popoverElement.find("h3 .pull-left").prepend('<a href="/web/cluster/alias/'+encodeURIComponent(cluster.ClusterAlias)+'"><strong>'+cluster.ClusterAlias+'</strong></a><br/>');
compactClusterUri = '/web/cluster/alias/'+encodeURIComponent(cluster.ClusterAlias)+'?compact=true';
}
if (clustersAnalysisProblems[cluster.ClusterName]) {
clustersAnalysisProblems[cluster.ClusterName].forEach(function (analysisEntry) {
console.log(analysisEntry)
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>');
});

}
popoverElement.find("h3 .pull-right").append('<a href="'+compactClusterUri+'"><span class="glyphicon glyphicon-compressed" title="Compact display"></span></a>');
if (cluster.HasAutomatedIntermediateMasterRecovery === true) {
popoverElement.find("h3 .pull-right").prepend('<span class="glyphicon glyphicon-heart-empty text-info" title="Automated intermediate master recovery for this cluster ENABLED"></span>');
}
if (cluster.HasAutomatedMasterRecovery === true) {
popoverElement.find("h3 .pull-right").prepend('<span class="glyphicon glyphicon-heart text-info" title="Automated master recovery for this cluster ENABLED"></span>');
}






var contentHtml = ''
+ '<div>Instances: <div class="pull-right"></div></div>'
Expand Down
1 change: 1 addition & 0 deletions resources/templates/clusters.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
return "{{.removeTextFromHostnameDisplay}}";
}
</script>
<script src="/js/cluster-analysis-shared.js"></script>
<script src="/js/clusters.js"></script>

0 comments on commit 6b666d2

Please sign in to comment.