Преглед на файлове

update dashboard

master
yangxiaodong преди 7 години
родител
ревизия
0d165b7e88
променени са 26 файла, в които са добавени 1671 реда и са изтрити 471 реда
  1. +2
    -2
      src/DotNetCore.CAP/Dashboard/Content/js/cap.js
  2. +75
    -88
      src/DotNetCore.CAP/Dashboard/DashboardMetrics.cs
  3. +8
    -2
      src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
  4. +19
    -12
      src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
  5. +14
    -23
      src/DotNetCore.CAP/Dashboard/IMonitoringApi.cs
  6. +3
    -3
      src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs
  7. +57
    -0
      src/DotNetCore.CAP/Dashboard/MessagesSidebarMenu.cs
  8. +0
    -17
      src/DotNetCore.CAP/Dashboard/Monitoring/DeletedJobDto.cs
  9. +22
    -0
      src/DotNetCore.CAP/Dashboard/Monitoring/MessageDto.cs
  10. +22
    -0
      src/DotNetCore.CAP/Dashboard/Monitoring/MessageQueryDto.cs
  11. +0
    -10
      src/DotNetCore.CAP/Dashboard/Monitoring/QueueWithTopEnqueuedJobsDto.cs
  12. +10
    -9
      src/DotNetCore.CAP/Dashboard/Monitoring/StatisticsDto.cs
  13. +14
    -10
      src/DotNetCore.CAP/Dashboard/NavigationMenu.cs
  14. +0
    -159
      src/DotNetCore.CAP/Dashboard/Pages/AwaitingJobsPage.cshtml
  15. +5
    -5
      src/DotNetCore.CAP/Dashboard/Pages/HomePage.cshtml
  16. +6
    -6
      src/DotNetCore.CAP/Dashboard/Pages/HomePage.generated.cs
  17. +0
    -123
      src/DotNetCore.CAP/Dashboard/Pages/ProcessingJobsPage.cshtml
  18. +33
    -0
      src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs
  19. +122
    -0
      src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml
  20. +372
    -0
      src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs
  21. +33
    -0
      src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs
  22. +121
    -0
      src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cshtml
  23. +372
    -0
      src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs
  24. +248
    -0
      src/DotNetCore.CAP/Dashboard/Pages/_Paginator.generated.cs
  25. +106
    -0
      src/DotNetCore.CAP/Dashboard/Pages/_PerPageSelector.generated.cs
  26. +7
    -2
      src/DotNetCore.CAP/Dashboard/UrlHelper.cs

+ 2
- 2
src/DotNetCore.CAP/Dashboard/Content/js/cap.js Целия файл

@@ -112,8 +112,8 @@
RealtimeGraph.prototype = Object.create(BaseGraph.prototype);

RealtimeGraph.prototype.appendHistory = function (statistics) {
var newSucceeded = parseInt(statistics["succeeded:count"].intValue);
var newFailed = parseInt(statistics["failed:count"].intValue);
var newSucceeded = parseInt(statistics["published_succeeded:count"].intValue);
var newFailed = parseInt(statistics["published_failed:count"].intValue);

if (this._succeeded !== null && this._failed !== null) {
var succeeded = newSucceeded - this._succeeded;


+ 75
- 88
src/DotNetCore.CAP/Dashboard/DashboardMetrics.cs Целия файл

@@ -12,17 +12,19 @@ namespace DotNetCore.CAP.Dashboard
static DashboardMetrics()
{
AddMetric(ServerCount);
AddMetric(RecurringJobCount);
AddMetric(RetriesCount);
AddMetric(EnqueuedCountOrNull);
AddMetric(FailedCountOrNull);
AddMetric(EnqueuedAndQueueCount);
AddMetric(ScheduledCount);
AddMetric(ProcessingCount);
AddMetric(SucceededCount);
AddMetric(FailedCount);
AddMetric(DeletedCount);
AddMetric(AwaitingCount);

AddMetric(PublishedFailedCountOrNull);
AddMetric(ReceivedFailedCountOrNull);

AddMetric(PublishedProcessingCount);
AddMetric(ReceivedProcessingCount);

AddMetric(PublishedSucceededCount);
AddMetric(ReceivedSucceededCount);

AddMetric(PublishedFailedCount);
AddMetric(ReceivedFailedCount);
}

public static void AddMetric(DashboardMetric metric)
@@ -44,7 +46,7 @@ namespace DotNetCore.CAP.Dashboard
}

public static readonly DashboardMetric ServerCount = new DashboardMetric(
"servers:count",
"servers:count",
"Metrics_Servers",
page => new Metric(page.Statistics.Servers.ToString("N0"))
{
@@ -55,11 +57,6 @@ namespace DotNetCore.CAP.Dashboard
: null
});

public static readonly DashboardMetric RecurringJobCount = new DashboardMetric(
"recurring:count",
"Metrics_RecurringJobs",
page => new Metric(page.Statistics.Recurring.ToString("N0")));

public static readonly DashboardMetric RetriesCount = new DashboardMetric(
"retries:count",
"Metrics_Retries",
@@ -83,97 +80,87 @@ namespace DotNetCore.CAP.Dashboard
};
});

public static readonly DashboardMetric EnqueuedCountOrNull = new DashboardMetric(
"enqueued:count-or-null",
"Metrics_EnqueuedCountOrNull",
page => page.Statistics.Enqueued > 0 || page.Statistics.Failed == 0
? new Metric(page.Statistics.Enqueued.ToString("N0"))
{
Style = page.Statistics.Enqueued > 0 ? MetricStyle.Info : MetricStyle.Default,
Highlighted = page.Statistics.Enqueued > 0 && page.Statistics.Failed == 0
}
: null);
//----------------------------------------------------

