Explorar el Código

upgrade dashoboard module

master
Savorboard hace 5 años
padre
commit
c4f4f5f484
Se han modificado 45 ficheros con 2481 adiciones y 1773 borrados
  1. +7
    -0
      samples/Sample.RabbitMQ.MySql/Controllers/ValuesController.cs
  2. +1
    -0
      samples/Sample.RabbitMQ.MySql/Sample.RabbitMQ.MySql.csproj
  3. +1
    -1
      samples/Sample.RabbitMQ.MySql/Startup.cs
  4. +128
    -0
      src/DotNetCore.CAP.Dashboard/AwaitableInfo.cs
  5. +72
    -2
      src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs
  6. +3
    -0
      src/DotNetCore.CAP.Dashboard/CAP.DashboardOptionsExtensions.cs
  7. +378
    -0
      src/DotNetCore.CAP.Dashboard/CapCache.cs
  8. +44
    -0
      src/DotNetCore.CAP.Dashboard/CoercedAwaitableInfo.cs
  9. +6
    -5
      src/DotNetCore.CAP.Dashboard/CombinedResourceDispatcher.cs
  10. +4
    -3
      src/DotNetCore.CAP.Dashboard/DashboardContext.cs
  11. +5
    -5
      src/DotNetCore.CAP.Dashboard/DashboardRoutes.cs
  12. +141
    -27
      src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj
  13. +6
    -9
      src/DotNetCore.CAP.Dashboard/EmbeddedResourceDispatcher.cs
  14. +1
    -1
      src/DotNetCore.CAP.Dashboard/GatewayProxy/GatewayProxyMiddleware.cs
  15. +1
    -1
      src/DotNetCore.CAP.Dashboard/HtmlHelper.cs
  16. +1
    -1
      src/DotNetCore.CAP.Dashboard/JsonDispatcher.cs
  17. +2
    -2
      src/DotNetCore.CAP.Dashboard/JsonStats.cs
  18. +1
    -1
      src/DotNetCore.CAP.Dashboard/LocalRequestsOnlyAuthorizationFilter.cs
  19. +9
    -9
      src/DotNetCore.CAP.Dashboard/MessageHistoryRenderer.cs
  20. +2
    -2
      src/DotNetCore.CAP.Dashboard/Pages/BlockMetric.cs
  21. +210
    -228
      src/DotNetCore.CAP.Dashboard/Pages/HomePage.generated.cs
  22. +206
    -213
      src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.generated.cs
  23. +1
    -1
      src/DotNetCore.CAP.Dashboard/Pages/NodePage.cs
  24. +162
    -163
      src/DotNetCore.CAP.Dashboard/Pages/NodePage.generated.cs
  25. +5
    -4
      src/DotNetCore.CAP.Dashboard/Pages/PublishedPage.cs
  26. +4
    -4
      src/DotNetCore.CAP.Dashboard/Pages/PublishedPage.cshtml
  27. +441
    -429
      src/DotNetCore.CAP.Dashboard/Pages/PublishedPage.generated.cs
  28. +2
    -1
      src/DotNetCore.CAP.Dashboard/Pages/ReceivedPage.cs
  29. +1
    -1
      src/DotNetCore.CAP.Dashboard/Pages/ReceivedPage.cshtml
  30. +428
    -424
      src/DotNetCore.CAP.Dashboard/Pages/ReceivedPage.generated.cs
  31. +58
    -73
      src/DotNetCore.CAP.Dashboard/Pages/SubscriberPage.generated.cs
  32. +6
    -5
      src/DotNetCore.CAP.Dashboard/Pages/_BlockMetric.cshtml
  33. +14
    -18
      src/DotNetCore.CAP.Dashboard/Pages/_BlockMetric.generated.cs
  34. +13
    -19
      src/DotNetCore.CAP.Dashboard/Pages/_Breadcrumbs.generated.cs
  35. +7
    -7
      src/DotNetCore.CAP.Dashboard/Pages/_InlineMetric.generated.cs
  36. +17
    -14
      src/DotNetCore.CAP.Dashboard/Pages/_Navigation.generated.cs
  37. +24
    -26
      src/DotNetCore.CAP.Dashboard/Pages/_Paginator.generated.cs
  38. +23
    -23
      src/DotNetCore.CAP.Dashboard/Pages/_PerPageSelector.generated.cs
  39. +12
    -20
      src/DotNetCore.CAP.Dashboard/Pages/_SidebarMenu.generated.cs
  40. +6
    -6
      src/DotNetCore.CAP.Dashboard/RazorPage.cs
  41. +8
    -21
      src/DotNetCore.CAP.MySql/MySqlDataStorage.cs
  42. +8
    -0
      src/DotNetCore.CAP/Internal/Helper.cs
  43. +1
    -1
      src/DotNetCore.CAP/Internal/MethodMatcherCache.cs
  44. +9
    -3
      src/DotNetCore.CAP/Persistence/IDataStorage.cs
  45. +2
    -0
      src/DotNetCore.CAP/Persistence/MediumMessage.cs

+ 7
- 0
samples/Sample.RabbitMQ.MySql/Controllers/ValuesController.cs Ver fichero

@@ -75,5 +75,12 @@ namespace Sample.RabbitMQ.MySql.Controllers
{
Console.WriteLine($@"{DateTime.Now} Subscriber invoked, Info: {p}");
}

[NonAction]
[CapSubscribe("sample.rabbitmq.mysql", Group = "group.test2")]
public void Subscriber2(DateTime p, [FromCap]CapHeader header)
{
Console.WriteLine($@"{DateTime.Now} Subscriber invoked, Info: {p}");
}
}
}

+ 1
- 0
samples/Sample.RabbitMQ.MySql/Sample.RabbitMQ.MySql.csproj Ver fichero

@@ -8,6 +8,7 @@
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.0-rc1.final" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\DotNetCore.CAP.Dashboard\DotNetCore.CAP.Dashboard.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP.MySql\DotNetCore.CAP.MySql.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP.RabbitMQ\DotNetCore.CAP.RabbitMQ.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP\DotNetCore.CAP.csproj" />


+ 1
- 1
samples/Sample.RabbitMQ.MySql/Startup.cs Ver fichero

@@ -15,7 +15,7 @@ namespace Sample.RabbitMQ.MySql
{
x.UseEntityFramework<AppDbContext>();
x.UseRabbitMQ("192.168.2.120");
//x.UseDashboard();
x.UseDashboard();
x.FailedRetryCount = 5;
x.FailedThresholdCallback = (type, msg) =>
{


+ 128
- 0
src/DotNetCore.CAP.Dashboard/AwaitableInfo.cs Ver fichero

@@ -0,0 +1,128 @@
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;

namespace Microsoft.Extensions.Internal
{
internal struct AwaitableInfo
{
public Type AwaiterType { get; }
public PropertyInfo AwaiterIsCompletedProperty { get; }
public MethodInfo AwaiterGetResultMethod { get; }
public MethodInfo AwaiterOnCompletedMethod { get; }
public MethodInfo AwaiterUnsafeOnCompletedMethod { get; }
public Type ResultType { get; }
public MethodInfo GetAwaiterMethod { get; }

public AwaitableInfo(
Type awaiterType,
PropertyInfo awaiterIsCompletedProperty,
MethodInfo awaiterGetResultMethod,
MethodInfo awaiterOnCompletedMethod,
MethodInfo awaiterUnsafeOnCompletedMethod,
Type resultType,
MethodInfo getAwaiterMethod)
{
AwaiterType = awaiterType;
AwaiterIsCompletedProperty = awaiterIsCompletedProperty;
AwaiterGetResultMethod = awaiterGetResultMethod;
AwaiterOnCompletedMethod = awaiterOnCompletedMethod;
AwaiterUnsafeOnCompletedMethod = awaiterUnsafeOnCompletedMethod;
ResultType = resultType;
GetAwaiterMethod = getAwaiterMethod;
}

public static bool IsTypeAwaitable(Type type, out AwaitableInfo awaitableInfo)
{
// Based on Roslyn code: http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/Shared/Extensions/ISymbolExtensions.cs,db4d48ba694b9347

// Awaitable must have method matching "object GetAwaiter()"
var getAwaiterMethod = type.GetRuntimeMethods().FirstOrDefault(m =>
m.Name.Equals("GetAwaiter", StringComparison.OrdinalIgnoreCase)
&& m.GetParameters().Length == 0
&& m.ReturnType != null);
if (getAwaiterMethod == null)
{
awaitableInfo = default(AwaitableInfo);
return false;
}

var awaiterType = getAwaiterMethod.ReturnType;

// Awaiter must have property matching "bool IsCompleted { get; }"
var isCompletedProperty = awaiterType.GetRuntimeProperties().FirstOrDefault(p =>
p.Name.Equals("IsCompleted", StringComparison.OrdinalIgnoreCase)
&& p.PropertyType == typeof(bool)
&& p.GetMethod != null);
if (isCompletedProperty == null)
{
awaitableInfo = default(AwaitableInfo);
return false;
}

// Awaiter must implement INotifyCompletion
var awaiterInterfaces = awaiterType.GetInterfaces();
var implementsINotifyCompletion = awaiterInterfaces.Any(t => t == typeof(INotifyCompletion));
if (!implementsINotifyCompletion)
{
awaitableInfo = default(AwaitableInfo);
return false;
}

// INotifyCompletion supplies a method matching "void OnCompleted(Action action)"
var iNotifyCompletionMap = awaiterType
.GetTypeInfo()
.GetRuntimeInterfaceMap(typeof(INotifyCompletion));
var onCompletedMethod = iNotifyCompletionMap.InterfaceMethods.Single(m =>
m.Name.Equals("OnCompleted", StringComparison.OrdinalIgnoreCase)
&& m.ReturnType == typeof(void)
&& m.GetParameters().Length == 1
&& m.GetParameters()[0].ParameterType == typeof(Action));

// Awaiter optionally implements ICriticalNotifyCompletion
var implementsICriticalNotifyCompletion =
awaiterInterfaces.Any(t => t == typeof(ICriticalNotifyCompletion));
MethodInfo unsafeOnCompletedMethod;
if (implementsICriticalNotifyCompletion)
{
// ICriticalNotifyCompletion supplies a method matching "void UnsafeOnCompleted(Action action)"
var iCriticalNotifyCompletionMap = awaiterType
.GetTypeInfo()
.GetRuntimeInterfaceMap(typeof(ICriticalNotifyCompletion));
unsafeOnCompletedMethod = iCriticalNotifyCompletionMap.InterfaceMethods.Single(m =>
m.Name.Equals("UnsafeOnCompleted", StringComparison.OrdinalIgnoreCase)
&& m.ReturnType == typeof(void)
&& m.GetParameters().Length == 1
&& m.GetParameters()[0].ParameterType == typeof(Action));
}
else
{
unsafeOnCompletedMethod = null;
}

// Awaiter must have method matching "void GetResult" or "T GetResult()"
var getResultMethod = awaiterType.GetRuntimeMethods().FirstOrDefault(m =>
m.Name.Equals("GetResult")
&& m.GetParameters().Length == 0);
if (getResultMethod == null)
{
awaitableInfo = default(AwaitableInfo);
return false;
}

awaitableInfo = new AwaitableInfo(
awaiterType,
isCompletedProperty,
getResultMethod,
onCompletedMethod,
unsafeOnCompletedMethod,
getResultMethod.ReturnType,
getAwaiterMethod);
return true;
}
}
}

+ 72
- 2
src/DotNetCore.CAP.Dashboard/CAP.DashboardMiddleware.cs Ver fichero

@@ -6,19 +6,89 @@ using System.Linq;
using System.Net;
using System.Threading.Tasks;
using DotNetCore.CAP.Dashboard;
using DotNetCore.CAP.Dashboard.GatewayProxy;
using DotNetCore.CAP.Dashboard.NodeDiscovery;
using DotNetCore.CAP.Persistence;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;

// ReSharper disable once CheckNamespace
namespace DotNetCore.CAP
{
public static class CapBuilderExtension
{
public static IApplicationBuilder UseCapDashboard(this IApplicationBuilder app)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}

CheckRequirement(app);

var provider = app.ApplicationServices;

if (provider.GetService<DashboardOptions>() != null)
{
if (provider.GetService<DiscoveryOptions>() != null)
{
app.UseMiddleware<GatewayProxyMiddleware>();
}

app.UseMiddleware<DashboardMiddleware>();
}

return app;
}

private static void CheckRequirement(IApplicationBuilder app)
{
var marker = app.ApplicationServices.GetService<CapMarkerService>();
if (marker == null)
{
throw new InvalidOperationException(
"AddCap() must be called on the service collection. eg: services.AddCap(...)");
}

var messageQueueMarker = app.ApplicationServices.GetService<CapMessageQueueMakerService>();
if (messageQueueMarker == null)
{
throw new InvalidOperationException(
"You must be config used message queue provider at AddCap() options! eg: services.AddCap(options=>{ options.UseKafka(...) })");
}

var databaseMarker = app.ApplicationServices.GetService<CapStorageMarkerService>();
if (databaseMarker == null)
{
throw new InvalidOperationException(
"You must be config used database provider at AddCap() options! eg: services.AddCap(options=>{ options.UseSqlServer(...) })");
}
}
}

sealed class CapStartupFilter : IStartupFilter
{
public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next)
{
return app =>
{
app.UseCapDashboard();

next(app);
};
}
}

