mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-04-04 19:59:23 +00:00
WebServiceDashboardApi: updated code for stats manager related changes.
This commit is contained in:
@@ -48,7 +48,7 @@ namespace DnsServerCore
|
||||
|
||||
#region private
|
||||
|
||||
private static void WriteChartDataSet(JsonTextWriter jsonWriter, string label, string backgroundColor, string borderColor, List<KeyValuePair<string, int>> statsPerInterval)
|
||||
private static void WriteChartDataSet(JsonTextWriter jsonWriter, string label, string backgroundColor, string borderColor, List<KeyValuePair<string, long>> statsPerInterval)
|
||||
{
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
@@ -69,14 +69,14 @@ namespace DnsServerCore
|
||||
|
||||
jsonWriter.WritePropertyName("data");
|
||||
jsonWriter.WriteStartArray();
|
||||
foreach (KeyValuePair<string, int> item in statsPerInterval)
|
||||
foreach (KeyValuePair<string, long> item in statsPerInterval)
|
||||
jsonWriter.WriteValue(item.Value);
|
||||
jsonWriter.WriteEndArray();
|
||||
|
||||
jsonWriter.WriteEndObject();
|
||||
}
|
||||
|
||||
private async Task<IDictionary<string, string>> ResolvePtrTopClientsAsync(List<KeyValuePair<string, int>> topClients)
|
||||
private async Task<IDictionary<string, string>> ResolvePtrTopClientsAsync(List<KeyValuePair<string, long>> topClients)
|
||||
{
|
||||
IDictionary<string, string> dhcpClientIpMap = _dnsWebService.DhcpServer.GetAddressHostNameMap();
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace DnsServerCore
|
||||
|
||||
List<Task<KeyValuePair<string, string>>> resolverTasks = new List<Task<KeyValuePair<string, string>>>();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in topClients)
|
||||
foreach (KeyValuePair<string, long> item in topClients)
|
||||
{
|
||||
resolverTasks.Add(ResolvePtrAsync(item.Key));
|
||||
}
|
||||
@@ -134,7 +134,7 @@ namespace DnsServerCore
|
||||
if (string.IsNullOrEmpty(strType))
|
||||
strType = "lastHour";
|
||||
|
||||
Dictionary<string, List<KeyValuePair<string, int>>> data;
|
||||
Dictionary<string, List<KeyValuePair<string, long>>> data;
|
||||
|
||||
switch (strType)
|
||||
{
|
||||
@@ -189,12 +189,12 @@ namespace DnsServerCore
|
||||
|
||||
//stats
|
||||
{
|
||||
List<KeyValuePair<string, int>> stats = data["stats"];
|
||||
List<KeyValuePair<string, long>> stats = data["stats"];
|
||||
|
||||
jsonWriter.WritePropertyName("stats");
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in stats)
|
||||
foreach (KeyValuePair<string, long> item in stats)
|
||||
{
|
||||
jsonWriter.WritePropertyName(item.Key);
|
||||
jsonWriter.WriteValue(item.Value);
|
||||
@@ -225,12 +225,12 @@ namespace DnsServerCore
|
||||
|
||||
//label
|
||||
{
|
||||
List<KeyValuePair<string, int>> statsPerInterval = data["totalQueriesPerInterval"];
|
||||
List<KeyValuePair<string, long>> statsPerInterval = data["totalQueriesPerInterval"];
|
||||
|
||||
jsonWriter.WritePropertyName("labels");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in statsPerInterval)
|
||||
foreach (KeyValuePair<string, long> item in statsPerInterval)
|
||||
jsonWriter.WriteValue(item.Key);
|
||||
|
||||
jsonWriter.WriteEndArray();
|
||||
@@ -265,14 +265,14 @@ namespace DnsServerCore
|
||||
jsonWriter.WritePropertyName("queryResponseChartData");
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
List<KeyValuePair<string, int>> stats = data["stats"];
|
||||
List<KeyValuePair<string, long>> stats = data["stats"];
|
||||
|
||||
//labels
|
||||
{
|
||||
jsonWriter.WritePropertyName("labels");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in stats)
|
||||
foreach (KeyValuePair<string, long> item in stats)
|
||||
{
|
||||
switch (item.Key)
|
||||
{
|
||||
@@ -307,7 +307,7 @@ namespace DnsServerCore
|
||||
jsonWriter.WritePropertyName("data");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in stats)
|
||||
foreach (KeyValuePair<string, long> item in stats)
|
||||
{
|
||||
switch (item.Key)
|
||||
{
|
||||
@@ -343,14 +343,14 @@ namespace DnsServerCore
|
||||
jsonWriter.WritePropertyName("queryTypeChartData");
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
List<KeyValuePair<string, int>> queryTypes = data["queryTypes"];
|
||||
List<KeyValuePair<string, long>> queryTypes = data["queryTypes"];
|
||||
|
||||
//labels
|
||||
{
|
||||
jsonWriter.WritePropertyName("labels");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in queryTypes)
|
||||
foreach (KeyValuePair<string, long> item in queryTypes)
|
||||
jsonWriter.WriteValue(item.Key);
|
||||
|
||||
jsonWriter.WriteEndArray();
|
||||
@@ -365,7 +365,7 @@ namespace DnsServerCore
|
||||
|
||||
jsonWriter.WritePropertyName("data");
|
||||
jsonWriter.WriteStartArray();
|
||||
foreach (KeyValuePair<string, int> item in queryTypes)
|
||||
foreach (KeyValuePair<string, long> item in queryTypes)
|
||||
jsonWriter.WriteValue(item.Value);
|
||||
jsonWriter.WriteEndArray();
|
||||
|
||||
@@ -393,14 +393,14 @@ namespace DnsServerCore
|
||||
|
||||
//top clients
|
||||
{
|
||||
List<KeyValuePair<string, int>> topClients = data["topClients"];
|
||||
List<KeyValuePair<string, long>> topClients = data["topClients"];
|
||||
|
||||
IDictionary<string, string> clientIpMap = await ResolvePtrTopClientsAsync(topClients);
|
||||
|
||||
jsonWriter.WritePropertyName("topClients");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in topClients)
|
||||
foreach (KeyValuePair<string, long> item in topClients)
|
||||
{
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
@@ -424,12 +424,12 @@ namespace DnsServerCore
|
||||
|
||||
//top domains
|
||||
{
|
||||
List<KeyValuePair<string, int>> topDomains = data["topDomains"];
|
||||
List<KeyValuePair<string, long>> topDomains = data["topDomains"];
|
||||
|
||||
jsonWriter.WritePropertyName("topDomains");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in topDomains)
|
||||
foreach (KeyValuePair<string, long> item in topDomains)
|
||||
{
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
@@ -447,12 +447,12 @@ namespace DnsServerCore
|
||||
|
||||
//top blocked domains
|
||||
{
|
||||
List<KeyValuePair<string, int>> topBlockedDomains = data["topBlockedDomains"];
|
||||
List<KeyValuePair<string, long>> topBlockedDomains = data["topBlockedDomains"];
|
||||
|
||||
jsonWriter.WritePropertyName("topBlockedDomains");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in topBlockedDomains)
|
||||
foreach (KeyValuePair<string, long> item in topBlockedDomains)
|
||||
{
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
@@ -486,7 +486,7 @@ namespace DnsServerCore
|
||||
TopStatsType statsType = Enum.Parse<TopStatsType>(strStatsType, true);
|
||||
int limit = int.Parse(strLimit);
|
||||
|
||||
List<KeyValuePair<string, int>> topStatsData;
|
||||
List<KeyValuePair<string, long>> topStatsData;
|
||||
|
||||
switch (strType)
|
||||
{
|
||||
@@ -548,7 +548,7 @@ namespace DnsServerCore
|
||||
jsonWriter.WritePropertyName("topClients");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in topStatsData)
|
||||
foreach (KeyValuePair<string, long> item in topStatsData)
|
||||
{
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
@@ -576,7 +576,7 @@ namespace DnsServerCore
|
||||
jsonWriter.WritePropertyName("topDomains");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in topStatsData)
|
||||
foreach (KeyValuePair<string, long> item in topStatsData)
|
||||
{
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
@@ -598,7 +598,7 @@ namespace DnsServerCore
|
||||
jsonWriter.WritePropertyName("topBlockedDomains");
|
||||
jsonWriter.WriteStartArray();
|
||||
|
||||
foreach (KeyValuePair<string, int> item in topStatsData)
|
||||
foreach (KeyValuePair<string, long> item in topStatsData)
|
||||
{
|
||||
jsonWriter.WriteStartObject();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user