public static readonly DashboardMetric FailedCountOrNull = new DashboardMetric(
"failed:count-or-null",
public static readonly DashboardMetric PublishedFailedCountOrNull = new DashboardMetric(
"publish_failed:count-or-null",
"Metrics_FailedJobs",
page => page.Statistics.Failed > 0
? new Metric(page.Statistics.Failed.ToString("N0"))
page => page.Statistics.PublishedFailed > 0
? new Metric(page.Statistics.PublishedFailed.ToString("N0"))
{
Style = MetricStyle.Danger,
Highlighted = true,
Title = string.Format(Strings.Metrics_FailedCountOrNull, page.Statistics.Failed)
Title = string.Format(Strings.Metrics_FailedCountOrNull, page.Statistics.PublishedFailed)
}
: null);

public static readonly DashboardMetric EnqueuedAndQueueCount = new DashboardMetric(
"enqueued-queues:count",
"Metrics_EnqueuedQueuesCount",
page => new Metric($"{page.Statistics.Enqueued:N0} / {page.Statistics.Queues:N0}")
{
Style = page.Statistics.Enqueued > 0 ? MetricStyle.Info : MetricStyle.Default,
Highlighted = page.Statistics.Enqueued > 0
});

public static readonly DashboardMetric ScheduledCount = new DashboardMetric(
"scheduled:count",
"Metrics_ScheduledJobs",
page => new Metric(page.Statistics.Scheduled.ToString("N0"))
{
Style = page.Statistics.Scheduled > 0 ? MetricStyle.Info : MetricStyle.Default
});

public static readonly DashboardMetric ProcessingCount = new DashboardMetric(
"processing:count",
public static readonly DashboardMetric ReceivedFailedCountOrNull = new DashboardMetric(
"received_failed:count-or-null",
"Metrics_FailedJobs",
page => page.Statistics.ReceivedFailed > 0
? new Metric(page.Statistics.ReceivedFailed.ToString("N0"))
{
Style = MetricStyle.Danger,
Highlighted = true,
Title = string.Format(Strings.Metrics_FailedCountOrNull, page.Statistics.ReceivedFailed)
}
: null);

//----------------------------------------------------

public static readonly DashboardMetric PublishedProcessingCount = new DashboardMetric(
"publish_processing:count",
"Metrics_ProcessingJobs",
page => new Metric(page.Statistics.Processing.ToString("N0"))
page => new Metric(page.Statistics.PublishedProcessing.ToString("N0"))
{
Style = page.Statistics.Processing > 0 ? MetricStyle.Warning : MetricStyle.Default
Style = page.Statistics.PublishedProcessing > 0 ? MetricStyle.Warning : MetricStyle.Default
});

public static readonly DashboardMetric SucceededCount = new DashboardMetric(
"succeeded:count",
public static readonly DashboardMetric ReceivedProcessingCount = new DashboardMetric(
"received_processing:count",
"Metrics_ProcessingJobs",
page => new Metric(page.Statistics.ReceivedProcessing.ToString("N0"))
{
Style = page.Statistics.ReceivedProcessing > 0 ? MetricStyle.Warning : MetricStyle.Default
});

//----------------------------------------------------
public static readonly DashboardMetric PublishedSucceededCount = new DashboardMetric(
"publish_succeeded:count",
"Metrics_SucceededJobs",
page => new Metric(page.Statistics.Succeeded.ToString("N0"))
page => new Metric(page.Statistics.PublishedSucceeded.ToString("N0"))
{
IntValue = page.Statistics.Succeeded
IntValue = page.Statistics.PublishedSucceeded
});

public static readonly DashboardMetric FailedCount = new DashboardMetric(
"failed:count",
"Metrics_FailedJobs",
page => new Metric(page.Statistics.Failed.ToString("N0"))
{
IntValue = page.Statistics.Failed,
Style = page.Statistics.Failed > 0 ? MetricStyle.Danger : MetricStyle.Default,
Highlighted = page.Statistics.Failed > 0
});
public static readonly DashboardMetric ReceivedSucceededCount = new DashboardMetric(
"received_succeeded:count",
"Metrics_SucceededJobs",
page => new Metric(page.Statistics.ReceivedSucceeded.ToString("N0"))
{
IntValue = page.Statistics.ReceivedSucceeded
});

public static readonly DashboardMetric DeletedCount = new DashboardMetric(
"deleted:count",
"Metrics_DeletedJobs",
page => new Metric(page.Statistics.Deleted.ToString("N0")));

public static readonly DashboardMetric AwaitingCount = new DashboardMetric(
"awaiting:count",
"Metrics_AwaitingCount",
page =>
{
long awaitingCount = -1;
//----------------------------------------------------

using (var connection = page.Storage.GetConnection())
{
var storageConnection = connection as IStorageConnection;
if (storageConnection != null)
{
awaitingCount = storageConnection.GetSetCount("awaiting");
}
}

return new Metric(awaitingCount.ToString("N0"))
{
Style = awaitingCount > 0 ? MetricStyle.Info : MetricStyle.Default
};
public static readonly DashboardMetric PublishedFailedCount = new DashboardMetric(
"publish_failed:count",
"Metrics_FailedJobs",
page => new Metric(page.Statistics.PublishedFailed.ToString("N0"))
{
IntValue = page.Statistics.PublishedFailed,
Style = page.Statistics.PublishedFailed > 0 ? MetricStyle.Danger : MetricStyle.Default,
Highlighted = page.Statistics.PublishedFailed > 0
});
public static readonly DashboardMetric ReceivedFailedCount = new DashboardMetric(
"received_failed:count",
"Metrics_FailedJobs",
page => new Metric(page.Statistics.ReceivedFailed.ToString("N0"))
{
IntValue = page.Statistics.ReceivedFailed,
Style = page.Statistics.ReceivedFailed > 0 ? MetricStyle.Danger : MetricStyle.Default,
Highlighted = page.Statistics.ReceivedFailed > 0
});
}
}

+ 8
- 2
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs Целия файл

@@ -74,7 +74,7 @@ namespace DotNetCore.CAP.Dashboard

#region Razor pages and commands

Routes.AddRazorPage("/jobs/enqueued", x => new QueuesPage());
//Routes.AddRazorPage("/jobs/enqueued", x => new QueuesPage());
//Routes.AddRazorPage(
// "/jobs/enqueued/fetched/(?<Queue>.+)",
// x => new FetchedJobsPage(x.Groups["Queue"].Value));
@@ -105,7 +105,13 @@ namespace DotNetCore.CAP.Dashboard
// "/jobs/scheduled/delete",
// (client, jobId) => client.ChangeState(jobId, CreateDeletedState(), ScheduledState.StateName));

//Routes.AddRazorPage("/jobs/succeeded", x => new SucceededJobs());
Routes.AddRazorPage(
"/published/(?<StatusName>.+)",
x => new PublishedPage(x.Groups["StatusName"].Value));

Routes.AddRazorPage(
"/received/(?<StatusName>.+)",
x => new ReceivedPage(x.Groups["StatusName"].Value));
//Routes.AddClientBatchCommand(
// "/jobs/succeeded/requeue",
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), SucceededState.StateName));


+ 19
- 12
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs Целия файл

@@ -29,9 +29,16 @@ namespace DotNetCore.CAP.Dashboard
return RenderPartial(new Breadcrumbs(title, items));
}

public NonEscapedString JobsSidebar()
public NonEscapedString JobsSidebar(MessageType type)
{
return RenderPartial(new SidebarMenu(JobsSidebarMenu.Items));
if (type == MessageType.Publish)
{
return SidebarMenu(MessagesSidebarMenu.PublishedItems);
}
else
{
return SidebarMenu(MessagesSidebarMenu.ReceivedItems);
}
}

