浏览代码

add subscriber page.

master
yangxiaodong 7 年前
父节点
当前提交
2b11bf44da
共有 6 个文件被更改,包括 58 次插入24 次删除
  1. +3
    -3
      src/DotNetCore.CAP/Dashboard/DashboardMetrics.cs
  2. +1
    -1
      src/DotNetCore.CAP/Dashboard/IMonitoringApi.cs
  3. +3
    -5
      src/DotNetCore.CAP/Dashboard/Monitoring/ServerDto.cs
  4. +3
    -3
      src/DotNetCore.CAP/Dashboard/NavigationMenu.cs
  5. +48
    -0
      src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml
  6. +0
    -12
      src/DotNetCore.CAP/MessageData.cs

+ 3
- 3
src/DotNetCore.CAP/Dashboard/DashboardMetrics.cs 查看文件

@@ -12,7 +12,7 @@ namespace DotNetCore.CAP.Dashboard
static DashboardMetrics()
{
AddMetric(ServerCount);
AddMetric(RetriesCount);
AddMetric(SubscriberCount);

AddMetric(PublishedFailedCountOrNull);
AddMetric(ReceivedFailedCountOrNull);
@@ -57,7 +57,7 @@ namespace DotNetCore.CAP.Dashboard
: null
});

public static readonly DashboardMetric RetriesCount = new DashboardMetric(
public static readonly DashboardMetric SubscriberCount = new DashboardMetric(
"retries:count",
"Metrics_Retries",
page =>
@@ -71,7 +71,7 @@ namespace DotNetCore.CAP.Dashboard
return null;
}

retryCount = storageConnection.GetSetCount("retries");
retryCount =1111;
}

return new Metric(retryCount.ToString("N0"))


+ 1
- 1
src/DotNetCore.CAP/Dashboard/IMonitoringApi.cs 查看文件

@@ -6,7 +6,7 @@ namespace DotNetCore.CAP.Dashboard
{
public interface IMonitoringApi
{
IList<ServerDto> Servers();
IList<SubscriberDto> Subscribers();

StatisticsDto GetStatistics();


+ 3
- 5
src/DotNetCore.CAP/Dashboard/Monitoring/ServerDto.cs 查看文件

@@ -3,12 +3,10 @@ using System.Collections.Generic;

namespace DotNetCore.CAP.Dashboard.Monitoring
{
public class ServerDto
public class SubscriberDto
{
public string Name { get; set; }
public int WorkersCount { get; set; }
public DateTime StartedAt { get; set; }
public IList<string> Queues { get; set; }
public DateTime? Heartbeat { get; set; }

public string Method { get; set; }
}
}

+ 3
- 3
src/DotNetCore.CAP/Dashboard/NavigationMenu.cs 查看文件

@@ -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"),
Metric = DashboardMetrics.RetriesCount
Active = page.RequestPath.StartsWith("/subscribers"),
Metric = DashboardMetrics.SubscriberCount
});

Items.Add(page => new MenuItem(Strings.NavigationMenu_Servers, page.Url.To("/servers"))


+ 48
- 0
src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml 查看文件

@@ -0,0 +1,48 @@
@* 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>

+ 0
- 12
src/DotNetCore.CAP/MessageData.cs 查看文件

@@ -1,12 +0,0 @@
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; }
}
}

正在加载...
取消
保存