public class DashboardMiddleware
{
private readonly RequestDelegate _next;
private readonly DashboardOptions _options;
private readonly RouteCollection _routes;
private readonly IStorage _storage;
private readonly IDataStorage _storage;

public DashboardMiddleware(RequestDelegate next, DashboardOptions options, IStorage storage,
public DashboardMiddleware(RequestDelegate next, DashboardOptions options, IDataStorage storage,
RouteCollection routes)
{
_next = next ?? throw new ArgumentNullException(nameof(next));


+ 3
- 0
src/DotNetCore.CAP.Dashboard/CAP.DashboardOptionsExtensions.cs Ver fichero

@@ -6,6 +6,7 @@ using DotNetCore.CAP;
using DotNetCore.CAP.Dashboard;
using DotNetCore.CAP.Dashboard.GatewayProxy;
using DotNetCore.CAP.Dashboard.GatewayProxy.Requester;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;

namespace DotNetCore.CAP
@@ -23,11 +24,13 @@ namespace DotNetCore.CAP
{
var dashboardOptions = new DashboardOptions();
_options?.Invoke(dashboardOptions);
services.AddTransient<IStartupFilter, CapStartupFilter>();
services.AddSingleton(dashboardOptions);
services.AddSingleton(DashboardRoutes.Routes);
services.AddSingleton<IHttpRequester, HttpClientHttpRequester>();
services.AddSingleton<IHttpClientCache, MemoryHttpClientCache>();
services.AddSingleton<IRequestMapper, RequestMapper>();

}
}
}


+ 378
- 0
src/DotNetCore.CAP.Dashboard/CapCache.cs Ver fichero

@@ -0,0 +1,378 @@
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace DotNetCore.CAP.Dashboard
{
#region Cache<T> class

/// <summary>
/// This is a generic cache subsystem based on key/value pairs, where key is generic, too. Key must be unique.
/// Every cache entry has its own timeout.
/// Cache is thread safe and will delete expired entries on its own using System.Threading.Timers (which run on
/// <see cref="ThreadPool" /> threads).
/// </summary>
// ReSharper disable once InheritdocConsiderUsage
// ReSharper disable once InconsistentNaming
internal class Cache<K, T> : IDisposable
{
#region Constructor and class members

private readonly Dictionary<K, T> _cache = new Dictionary<K, T>();
private readonly Dictionary<K, Timer> _timers = new Dictionary<K, Timer>();
private readonly ReaderWriterLockSlim _locker = new ReaderWriterLockSlim();

#endregion

#region IDisposable implementation & Clear

private bool disposed;

/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="disposing">
/// <c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.
/// </param>
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
disposed = true;

if (disposing)
{
// Dispose managed resources.
Clear();
_locker.Dispose();
}

// Dispose unmanaged resources
}
}

/// <summary>
/// Clears the entire cache and disposes all active timers.
/// </summary>
public void Clear()
{
_locker.EnterWriteLock();
try
{
try
{
foreach (var t in _timers.Values)
{
t.Dispose();
}
}
catch
{
}

_timers.Clear();
_cache.Clear();
}
finally
{
_locker.ExitWriteLock();
}
}

#endregion

#region CheckTimer

// Checks whether a specific timer already exists and adds a new one, if not
private void CheckTimer(K key, TimeSpan? cacheTimeout, bool restartTimerIfExists)
{
Timer timer;

if (_timers.TryGetValue(key, out timer))
{
if (restartTimerIfExists)
{
timer.Change(
cacheTimeout ?? Timeout.InfiniteTimeSpan,
Timeout.InfiniteTimeSpan);
}
}
else
{
_timers.Add(
key,
new Timer(
RemoveByTimer,
key,
cacheTimeout ?? Timeout.InfiniteTimeSpan,
Timeout.InfiniteTimeSpan));
}
}

private void RemoveByTimer(object state)
{
Remove((K) state);
}

#endregion

#region AddOrUpdate, Get, Remove, Exists, Clear

/// <summary>
/// Adds or updates the specified cache-key with the specified cacheObject and applies a specified timeout (in seconds)
/// to this key.
/// </summary>
/// <param name="key">The cache-key to add or update.</param>
/// <param name="cacheObject">The cache object to store.</param>
/// <param name="cacheTimeout">
/// The cache timeout (lifespan) of this object. Must be 1 or greater.
/// Specify Timeout.Infinite to keep the entry forever.
/// </param>
/// <param name="restartTimerIfExists">
/// (Optional). If set to <c>true</c>, the timer for this cacheObject will be reset if the object already
/// exists in the cache. (Default = false).
/// </param>
public void AddOrUpdate(K key, T cacheObject, TimeSpan? cacheTimeout, bool restartTimerIfExists = false)
{
if (disposed)
{
return;
}

_locker.EnterWriteLock();
try
{
CheckTimer(key, cacheTimeout, restartTimerIfExists);

if (!_cache.ContainsKey(key))
{
_cache.Add(key, cacheObject);
}
else
{
_cache[key] = cacheObject;
}
}
finally
{
_locker.ExitWriteLock();
}
}

/// <summary>
/// Adds or updates the specified cache-key with the specified cacheObject and applies <c>Timeout.Infinite</c> to this
/// key.
/// </summary>
/// <param name="key">The cache-key to add or update.</param>
/// <param name="cacheObject">The cache object to store.</param>
public void AddOrUpdate(K key, T cacheObject)
{
AddOrUpdate(key, cacheObject, Timeout.InfiniteTimeSpan);
}

/// <summary>
/// Gets the cache entry with the specified key or returns <c>default(T)</c> if the key is not found.
/// </summary>
/// <param name="key">The cache-key to retrieve.</param>
/// <returns>The object from the cache or <c>default(T)</c>, if not found.</returns>
public T this[K key] => Get(key);

/// <summary>
/// Gets the cache entry with the specified key or return <c>default(T)</c> if the key is not found.
/// </summary>
/// <param name="key">The cache-key to retrieve.</param>
/// <returns>The object from the cache or <c>default(T)</c>, if not found.</returns>
public T Get(K key)
{
if (disposed)
{
return default(T);
}

_locker.EnterReadLock();
try
{
T rv;
return _cache.TryGetValue(key, out rv) ? rv : default(T);
}
finally
{
_locker.ExitReadLock();
}
}

/// <summary>
/// Tries to gets the cache entry with the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">(out) The value, if found, or <c>default(T)</c>, if not.</param>
/// <returns><c>True</c>, if <c>key</c> exists, otherwise <c>false</c>.</returns>
public bool TryGet(K key, out T value)
{
if (disposed)
{
value = default(T);
return false;
}

_locker.EnterReadLock();
try
{
return _cache.TryGetValue(key, out value);
}
finally
{
_locker.ExitReadLock();
}
}

/// <summary>
/// Removes a series of cache entries in a single call for all key that match the specified key pattern.
/// </summary>
/// <param name="keyPattern">The key pattern to remove. The Predicate has to return true to get key removed.</param>
public void Remove(Predicate<K> keyPattern)
{
if (disposed)
{
return;
}

_locker.EnterWriteLock();
try
{
var removers = (from k in _cache.Keys.Cast<K>()
where keyPattern(k)
select k).ToList();

foreach (var workKey in removers)
{
try
{
_timers[workKey].Dispose();
}
catch
{
}

_timers.Remove(workKey);
_cache.Remove(workKey);
}
}
finally
{
_locker.ExitWriteLock();
}
}

/// <summary>
/// Removes the specified cache entry with the specified key.
/// If the key is not found, no exception is thrown, the statement is just ignored.
/// </summary>
/// <param name="key">The cache-key to remove.</param>
public void Remove(K key)
{
if (disposed)
{
return;
}

_locker.EnterWriteLock();
try
{
if (_cache.ContainsKey(key))
{
try
{
_timers[key].Dispose();
}
catch
{
}

_timers.Remove(key);
_cache.Remove(key);
}
}
finally
{
_locker.ExitWriteLock();
}
}

/// <summary>
/// Checks if a specified key exists in the cache.
/// </summary>
/// <param name="key">The cache-key to check.</param>
/// <returns><c>True</c> if the key exists in the cache, otherwise <c>False</c>.</returns>
public bool Exists(K key)
{
if (disposed)
{
return false;
}

_locker.EnterReadLock();
try
{
return _cache.ContainsKey(key);
}
finally
{
_locker.ExitReadLock();
}
}

#endregion
}

#endregion

#region Other Cache classes (derived)

/// <summary>
/// This is a generic cache subsystem based on key/value pairs, where key is a string.
/// You can add any item to this cache as long as the key is unique, so treat keys as something like namespaces and
/// build them with a
/// specific system/syntax in your application.
/// Every cache entry has its own timeout.
/// Cache is thread safe and will delete expired entries on its own using System.Threading.Timers (which run on
/// <see cref="ThreadPool" /> threads).
/// </summary>
/// <summary>
/// The non-generic Cache class instanciates a Cache{object} that can be used with any type of (mixed) contents.
/// It also publishes a static <c>.Global</c> member, so a cache can be used even without creating a dedicated
/// instance.
/// The <c>.Global</c> member is lazy instanciated.
/// </summary>
internal class CapCache : Cache<string, object>
{
#region Static Global Cache instance

private static readonly Lazy<CapCache> global = new Lazy<CapCache>();

/// <summary>
/// Gets the global shared cache instance valid for the entire process.
/// </summary>
/// <value>
/// The global shared cache instance.
/// </value>
public static CapCache Global => global.Value;

#endregion
}

#endregion
}

+ 44
- 0
src/DotNetCore.CAP.Dashboard/CoercedAwaitableInfo.cs Ver fichero

@@ -0,0 +1,44 @@
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Linq.Expressions;
using Microsoft.Extensions.Internal;

namespace DotNetCore.CAP.Dashboard
{
internal struct CoercedAwaitableInfo
{
public AwaitableInfo AwaitableInfo { get; }
public Expression CoercerExpression { get; }
public Type CoercerResultType { get; }
public bool RequiresCoercion => CoercerExpression != null;

public CoercedAwaitableInfo(AwaitableInfo awaitableInfo)
{
AwaitableInfo = awaitableInfo;
CoercerExpression = null;
CoercerResultType = null;
}

public CoercedAwaitableInfo(Expression coercerExpression, Type coercerResultType,
AwaitableInfo coercedAwaitableInfo)
{
CoercerExpression = coercerExpression;
CoercerResultType = coercerResultType;
AwaitableInfo = coercedAwaitableInfo;
}

public static bool IsTypeAwaitable(Type type, out CoercedAwaitableInfo info)
{
if (AwaitableInfo.IsTypeAwaitable(type, out var directlyAwaitableInfo))
{
info = new CoercedAwaitableInfo(directlyAwaitableInfo);
return true;
}

info = default(CoercedAwaitableInfo);
return false;
}
}
}

+ 6
- 5
src/DotNetCore.CAP.Dashboard/CombinedResourceDispatcher.cs Ver fichero

@@ -2,6 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Reflection;
using System.Threading.Tasks;

namespace DotNetCore.CAP.Dashboard
{
@@ -22,14 +23,14 @@ namespace DotNetCore.CAP.Dashboard
_resourceNames = resourceNames;
}

protected override void WriteResponse(DashboardResponse response)
protected override async Task WriteResponse(DashboardResponse response)
{
foreach (var resourceName in _resourceNames)
{
WriteResource(
response,
_assembly,
$"{_baseNamespace}.{resourceName}");
await WriteResource(
response,
_assembly,
$"{_baseNamespace}.{resourceName}");
}
}
}

+ 4
- 3
src/DotNetCore.CAP.Dashboard/DashboardContext.cs Ver fichero

@@ -3,13 +3,14 @@

using System;
using System.Text.RegularExpressions;
using DotNetCore.CAP.Persistence;
using Microsoft.AspNetCore.Http;

