From cd86ca5eb859ba2e16dd02ea991e817538352f32 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sun, 9 Dec 2018 17:07:27 +0530 Subject: [PATCH] webapp: implemented cache hit stats into dashboard. --- DnsServerCore/www/css/main.css | 9 +++++++-- DnsServerCore/www/index.html | 6 ++++++ DnsServerCore/www/js/main.js | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/DnsServerCore/www/css/main.css b/DnsServerCore/www/css/main.css index 9ab342b5..9c14d155 100644 --- a/DnsServerCore/www/css/main.css +++ b/DnsServerCore/www/css/main.css @@ -214,6 +214,11 @@ label { color: #ffffff; } + .stats-panel .cache-hit { + background-color: rgba(111, 84, 153, 0.7); + color: #ffffff; + } + .stats-panel .no-error { background-color: rgba(92, 184, 92, 0.7); color: #ffffff; @@ -255,7 +260,7 @@ label { } .stats-panel .stats-item { - width: 120px; + width: 107px; float: left; padding: 6px; margin-right: 3px; @@ -263,7 +268,7 @@ label { } .stats-panel .stats-item .number { - font-size: 16px; + font-size: 15px; font-weight: bold; } diff --git a/DnsServerCore/www/index.html b/DnsServerCore/www/index.html index d9303656..c2c3c86e 100644 --- a/DnsServerCore/www/index.html +++ b/DnsServerCore/www/index.html @@ -131,6 +131,12 @@
Total Queries
+
+
10
+
0%
+
Cache Hit
+
+
70
0%
diff --git a/DnsServerCore/www/js/main.js b/DnsServerCore/www/js/main.js index 8509ed8b..3ec78922 100644 --- a/DnsServerCore/www/js/main.js +++ b/DnsServerCore/www/js/main.js @@ -687,6 +687,7 @@ function refreshDashboard(hideLoader) { //stats $("#divDashboardStatsTotalQueries").text(responseJSON.response.stats.totalQueries.toLocaleString()); + $("#divDashboardStatsTotalCacheHit").text(responseJSON.response.stats.totalCacheHit.toLocaleString()); $("#divDashboardStatsTotalNoError").text(responseJSON.response.stats.totalNoError.toLocaleString()); $("#divDashboardStatsTotalServerFailure").text(responseJSON.response.stats.totalServerFailure.toLocaleString()); $("#divDashboardStatsTotalNameError").text(responseJSON.response.stats.totalNameError.toLocaleString()); @@ -697,6 +698,7 @@ function refreshDashboard(hideLoader) { $("#divDashboardStatsBlockedZones").text(responseJSON.response.stats.blockedZones.toLocaleString()); if (responseJSON.response.stats.totalQueries > 0) { + $("#divDashboardStatsTotalCacheHitPercentage").text((responseJSON.response.stats.totalCacheHit * 100 / responseJSON.response.stats.totalQueries).toFixed(2) + "%"); $("#divDashboardStatsTotalNoErrorPercentage").text((responseJSON.response.stats.totalNoError * 100 / responseJSON.response.stats.totalQueries).toFixed(2) + "%"); $("#divDashboardStatsTotalServerFailurePercentage").text((responseJSON.response.stats.totalServerFailure * 100 / responseJSON.response.stats.totalQueries).toFixed(2) + "%"); $("#divDashboardStatsTotalNameErrorPercentage").text((responseJSON.response.stats.totalNameError * 100 / responseJSON.response.stats.totalQueries).toFixed(2) + "%"); @@ -704,6 +706,7 @@ function refreshDashboard(hideLoader) { $("#divDashboardStatsTotalBlockedPercentage").text((responseJSON.response.stats.totalBlocked * 100 / responseJSON.response.stats.totalQueries).toFixed(2) + "%"); } else { + $("#divDashboardStatsTotalCacheHitPercentage").text("0%"); $("#divDashboardStatsTotalNoErrorPercentage").text("0%"); $("#divDashboardStatsTotalServerFailurePercentage").text("0%"); $("#divDashboardStatsTotalNameErrorPercentage").text("0%");