Sfoglia il codice sorgente

add node page.

master
yangxiaodong 7 anni fa
parent
commit
e6343e3d52
5 ha cambiato i file con 250 aggiunte e 2 eliminazioni
  1. +31
    -0
      src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs
  2. +46
    -0
      src/DotNetCore.CAP/Dashboard/Pages/NodePage.cshtml
  3. +171
    -0
      src/DotNetCore.CAP/Dashboard/Pages/NodePage.generated.cs
  4. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml
  5. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.generated.cs

+ 31
- 0
src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs Vedi File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using DotNetCore.CAP.NodeDiscovery;
using Microsoft.Extensions.DependencyInjection;

namespace DotNetCore.CAP.Dashboard.Pages
{
partial class NodePage
{
private IList<Node> _nodes = null;

public IList<Node> Nodes
{
get
{
if (_nodes == null)
{
var configOptions = RequestServices.GetService<DashboardOptions>();
var discoveryServer = configOptions.Discovery;
if (discoveryServer == null)
return null;

var factory = RequestServices.GetService<IDiscoveryProviderFactory>();
var discoryProvider = factory.Get(discoveryServer);
_nodes = discoryProvider.GetNodes().GetAwaiter().GetResult();
}
return _nodes;
}
}
}
}

+ 46
- 0
src/DotNetCore.CAP/Dashboard/Pages/NodePage.cshtml Vedi File

@@ -0,0 +1,46 @@
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True *@
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Resources
@inherits RazorPage
@{
Layout = new LayoutPage(Strings.NodePage_Title);
}
<div class="row">
<div class="col-md-12">
<h1 class="page-header">@Strings.NodePage_Title</h1>

@if (Nodes == null || Nodes.Count==0)
{
<div class="alert alert-warning">
@Strings.NodePage_NoNodes
</div>
}
else
{
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th width="20%">节点名称</th>
<th width="20%">IP地址</th>
<th>Tags</th>
<th width="20%">操作</th>
</tr>
</thead>
<tbody>
@foreach (var node in Nodes)
{
<tr>
<td>@node.Name</td>
<td>@node.Address</td>

<td><a class="btn">切换到</a></td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</div>

+ 171
- 0
src/DotNetCore.CAP/Dashboard/Pages/NodePage.generated.cs Vedi File

@@ -0,0 +1,171 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace DotNetCore.CAP.Dashboard.Pages
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\NodePage.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
#line hidden
#line 3 "..\..\Dashboard\Pages\NodePage.cshtml"
using DotNetCore.CAP.Dashboard.Pages;
#line default
#line hidden
#line 4 "..\..\Dashboard\Pages\NodePage.cshtml"
using DotNetCore.CAP.Dashboard.Resources;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
internal partial class NodePage : RazorPage
{
#line hidden

public override void Execute()
{


WriteLiteral("\r\n");






#line 6 "..\..\Dashboard\Pages\NodePage.cshtml"
Layout = new LayoutPage(Strings.NodePage_Title);


#line default
#line hidden
WriteLiteral("<div class=\"row\">\r\n <div class=\"col-md-12\">\r\n <h1 class=\"page-header\">");


#line 11 "..\..\Dashboard\Pages\NodePage.cshtml"
Write(Strings.NodePage_Title);

#line default
#line hidden
WriteLiteral("</h1>\r\n\r\n");


#line 13 "..\..\Dashboard\Pages\NodePage.cshtml"
if (Nodes == null || Nodes.Count==0)
{

#line default
#line hidden
WriteLiteral(" <div class=\"alert alert-warning\">\r\n ");


#line 16 "..\..\Dashboard\Pages\NodePage.cshtml"
Write(Strings.NodePage_NoNodes);

#line default
#line hidden
WriteLiteral("\r\n </div>\r\n");


#line 18 "..\..\Dashboard\Pages\NodePage.cshtml"
}
else
{

#line default
#line hidden
WriteLiteral(@" <div class=""table-responsive"">
<table class=""table"">
<thead>
<tr>
<th width=""50%"">节点名称</th>
<th width=""50%"">IP地址</th>
</tr>
</thead>
<tbody>
");


#line 30 "..\..\Dashboard\Pages\NodePage.cshtml"
foreach (var node in Nodes)
{

#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>");


#line 33 "..\..\Dashboard\Pages\NodePage.cshtml"
Write(node.Name);

#line default
#line hidden
WriteLiteral("</td>\r\n <td>");


#line 34 "..\..\Dashboard\Pages\NodePage.cshtml"
Write(node.Address);

#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n");


#line 36 "..\..\Dashboard\Pages\NodePage.cshtml"
}

#line default
#line hidden
WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n");


#line 40 "..\..\Dashboard\Pages\NodePage.cshtml"
}

#line default
#line hidden
WriteLiteral(" </div>\r\n</div>");


}
}
}
#pragma warning restore 1591

+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml Vedi File

@@ -18,7 +18,7 @@
@if (subscribers.Count == 0)
{
<div class="alert alert-warning">
@Strings.ServersPage_NoServers
@Strings.SubscribersPage_NoSubscribers
</div>
}
else


+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.generated.cs Vedi File

@@ -96,7 +96,7 @@ WriteLiteral(" <div class=\"alert alert-warning\">\r\n

#line 21 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(Strings.ServersPage_NoServers);
Write(Strings.SubscribersPage_NoSubscribers);

#line default


Caricamento…
Annulla
Salva