public NonEscapedString SidebarMenu(IEnumerable<Func<RazorPage, MenuItem>> items)
@@ -52,17 +59,17 @@ namespace DotNetCore.CAP.Dashboard
return RenderPartial(new InlineMetric(metric));
}

//public NonEscapedString Paginator(Pager pager)
//{
// if (pager == null) throw new ArgumentNullException(nameof(pager));
// return RenderPartial(new Paginator(pager));
//}
public NonEscapedString Paginator(Pager pager)
{
if (pager == null) throw new ArgumentNullException(nameof(pager));
return RenderPartial(new Paginator(pager));
}

//public NonEscapedString PerPageSelector(Pager pager)
//{
// if (pager == null) throw new ArgumentNullException(nameof(pager));
// return RenderPartial(new PerPageSelector(pager));
//}
public NonEscapedString PerPageSelector(Pager pager)
{
if (pager == null) throw new ArgumentNullException(nameof(pager));
return RenderPartial(new PerPageSelector(pager));
}

public NonEscapedString RenderPartial(RazorPage partialPage)
{


+ 14
- 23
src/DotNetCore.CAP/Dashboard/IMonitoringApi.cs Целия файл

@@ -6,32 +6,23 @@ namespace DotNetCore.CAP.Dashboard
{
public interface IMonitoringApi
{
IList<QueueWithTopEnqueuedJobsDto> Queues();
IList<ServerDto> Servers();
JobDetailsDto JobDetails(string jobId);
StatisticsDto GetStatistics();

JobList<EnqueuedJobDto> EnqueuedJobs(string queue, int from, int perPage);
JobList<FetchedJobDto> FetchedJobs(string queue, int from, int perPage);

JobList<ProcessingJobDto> ProcessingJobs(int from, int count);
JobList<ScheduledJobDto> ScheduledJobs(int from, int count);
JobList<SucceededJobDto> SucceededJobs(int from, int count);
JobList<FailedJobDto> FailedJobs(int from, int count);
JobList<DeletedJobDto> DeletedJobs(int from, int count);
StatisticsDto GetStatistics();
IList<MessageDto> Messages(MessageQueryDto queryDto);
int PublishedFailedCount();
int PublishedProcessingCount();
int PublishedSucceededCount();

long ScheduledCount();
long EnqueuedCount(string queue);
long FetchedCount(string queue);
long FailedCount();
long ProcessingCount();
int ReceivedFailedCount();
int ReceivedProcessingCount();
int ReceivedSucceededCount();

long SucceededListCount();
long DeletedListCount();
IDictionary<DateTime, long> SucceededByDatesCount();
IDictionary<DateTime, long> FailedByDatesCount();
IDictionary<DateTime, long> HourlySucceededJobs();
IDictionary<DateTime, long> HourlyFailedJobs();
IDictionary<DateTime, int> SucceededByDatesCount();
IDictionary<DateTime, int> FailedByDatesCount();
IDictionary<DateTime, int> HourlySucceededJobs();
IDictionary<DateTime, int> HourlyFailedJobs();
}
}

+ 3
- 3
src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs Целия файл

@@ -20,7 +20,7 @@ namespace DotNetCore.CAP.Dashboard
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
static JobHistoryRenderer()
{
Register(SuccessedState.StateName, SucceededRenderer);
Register(SucceededState.StateName, SucceededRenderer);
Register(FailedState.StateName, FailedRenderer);
Register(ProcessingState.StateName, ProcessingRenderer);
Register(EnqueuedState.StateName, EnqueuedRenderer);
@@ -29,7 +29,7 @@ namespace DotNetCore.CAP.Dashboard
//Register(AwaitingState.StateName, AwaitingRenderer);

BackgroundStateColors.Add(EnqueuedState.StateName, "#F5F5F5");
BackgroundStateColors.Add(SuccessedState.StateName, "#EDF7ED");
BackgroundStateColors.Add(SucceededState.StateName, "#EDF7ED");
BackgroundStateColors.Add(FailedState.StateName, "#FAEBEA");
BackgroundStateColors.Add(ProcessingState.StateName, "#FCEFDC");
BackgroundStateColors.Add(ScheduledState.StateName, "#E0F3F8");
@@ -37,7 +37,7 @@ namespace DotNetCore.CAP.Dashboard
//BackgroundStateColors.Add(AwaitingState.StateName, "#F5F5F5");

ForegroundStateColors.Add(EnqueuedState.StateName, "#999");
ForegroundStateColors.Add(SuccessedState.StateName, "#5cb85c");
ForegroundStateColors.Add(SucceededState.StateName, "#5cb85c");
ForegroundStateColors.Add(FailedState.StateName, "#d9534f");
ForegroundStateColors.Add(ProcessingState.StateName, "#f0ad4e");
ForegroundStateColors.Add(ScheduledState.StateName, "#5bc0de");


+ 57
- 0
src/DotNetCore.CAP/Dashboard/MessagesSidebarMenu.cs Целия файл

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using DotNetCore.CAP.Dashboard.Resources;

namespace DotNetCore.CAP.Dashboard
{
public static class MessagesSidebarMenu
{
public static readonly List<Func<RazorPage, MenuItem>> PublishedItems
= new List<Func<RazorPage, MenuItem>>();

public static readonly List<Func<RazorPage, MenuItem>> ReceivedItems
= new List<Func<RazorPage, MenuItem>>();

static MessagesSidebarMenu()
{
PublishedItems.Add(page => new MenuItem(Strings.MessagesSidebarMenu_Succeeded, page.Url.To("/published/succeeded"))
{
Active = page.RequestPath.StartsWith("/published/succeeded"),
Metric = DashboardMetrics.PublishedSucceededCount
});

PublishedItems.Add(page => new MenuItem(Strings.MessagesSidebarMenu_Processing, page.Url.To("/published/processing"))
{
Active = page.RequestPath.StartsWith("/published/processing"),
Metric = DashboardMetrics.PublishedProcessingCount
});

PublishedItems.Add(page => new MenuItem(Strings.MessagesSidebarMenu_Failed, page.Url.To("/published/failed"))
{
Active = page.RequestPath.StartsWith("/published/failed"),
Metric = DashboardMetrics.PublishedFailedCount
});
//=======================================ReceivedItems=============================

ReceivedItems.Add(page => new MenuItem(Strings.MessagesSidebarMenu_Succeeded, page.Url.To("/received/succeeded"))
{
Active = page.RequestPath.StartsWith("/received/succeeded"),
Metric = DashboardMetrics.ReceivedSucceededCount
});

ReceivedItems.Add(page => new MenuItem(Strings.MessagesSidebarMenu_Processing, page.Url.To("/received/processing"))
{
Active = page.RequestPath.StartsWith("/received/processing"),
Metric = DashboardMetrics.ReceivedProcessingCount
});

ReceivedItems.Add(page => new MenuItem(Strings.MessagesSidebarMenu_Failed, page.Url.To("/received/failed"))
{
Active = page.RequestPath.StartsWith("/received/failed"),
Metric = DashboardMetrics.ReceivedFailedCount
});

}
}
}

+ 0
- 17
src/DotNetCore.CAP/Dashboard/Monitoring/DeletedJobDto.cs Целия файл

@@ -1,17 +0,0 @@
using System;
using DotNetCore.CAP.Models;

namespace DotNetCore.CAP.Dashboard.Monitoring
{
public class DeletedJobDto
{
public DeletedJobDto()
{
InDeletedState = true;
}

public Message Message { get; set; }
public DateTime? DeletedAt { get; set; }
public bool InDeletedState { get; set; }
}
}

+ 22
- 0
src/DotNetCore.CAP/Dashboard/Monitoring/MessageDto.cs Целия файл

@@ -0,0 +1,22 @@
using System;
namespace DotNetCore.CAP.Dashboard.Monitoring
{
public class MessageDto
{
public int Id { get; set; }

public string Group { get; set; }

public string Name { get; set; }

public string Content { get; set; }

public DateTime Added { get; set; }

public DateTime? ExpiresAt { get; set; }

public int Retries { get; set; }

public string StatusName { get; set; }
}
}

+ 22
- 0
src/DotNetCore.CAP/Dashboard/Monitoring/MessageQueryDto.cs Целия файл

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
using DotNetCore.CAP.Models;

namespace DotNetCore.CAP.Dashboard.Monitoring
{
public class MessageQueryDto
{
public MessageType MessageType { get; set; }

public string Name { get; set; }

public string Content { get; set; }

public string StatusName { get; set; }
public int CurrentPage { get; set; }

public int PageSize { get; set; }
}
}

+ 0
- 10
src/DotNetCore.CAP/Dashboard/Monitoring/QueueWithTopEnqueuedJobsDto.cs Целия файл

@@ -1,10 +0,0 @@
namespace DotNetCore.CAP.Dashboard.Monitoring
{
public class QueueWithTopEnqueuedJobsDto
{
public string Name { get; set; }
public long Length { get; set; }
public long? Fetched { get; set; }
public JobList<EnqueuedJobDto> FirstJobs { get; set; }
}
}

+ 10
- 9
src/DotNetCore.CAP/Dashboard/Monitoring/StatisticsDto.cs Целия файл

@@ -2,14 +2,15 @@
{
public class StatisticsDto
{
public long Servers { get; set; }
public long Recurring { get; set; }
public long Enqueued { get; set; }
public long Queues { get; set; }
public long Scheduled { get; set; }
public long Processing { get; set; }
public long Succeeded { get; set; }
public long Failed { get; set; }
public long Deleted { get; set; }
public int Servers { get; set; }

public int PublishedSucceeded { get; set; }
public int ReceivedSucceeded { get; set; }

public int PublishedFailed { get; set; }
public int ReceivedFailed { get; set; }

public int PublishedProcessing { get; set; }
public int ReceivedProcessing { get; set; }
}
}

+ 14
- 10
src/DotNetCore.CAP/Dashboard/NavigationMenu.cs Целия файл

@@ -10,26 +10,30 @@ namespace DotNetCore.CAP.Dashboard

static NavigationMenu()
{
Items.Add(page => new MenuItem(Strings.NavigationMenu_Jobs, page.Url.LinkToQueues())
Items.Add(page => new MenuItem(Strings.NavigationMenu_Published, page.Url.LinkToPublished())
{
Active = page.RequestPath.StartsWith("/jobs"),
Active = page.RequestPath.StartsWith("/published"),
Metrics = new []
{
DashboardMetrics.EnqueuedCountOrNull,
DashboardMetrics.FailedCountOrNull
DashboardMetrics.PublishedSucceededCount,
DashboardMetrics.PublishedFailedCountOrNull
}
});

Items.Add(page => new MenuItem(Strings.NavigationMenu_Retries, page.Url.To("/retries"))
Items.Add(page => new MenuItem(Strings.NavigationMenu_Received, page.Url.LinkToReceived())
{
Active = page.RequestPath.StartsWith("/retries"),
Metric = DashboardMetrics.RetriesCount
Active = page.RequestPath.StartsWith("/received"),
Metrics = new[]
{
DashboardMetrics.ReceivedSucceededCount,
DashboardMetrics.ReceivedFailedCountOrNull
}
});

Items.Add(page => new MenuItem(Strings.NavigationMenu_RecurringJobs, page.Url.To("/recurring"))
Items.Add(page => new MenuItem(Strings.NavigationMenu_Retries, page.Url.To("/retries"))
{
Active = page.RequestPath.StartsWith("/recurring"),
Metric = DashboardMetrics.RecurringJobCount
Active = page.RequestPath.StartsWith("/retries"),
Metric = DashboardMetrics.RetriesCount
});

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


+ 0
- 159
src/DotNetCore.CAP/Dashboard/Pages/AwaitingJobsPage.cshtml Целия файл

@@ -1,159 +0,0 @@
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: true *@
@using System
@using System.Collections.Generic
@using DotNetCore.CAP
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Resources
@inherits RazorPage
@{
Layout = new LayoutPage(Strings.AwaitingJobsPage_Title);

int from, perPage;

int.TryParse(Query("from"), out from);
int.TryParse(Query("count"), out perPage);

List<string> jobIds = null;
Pager pager = null;

using (var connection = Storage.GetConnection())
{
var storageConnection = connection as IStorageConnection;

if (storageConnection != null)
{
pager = new Pager(from, perPage, storageConnection.GetSetCount("awaiting"));
jobIds = storageConnection.GetRangeFromSet("awaiting", pager.FromRecord, pager.FromRecord + pager.RecordsPerPage - 1);
}
}
}

<div class="row">
<div class="col-md-3">
@Html.JobsSidebar()
</div>
<div class="col-md-9">
<h1 class="page-header">@Strings.AwaitingJobsPage_Title</h1>

@if (jobIds == null)
{
<div class="alert alert-warning">
<h4>@Strings.AwaitingJobsPage_ContinuationsWarning_Title</h4>
<p>@Strings.AwaitingJobsPage_ContinuationsWarning_Text</p>
</div>
}
else if (jobIds.Count > 0)
{
<div class="js-jobs-list">
<div class="btn-toolbar btn-toolbar-top">
<button class="js-jobs-list-command btn btn-sm btn-primary"
data-url="@Url.To("/jobs/awaiting/enqueue")"
data-loading-text="@Strings.Common_Enqueueing">
<span class="glyphicon glyphicon-repeat"></span>
@Strings.Common_EnqueueButton_Text
</button>

<button class="js-jobs-list-command btn btn-sm btn-default"
data-url="@Url.To("/jobs/awaiting/delete")"
data-loading-text="@Strings.Common_Deleting"
data-confirm="@Strings.Common_DeleteConfirm">
<span class="glyphicon glyphicon-remove"></span>
@Strings.Common_DeleteSelected
</button>

@Html.PerPageSelector(pager)
</div>

<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th class="min-width">
<input type="checkbox" class="js-jobs-list-select-all" />
</th>
<th class="min-width">@Strings.Common_Id</th>
<th>@Strings.Common_Job</th>
<th class="min-width">@Strings.AwaitingJobsPage_Table_Options</th>
<th class="min-width">@Strings.AwaitingJobsPage_Table_Parent</th>
<th class="align-right">@Strings.Common_Created</th>
</tr>
</thead>
<tbody>
@foreach (var jobId in jobIds)
{
MessageData jobData;
StateData stateData;
StateData parentStateData = null;

using (var connection = Storage.GetConnection())
{
jobData = connection.GetJobData(jobId);
stateData = connection.GetStateData(jobId);

//if (stateData != null && stateData.Name == AwaitingState.StateName)
//{
// parentStateData = connection.GetStateData(stateData.Data["ParentId"]);
//}
}

<tr class="js-jobs-list-row @(jobData != null ? "hover" : null)">
<td>
<input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@jobId" />
</td>
<td class="min-width">
@Html.JobIdLink(jobId)
</td>
@if (jobData == null)
{
<td colspan="2"><em>@Strings.Common_JobExpired</em></td>
}
else
{
<td class="word-break">
@Html.JobNameLink(jobId, jobData.Message)
</td>
<td class="min-width">
@if (stateData != null && stateData.Data.ContainsKey("Options") && !String.IsNullOrWhiteSpace(stateData.Data["Options"]))
{
<code>@stateData.Data["Options"]</code>
}
else
{
<em>@Strings.Common_NotAvailable</em>
}
</td>
<td class="min-width">
@if (parentStateData != null)
{
<a href="@Url.JobDetails(stateData.Data["ParentId"])">
<span class="label label-default label-hover" style="@($"background-color: {JobHistoryRenderer.GetForegroundStateColor(parentStateData.Name)};")">
@parentStateData.Name
</span>
</a>
}
else
{
<em>@Strings.Common_NotAvailable</em>
}
</td>
<td class="min-width align-right">
@Html.RelativeTime(jobData.CreatedAt)
</td>
}
</tr>
}
</tbody>
</table>
</div>
@Html.Paginator(pager)
</div>
}
else
{
<div class="alert alert-info">
@Strings.AwaitingJobsPage_NoJobs
</div>
}
</div>
</div>

+ 5
- 5
src/DotNetCore.CAP/Dashboard/Pages/HomePage.cshtml Целия файл

@@ -8,8 +8,8 @@
@inherits RazorPage
@{
Layout = new LayoutPage(Strings.HomePage_Title);
IDictionary<DateTime, long> succeeded = null;
IDictionary<DateTime, long> failed = null;
IDictionary<DateTime, int> succeeded = null;
IDictionary<DateTime, int> failed = null;

var period = Query("period") ?? "day";

@@ -41,12 +41,12 @@
</div>
}
<h3>@Strings.HomePage_RealtimeGraph</h3>
<div id="realtimeGraph" data-succeeded="@Statistics.Succeeded" data-failed="@Statistics.Failed"
<div id="realtimeGraph" data-succeeded="@Statistics.PublishedSucceeded" data-failed="@Statistics.PublishedFailed"
data-succeeded-string="@Strings.HomePage_GraphHover_Succeeded"
data-failed-string="@Strings.HomePage_GraphHover_Failed"></div>
<div style="display: none;">
<span data-metric="succeeded:count"></span>
<span data-metric="failed:count"></span>
<span data-metric="published_succeeded:count"></span>
<span data-metric="published_failed:count"></span>
</div>

<h3>


+ 6
- 6
src/DotNetCore.CAP/Dashboard/Pages/HomePage.generated.cs Целия файл

@@ -73,8 +73,8 @@ WriteLiteral("\r\n");
#line 9 "..\..\Dashboard\Pages\HomePage.cshtml"
Layout = new LayoutPage(Strings.HomePage_Title);
IDictionary<DateTime, long> succeeded = null;
IDictionary<DateTime, long> failed = null;
IDictionary<DateTime, int> succeeded = null;
IDictionary<DateTime, int> failed = null;

var period = Query("period") ?? "day";

@@ -172,7 +172,7 @@ WriteLiteral("</h3>\r\n <div id=\"realtimeGraph\" data-succeeded=\"");

#line 44 "..\..\Dashboard\Pages\HomePage.cshtml"
Write(Statistics.Succeeded);
Write(Statistics.PublishedSucceeded);

#line default
@@ -182,7 +182,7 @@ WriteLiteral("\" data-failed=\"");

#line 44 "..\..\Dashboard\Pages\HomePage.cshtml"
Write(Statistics.Failed);
Write(Statistics.PublishedFailed);

#line default
@@ -209,8 +209,8 @@ WriteLiteral("\"\r\n data-failed-string=\"");
#line hidden
WriteLiteral(@"""></div>
<div style=""display: none;"">
<span data-metric=""succeeded:count""></span>
<span data-metric=""failed:count""></span>
<span data-metric=""published_succeeded:count""></span>
<span data-metric=""published_failed:count""></span>
</div>

<h3>


+ 0
- 123
src/DotNetCore.CAP/Dashboard/Pages/ProcessingJobsPage.cshtml Целия файл

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

int from, perPage;

int.TryParse(Query("from"), out from);
int.TryParse(Query("count"), out perPage);

var monitor = Storage.GetMonitoringApi();
var pager = new Pager(from, perPage, monitor.ProcessingCount());
var processingJobs = monitor.ProcessingJobs(pager.FromRecord, pager.RecordsPerPage);
var servers = monitor.Servers();
}

<div class="row">
<div class="col-md-3">
@Html.JobsSidebar()
</div>
<div class="col-md-9">
<h1 class="page-header">@Strings.ProcessingJobsPage_Title</h1>

@if (pager.TotalPageCount == 0)
{
<div class="alert alert-info">
@Strings.ProcessingJobsPage_NoJobs
</div>
}
else
{
<div class="js-jobs-list">
<div class="btn-toolbar btn-toolbar-top">
<button class="js-jobs-list-command btn btn-sm btn-primary"
data-url="@Url.To("/jobs/processing/requeue")"
data-loading-text="@Strings.Common_Enqueueing"
disabled="disabled">
<span class="glyphicon glyphicon-repeat"></span>
@Strings.Common_RequeueJobs
</button>

<button class="js-jobs-list-command btn btn-sm btn-default"
data-url="@Url.To("/jobs/processing/delete")"
data-loading-text="@Strings.Common_Deleting"
data-confirm="@Strings.Common_DeleteConfirm"
disabled="disabled">
<span class="glyphicon glyphicon-remove"></span>
@Strings.Common_DeleteSelected
</button>

@Html.PerPageSelector(pager)
</div>

<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="min-width">
<input type="checkbox" class="js-jobs-list-select-all" />
</th>
<th class="min-width">@Strings.Common_Id</th>
<th class="min-width">@Strings.Common_Server</th>
<th>@Strings.Common_Job</th>
<th class="align-right">@Strings.ProcessingJobsPage_Table_Started</th>
</tr>
</thead>
<tbody>
@foreach (var job in processingJobs)
{
<tr class="js-jobs-list-row @(!job.Value.InProcessingState ? "obsolete-data" : null) @(job.Value.InProcessingState ? "hover" : null)">
<td>
@if (job.Value.InProcessingState)
{
<input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@job.Key" />
}
</td>
<td class="min-width">
@Html.JobIdLink(job.Key)
@if (!job.Value.InProcessingState)
{
<span title="@Strings.Common_JobStateChanged_Text" class="glyphicon glyphicon-question-sign"></span>
}
</td>
@if (!job.Value.InProcessingState)
{
<td colspan="3">@Strings.Common_JobStateChanged_Text</td>
}
else
{
<td class="min-width">
@Html.ServerId(job.Value.ServerId)
</td>
<td class="word-break">
@if (servers.All(x => x.Name != job.Value.ServerId || x.Heartbeat < DateTime.UtcNow.AddMinutes(-1)))
{
<span title="@Strings.ProcessingJobsPage_Aborted" class="glyphicon glyphicon-warning-sign" style="font-size: 10px;"></span>
}

@Html.JobNameLink(job.Key, job.Value.Job)
</td>
<td class="align-right">
@if (job.Value.StartedAt.HasValue)
{
@Html.RelativeTime(job.Value.StartedAt.Value)
}
</td>
}
</tr>
}
</tbody>
</table>
</div>

@Html.Paginator(pager)
</div>
}
</div>
</div>

+ 33
- 0
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs Целия файл

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Text;
using DotNetCore.CAP.Processor.States;

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

public string StatusName { get; set; }

public int GetTotal(IMonitoringApi api)
{
if (String.Compare(StatusName, SucceededState.StateName, true) == 0)
{
return api.PublishedSucceededCount();
}
else if (String.Compare(StatusName, ProcessingState.StateName, true) == 0)
{
return api.PublishedProcessingCount();
}
else
{
return api.PublishedFailedCount();
}
}
}
}

+ 122
- 0
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml Целия файл

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

int from, perPage;

int.TryParse(Query("from"), out from);
int.TryParse(Query("count"), out perPage);
string name = Query("name");
string content = Query("content");

var monitor = Storage.GetMonitoringApi();
var pager = new Pager(from, perPage, GetTotal(monitor));
var total = 0;
var queryDto = new MessageQueryDto
{
MessageType = MessageType.Publish,
Name = name,
Content = content,
StatusName = StatusName,
CurrentPage = pager.CurrentPage - 1,
PageSize = pager.RecordsPerPage
};
var succeededMessages = monitor.Messages(queryDto);
}

<div class="row">
<div class="col-md-3">
@Html.JobsSidebar(MessageType.Publish)
</div>
<div class="col-md-9">
<h1 class="page-header">@Strings.SucceededMessagesPage_Title</h1>

@if (succeededMessages.Count == 0)
{
<div class="alert alert-info">
@Strings.SucceededJobsPage_NoJobs
</div>
}
else
{
<div class="js-jobs-list">
<div class="btn-toolbar btn-toolbar-top">
<form class="row">
<span class="col-md-3">
<input type="text" class="form-control" name="name" value="@Query("name")" placeholder="消息名称" />
</span>
<div class="col-md-5">
<div class="input-group">
<input type="text" class="form-control" name="content" value="@Query("content")" placeholder="消息内容" />
<span class="input-group-btn">
<button class="btn btn-info">查找</button>
</span>
</div>
</div>
</form>
</div>
<div class="btn-toolbar btn-toolbar-top">
<button class="js-jobs-list-command btn btn-sm btn-primary"
data-url="@Url.To("/published/requeue")"
data-loading-text="@Strings.Common_Enqueueing"
disabled="disabled">
<span class="glyphicon glyphicon-repeat"></span>
@Strings.Common_RequeueJobs
</button>

@Html.PerPageSelector(pager)
</div>

<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th style="width:60px;">
<input type="checkbox" class="js-jobs-list-select-all" />
</th>
<th>名称</th>
<th>内容</th>
<th class="min-width">重试次数</th>
<th class="min-width align-right">过期时间</th>
</tr>
</thead>
<tbody>
@foreach (var message in succeededMessages)
{
<tr class="js-jobs-list-row hover">
<td>
<input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@message.Id" />
</td>
<td class="word-break">
@message.Name
</td>
<td>
@message.Content
</td>
<td>
@message.Retries
</td>
<td class="align-right">
@if (message.ExpiresAt.HasValue)
{
@Html.RelativeTime(message.ExpiresAt.Value)
}
</td>

</tr>
}
</tbody>
</table>
</div>
@Html.Paginator(pager)
</div>
}
</div>
</div>

+ 372
- 0
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs Целия файл

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

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

public override void Execute()
{


WriteLiteral("\r\n");









#line 9 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Layout = new LayoutPage(Strings.SucceededMessagesPage_Title);

int from, perPage;

int.TryParse(Query("from"), out from);
int.TryParse(Query("count"), out perPage);
string name = Query("name");
string content = Query("content");

var monitor = Storage.GetMonitoringApi();
var pager = new Pager(from, perPage, GetTotal(monitor));
var total = 0;
var queryDto = new MessageQueryDto
{
MessageType = MessageType.Publish,
Name = name,
Content = content,
StatusName = StatusName,
CurrentPage = pager.CurrentPage - 1,
PageSize = pager.RecordsPerPage
};
var succeededMessages = monitor.Messages(queryDto);


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


#line 36 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Html.JobsSidebar(MessageType.Publish));

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


#line 39 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Strings.SucceededMessagesPage_Title);

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


#line 41 "..\..\Dashboard\Pages\PublishedPage.cshtml"
if (succeededMessages.Count == 0)
{

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


#line 44 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Strings.SucceededJobsPage_NoJobs);

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


#line 46 "..\..\Dashboard\Pages\PublishedPage.cshtml"
}
else
{

#line default
#line hidden
WriteLiteral(@" <div class=""js-jobs-list"">
<div class=""btn-toolbar btn-toolbar-top"">
<form class=""row"">
<span class=""col-md-3"">
<input type=""text"" class=""form-control"" name=""name"" value=""");


#line 53 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Query("name"));

#line default
#line hidden
WriteLiteral("\" placeholder=\"消息名称\" />\r\n </span>\r\n " +
" <div class=\"col-md-5\">\r\n <div class=\"input-group\">\r\n" +
" <input type=\"text\" class=\"form-control\" name=\"co" +
"ntent\" value=\"");


#line 57 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Query("content"));

#line default
#line hidden
WriteLiteral(@""" placeholder=""消息内容"" />
<span class=""input-group-btn"">
<button class=""btn btn-info"">查找</button>
</span>
</div>
</div>
</form>
</div>
<div class=""btn-toolbar btn-toolbar-top"">
<button class=""js-jobs-list-command btn btn-sm btn-primary""
data-url=""");


#line 67 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Url.To("/jobs/succeeded/requeue"));

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


#line 68 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Strings.Common_Enqueueing);

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


#line 71 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Strings.Common_RequeueJobs);

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


#line 74 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Html.PerPageSelector(pager));

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

<div class=""table-responsive"">
<table class=""table"">
<thead>
<tr>
<th style=""width:60px;"">
<input type=""checkbox"" class=""js-jobs-list-select-all"" />
</th>
<th>名称</th>
<th>内容</th>
<th class=""min-width"">重试次数</th>
<th class=""min-width align-right"">过期时间</th>
</tr>
</thead>
<tbody>
");


#line 91 "..\..\Dashboard\Pages\PublishedPage.cshtml"
foreach (var message in succeededMessages)
{

#line default
#line hidden
WriteLiteral(" <tr class=\"js-jobs-list-row hover\">\r\n " +
" <td>\r\n <input typ" +
"e=\"checkbox\" class=\"js-jobs-list-checkbox\" name=\"jobs[]\" value=\"");


#line 95 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(message.Id);

#line default
#line hidden
WriteLiteral("\" />\r\n </td>\r\n " +
" <td class=\"word-break\">\r\n ");


#line 98 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(message.Name);

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


#line 101 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(message.Content);

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


#line 104 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(message.Retries);

#line default
#line hidden
WriteLiteral("\r\n </td>\r\n " +
"<td class=\"align-right\">\r\n");


#line 107 "..\..\Dashboard\Pages\PublishedPage.cshtml"
if (message.ExpiresAt.HasValue)
{
#line default
#line hidden
#line 109 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Html.RelativeTime(message.ExpiresAt.Value));

#line default
#line hidden
#line 109 "..\..\Dashboard\Pages\PublishedPage.cshtml"
}

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


#line 114 "..\..\Dashboard\Pages\PublishedPage.cshtml"
}

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


#line 118 "..\..\Dashboard\Pages\PublishedPage.cshtml"
Write(Html.Paginator(pager));

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


#line 120 "..\..\Dashboard\Pages\PublishedPage.cshtml"
}

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


}
}
}
#pragma warning restore 1591

+ 33
- 0
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs Целия файл

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Text;
using DotNetCore.CAP.Processor.States;

namespace DotNetCore.CAP.Dashboard.Pages
{
internal partial class ReceivedPage
{
public ReceivedPage(string statusName)
{
StatusName = statusName;
}

public string StatusName { get; set; }

public int GetTotal(IMonitoringApi api)
{
if (String.Compare(StatusName, SucceededState.StateName, true) == 0)
{
return api.ReceivedSucceededCount();
}
else if (String.Compare(StatusName, ProcessingState.StateName, true) == 0)
{
return api.ReceivedProcessingCount();
}
else
{
return api.ReceivedFailedCount();
}
}
}
}

+ 121
- 0
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cshtml Целия файл

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

int from, perPage;

int.TryParse(Query("from"), out from);
int.TryParse(Query("count"), out perPage);
string name = Query("name");
string content = Query("content");

var monitor = Storage.GetMonitoringApi();
var pager = new Pager(from, perPage, GetTotal(monitor));
var total = 0;
var queryDto = new MessageQueryDto
{
MessageType = MessageType.Subscribe,
Name = name,
Content = content,
StatusName = StatusName,
CurrentPage = pager.CurrentPage - 1,
PageSize = pager.RecordsPerPage
};
var succeededMessages = monitor.Messages(queryDto);
}

<div class="row">
<div class="col-md-3">
@Html.JobsSidebar(MessageType.Subscribe)
</div>
<div class="col-md-9">
<h1 class="page-header">@Strings.SucceededMessagesPage_Title</h1>

@if (succeededMessages.Count == 0)
{
<div class="alert alert-info">
@Strings.SucceededJobsPage_NoJobs
</div>
}
else
{
<div class="js-jobs-list">
<div class="btn-toolbar btn-toolbar-top">
<form class="row">
<span class="col-md-3">
<input type="text" class="form-control" name="name" value="@Query("name")" placeholder="消息名称" />
</span>
<div class="col-md-5">
<div class="input-group">
<input type="text" class="form-control" name="content" value="@Query("content")" placeholder="消息内容" />
<span class="input-group-btn">
<button class="btn btn-info">查找</button>
</span>
</div>
</div>
</form>
</div>
<div class="btn-toolbar btn-toolbar-top">
<button class="js-jobs-list-command btn btn-sm btn-primary"
data-url="@Url.To("/received/requeue")"
data-loading-text="@Strings.Common_Enqueueing"
disabled="disabled">
<span class="glyphicon glyphicon-repeat"></span>
@Strings.Common_RequeueJobs
</button>

@Html.PerPageSelector(pager)
</div>

<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th style="width:60px;">
<input type="checkbox" class="js-jobs-list-select-all" />
</th>
<th>名称</th>
<th>内容</th>
<th class="min-width">重试次数</th>
<th class="min-width align-right">过期时间</th>
</tr>
</thead>
<tbody>
@foreach (var message in succeededMessages)
{
<tr class="js-jobs-list-row hover">
<td>
<input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@message.Id" />
</td>
<td class="word-break">
@message.Name
</td>
<td>
@message.Content
</td>
<td>
@message.Retries
</td>
<td class="align-right">
@if (message.ExpiresAt.HasValue)
{
@Html.RelativeTime(message.ExpiresAt.Value)
}
</td>
</tr>
}
</tbody>
</table>
</div>
@Html.Paginator(pager)
</div>
}
</div>
</div>

+ 372
- 0
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs Целия файл

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

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

public override void Execute()
{


WriteLiteral("\r\n");









#line 9 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Layout = new LayoutPage(Strings.SucceededMessagesPage_Title);

int from, perPage;

int.TryParse(Query("from"), out from);
int.TryParse(Query("count"), out perPage);
string name = Query("name");
string content = Query("content");

var monitor = Storage.GetMonitoringApi();
var pager = new Pager(from, perPage, GetTotal(monitor));
var total = 0;
var queryDto = new MessageQueryDto
{
MessageType = MessageType.Subscribe,
Name = name,
Content = content,
StatusName = StatusName,
CurrentPage = pager.CurrentPage - 1,
PageSize = pager.RecordsPerPage
};
var succeededMessages = monitor.Messages(queryDto);


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


#line 36 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Html.JobsSidebar(MessageType.Subscribe));

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


#line 39 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Strings.SucceededMessagesPage_Title);

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


#line 41 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
if (succeededMessages.Count == 0)
{

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


#line 44 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Strings.SucceededJobsPage_NoJobs);

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


#line 46 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
}
else
{

#line default
#line hidden
WriteLiteral(@" <div class=""js-jobs-list"">
<div class=""btn-toolbar btn-toolbar-top"">
<form class=""row"">
<span class=""col-md-3"">
<input type=""text"" class=""form-control"" name=""name"" value=""");


#line 53 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Query("name"));

#line default
#line hidden
WriteLiteral("\" placeholder=\"消息名称\" />\r\n </span>\r\n " +
" <div class=\"col-md-5\">\r\n <div class=\"input-group\">\r\n" +
" <input type=\"text\" class=\"form-control\" name=\"co" +
"ntent\" value=\"");


#line 57 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Query("content"));

#line default
#line hidden
WriteLiteral(@""" placeholder=""消息内容"" />
<span class=""input-group-btn"">
<button class=""btn btn-info"">查找</button>
</span>
</div>
</div>
</form>
</div>
<div class=""btn-toolbar btn-toolbar-top"">
<button class=""js-jobs-list-command btn btn-sm btn-primary""
data-url=""");


#line 67 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Url.To("/received/requeue"));

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


#line 68 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Strings.Common_Enqueueing);

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


#line 71 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Strings.Common_RequeueJobs);

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


#line 74 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Html.PerPageSelector(pager));

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

<div class=""table-responsive"">
<table class=""table"">
<thead>
<tr>
<th style=""width:60px;"">
<input type=""checkbox"" class=""js-jobs-list-select-all"" />
</th>
<th>名称</th>
<th>内容</th>
<th class=""min-width"">重试次数</th>
<th class=""min-width align-right"">过期时间</th>
</tr>
</thead>
<tbody>
");


#line 91 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
foreach (var message in succeededMessages)
{

#line default
#line hidden
WriteLiteral(" <tr class=\"js-jobs-list-row hover\">\r\n " +
" <td>\r\n <input typ" +
"e=\"checkbox\" class=\"js-jobs-list-checkbox\" name=\"jobs[]\" value=\"");


#line 95 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(message.Id);

#line default
#line hidden
WriteLiteral("\" />\r\n </td>\r\n " +
" <td class=\"word-break\">\r\n ");


#line 98 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(message.Name);

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


#line 101 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(message.Content);

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


#line 104 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(message.Retries);

#line default
#line hidden
WriteLiteral("\r\n </td>\r\n " +
"<td class=\"align-right\">\r\n");


#line 107 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
if (message.ExpiresAt.HasValue)
{
#line default
#line hidden
#line 109 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Html.RelativeTime(message.ExpiresAt.Value));

#line default
#line hidden
#line 109 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
}

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


#line 113 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
}

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


#line 117 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
Write(Html.Paginator(pager));

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


#line 119 "..\..\Dashboard\Pages\ReceivedPage.cshtml"
}

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


}
}
}
#pragma warning restore 1591

+ 248
- 0
src/DotNetCore.CAP/Dashboard/Pages/_Paginator.generated.cs Целия файл

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

namespace DotNetCore.CAP.Dashboard.Pages
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#line 2 "..\..\Dashboard\Pages\_Paginator.cshtml"
using DotNetCore.CAP.Dashboard;
#line default
#line hidden
#line 3 "..\..\Dashboard\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
{
#line hidden

public override void Execute()
{


WriteLiteral("\r\n");



WriteLiteral("\r\n");


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


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

#line default
#line hidden
WriteLiteral(" <div class=\"btn-group paginator\">\r\n");


#line 10 "..\..\Dashboard\Pages\_Paginator.cshtml"
foreach (var page in _pager.PagerItems)
{
switch (page.Type)
{
case Pager.ItemType.Page:

#line default
#line hidden
WriteLiteral(" <a href=\"");


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

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


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

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


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

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


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

#line default
#line hidden
WriteLiteral(" <a href=\"");


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

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


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

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


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

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


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

#line default
#line hidden
WriteLiteral(" <a href=\"");


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

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


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

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


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

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


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

#line default
#line hidden
WriteLiteral(" <a href=\"#\" class=\"btn btn-default disabled\">\r\n " +
" …\r\n </a>\r\n");


#line 33 "..\..\Dashboard\Pages\_Paginator.cshtml"
break;
}
}

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



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


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

#line default
#line hidden
WriteLiteral("\r\n <div class=\"btn-toolbar-label\">\r\n ");


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

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


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

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


}
}
}
#pragma warning restore 1591

+ 106
- 0
src/DotNetCore.CAP/Dashboard/Pages/_PerPageSelector.generated.cs Целия файл

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

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

public override void Execute()
{


WriteLiteral("\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 default
#line hidden
WriteLiteral(" <a class=\"btn btn-sm btn-default ");


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

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


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

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


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

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


#line 10 "..\..\Dashboard\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 ");


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

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


}
}
}
#pragma warning restore 1591

+ 7
- 2
src/DotNetCore.CAP/Dashboard/UrlHelper.cs Целия файл

@@ -31,9 +31,14 @@ namespace DotNetCore.CAP.Dashboard
return To("/jobs/details/" + jobId);
}

public string LinkToQueues()
public string LinkToPublished()
{
return To("/jobs/enqueued");
return To("/published/succeeded");
}

public string LinkToReceived()
{
return To("/received/succeeded");
}

public string Queue(string queue)


Зареждане…
Отказ
Запис