namespace DotNetCore.CAP.Dashboard
{
public abstract class DashboardContext
{
protected DashboardContext(IStorage storage, DashboardOptions options)
protected DashboardContext(IDataStorage storage, DashboardOptions options)
{
if (storage == null)
{
@@ -25,7 +26,7 @@ namespace DotNetCore.CAP.Dashboard
Options = options;
}

public IStorage Storage { get; }
public IDataStorage Storage { get; }

public DashboardOptions Options { get; }

@@ -41,7 +42,7 @@ namespace DotNetCore.CAP.Dashboard
public sealed class CapDashboardContext : DashboardContext
{
public CapDashboardContext(
IStorage storage,
IDataStorage storage,
DashboardOptions options,
HttpContext httpContext)
: base(storage, options)


+ 5
- 5
src/DotNetCore.CAP.Dashboard/DashboardRoutes.cs Ver fichero

@@ -83,14 +83,14 @@ namespace DotNetCore.CAP.Dashboard
Routes.AddJsonResult("/published/message/(?<Id>.+)", x =>
{
var id = long.Parse(x.UriMatch.Groups["Id"].Value);
var message = x.Storage.GetConnection().GetPublishedMessageAsync(id)
var message = x.Storage.GetMonitoringApi().GetPublishedMessageAsync(id)
.GetAwaiter().GetResult();
return message.Content;
});
Routes.AddJsonResult("/received/message/(?<Id>.+)", x =>
{
var id = long.Parse(x.UriMatch.Groups["Id"].Value);
var message = x.Storage.GetConnection().GetReceivedMessageAsync(id)
var message = x.Storage.GetMonitoringApi().GetReceivedMessageAsync(id)
.GetAwaiter().GetResult();
return message.Content;
});
@@ -99,7 +99,7 @@ namespace DotNetCore.CAP.Dashboard
"/published/requeue",
(client, messageId) =>
{
var msg = client.Storage.GetConnection().GetPublishedMessageAsync(messageId)
var msg = client.Storage.GetMonitoringApi().GetPublishedMessageAsync(messageId)
.GetAwaiter().GetResult();
client.RequestServices.GetService<IDispatcher>().EnqueueToPublish(msg);
});
@@ -107,9 +107,9 @@ namespace DotNetCore.CAP.Dashboard
"/received/requeue",
(client, messageId) =>
{
var msg = client.Storage.GetConnection().GetReceivedMessageAsync(messageId)
var msg = client.Storage.GetMonitoringApi().GetReceivedMessageAsync(messageId)
.GetAwaiter().GetResult();
client.RequestServices.GetService<IDispatcher>().EnqueueToExecute(msg);
client.RequestServices.GetService<ISubscriberExecutor>().ExecuteAsync(msg);
});

Routes.AddRazorPage(


+ 141
- 27
src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj Ver fichero

@@ -2,8 +2,21 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWarn>1591</NoWarn>
</PropertyGroup>

<PropertyGroup>
<MSBuildCurrentFullPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe</MSBuildCurrentFullPath>
<RazorProjectFile>Razor.build</RazorProjectFile>
<InnerTargets>GenerateRazorClasses;Build</InnerTargets>
</PropertyGroup>

<Target Name="GenerateRazorClasses">
<Exec Command="&quot;$(MSBuildCurrentFullPath)&quot; $(RazorProjectFile) /v:quiet /nologo" Condition="Exists('$(MSBuildCurrentFullPath)')" />
<Warning Text="Classes for Razor files (*.cshtml) weren't re-generated: couldn't find the '$(MSBuildCurrentFullPath)' file" Condition="!Exists('$(MSBuildCurrentFullPath)')" />
</Target>

<ItemGroup>
<EmbeddedResource Include="Content\css\bootstrap.min.css" />
<EmbeddedResource Include="Content\css\cap.css" />
@@ -25,83 +38,129 @@
<EmbeddedResource Include="Content\js\rickshaw.min.js" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Consul" Version="0.7.2.6" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DotNetCore.CAP\DotNetCore.CAP.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Dashboard\Content\resx\Strings.Designer.cs">
<Compile Update="Content\resx\Strings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\_SidebarMenu.generated.cs">
<Compile Update="Pages\_BlockMetric.generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>_BlockMetric.cshtml</DependentUpon>
</Compile>
<Compile Update="Pages\_SidebarMenu.generated.cs">
<DependentUpon>_SidebarMenu.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Dashboard\Pages\SidebarMenu.cs">
<Compile Update="Pages\SidebarMenu.cs">
<DependentUpon>_SidebarMenu.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\ReceivedPage.generated.cs">
<Compile Update="Pages\ReceivedPage.generated.cs">
<DependentUpon>ReceivedPage.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Dashboard\Pages\ReceivedPage.cs">
<Compile Update="Pages\ReceivedPage.cs">
<DependentUpon>ReceivedPage.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\_BlockMetric.generated.cs">
<DependentUpon>_BlockMetric.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\BlockMetric.cs">
<Compile Update="Pages\BlockMetric.cs">
<DependentUpon>_BlockMetric.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\Breadcrumbs.cs">
<Compile Update="Pages\Breadcrumbs.cs">
<DependentUpon>_Breadcrumbs.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\_Breadcrumbs.generated.cs">
<Compile Update="Pages\_Breadcrumbs.generated.cs">
<DependentUpon>_Breadcrumbs.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Dashboard\Pages\_Paginator.generated.cs">
<Compile Update="Pages\_Paginator.generated.cs">
<DependentUpon>_Paginator.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Dashboard\Pages\_Paginator.cs">
<Compile Update="Pages\_Paginator.cs">
<DependentUpon>_Paginator.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\_PerPageSelector.cs">
<Compile Update="Pages\_PerPageSelector.cs">
<DependentUpon>_PerPageSelector.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\_PerPageSelector.generated.cs">
<Compile Update="Pages\_PerPageSelector.generated.cs">
<DependentUpon>_PerPageSelector.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Dashboard\Pages\PublishedPage.cs">
<Compile Update="Pages\PublishedPage.cs">
<DependentUpon>PublishedPage.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\PublishedPage*.cs">
<Compile Update="Pages\PublishedPage*.cs">
<DependentUpon>PublishedPage.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\LayoutPage.*.cs">
<Compile Update="Pages\LayoutPage.*.cs">
<DependentUpon>LayoutPage.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\LayoutPage.cs">
<Compile Update="Pages\LayoutPage.cs">
<DependentUpon>LayoutPage.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\InlineMetric.cs">
<Compile Update="Pages\InlineMetric.cs">
<DependentUpon>_InlineMetric.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\_InlineMetric.generated.cs">
<Compile Update="Pages\LayoutPage.generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>LayoutPage.cshtml</DependentUpon>
</Compile>
<Compile Update="Pages\PublishedPage.generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>PublishedPage.cshtml</DependentUpon>
</Compile>
<Compile Update="Pages\_InlineMetric.generated.cs">
<DependentUpon>_InlineMetric.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Dashboard\Pages\_Navigation.generated.cs">
<Compile Update="Pages\_Navigation.generated.cs">
<DependentUpon>_Navigation.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Dashboard\Pages\HomePage.generated.cs">
<Compile Update="Pages\HomePage.generated.cs">
<DependentUpon>HomePage.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Dashboard\Pages\HomePage.cs">
<Compile Update="Pages\HomePage.cs">
<DependentUpon>HomePage.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\SubscriberPage.generated.cs">
<Compile Update="Pages\SubscriberPage.generated.cs">
<DependentUpon>SubscriberPage.cshtml</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Pages\NodePage*.cs">
<DependentUpon>NodePage.cshtml</DependentUpon>
</Compile>
<Compile Update="Dashboard\Pages\NodePage*.cs">
</ItemGroup>

<ItemGroup>
<Compile Update="Pages\NodePage.generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>NodePage.cshtml</DependentUpon>
</Compile>
</ItemGroup>
@@ -115,11 +174,66 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Dashboard\Content\resx\Strings.resx">
<EmbeddedResource Update="Content\resx\Strings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<CustomToolNamespace>DotNetCore.CAP.Dashboard.Resources</CustomToolNamespace>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="Pages\HomePage.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>HomePage.generated.cs</LastGenOutput>
</None>
<None Update="Pages\LayoutPage.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>LayoutPage.generated.cs</LastGenOutput>
</None>
<None Update="Pages\NodePage.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>NodePage.generated.cs</LastGenOutput>
</None>
<None Update="Pages\PublishedPage.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>PublishedPage.generated.cs</LastGenOutput>
</None>
<None Update="Pages\ReceivedPage.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>ReceivedPage.generated.cs</LastGenOutput>
</None>
<None Update="Pages\SubscriberPage.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>SubscriberPage.generated.cs</LastGenOutput>
</None>
<None Update="Pages\_BlockMetric.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_BlockMetric.generated.cs</LastGenOutput>
</None>
<None Update="Pages\_Breadcrumbs.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_Breadcrumbs.generated.cs</LastGenOutput>
</None>
<None Update="Pages\_InlineMetric.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_InlineMetric.generated.cs</LastGenOutput>
</None>
<None Update="Pages\_Navigation.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_Navigation.generated.cs</LastGenOutput>
</None>
<None Update="Pages\_Paginator.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_Paginator.generated.cs</LastGenOutput>
</None>
<None Update="Pages\_PerPageSelector.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_PerPageSelector.generated.cs</LastGenOutput>
</None>
<None Update="Pages\_SidebarMenu.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_SidebarMenu.generated.cs</LastGenOutput>
</None>
</ItemGroup>

</Project>

+ 6
- 9
src/DotNetCore.CAP.Dashboard/EmbeddedResourceDispatcher.cs Ver fichero

@@ -30,22 +30,20 @@ namespace DotNetCore.CAP.Dashboard
}
}

public Task Dispatch(DashboardContext context)
public async Task Dispatch(DashboardContext context)
{
context.Response.ContentType = _contentType;
context.Response.SetExpire(DateTimeOffset.Now.AddYears(1));

WriteResponse(context.Response);

return Task.FromResult(true);
await WriteResponse(context.Response);
}

protected virtual void WriteResponse(DashboardResponse response)
protected virtual Task WriteResponse(DashboardResponse response)
{
WriteResource(response, _assembly, _resourceName);
return WriteResource(response, _assembly, _resourceName);
}

protected void WriteResource(DashboardResponse response, Assembly assembly, string resourceName)
protected async Task WriteResource(DashboardResponse response, Assembly assembly, string resourceName)
{
using (var inputStream = assembly.GetManifestResourceStream(resourceName))
{
@@ -54,8 +52,7 @@ namespace DotNetCore.CAP.Dashboard
throw new ArgumentException(
$@"Resource with name {resourceName} not found in assembly {assembly}.");
}

inputStream.CopyTo(response.Body);
await inputStream.CopyToAsync(response.Body);
}
}
}

+ 1
- 1
src/DotNetCore.CAP.Dashboard/GatewayProxy/GatewayProxyMiddleware.cs Ver fichero

@@ -9,7 +9,7 @@ using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using DotNetCore.CAP.Dashboard.GatewayProxy.Requester;
using DotNetCore.CAP.NodeDiscovery;
using DotNetCore.CAP.Dashboard.NodeDiscovery;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;


+ 1
- 1
src/DotNetCore.CAP.Dashboard/HtmlHelper.cs Ver fichero

@@ -10,7 +10,7 @@ using System.Text;
using System.Text.RegularExpressions;
using DotNetCore.CAP.Dashboard.Pages;
using DotNetCore.CAP.Dashboard.Resources;
using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages;
using Microsoft.Extensions.Internal;



+ 1
- 1
src/DotNetCore.CAP.Dashboard/JsonDispatcher.cs Ver fichero

@@ -38,7 +38,7 @@ namespace DotNetCore.CAP.Dashboard
{
new StringEnumConverter
{
NamingStrategy = new CamelCaseNamingStrategy()
CamelCaseText= true
}
}
};


+ 2
- 2
src/DotNetCore.CAP.Dashboard/JsonStats.cs Ver fichero

@@ -34,7 +34,7 @@ namespace DotNetCore.CAP.Dashboard
{
new StringEnumConverter
{
NamingStrategy = new CamelCaseNamingStrategy()
CamelCaseText = true
}
}
};
@@ -46,7 +46,7 @@ namespace DotNetCore.CAP.Dashboard

private class StubPage : RazorPage
{
protected override void Execute()
public override void Execute()
{
}
}


+ 1
- 1
src/DotNetCore.CAP.Dashboard/LocalRequestsOnlyAuthorizationFilter.cs Ver fichero

@@ -1,7 +1,7 @@
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Internal;

namespace DotNetCore.CAP.Dashboard
{


+ 9
- 9
src/DotNetCore.CAP.Dashboard/MessageHistoryRenderer.cs Ver fichero

@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Text;
using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Internal;

namespace DotNetCore.CAP.Dashboard
{
@@ -24,16 +24,16 @@ namespace DotNetCore.CAP.Dashboard
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
static MessageHistoryRenderer()
{
Register(StatusName.Succeeded, SucceededRenderer);
Register(StatusName.Failed, FailedRenderer);
Register(nameof(StatusName.Succeeded), SucceededRenderer);
Register(nameof(StatusName.Failed), FailedRenderer);

BackgroundStateColors.Add(StatusName.Succeeded, "#EDF7ED");
BackgroundStateColors.Add(StatusName.Failed, "#FAEBEA");
BackgroundStateColors.Add(StatusName.Scheduled, "#E0F3F8");
BackgroundStateColors.Add(nameof(StatusName.Succeeded), "#EDF7ED");
BackgroundStateColors.Add(nameof(StatusName.Failed), "#FAEBEA");
BackgroundStateColors.Add(nameof(StatusName.Scheduled), "#E0F3F8");

ForegroundStateColors.Add(StatusName.Succeeded, "#5cb85c");
ForegroundStateColors.Add(StatusName.Failed, "#d9534f");
ForegroundStateColors.Add(StatusName.Scheduled, "#5bc0de");
ForegroundStateColors.Add(nameof(StatusName.Succeeded), "#5cb85c");
ForegroundStateColors.Add(nameof(StatusName.Failed), "#d9534f");
ForegroundStateColors.Add(nameof(StatusName.Scheduled), "#5bc0de");
}

public static void AddBackgroundStateColor(string stateName, string color)


+ 2
- 2
src/DotNetCore.CAP.Dashboard/Pages/BlockMetric.cs Ver fichero

@@ -7,9 +7,9 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
public BlockMetric(DashboardMetric dashboardMetric)
{
DashboardMetric = dashboardMetric;
Metric = dashboardMetric;
}

public DashboardMetric DashboardMetric { get; }
public DashboardMetric Metric { get; }
}
}

+ 210
- 228
src/DotNetCore.CAP.Dashboard/Pages/HomePage.generated.cs Ver fichero

@@ -1,6 +1,4 @@
using DotNetCore.CAP.Messages;

#pragma warning disable 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -13,63 +11,45 @@

namespace DotNetCore.CAP.Dashboard.Pages
{

#line 2 "..\..\HomePage.cshtml"
using System;

#line default
#line hidden

#line 3 "..\..\HomePage.cshtml"
using System.Collections.Generic;

#line default
#line hidden
using System.Linq;
using System.Text;

#line 5 "..\..\HomePage.cshtml"
using DotNetCore.CAP.Dashboard;

#line default
#line hidden

#line 6 "..\..\HomePage.cshtml"
#line 2 "..\..\Pages\HomePage.cshtml"
using DotNetCore.CAP.Dashboard.Pages;
#line default
#line hidden
#line 7 "..\..\HomePage.cshtml"
#line default
#line hidden
#line 3 "..\..\Pages\HomePage.cshtml"
using DotNetCore.CAP.Dashboard.Resources;

#line default
#line hidden

#line 4 "..\..\HomePage.cshtml"
#line default
#line hidden

#line 8 "..\..\HomePage.cshtml"
#line default
#line hidden
#line 4 "..\..\Pages\HomePage.cshtml"
using DotNetCore.CAP.Messages;
#line default
#line hidden
#line 5 "..\..\Pages\HomePage.cshtml"
using Newtonsoft.Json;

#line default
#line hidden
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
internal partial class HomePage : RazorPage
internal partial class HomePage : DotNetCore.CAP.Dashboard.RazorPage
{
#line hidden

protected override void Execute()
public override void Execute()
{


WriteLiteral("\r\n");




WriteLiteral("\r\n");



@@ -77,175 +57,177 @@ namespace DotNetCore.CAP.Dashboard.Pages



#line 10 "..\..\HomePage.cshtml"
#line 7 "..\..\Pages\HomePage.cshtml"
Layout = new LayoutPage(Strings.HomePage_Title);

Layout = new LayoutPage(Strings.HomePage_Title);
var monitor = Storage.GetMonitoringApi();
var publishedSucceeded = monitor.HourlySucceededJobs(MessageType.Publish);
var publishedFailed = monitor.HourlyFailedJobs(MessageType.Publish);

var monitor = Storage.GetMonitoringApi();
IDictionary<DateTime, int> publishedSucceeded = monitor.HourlySucceededJobs(MessageType.Publish);
IDictionary<DateTime, int> publishedFailed = monitor.HourlyFailedJobs(MessageType.Publish);
var receivedSucceeded = monitor.HourlySucceededJobs(MessageType.Subscribe);
var receivedFailed = monitor.HourlyFailedJobs(MessageType.Subscribe);

IDictionary<DateTime, int> receivedSucceeded = monitor.HourlySucceededJobs(MessageType.Subscribe);
IDictionary<DateTime, int> receivedFailed = monitor.HourlyFailedJobs(MessageType.Subscribe);

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


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



#line 23 "..\..\HomePage.cshtml"
Write(Strings.HomePage_Title);


#line default
#line hidden
WriteLiteral("</h1>\r\n");
#line 20 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_Title);

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


#line 24 "..\..\HomePage.cshtml"
if (Metrics.Count > 0)
{


#line default
#line hidden
WriteLiteral(" <div class=\"row\">\r\n");
#line 21 "..\..\Pages\HomePage.cshtml"
if (Metrics.Count > 0)
{

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


#line 27 "..\..\HomePage.cshtml"
foreach (var metric in Metrics)
#line 24 "..\..\Pages\HomePage.cshtml"
foreach (var metric in Metrics)
{

#line default
#line hidden
WriteLiteral(" <div class=\"col-md-2\">\r\n ");

#line default
#line hidden
WriteLiteral(" <div class=\"col-md-2\">\r\n ");



#line 30 "..\..\HomePage.cshtml"
Write(Html.BlockMetric(metric));

#line 27 "..\..\Pages\HomePage.cshtml"
Write(Html.BlockMetric(metric));

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


#line 32 "..\..\HomePage.cshtml"
#line 29 "..\..\Pages\HomePage.cshtml"
}


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



#line 34 "..\..\HomePage.cshtml"
}


#line default
#line hidden
WriteLiteral(" <h3>");

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


#line 35 "..\..\HomePage.cshtml"
Write(Strings.HomePage_RealtimeGraph);


#line default
#line hidden
WriteLiteral("</h3>\r\n <div id=\"realtimeGraph\"\r\n data-published-succeeded=\"");



#line 37 "..\..\HomePage.cshtml"
Write(Statistics.PublishedSucceeded);


#line default
#line hidden
WriteLiteral("\"\r\n data-published-failed=\"");



#line 38 "..\..\HomePage.cshtml"
Write(Statistics.PublishedFailed);

#line 31 "..\..\Pages\HomePage.cshtml"
}

#line default
#line hidden
WriteLiteral("\"\r\n data-published-succeeded-string=\"");
#line default
#line hidden
WriteLiteral(" <h3>");


#line 32 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_RealtimeGraph);

#line 39 "..\..\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_PSucceeded);
#line default
#line hidden
WriteLiteral("</h3>\r\n <div id=\"realtimeGraph\"\r\n data-published-succeeded=\"");


#line default
#line hidden
WriteLiteral("\"\r\n data-published-failed-string=\"");
#line 34 "..\..\Pages\HomePage.cshtml"
Write(Statistics.PublishedSucceeded);

#line default
#line hidden
WriteLiteral("\"\r\n data-published-failed=\"");


#line 40 "..\..\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_PFailed);
#line 35 "..\..\Pages\HomePage.cshtml"
Write(Statistics.PublishedFailed);

#line default
#line hidden
WriteLiteral("\"\r\n data-published-succeeded-string=\"");

#line default
#line hidden
WriteLiteral("\"\r\n data-received-succeeded=\"");

#line 36 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_PSucceeded);

#line default
#line hidden
WriteLiteral("\"\r\n data-published-failed-string=\"");

#line 41 "..\..\HomePage.cshtml"
Write(Statistics.ReceivedSucceeded);

#line 37 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_PFailed);

#line default
#line hidden
WriteLiteral("\"\r\n data-received-failed=\"");
#line default
#line hidden
WriteLiteral("\"\r\n data-received-succeeded=\"");


#line 38 "..\..\Pages\HomePage.cshtml"
Write(Statistics.ReceivedSucceeded);

#line 42 "..\..\HomePage.cshtml"
Write(Statistics.ReceivedFailed);
#line default
#line hidden
WriteLiteral("\"\r\n data-received-failed=\"");


#line default
#line hidden
WriteLiteral("\"\r\n data-received-succeeded-string=\"");
#line 39 "..\..\Pages\HomePage.cshtml"
Write(Statistics.ReceivedFailed);

#line default
#line hidden
WriteLiteral("\"\r\n data-received-succeeded-string=\"");


#line 43 "..\..\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_RSucceeded);
#line 40 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_RSucceeded);

#line default
#line hidden
WriteLiteral("\"\r\n data-received-failed-string=\"");

#line default
#line hidden
WriteLiteral("\"\r\n data-received-failed-string=\"");

#line 41 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_RFailed);


#line 44 "..\..\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_RFailed);


#line default
#line hidden
WriteLiteral(@"""></div>
#line default
#line hidden
WriteLiteral(@""">
</div>
<div style=""display: none;"">
<span data-metric=""published_succeeded:count""></span>
<span data-metric=""published_failed:count""></span>
@@ -257,95 +239,95 @@ namespace DotNetCore.CAP.Dashboard.Pages
");


#line 51 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_HistoryGraph);

#line 53 "..\..\HomePage.cshtml"
Write(Strings.HomePage_HistoryGraph);

#line default
#line hidden
WriteLiteral("\r\n </h3>\r\n\r\n <div id=\"historyGraph\"\r\n data-published-su" +
"cceeded=\"");

#line default
#line hidden
WriteLiteral("\r\n </h3>\r\n\r\n <div id=\"historyGraph\"\r\n data-published-su" +
"cceeded=\"");



#line 57 "..\..\HomePage.cshtml"
Write(JsonConvert.SerializeObject(publishedSucceeded));


#line default
#line hidden
WriteLiteral("\"\r\n data-published-failed=\"");



#line 58 "..\..\HomePage.cshtml"
Write(JsonConvert.SerializeObject(publishedFailed));


#line default
#line hidden
WriteLiteral("\"\r\n data-published-succeeded-string=\"");

#line 55 "..\..\Pages\HomePage.cshtml"
Write(JsonConvert.SerializeObject(publishedSucceeded));

#line default
#line hidden
WriteLiteral("\"\r\n data-published-failed=\"");

#line 59 "..\..\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_PSucceeded);

#line 56 "..\..\Pages\HomePage.cshtml"
Write(JsonConvert.SerializeObject(publishedFailed));

#line default
#line hidden
WriteLiteral("\"\r\n data-published-failed-string=\"");
#line default
#line hidden
WriteLiteral("\"\r\n data-published-succeeded-string=\"");


#line 57 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_PSucceeded);

#line 60 "..\..\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_PFailed);
#line default
#line hidden
WriteLiteral("\"\r\n data-published-failed-string=\"");


#line default
#line hidden
WriteLiteral("\"\r\n data-received-succeeded=\"");
#line 58 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_PFailed);

#line default
#line hidden
WriteLiteral("\"\r\n data-received-succeeded=\"");


#line 61 "..\..\HomePage.cshtml"
Write(JsonConvert.SerializeObject(receivedSucceeded));
#line 59 "..\..\Pages\HomePage.cshtml"
Write(JsonConvert.SerializeObject(receivedSucceeded));

#line default
#line hidden
WriteLiteral("\"\r\n data-received-failed=\"");

#line default
#line hidden
WriteLiteral("\"\r\n data-received-failed=\"");

#line 60 "..\..\Pages\HomePage.cshtml"
Write(JsonConvert.SerializeObject(receivedFailed));

#line default
#line hidden
WriteLiteral("\"\r\n data-received-succeeded-string=\"");

#line 62 "..\..\HomePage.cshtml"
Write(JsonConvert.SerializeObject(receivedFailed));

#line 61 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_RSucceeded);

#line default
#line hidden
WriteLiteral("\"\r\n data-received-succeeded-string=\"");
#line default
#line hidden
WriteLiteral("\"\r\n data-received-failed-string=\"");


#line 62 "..\..\Pages\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_RFailed);

#line 63 "..\..\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_RSucceeded);


#line default
#line hidden
WriteLiteral("\"\r\n data-received-failed-string=\"");



#line 64 "..\..\HomePage.cshtml"
Write(Strings.HomePage_GraphHover_RFailed);


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


}


+ 206
- 213
src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.generated.cs Ver fichero

@@ -11,313 +11,306 @@

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

protected override void Execute()
public override void Execute()
{


WriteLiteral("\r\n");






WriteLiteral("\r\n");

WriteLiteral("<!DOCTYPE html>\r\n<html lang=\"");



#line 9 "..\..\LayoutPage.cshtml"
Write(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);


#line default
#line hidden
WriteLiteral("\">\r\n<head>\r\n <title>");



#line 11 "..\..\LayoutPage.cshtml"
Write(Title);
WriteLiteral("<!DOCTYPE html>\r\n<html lang=\"");


#line default
#line hidden
WriteLiteral(" - CAP</title>\r\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n <m" +
"eta charset=\"utf-8\">\r\n <meta name=\"viewport\" content=\"width=device-width, ini" +
"tial-scale=1.0\">\r\n");
#line 9 "..\..\Pages\LayoutPage.cshtml"
Write(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

#line default
#line hidden
WriteLiteral("\">\r\n<head>\r\n <title>");


#line 15 "..\..\LayoutPage.cshtml"
var version = GetType().GetTypeInfo().Assembly.GetName().Version;
#line 11 "..\..\Pages\LayoutPage.cshtml"
Write(Title);

#line default
#line hidden
WriteLiteral(" - CAP</title>\r\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n <m" +
"eta charset=\"utf-8\">\r\n <meta name=\"viewport\" content=\"width=device-width, ini" +
"tial-scale=1.0\">\r\n");

#line default
#line hidden
WriteLiteral(" <link rel=\"stylesheet\" href=\"");

#line 15 "..\..\Pages\LayoutPage.cshtml"
var version = GetType().GetTypeInfo().Assembly.GetName().Version;

#line default
#line hidden
WriteLiteral(" <link rel=\"stylesheet\" href=\"");

#line 16 "..\..\LayoutPage.cshtml"
Write(Url.To($"/css{version.Major}{version.Minor}{version.Build}"));

#line 16 "..\..\Pages\LayoutPage.cshtml"
Write(Url.To($"/css{version.Major}{version.Minor}{version.Build}"));

#line default
#line hidden
WriteLiteral(@""">
#line default
#line hidden
WriteLiteral(@""">
</head>
<body>
<!-- Wrap all page content here -->
<div id=""wrap"">

<!-- Fixed navbar -->
<div class=""navbar navbar-default navbar-fixed-top"">
<div class=""container"">
<div class=""navbar-header"">
<button type=""button"" class=""navbar-toggle"" data-toggle=""collapse"" data-target="".navbar-collapse"">
<span class=""icon-bar""></span>
<span class=""icon-bar""></span>
<span class=""icon-bar""></span>
</button>
<a class=""navbar-brand"" href=""");



#line 31 "..\..\LayoutPage.cshtml"
Write(Url.Home());


#line default
#line hidden
WriteLiteral("\">CAP Dashboard</a>\r\n </div>\r\n <div class=\"collapse" +
" navbar-collapse\">\r\n ");



#line 34 "..\..\LayoutPage.cshtml"
Write(Html.RenderPartial(new Navigation()));


#line default
#line hidden
WriteLiteral("\r\n");



#line 35 "..\..\LayoutPage.cshtml"
if (AppPath != null)
{


#line default
#line hidden
WriteLiteral(" <ul class=\"nav navbar-nav navbar-right\">\r\n " +
" <li>\r\n <a href=\"");



#line 39 "..\..\LayoutPage.cshtml"
Write(AppPath);


#line default
#line hidden
WriteLiteral("\">\r\n <span class=\"glyphicon glyphicon-log-out\"" +
"></span>\r\n ");

<!-- Wrap all page content here -->
<div id=""wrap"">

<!-- Fixed navbar -->
<div class=""navbar navbar-default navbar-fixed-top"">
<div class=""container"">
<div class=""navbar-header"">
<button type=""button"" class=""navbar-toggle"" data-toggle=""collapse"" data-target="".navbar-collapse"">
<span class=""icon-bar""></span>
<span class=""icon-bar""></span>
<span class=""icon-bar""></span>
</button>
<a class=""navbar-brand"" href=""");

#line 41 "..\..\LayoutPage.cshtml"
Write(Strings.LayoutPage_Back);

#line 31 "..\..\Pages\LayoutPage.cshtml"
Write(Url.Home());

#line default
#line hidden
WriteLiteral("\r\n </a>\r\n </li>\r\n " +
" </ul>\r\n");
#line default
#line hidden
WriteLiteral("\">CAP Dashboard</a>\r\n </div>\r\n <div class=\"collapse navbar-" +
"collapse\">\r\n ");


#line 34 "..\..\Pages\LayoutPage.cshtml"
Write(Html.RenderPartial(new Navigation()));

#line 45 "..\..\LayoutPage.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");


#line default
#line hidden
WriteLiteral(" </div>\r\n <!--/.nav-collapse -->\r\n </div" +
">\r\n </div>\r\n\r\n <!-- Begin page content -->\r\n <div class=\"co" +
"ntainer\" style=\"margin-bottom: 20px;\">\r\n ");
#line 35 "..\..\Pages\LayoutPage.cshtml"
if (AppPath != null)
{

#line default
#line hidden
WriteLiteral(" <ul class=\"nav navbar-nav navbar-right\">\r\n " +
" <li>\r\n <a href=\"");


#line 53 "..\..\LayoutPage.cshtml"
Write(RenderBody());
#line 39 "..\..\Pages\LayoutPage.cshtml"
Write(AppPath);

#line default
#line hidden
WriteLiteral("\">\r\n <span class=\"glyphicon glyphicon-log-out\"></s" +
"pan>\r\n ");

#line default
#line hidden
WriteLiteral(@"
</div>
</div>

<div id=""footer"">
<div class=""container"">
<ul class=""list-inline credit"">
<li>
<a href=""https://github.com/dotnetcore/cap/"" target=""_blank"">
CAP ");
#line 41 "..\..\Pages\LayoutPage.cshtml"
Write(Strings.LayoutPage_Back);

#line default
#line hidden
WriteLiteral("\r\n </a>\r\n </li>\r\n " +
" </ul>\r\n");


#line 62 "..\..\LayoutPage.cshtml"
Write($"{version.Major}.{version.Minor}.{version.Build}");
#line 45 "..\..\Pages\LayoutPage.cshtml"
}

#line default
#line hidden
WriteLiteral(" </div>\r\n <!--/.nav-collapse -->\r\n </div>\r\n </div" +
">\r\n\r\n <!-- Begin page content -->\r\n <div class=\"container\" style=\"margin-b" +
"ottom: 20px;\">\r\n ");

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

#line 53 "..\..\Pages\LayoutPage.cshtml"
Write(RenderBody());

#line default
#line hidden
WriteLiteral("\r\n </div>\r\n</div>\r\n\r\n<div id=\"footer\">\r\n <div class=\"container\">\r\n <" +
"ul class=\"list-inline credit\">\r\n <li>\r\n <a href=\"https" +
"://github.com/dotnetcore/cap/\" target=\"_blank\">\r\n CAP ");

#line 65 "..\..\LayoutPage.cshtml"
Write(Storage);

#line 62 "..\..\Pages\LayoutPage.cshtml"
Write($"{version.Major}.{version.Minor}.{version.Build}");

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


#line 65 "..\..\Pages\LayoutPage.cshtml"
Write(Storage);

#line 66 "..\..\LayoutPage.cshtml"
Write(Strings.LayoutPage_Footer_Time);
#line default
#line hidden
WriteLiteral("</li>\r\n <li>");


#line default
#line hidden
WriteLiteral(" ");
#line 66 "..\..\Pages\LayoutPage.cshtml"
Write(Strings.LayoutPage_Footer_Time);

#line default
#line hidden
WriteLiteral(" ");


#line 66 "..\..\LayoutPage.cshtml"
Write(Html.LocalTime(DateTime.UtcNow));
#line 66 "..\..\Pages\LayoutPage.cshtml"
Write(Html.LocalTime(DateTime.UtcNow));

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


#line 67 "..\..\Pages\LayoutPage.cshtml"
Write(string.Format(Strings.LayoutPage_Footer_Generatedms, GenerationTime.Elapsed.TotalMilliseconds.ToString("N")));

#line 67 "..\..\LayoutPage.cshtml"
Write(string.Format(Strings.LayoutPage_Footer_Generatedms, GenerationTime.Elapsed.TotalMilliseconds.ToString("N")));
#line default
#line hidden
WriteLiteral("</li>\r\n");


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



#line 68 "..\..\LayoutPage.cshtml"
if (NodeName != null)
#line 68 "..\..\Pages\LayoutPage.cshtml"
if (NodeName != null)
{

#line default
#line hidden
WriteLiteral(" <li>");
#line default
#line hidden
WriteLiteral(" <li>");


#line 70 "..\..\Pages\LayoutPage.cshtml"
Write(string.Format(Strings.LayoutPage_Footer_NodeCurrent, NodeName));

#line 70 "..\..\LayoutPage.cshtml"
Write(string.Format(Strings.LayoutPage_Footer_NodeCurrent, NodeName));
#line default
#line hidden
WriteLiteral("</li>\r\n");


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



#line 71 "..\..\LayoutPage.cshtml"
#line 71 "..\..\Pages\LayoutPage.cshtml"
}

#line default
#line hidden
WriteLiteral(" </ul>\r\n </div>\r\n</div>\r\n\r\n<div id=\"capConfig\"\r\n data-pollinterval=" +
"\"");

#line default
#line hidden
WriteLiteral(" </ul>\r\n </div>\r\n </div>\r\n\r\n <div id=\"capConfig\"\r\n " +
" data-pollinterval=\"");

#line 77 "..\..\Pages\LayoutPage.cshtml"
Write(StatsPollingInterval);

#line default
#line hidden
WriteLiteral("\"\r\n data-pollurl=\"");

#line 77 "..\..\LayoutPage.cshtml"
Write(StatsPollingInterval);

#line 78 "..\..\Pages\LayoutPage.cshtml"
Write(Url.To("/stats"));

#line default
#line hidden
WriteLiteral("\"\r\n data-pollurl=\"");



#line 78 "..\..\LayoutPage.cshtml"
Write(Url.To("/stats"));


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

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


#line 81 "..\..\LayoutPage.cshtml"
Write(Url.To($"/js{version.Major}{version.Minor}{version.Build}"));
#line 81 "..\..\Pages\LayoutPage.cshtml"
Write(Url.To($"/js{version.Major}{version.Minor}{version.Build}"));

#line default
#line hidden
WriteLiteral("\"></script>\r\n</body>\r\n</html>");
#line default
#line hidden
WriteLiteral("\"></script>\r\n</body>\r\n</html>");


}


+ 1
- 1
src/DotNetCore.CAP.Dashboard/Pages/NodePage.cs Ver fichero

@@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Collections.Generic;
using DotNetCore.CAP.NodeDiscovery;
using DotNetCore.CAP.Dashboard.NodeDiscovery;
using Microsoft.Extensions.DependencyInjection;

namespace DotNetCore.CAP.Dashboard.Pages


+ 162
- 163
src/DotNetCore.CAP.Dashboard/Pages/NodePage.generated.cs Ver fichero

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

protected override void Execute()
public override void Execute()
{


WriteLiteral("\r\n");






#line 5 "..\..\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 10 "..\..\NodePage.cshtml"
Write(Strings.NodePage_Title);


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



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


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



#line 15 "..\..\NodePage.cshtml"
Write(Strings.NodePage_NoNodes);


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



#line 17 "..\..\NodePage.cshtml"
}
else
{


#line default
#line hidden
WriteLiteral(" <div class=\"table-responsive\">\r\n <table class=\"table\">" +
"\r\n <thead>\r\n <tr>\r\n " +
" <th width=\"10%\">");



#line 24 "..\..\NodePage.cshtml"
Write(Strings.Common_Id);


#line default
#line hidden
WriteLiteral("</th>\r\n <th width=\"20%\">");



#line 25 "..\..\NodePage.cshtml"
Write(Strings.NodePage_Table_NodeName);


#line default
#line hidden
WriteLiteral("</th>\r\n <th width=\"20%\">");

WriteLiteral("\r\n");


#line 26 "..\..\NodePage.cshtml"
Write(Strings.NodePage_Table_IP);


#line default
#line hidden
WriteLiteral("</th>\r\n <th width=\"7%\">");

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


#line 27 "..\..\NodePage.cshtml"
Write(Strings.NodePage_Table_Port);
#line default
#line hidden
WriteLiteral("<div class=\"row\">\r\n <div class=\"col-md-12\">\r\n <h1 class=\"page-header\">");


#line default
#line hidden
WriteLiteral("</th>\r\n <th>Tags</th>\r\n <th" +
" width=\"20%\">");
#line 10 "..\..\Pages\NodePage.cshtml"
Write(Strings.NodePage_Title);

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


#line 29 "..\..\NodePage.cshtml"
Write(Strings.NodePage_Switch);
#line 12 "..\..\Pages\NodePage.cshtml"
if (Nodes == null || Nodes.Count == 0)
{

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

#line default
#line hidden
WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n " +
" <tbody>\r\n");

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

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

#line 33 "..\..\NodePage.cshtml"
foreach (var node in Nodes)
{

#line 17 "..\..\Pages\NodePage.cshtml"
}
else
{

#line default
#line hidden
WriteLiteral(" <tr class=\"");
#line default
#line hidden
WriteLiteral(" <div class=\"table-responsive\">\r\n <table class=\"table\">" +
"\r\n <thead>\r\n <tr>\r\n " +
" <th width=\"10%\">");


#line 24 "..\..\Pages\NodePage.cshtml"
Write(Strings.Common_Id);

#line 35 "..\..\NodePage.cshtml"
Write(CurrentNodeId == node.Id ? "active" : null);
#line default
#line hidden
WriteLiteral("</th>\r\n <th width=\"20%\">");


#line default
#line hidden
WriteLiteral("\">\r\n <td>");
#line 25 "..\..\Pages\NodePage.cshtml"
Write(Strings.NodePage_Table_NodeName);

#line default
#line hidden
WriteLiteral("</th>\r\n <th width=\"20%\">");


#line 36 "..\..\NodePage.cshtml"
Write(node.Id);
#line 26 "..\..\Pages\NodePage.cshtml"
Write(Strings.NodePage_Table_IP);

#line default
#line hidden
WriteLiteral("</th>\r\n <th width=\"7%\">");

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

#line 27 "..\..\Pages\NodePage.cshtml"
Write(Strings.NodePage_Table_Port);

#line default
#line hidden
WriteLiteral("</th>\r\n <th>Tags</th>\r\n <th width=\"" +
"20%\">");

#line 37 "..\..\NodePage.cshtml"
Write(node.Name);

#line 29 "..\..\Pages\NodePage.cshtml"
Write(Strings.NodePage_Switch);

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


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

#line 38 "..\..\NodePage.cshtml"
Write(node.Address);
#line default
#line hidden
WriteLiteral(" <tr class=\"");


#line default
#line hidden
WriteLiteral("</td>\r\n <td>");
#line 35 "..\..\Pages\NodePage.cshtml"
Write(CurrentNodeId == node.Id ? "active" : null);

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


#line 39 "..\..\NodePage.cshtml"
Write(node.Port);
#line 36 "..\..\Pages\NodePage.cshtml"
Write(node.Id);

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

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

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

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

#line 40 "..\..\NodePage.cshtml"
Write(node.Tags);

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

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


#line 39 "..\..\Pages\NodePage.cshtml"
Write(node.Port);

#line 42 "..\..\NodePage.cshtml"
Write(Html.NodeSwitchLink(node.Id));
#line default
#line hidden
WriteLiteral("</td>\r\n <td>");


#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 40 "..\..\Pages\NodePage.cshtml"
Write(node.Tags);

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


#line 45 "..\..\NodePage.cshtml"
}
#line 42 "..\..\Pages\NodePage.cshtml"
Write(Html.NodeSwitchLink(node.Id));

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

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

#line 45 "..\..\Pages\NodePage.cshtml"
}

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

#line 49 "..\..\NodePage.cshtml"
}

#line 49 "..\..\Pages\NodePage.cshtml"
}

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


}


+ 5
- 4
src/DotNetCore.CAP.Dashboard/Pages/PublishedPage.cs Ver fichero

@@ -2,21 +2,22 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using DotNetCore.CAP.Monitoring;

namespace DotNetCore.CAP.Dashboard.Pages
{
internal partial class PublishedPage
internal partial class PublishedPage : DotNetCore.CAP.Dashboard.RazorPage
{
public PublishedPage(string statusName)
{
StatusName = statusName;
Name = statusName;
}

public string StatusName { get; set; }
public string Name { get; set; }

public int GetTotal(IMonitoringApi api)
{
if (string.Equals(StatusName, Infrastructure.StatusName.Succeeded,
if (string.Equals(Name, nameof(Internal.StatusName.Succeeded),
StringComparison.CurrentCultureIgnoreCase))
{
return api.PublishedSucceededCount();


+ 4
- 4
src/DotNetCore.CAP.Dashboard/Pages/PublishedPage.cshtml Ver fichero

@@ -1,10 +1,10 @@
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True *@
@using System
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard.Monitoring
@using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Resources
@using DotNetCore.CAP.Messages
@using DotNetCore.CAP.Monitoring
@inherits DotNetCore.CAP.Dashboard.RazorPage
@{
Layout = new LayoutPage(Strings.PublishedMessagesPage_Title);
@@ -23,7 +23,7 @@
MessageType = MessageType.Publish,
Name = name,
Content = content,
StatusName = StatusName,
StatusName = Name,
CurrentPage = pager.CurrentPage - 1,
PageSize = pager.RecordsPerPage
};
@@ -84,7 +84,7 @@
<th>@Strings.Common_Version</th>
<th>@Strings.MessagesPage_Table_Name</th>
<th class="min-width">@Strings.MessagesPage_Table_Retries</th>
@if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase))
@if (string.Equals(Name, "Processing", StringComparison.CurrentCultureIgnoreCase))
{
<th>@Strings.MessagesPage_Table_State</th>
}
@@ -110,7 +110,7 @@
<td>
@message.Retries
</td>
@if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase))
@if (string.Equals(Name, "Processing", StringComparison.CurrentCultureIgnoreCase))
{
<td>
@message.StatusName


+ 441
- 429
src/DotNetCore.CAP.Dashboard/Pages/PublishedPage.generated.cs
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 2
- 1
src/DotNetCore.CAP.Dashboard/Pages/ReceivedPage.cs Ver fichero

@@ -2,6 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using DotNetCore.CAP.Monitoring;

namespace DotNetCore.CAP.Dashboard.Pages
{
@@ -16,7 +17,7 @@ namespace DotNetCore.CAP.Dashboard.Pages

public int GetTotal(IMonitoringApi api)
{
if (string.Equals(StatusName, Infrastructure.StatusName.Succeeded,
if (string.Equals(StatusName, nameof(Internal.StatusName.Succeeded),
StringComparison.CurrentCultureIgnoreCase))
{
return api.ReceivedSucceededCount();


+ 1
- 1
src/DotNetCore.CAP.Dashboard/Pages/ReceivedPage.cshtml Ver fichero

@@ -1,10 +1,10 @@
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True *@
@using System
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard.Monitoring
@using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Resources
@using DotNetCore.CAP.Messages
@using DotNetCore.CAP.Monitoring
@inherits DotNetCore.CAP.Dashboard.RazorPage
@{
Layout = new LayoutPage(Strings.ReceivedMessagesPage_Title);


+ 428
- 424
src/DotNetCore.CAP.Dashboard/Pages/ReceivedPage.generated.cs
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 58
- 73
src/DotNetCore.CAP.Dashboard/Pages/SubscriberPage.generated.cs Ver fichero

@@ -16,36 +16,30 @@ namespace DotNetCore.CAP.Dashboard.Pages
using System.Linq;
using System.Text;
#line 3 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
#line hidden
#line 4 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
#line 2 "..\..\Pages\SubscriberPage.cshtml"
using DotNetCore.CAP.Dashboard.Pages;
#line default
#line hidden
#line 5 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
#line 3 "..\..\Pages\SubscriberPage.cshtml"
using DotNetCore.CAP.Dashboard.Resources;
#line default
#line hidden
#line 2 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
#line 4 "..\..\Pages\SubscriberPage.cshtml"
using DotNetCore.CAP.Internal;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
internal partial class SubscriberPage : RazorPage
internal partial class SubscriberPage : DotNetCore.CAP.Dashboard.RazorPage
{
#line hidden

protected override void Execute()
public override void Execute()
{


@@ -56,9 +50,8 @@ WriteLiteral("\r\n");




#line 7 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
#line 6 "..\..\Pages\SubscriberPage.cshtml"
Layout = new LayoutPage(Strings.SubscribersPage_Title);

@@ -74,7 +67,7 @@ WriteLiteral("\r\n<div class=\"row\">\r\n <div class=\"col-md-12\">\r\n


#line 16 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
#line 15 "..\..\Pages\SubscriberPage.cshtml"
Write(Strings.SubscribersPage_Title);

@@ -84,7 +77,7 @@ WriteLiteral("</h1>\r\n\r\n");


#line 18 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
#line 17 "..\..\Pages\SubscriberPage.cshtml"
if (subscribers.Count == 0)
{

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


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

@@ -105,7 +98,7 @@ WriteLiteral("\r\n </div>\r\n");


#line 23 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
#line 22 "..\..\Pages\SubscriberPage.cshtml"
}
else
{
@@ -114,77 +107,70 @@ WriteLiteral("\r\n </div>\r\n");
#line default
#line hidden
WriteLiteral(" <div class=\"table-responsive\">\r\n <table class=\"table s" +
"ubscribe-table\">\r\n <thead>\r\n <tr>\r\n " +
" <th width=\"20%\">");
"ubscribe-table\">\r\n <thead>\r\n <tr>\r\n " +
" <th width=\"20%\">");


#line 30 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(Strings.Common_Group);
#line 29 "..\..\Pages\SubscriberPage.cshtml"
Write(Strings.Common_Group);

#line default
#line hidden
WriteLiteral("</th>\r\n <th width=\"40%\">\r\n " +
" ");
WriteLiteral("</th>\r\n <th width=\"40%\">\r\n ");


#line 32 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(Strings.Common_Name);
#line 31 "..\..\Pages\SubscriberPage.cshtml"
Write(Strings.Common_Name);

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


#line 34 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(Strings.Common_Method);
#line 33 "..\..\Pages\SubscriberPage.cshtml"
Write(Strings.Common_Method);

#line default
#line hidden
WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n " +
" <tbody>\r\n");
WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n " +
" <tbody>\r\n");


#line 38 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
foreach (var subscriber in subscribers)
#line 37 "..\..\Pages\SubscriberPage.cshtml"
foreach (var subscriber in subscribers)
{
var i = 0;
var rowCount = subscriber.Value.Count;
foreach (var column in subscriber.Value)
{
var i = 0;
var rowCount = subscriber.Value.Count;
#line default
#line hidden
#line 42 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
foreach (var column in subscriber.Value)
{

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


#line 45 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
if (i == 0)
{
#line 44 "..\..\Pages\SubscriberPage.cshtml"
if (i == 0)
{

#line default
#line hidden
WriteLiteral(" <td rowspan=\"");
WriteLiteral(" <td rowspan=\"");


#line 47 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(rowCount);
#line 46 "..\..\Pages\SubscriberPage.cshtml"
Write(rowCount);

#line default
@@ -193,8 +179,8 @@ WriteLiteral("\">");


#line 47 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(subscriber.Key);
#line 46 "..\..\Pages\SubscriberPage.cshtml"
Write(subscriber.Key);

#line default
@@ -203,56 +189,55 @@ WriteLiteral("</td>\r\n");


#line 48 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
}
#line 47 "..\..\Pages\SubscriberPage.cshtml"
}

#line default
#line hidden
WriteLiteral(" <td>");
WriteLiteral(" <td>");


#line 49 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(column.Attribute.Name);
#line 48 "..\..\Pages\SubscriberPage.cshtml"
Write(column.Attribute.Name);

#line default
#line hidden
WriteLiteral("</td>\r\n <td>\r\n " +
" <span style=\"color:#00bcd4\">");
WriteLiteral("</td>\r\n <td>\r\n " +
"<span style=\"color: #00bcd4\">");


#line 51 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(column.ImplTypeInfo.Name);
#line 50 "..\..\Pages\SubscriberPage.cshtml"
Write(column.ImplTypeInfo.Name);

#line default
#line hidden
WriteLiteral("</span>:\r\n <div class=\"job-snippet-code\">\r" +
"\n <code>\r\n " +
" <pre>");
WriteLiteral("</span>:\r\n <div class=\"job-snippet-code\">\r\n " +
" <code>\r\n " +
" <pre>");


#line 54 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
Write(Html.MethodEscaped(column.MethodInfo));
#line 53 "..\..\Pages\SubscriberPage.cshtml"
Write(Html.MethodEscaped(column.MethodInfo));

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

WriteLiteral("</pre>\r\n </code>\r\n " +
" </div>\r\n </td>\r\n " +
" </tr>\r\n");


#line 59 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
i++;
}
#line 58 "..\..\Pages\SubscriberPage.cshtml"
i++;
}
}

#line default
@@ -261,7 +246,7 @@ WriteLiteral(" </tbody>\r\n </table>\r\n


#line 65 "..\..\Dashboard\Pages\SubscriberPage.cshtml"
#line 64 "..\..\Pages\SubscriberPage.cshtml"
}



+ 6
- 5
src/DotNetCore.CAP.Dashboard/Pages/_BlockMetric.cshtml Ver fichero

@@ -1,17 +1,18 @@
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True TrimLeadingUnderscores : true *@
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard.Resources
@inherits RazorPage

@inherits DotNetCore.CAP.Dashboard.RazorPage
@{
var metric = DashboardMetric.Func(this);

var metric = Metric.Func(this);
var className = metric == null ? "metric-null" : metric.Style.ToClassName();
var highlighted = metric != null && metric.Highlighted ? "highlighted" : null;
}
<div class="metric @className @highlighted">
<div class="metric-body" data-metric="@DashboardMetric.Name">
<div class="metric-body" data-metric="@Metric.Name">
@(metric?.Value)
</div>
<div class="metric-description">
@(Strings.ResourceManager.GetString(DashboardMetric.Title) ?? DashboardMetric.Title)
@(Strings.ResourceManager.GetString(Metric.Title) ?? Metric.Title)
</div>
</div>

+ 14
- 18
src/DotNetCore.CAP.Dashboard/Pages/_BlockMetric.generated.cs Ver fichero

@@ -16,37 +16,33 @@ namespace DotNetCore.CAP.Dashboard.Pages
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\_BlockMetric.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
#line hidden
#line 3 "..\..\Dashboard\Pages\_BlockMetric.cshtml"
#line 2 "..\..\Pages\_BlockMetric.cshtml"
using DotNetCore.CAP.Dashboard.Resources;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
internal partial class BlockMetric : RazorPage
internal partial class BlockMetric : DotNetCore.CAP.Dashboard.RazorPage
{
#line hidden

protected override void Execute()
public override void Execute()
{


WriteLiteral("\r\n");


WriteLiteral("\r\n");



#line 5 "..\..\Dashboard\Pages\_BlockMetric.cshtml"
#line 5 "..\..\Pages\_BlockMetric.cshtml"
var metric = DashboardMetric.Func(this);

var metric = Metric.Func(this);
var className = metric == null ? "metric-null" : metric.Style.ToClassName();
var highlighted = metric != null && metric.Highlighted ? "highlighted" : null;

@@ -58,7 +54,7 @@ WriteLiteral("<div class=\"metric ");


#line 10 "..\..\Dashboard\Pages\_BlockMetric.cshtml"
#line 11 "..\..\Pages\_BlockMetric.cshtml"
Write(className);

@@ -68,7 +64,7 @@ WriteLiteral(" ");


#line 10 "..\..\Dashboard\Pages\_BlockMetric.cshtml"
#line 11 "..\..\Pages\_BlockMetric.cshtml"
Write(highlighted);

@@ -78,8 +74,8 @@ WriteLiteral("\">\r\n <div class=\"metric-body\" data-metric=\"");


#line 11 "..\..\Dashboard\Pages\_BlockMetric.cshtml"
Write(DashboardMetric.Name);
#line 12 "..\..\Pages\_BlockMetric.cshtml"
Write(Metric.Name);

#line default
@@ -88,7 +84,7 @@ WriteLiteral("\">\r\n ");


#line 12 "..\..\Dashboard\Pages\_BlockMetric.cshtml"
#line 13 "..\..\Pages\_BlockMetric.cshtml"
Write(metric?.Value);

@@ -98,8 +94,8 @@ WriteLiteral("\r\n </div>\r\n <div class=\"metric-description\">\r\n


#line 15 "..\..\Dashboard\Pages\_BlockMetric.cshtml"
Write(Strings.ResourceManager.GetString(DashboardMetric.Title) ?? DashboardMetric.Title);
#line 16 "..\..\Pages\_BlockMetric.cshtml"
Write(Strings.ResourceManager.GetString(Metric.Title) ?? Metric.Title);

#line default


+ 13
- 19
src/DotNetCore.CAP.Dashboard/Pages/_Breadcrumbs.generated.cs Ver fichero

@@ -16,51 +16,45 @@ namespace DotNetCore.CAP.Dashboard.Pages
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\_Breadcrumbs.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
internal partial class Breadcrumbs : RazorPage
internal partial class Breadcrumbs : DotNetCore.CAP.Dashboard.RazorPage
{
#line hidden

protected override void Execute()
public override void Execute()
{


WriteLiteral("\r\n");



WriteLiteral("\r\n<ol class=\"breadcrumb\">\r\n <li><a href=\"");
WriteLiteral("\r\n<ol class=\"breadcrumb\">\r\n <li>\r\n <a href=\"");


#line 6 "..\..\Dashboard\Pages\_Breadcrumbs.cshtml"
#line 6 "..\..\Pages\_Breadcrumbs.cshtml"
Write(Url.Home());

#line default
#line hidden
WriteLiteral("\"><span class=\"glyphicon glyphicon-home\"></span></a></li>\r\n");
WriteLiteral("\">\r\n <span class=\"glyphicon glyphicon-home\"></span>\r\n </a>\r\n " +
" </li>\r\n");


#line 7 "..\..\Dashboard\Pages\_Breadcrumbs.cshtml"
#line 10 "..\..\Pages\_Breadcrumbs.cshtml"
foreach (var item in Items)
{

#line default
#line hidden
WriteLiteral(" <li><a href=\"");
WriteLiteral(" <li>\r\n <a href=\"");


#line 9 "..\..\Dashboard\Pages\_Breadcrumbs.cshtml"
#line 13 "..\..\Pages\_Breadcrumbs.cshtml"
Write(item.Value);

@@ -70,17 +64,17 @@ WriteLiteral("\">");


#line 9 "..\..\Dashboard\Pages\_Breadcrumbs.cshtml"
#line 13 "..\..\Pages\_Breadcrumbs.cshtml"
Write(item.Key);

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


#line 10 "..\..\Dashboard\Pages\_Breadcrumbs.cshtml"
#line 15 "..\..\Pages\_Breadcrumbs.cshtml"
}

@@ -90,7 +84,7 @@ WriteLiteral(" <li class=\"active\">");


#line 11 "..\..\Dashboard\Pages\_Breadcrumbs.cshtml"
#line 16 "..\..\Pages\_Breadcrumbs.cshtml"
Write(Title);



+ 7
- 7
src/DotNetCore.CAP.Dashboard/Pages/_InlineMetric.generated.cs Ver fichero

@@ -16,7 +16,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\_InlineMetric.cshtml"
#line 2 "..\..\Pages\_InlineMetric.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

protected override void Execute()
public override void Execute()
{


@@ -37,7 +37,7 @@ WriteLiteral("\r\n");


#line 4 "..\..\Dashboard\Pages\_InlineMetric.cshtml"
#line 4 "..\..\Pages\_InlineMetric.cshtml"
var metric = DashboardMetric.Func(this);
var className = metric == null ? "metric-null" : metric.Style.ToClassName();
@@ -51,7 +51,7 @@ WriteLiteral("<span data-metric=\"");


#line 9 "..\..\Dashboard\Pages\_InlineMetric.cshtml"
#line 9 "..\..\Pages\_InlineMetric.cshtml"
Write(DashboardMetric.Name);

@@ -61,7 +61,7 @@ WriteLiteral("\" class=\"metric ");


#line 9 "..\..\Dashboard\Pages\_InlineMetric.cshtml"
#line 9 "..\..\Pages\_InlineMetric.cshtml"
Write(className);

@@ -71,7 +71,7 @@ WriteLiteral(" ");


#line 9 "..\..\Dashboard\Pages\_InlineMetric.cshtml"
#line 9 "..\..\Pages\_InlineMetric.cshtml"
Write(highlighted);

@@ -81,7 +81,7 @@ WriteLiteral("\">");


#line 9 "..\..\Dashboard\Pages\_InlineMetric.cshtml"
#line 9 "..\..\Pages\_InlineMetric.cshtml"
Write(metric?.Value);



+ 17
- 14
src/DotNetCore.CAP.Dashboard/Pages/_Navigation.generated.cs Ver fichero

@@ -16,18 +16,18 @@ namespace DotNetCore.CAP.Dashboard.Pages
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 2 "..\..\Pages\_Navigation.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
internal partial class Navigation : RazorPage
internal partial class Navigation : DotNetCore.CAP.Dashboard.RazorPage
{
#line hidden

protected override void Execute()
public override void Execute()
{


@@ -37,7 +37,7 @@ WriteLiteral("\r\n");


#line 4 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 4 "..\..\Pages\_Navigation.cshtml"
if (NavigationMenu.Items.Count > 0)
{

@@ -48,12 +48,15 @@ WriteLiteral(" <ul class=\"nav navbar-nav\">\r\n");


#line 7 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 7 "..\..\Pages\_Navigation.cshtml"
foreach (var item in NavigationMenu.Items)
{
var itemValue = item(this);

if (itemValue == null) { continue; }
if (itemValue == null)
{
continue;
}


@@ -63,7 +66,7 @@ WriteLiteral(" <li class=\"");


#line 13 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 16 "..\..\Pages\_Navigation.cshtml"
Write(itemValue.Active ? "active" : null);

@@ -73,7 +76,7 @@ WriteLiteral("\">\r\n <a href=\"");


#line 14 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 17 "..\..\Pages\_Navigation.cshtml"
Write(itemValue.Url);

@@ -83,7 +86,7 @@ WriteLiteral("\">\r\n ");


#line 15 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 18 "..\..\Pages\_Navigation.cshtml"
Write(itemValue.Text);

@@ -93,7 +96,7 @@ WriteLiteral("\r\n\r\n");


#line 17 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 20 "..\..\Pages\_Navigation.cshtml"
foreach (var metric in itemValue.GetAllMetrics())
{
@@ -101,14 +104,14 @@ WriteLiteral("\r\n\r\n");
#line default
#line hidden
#line 19 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 22 "..\..\Pages\_Navigation.cshtml"
Write(Html.InlineMetric(metric));

#line default
#line hidden
#line 19 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 22 "..\..\Pages\_Navigation.cshtml"
}

@@ -119,7 +122,7 @@ WriteLiteral(" </a>\r\n </li>\r\n");


#line 23 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 26 "..\..\Pages\_Navigation.cshtml"
}

@@ -129,7 +132,7 @@ WriteLiteral(" </ul>\r\n");


#line 25 "..\..\Dashboard\Pages\_Navigation.cshtml"
#line 28 "..\..\Pages\_Navigation.cshtml"
}
#line default


+ 24
- 26
src/DotNetCore.CAP.Dashboard/Pages/_Paginator.generated.cs Ver fichero

@@ -16,24 +16,24 @@ namespace DotNetCore.CAP.Dashboard.Pages
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 2 "..\..\Pages\_Paginator.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
#line hidden
#line 3 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 3 "..\..\Pages\_Paginator.cshtml"
using DotNetCore.CAP.Dashboard.Resources;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
internal partial class Paginator : RazorPage
internal partial class Paginator : DotNetCore.CAP.Dashboard.RazorPage
{
#line hidden

protected override void Execute()
public override void Execute()
{


@@ -41,14 +41,12 @@ WriteLiteral("\r\n");



WriteLiteral("\r\n");


WriteLiteral("<div class=\"btn-toolbar\">\r\n");


#line 7 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 6 "..\..\Pages\_Paginator.cshtml"
if (_pager.TotalPageCount > 1)
{

@@ -59,7 +57,7 @@ WriteLiteral(" <div class=\"btn-group paginator\">\r\n");


#line 10 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 9 "..\..\Pages\_Paginator.cshtml"
foreach (var page in _pager.PagerItems)
{
switch (page.Type)
@@ -73,7 +71,7 @@ WriteLiteral(" <a href=\"");


#line 15 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 14 "..\..\Pages\_Paginator.cshtml"
Write(_pager.PageUrl(page.PageIndex));

@@ -83,7 +81,7 @@ WriteLiteral("\" class=\"btn btn-default ");


#line 15 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 14 "..\..\Pages\_Paginator.cshtml"
Write(_pager.CurrentPage == page.PageIndex ? "active" : null);

@@ -93,17 +91,17 @@ WriteLiteral("\">\r\n ");


#line 16 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 15 "..\..\Pages\_Paginator.cshtml"
Write(page.PageIndex);

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


#line 18 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 17 "..\..\Pages\_Paginator.cshtml"
break;
case Pager.ItemType.NextPage:

@@ -114,7 +112,7 @@ WriteLiteral(" <a href=\"");


#line 20 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 19 "..\..\Pages\_Paginator.cshtml"
Write(_pager.PageUrl(page.PageIndex));

@@ -124,7 +122,7 @@ WriteLiteral("\" class=\"btn btn-default ");


#line 20 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 19 "..\..\Pages\_Paginator.cshtml"
Write(page.Disabled ? "disabled" : null);

@@ -134,7 +132,7 @@ WriteLiteral("\">\r\n ");


#line 21 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 20 "..\..\Pages\_Paginator.cshtml"
Write(Strings.Paginator_Next);

@@ -144,7 +142,7 @@ WriteLiteral("\r\n </a>\r\n");


#line 23 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 22 "..\..\Pages\_Paginator.cshtml"
break;
case Pager.ItemType.PrevPage:

@@ -155,7 +153,7 @@ WriteLiteral(" <a href=\"");


#line 25 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 24 "..\..\Pages\_Paginator.cshtml"
Write(_pager.PageUrl(page.PageIndex));

@@ -165,7 +163,7 @@ WriteLiteral("\" class=\"btn btn-default ");


#line 25 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 24 "..\..\Pages\_Paginator.cshtml"
Write(page.Disabled ? "disabled" : null);

@@ -175,7 +173,7 @@ WriteLiteral("\">\r\n ");


#line 26 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 25 "..\..\Pages\_Paginator.cshtml"
Write(Strings.Paginator_Prev);

@@ -185,7 +183,7 @@ WriteLiteral("\r\n </a>\r\n");


#line 28 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 27 "..\..\Pages\_Paginator.cshtml"
break;
case Pager.ItemType.MorePage:

@@ -197,7 +195,7 @@ WriteLiteral(" <a href=\"#\" class=\"btn btn-default disa


#line 33 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 32 "..\..\Pages\_Paginator.cshtml"
break;
}
}
@@ -213,7 +211,7 @@ WriteLiteral(" <div class=\"btn-toolbar-spacer\"></div>\r\n");


#line 38 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 37 "..\..\Pages\_Paginator.cshtml"
}

@@ -223,7 +221,7 @@ WriteLiteral("\r\n <div class=\"btn-toolbar-label\">\r\n ");


#line 41 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 40 "..\..\Pages\_Paginator.cshtml"
Write(Strings.Paginator_TotalItems);

@@ -233,13 +231,13 @@ WriteLiteral(": ");


#line 41 "..\..\Dashboard\Pages\_Paginator.cshtml"
#line 40 "..\..\Pages\_Paginator.cshtml"
Write(_pager.TotalRecordCount);

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


}


+ 23
- 23
src/DotNetCore.CAP.Dashboard/Pages/_PerPageSelector.generated.cs Ver fichero

@@ -16,7 +16,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\_PerPageSelector.cshtml"
#line 2 "..\..\Pages\_PerPageSelector.cshtml"
using DotNetCore.CAP.Dashboard.Resources;
#line default
@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

protected override void Execute()
public override void Execute()
{


@@ -35,69 +35,69 @@ WriteLiteral("\r\n");



WriteLiteral("\r\n <div class=\"btn-group pull-right paginator\">\r\n");
WriteLiteral("\r\n<div class=\"btn-group pull-right paginator\">\r\n");


#line 6 "..\..\Dashboard\Pages\_PerPageSelector.cshtml"
foreach (var count in new[] { 10, 20, 50, 100, 500 })
{
#line 6 "..\..\Pages\_PerPageSelector.cshtml"
foreach (var count in new[] {10, 20, 50, 100, 500})
{

#line default
#line hidden
WriteLiteral(" <a class=\"btn btn-sm btn-default ");
WriteLiteral(" <a class=\"btn btn-sm btn-default ");


#line 8 "..\..\Dashboard\Pages\_PerPageSelector.cshtml"
Write(count == _pager.RecordsPerPage ? "active" : null);
#line 8 "..\..\Pages\_PerPageSelector.cshtml"
Write(count == _pager.RecordsPerPage ? "active" : null);

#line default
#line hidden
WriteLiteral("\" \r\n href=\"");
WriteLiteral("\"\r\n href=\"");


#line 9 "..\..\Dashboard\Pages\_PerPageSelector.cshtml"
Write(_pager.RecordsPerPageUrl(count));
#line 9 "..\..\Pages\_PerPageSelector.cshtml"
Write(_pager.RecordsPerPageUrl(count));

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


#line 9 "..\..\Dashboard\Pages\_PerPageSelector.cshtml"
Write(count);
#line 10 "..\..\Pages\_PerPageSelector.cshtml"
Write(count);

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


#line 10 "..\..\Dashboard\Pages\_PerPageSelector.cshtml"
}
#line 11 "..\..\Pages\_PerPageSelector.cshtml"
}

#line default
#line hidden
WriteLiteral(" </div>\r\n <div class=\"btn-toolbar-spacer pull-right\"></div>\r\n <div class" +
"=\"btn-toolbar-label btn-toolbar-label-sm pull-right\">\r\n ");
WriteLiteral("</div>\r\n<div class=\"btn-toolbar-spacer pull-right\"></div>\r\n<div class=\"btn-toolba" +
"r-label btn-toolbar-label-sm pull-right\">\r\n ");


#line 14 "..\..\Dashboard\Pages\_PerPageSelector.cshtml"
Write(Strings.PerPageSelector_ItemsPerPage);
#line 15 "..\..\Pages\_PerPageSelector.cshtml"
Write(Strings.PerPageSelector_ItemsPerPage);

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


}


+ 12
- 20
src/DotNetCore.CAP.Dashboard/Pages/_SidebarMenu.generated.cs Ver fichero

@@ -16,18 +16,12 @@ namespace DotNetCore.CAP.Dashboard.Pages
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
internal partial class SidebarMenu : RazorPage
internal partial class SidebarMenu : DotNetCore.CAP.Dashboard.RazorPage
{
#line hidden

protected override void Execute()
public override void Execute()
{


@@ -35,9 +29,8 @@ WriteLiteral("\r\n");




#line 4 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 3 "..\..\Pages\_SidebarMenu.cshtml"
if (Items.Any())
{

@@ -48,7 +41,7 @@ WriteLiteral(" <div id=\"stats\" class=\"list-group\">\r\n");


#line 7 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 6 "..\..\Pages\_SidebarMenu.cshtml"
foreach (var item in Items)
{
var itemValue = item(this);
@@ -60,7 +53,7 @@ WriteLiteral(" <a href=\"");


#line 10 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 9 "..\..\Pages\_SidebarMenu.cshtml"
Write(itemValue.Url);

@@ -70,7 +63,7 @@ WriteLiteral("\" class=\"list-group-item ");


#line 10 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 9 "..\..\Pages\_SidebarMenu.cshtml"
Write(itemValue.Active ? "active" : null);

@@ -80,7 +73,7 @@ WriteLiteral("\">\r\n ");


#line 11 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 10 "..\..\Pages\_SidebarMenu.cshtml"
Write(itemValue.Text);

@@ -90,7 +83,7 @@ WriteLiteral("\r\n <span class=\"pull-right\">\r\n");


#line 13 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 12 "..\..\Pages\_SidebarMenu.cshtml"
foreach (var metric in itemValue.GetAllMetrics())
{
@@ -98,14 +91,14 @@ WriteLiteral("\r\n <span class=\"pull-right\">\r\n");
#line default
#line hidden
#line 15 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 14 "..\..\Pages\_SidebarMenu.cshtml"
Write(Html.InlineMetric(metric));

#line default
#line hidden
#line 15 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 14 "..\..\Pages\_SidebarMenu.cshtml"
}

@@ -116,7 +109,7 @@ WriteLiteral(" </span>\r\n </a>\r\n");


#line 19 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 18 "..\..\Pages\_SidebarMenu.cshtml"
}

@@ -126,9 +119,8 @@ WriteLiteral(" </div>\r\n");


#line 21 "..\..\Dashboard\Pages\_SidebarMenu.cshtml"
#line 20 "..\..\Pages\_SidebarMenu.cshtml"
}

#line default
#line hidden


+ 6
- 6
src/DotNetCore.CAP.Dashboard/RazorPage.cs Ver fichero

@@ -5,9 +5,10 @@ using System;
using System.Diagnostics;
using System.Net;
using System.Text;
using DotNetCore.CAP.Dashboard.Monitoring;
using DotNetCore.CAP.Dashboard.NodeDiscovery;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.NodeDiscovery;
using DotNetCore.CAP.Monitoring;
using DotNetCore.CAP.Persistence;
using Microsoft.Extensions.DependencyInjection;

namespace DotNetCore.CAP.Dashboard
@@ -28,7 +29,7 @@ namespace DotNetCore.CAP.Dashboard
protected HtmlHelper Html { get; }
public UrlHelper Url { get; private set; }

protected IStorage Storage { get; set; }
protected IDataStorage Storage { get; set; }
protected string AppPath { get; set; }
protected string NodeName { get; set; }

@@ -55,7 +56,7 @@ namespace DotNetCore.CAP.Dashboard
public string RequestPath => Request.Path;

/// <exclude />
protected abstract void Execute();
public abstract void Execute();

protected string Query(string key)
{
@@ -95,8 +96,7 @@ namespace DotNetCore.CAP.Dashboard

_statisticsLazy = new Lazy<StatisticsDto>(() =>
{
var monitoring = Storage.GetMonitoringApi();
var dto = monitoring.GetStatistics();
var dto = Storage.GetMonitoringApi().GetStatistics();

SetServersCount(dto);



+ 8
- 21
src/DotNetCore.CAP.MySql/MySqlDataStorage.cs Ver fichero

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Dapper;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Monitoring;
using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Serialization;
using Microsoft.EntityFrameworkCore.Storage;
@@ -65,6 +66,7 @@ namespace DotNetCore.CAP.MySql
{
DbId = content.GetId(),
Origin = content,
Content = StringSerializer.Serialize(content),
Added = DateTime.Now,
ExpiresAt = null,
Retries = 0
@@ -74,7 +76,7 @@ namespace DotNetCore.CAP.MySql
{
Id = message.DbId,
Name = name,
Content = StringSerializer.Serialize(message.Origin),
message.Content,
message.Retries,
message.Added,
message.ExpiresAt,
@@ -138,7 +140,7 @@ namespace DotNetCore.CAP.MySql
var content = StringSerializer.Serialize(mdMessage.Origin);
using (var connection = new MySqlConnection(_options.Value.ConnectionString))
{
connection.Execute(sql, new
{
Id = mdMessage.DbId,
@@ -212,24 +214,9 @@ namespace DotNetCore.CAP.MySql
return result;
}

//public Task<CapPublishedMessage> GetPublishedMessageAsync(long id)
//{
// var sql = $@"SELECT * FROM `{_prefix}.published` WHERE `Id`={id};";

// using (var connection = new MySqlConnection(Options.ConnectionString))
// {
// return await connection.QueryFirstOrDefaultAsync<CapPublishedMessage>(sql);
// }
//}

//public Task<CapReceivedMessage> GetReceivedMessageAsync(long id)
//{
// var sql =
// $@"SELECT * FROM `{_prefix}.received` WHERE Id={id};";
// using (var connection = new MySqlConnection(Options.ConnectionString))
// {
// return await connection.QueryFirstOrDefaultAsync<CapReceivedMessage>(sql);
// }
//}
public IMonitoringApi GetMonitoringApi()
{
return new MySqlMonitoringApi(_options);
}
}
}

+ 8
- 0
src/DotNetCore.CAP/Internal/Helper.cs Ver fichero

@@ -9,6 +9,14 @@ namespace DotNetCore.CAP.Internal
{
public static class Helper
{
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local);

public static long ToTimestamp(DateTime value)
{
var elapsedTime = value - Epoch;
return (long)elapsedTime.TotalSeconds;
}

public static bool IsController(TypeInfo typeInfo)
{
if (!typeInfo.IsClass)


+ 1
- 1
src/DotNetCore.CAP/Internal/MethodMatcherCache.cs Ver fichero

@@ -8,7 +8,7 @@ using System.Linq;

namespace DotNetCore.CAP.Internal
{
internal class MethodMatcherCache
public class MethodMatcherCache
{
private readonly IConsumerServiceSelector _selector;



+ 9
- 3
src/DotNetCore.CAP/Persistence/IDataStorage.cs Ver fichero

@@ -4,6 +4,7 @@ using System.Threading;
using System.Threading.Tasks;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Monitoring;

namespace DotNetCore.CAP.Persistence
{
@@ -13,16 +14,21 @@ namespace DotNetCore.CAP.Persistence

Task ChangeReceiveStateAsync(MediumMessage message, StatusName state);

Task<MediumMessage> StoreMessageAsync(string name, Message content, object dbTransaction = null, CancellationToken cancellationToken = default);
Task<MediumMessage> StoreMessageAsync(string name, Message content, object dbTransaction = null,
CancellationToken cancellationToken = default);

Task StoreReceivedExceptionMessageAsync(string name, string group, string content);

Task<MediumMessage> StoreReceivedMessageAsync(string name, string group, Message content);

Task<int> DeleteExpiresAsync(string table, DateTime timeout, int batchCount = 1000, CancellationToken token = default);
Task<int> DeleteExpiresAsync(string table, DateTime timeout, int batchCount = 1000,
CancellationToken token = default);

Task<IEnumerable<MediumMessage>> GetPublishedMessagesOfNeedRetry();

Task<IEnumerable<MediumMessage>> GetReceivedMessagesOfNeedRetry();

//dashboard api
IMonitoringApi GetMonitoringApi();
}
}
}

+ 2
- 0
src/DotNetCore.CAP/Persistence/MediumMessage.cs Ver fichero

@@ -9,6 +9,8 @@ namespace DotNetCore.CAP.Persistence

public Message Origin { get; set; }

public string Content { get; set; }

public DateTime Added { get; set; }

public DateTime? ExpiresAt { get; set; }


Cargando…
Cancelar
Guardar