Commit 2b11bf44 authored by yangxiaodong's avatar yangxiaodong

add subscriber page.

parent 9d97e190
...@@ -12,7 +12,7 @@ namespace DotNetCore.CAP.Dashboard ...@@ -12,7 +12,7 @@ namespace DotNetCore.CAP.Dashboard
static DashboardMetrics() static DashboardMetrics()
{ {
AddMetric(ServerCount); AddMetric(ServerCount);
AddMetric(RetriesCount); AddMetric(SubscriberCount);
AddMetric(PublishedFailedCountOrNull); AddMetric(PublishedFailedCountOrNull);
AddMetric(ReceivedFailedCountOrNull); AddMetric(ReceivedFailedCountOrNull);
...@@ -57,7 +57,7 @@ namespace DotNetCore.CAP.Dashboard ...@@ -57,7 +57,7 @@ namespace DotNetCore.CAP.Dashboard
: null : null
}); });
public static readonly DashboardMetric RetriesCount = new DashboardMetric( public static readonly DashboardMetric SubscriberCount = new DashboardMetric(
"retries:count", "retries:count",
"Metrics_Retries", "Metrics_Retries",
page => page =>
...@@ -71,7 +71,7 @@ namespace DotNetCore.CAP.Dashboard ...@@ -71,7 +71,7 @@ namespace DotNetCore.CAP.Dashboard
return null; return null;
} }
retryCount = storageConnection.GetSetCount("retries"); retryCount =1111;
} }
return new Metric(retryCount.ToString("N0")) return new Metric(retryCount.ToString("N0"))
......
...@@ -6,7 +6,7 @@ namespace DotNetCore.CAP.Dashboard ...@@ -6,7 +6,7 @@ namespace DotNetCore.CAP.Dashboard
{ {
public interface IMonitoringApi public interface IMonitoringApi
{ {
IList<ServerDto> Servers(); IList<SubscriberDto> Subscribers();
StatisticsDto GetStatistics(); StatisticsDto GetStatistics();
......
...@@ -3,12 +3,10 @@ using System.Collections.Generic; ...@@ -3,12 +3,10 @@ using System.Collections.Generic;
namespace DotNetCore.CAP.Dashboard.Monitoring namespace DotNetCore.CAP.Dashboard.Monitoring
{ {
public class ServerDto public class SubscriberDto
{ {
public string Name { get; set; } public string Name { get; set; }
public int WorkersCount { get; set; }
public DateTime StartedAt { get; set; } public string Method { get; set; }
public IList<string> Queues { get; set; }
public DateTime? Heartbeat { get; set; }
} }
} }
\ No newline at end of file
...@@ -30,10 +30,10 @@ namespace DotNetCore.CAP.Dashboard ...@@ -30,10 +30,10 @@ namespace DotNetCore.CAP.Dashboard
} }
}); });
Items.Add(page => new MenuItem(Strings.NavigationMenu_Retries, page.Url.To("/retries")) Items.Add(page => new MenuItem(Strings.NavigationMenu_Subscribers, page.Url.To("/subscribers"))
{ {
Active = page.RequestPath.StartsWith("/retries"), Active = page.RequestPath.StartsWith("/subscribers"),
Metric = DashboardMetrics.RetriesCount Metric = DashboardMetrics.SubscriberCount
}); });
Items.Add(page => new MenuItem(Strings.NavigationMenu_Servers, page.Url.To("/servers")) Items.Add(page => new MenuItem(Strings.NavigationMenu_Servers, page.Url.To("/servers"))
......
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True *@
@using System
@using System.Linq
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Resources
@inherits RazorPage
@{
Layout = new LayoutPage(Strings.ServersPage_Title);
var monitor = Storage.GetMonitoringApi();
var subscribers = monitor.Subscribers();
}
<div class="row">
<div class="col-md-12">
<h1 class="page-header">订阅列表</h1>
@if (subscribers.Count == 0)
{
<div class="alert alert-warning">
@Strings.ServersPage_NoServers
</div>
}
else
{
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>名称</th>
<th>方法</th>
</tr>
</thead>
<tbody>
@foreach (var subscriber in subscribers)
{
<tr>
<td>@subscriber.Name</td>
<td>@subscriber.Method</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</div>
\ No newline at end of file
using System;
using DotNetCore.CAP.Models;
namespace DotNetCore.CAP
{
public class MessageData
{
public string State { get; set; }
public Message Message { get; set; }
public DateTime CreatedAt { get; set; }
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment