@@ -87,37 +87,7 @@ namespace DotNetCore.CAP.Dashboard | |||||
var id = int.Parse(x.UriMatch.Groups["Id"].Value); | var id = int.Parse(x.UriMatch.Groups["Id"].Value); | ||||
var message = x.Storage.GetConnection().GetReceivedMessageAsync(id).GetAwaiter().GetResult(); | var message = x.Storage.GetConnection().GetReceivedMessageAsync(id).GetAwaiter().GetResult(); | ||||
return message.Content; | return message.Content; | ||||
}); | |||||
//Routes.AddRazorPage("/jobs/enqueued", x => new QueuesPage()); | |||||
//Routes.AddRazorPage( | |||||
// "/jobs/enqueued/fetched/(?<Queue>.+)", | |||||
// x => new FetchedJobsPage(x.Groups["Queue"].Value)); | |||||
//Routes.AddClientBatchCommand("/jobs/enqueued/delete", (client, jobId) => client.ChangeState(jobId, CreateDeletedState())); | |||||
//Routes.AddClientBatchCommand("/jobs/enqueued/requeue", (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState())); | |||||
//Routes.AddRazorPage( | |||||
// "/jobs/enqueued/(?<Queue>.+)", | |||||
// x => new EnqueuedJobsPage(x.Groups["Queue"].Value)); | |||||
//Routes.AddRazorPage("/jobs/processing", x => new ProcessingJobsPage()); | |||||
//Routes.AddClientBatchCommand( | |||||
// "/jobs/processing/delete", | |||||
// (client, jobId) => client.ChangeState(jobId, CreateDeletedState(), ProcessingState.StateName)); | |||||
//Routes.AddClientBatchCommand( | |||||
// "/jobs/processing/requeue", | |||||
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), ProcessingState.StateName)); | |||||
//Routes.AddRazorPage("/jobs/scheduled", x => new ScheduledJobsPage()); | |||||
//Routes.AddClientBatchCommand( | |||||
// "/jobs/scheduled/enqueue", | |||||
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), ScheduledState.StateName)); | |||||
//Routes.AddClientBatchCommand( | |||||
// "/jobs/scheduled/delete", | |||||
// (client, jobId) => client.ChangeState(jobId, CreateDeletedState(), ScheduledState.StateName)); | |||||
}); | |||||
Routes.AddPublishBatchCommand( | Routes.AddPublishBatchCommand( | ||||
"/published/requeue", | "/published/requeue", | ||||
@@ -132,55 +102,7 @@ namespace DotNetCore.CAP.Dashboard | |||||
Routes.AddRazorPage( | Routes.AddRazorPage( | ||||
"/received/(?<StatusName>.+)", | "/received/(?<StatusName>.+)", | ||||
x => new ReceivedPage(x.Groups["StatusName"].Value)); | x => new ReceivedPage(x.Groups["StatusName"].Value)); | ||||
Routes.AddRazorPage("/subscribers", x => new SubscriberPage()); | |||||
//Routes.AddRazorPage("/jobs/failed", x => new FailedJobsPage()); | |||||
//Routes.AddClientBatchCommand( | |||||
// "/jobs/failed/requeue", | |||||
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), FailedState.StateName)); | |||||
//Routes.AddClientBatchCommand( | |||||
// "/jobs/failed/delete", | |||||
// (client, jobId) => client.ChangeState(jobId, CreateDeletedState(), FailedState.StateName)); | |||||
//Routes.AddRazorPage("/jobs/deleted", x => new DeletedJobsPage()); | |||||
//Routes.AddClientBatchCommand( | |||||
// "/jobs/deleted/requeue", | |||||
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), DeletedState.StateName)); | |||||
//Routes.AddRazorPage("/jobs/awaiting", x => new AwaitingJobsPage()); | |||||
//Routes.AddClientBatchCommand("/jobs/awaiting/enqueue", (client, jobId) => client.ChangeState( | |||||
// jobId, CreateEnqueuedState(), AwaitingState.StateName)); | |||||
//Routes.AddClientBatchCommand("/jobs/awaiting/delete", (client, jobId) => client.ChangeState( | |||||
// jobId, CreateDeletedState(), AwaitingState.StateName)); | |||||
//Routes.AddCommand( | |||||
// "/jobs/actions/requeue/(?<JobId>.+)", | |||||
// context => | |||||
// { | |||||
// var client = new BackgroundJobClient(context.Storage); | |||||
// return client.ChangeState(context.UriMatch.Groups["JobId"].Value, CreateEnqueuedState()); | |||||
// }); | |||||
//Routes.AddCommand( | |||||
// "/jobs/actions/delete/(?<JobId>.+)", | |||||
// context => | |||||
// { | |||||
// var client = new BackgroundJobClient(context.Storage); | |||||
// return client.ChangeState(context.UriMatch.Groups["JobId"].Value, CreateDeletedState()); | |||||
// }); | |||||
//Routes.AddRazorPage("/jobs/details/(?<JobId>.+)", x => new JobDetailsPage(x.Groups["JobId"].Value)); | |||||
//Routes.AddRazorPage("/recurring", x => new RecurringJobsPage()); | |||||
//Routes.AddRecurringBatchCommand( | |||||
// "/recurring/remove", | |||||
// (manager, jobId) => manager.RemoveIfExists(jobId)); | |||||
//Routes.AddRecurringBatchCommand( | |||||
// "/recurring/trigger", | |||||
// (manager, jobId) => manager.Trigger(jobId)); | |||||
Routes.AddRazorPage("/subscribers", x => new SubscriberPage()); | |||||
//Routes.AddRazorPage("/servers", x => new ServersPage()); | //Routes.AddRazorPage("/servers", x => new ServersPage()); | ||||
//Routes.AddRazorPage("/retries", x => new RetriesPage()); | //Routes.AddRazorPage("/retries", x => new RetriesPage()); | ||||
@@ -200,14 +122,9 @@ namespace DotNetCore.CAP.Dashboard | |||||
return $"{GetContentFolderNamespace(contentFolder)}.{resourceName}"; | return $"{GetContentFolderNamespace(contentFolder)}.{resourceName}"; | ||||
} | } | ||||
//private static DeletedState CreateDeletedState() | |||||
//{ | |||||
// return new DeletedState { Reason = "Triggered via Dashboard UI" }; | |||||
//} | |||||
private static EnqueuedState CreateEnqueuedState() | private static EnqueuedState CreateEnqueuedState() | ||||
{ | { | ||||
return new EnqueuedState();// { Reason = "Triggered via Dashboard UI" }; | |||||
return new EnqueuedState(); | |||||
} | } | ||||
private static Assembly GetExecutingAssembly() | private static Assembly GetExecutingAssembly() | ||||
@@ -29,7 +29,7 @@ namespace DotNetCore.CAP.Dashboard | |||||
return RenderPartial(new Breadcrumbs(title, items)); | return RenderPartial(new Breadcrumbs(title, items)); | ||||
} | } | ||||
public NonEscapedString JobsSidebar(MessageType type) | |||||
public NonEscapedString MessagesSidebar(MessageType type) | |||||
{ | { | ||||
if (type == MessageType.Publish) | if (type == MessageType.Publish) | ||||
{ | { | ||||
@@ -82,24 +82,6 @@ namespace DotNetCore.CAP.Dashboard | |||||
return new NonEscapedString(value); | return new NonEscapedString(value); | ||||
} | } | ||||
public NonEscapedString JobId(string jobId, bool shorten = true) | |||||
{ | |||||
Guid guid; | |||||
return new NonEscapedString(Guid.TryParse(jobId, out guid) | |||||
? (shorten ? jobId.Substring(0, 8) + "…" : jobId) | |||||
: $"#{jobId}"); | |||||
} | |||||
public string JobName(Message job) | |||||
{ | |||||
if (job == null) | |||||
{ | |||||
return Strings.Common_CannotFindTargetMethod; | |||||
} | |||||
return job.ToString(); | |||||
} | |||||
public NonEscapedString StateLabel(string stateName) | public NonEscapedString StateLabel(string stateName) | ||||
{ | { | ||||
if (String.IsNullOrWhiteSpace(stateName)) | if (String.IsNullOrWhiteSpace(stateName)) | ||||
@@ -110,16 +92,6 @@ namespace DotNetCore.CAP.Dashboard | |||||
return Raw($"<span class=\"label label-default\" style=\"background-color: {JobHistoryRenderer.GetForegroundStateColor(stateName)};\">{stateName}</span>"); | return Raw($"<span class=\"label label-default\" style=\"background-color: {JobHistoryRenderer.GetForegroundStateColor(stateName)};\">{stateName}</span>"); | ||||
} | } | ||||
public NonEscapedString JobIdLink(string jobId) | |||||
{ | |||||
return Raw($"<a href=\"{_page.Url.JobDetails(jobId)}\">{JobId(jobId)}</a>"); | |||||
} | |||||
public NonEscapedString JobNameLink(string jobId, Message job) | |||||
{ | |||||
return Raw($"<a class=\"job-method\" href=\"{_page.Url.JobDetails(jobId)}\">{HtmlEncode(JobName(job))}</a>"); | |||||
} | |||||
public NonEscapedString RelativeTime(DateTime value) | public NonEscapedString RelativeTime(DateTime value) | ||||
{ | { | ||||
return Raw($"<span data-moment=\"{Helper.ToTimestamp(value)}\">{value}</span>"); | return Raw($"<span data-moment=\"{Helper.ToTimestamp(value)}\">{value}</span>"); | ||||
@@ -318,18 +290,6 @@ namespace DotNetCore.CAP.Dashboard | |||||
return $"<span class=\"{@class}\">{value}</span>"; | return $"<span class=\"{@class}\">{value}</span>"; | ||||
} | } | ||||
//private static readonly StackTraceHtmlFragments StackTraceHtmlFragments = new StackTraceHtmlFragments | |||||
//{ | |||||
// BeforeFrame = "<span class='st-frame'>" , AfterFrame = "</span>", | |||||
// BeforeType = "<span class='st-type'>" , AfterType = "</span>", | |||||
// BeforeMethod = "<span class='st-method'>" , AfterMethod = "</span>", | |||||
// BeforeParameters = "<span class='st-params'>" , AfterParameters = "</span>", | |||||
// BeforeParameterType = "<span class='st-param'><span class='st-param-type'>", AfterParameterType = "</span>", | |||||
// BeforeParameterName = "<span class='st-param-name'>" , AfterParameterName = "</span></span>", | |||||
// BeforeFile = "<span class='st-file'>" , AfterFile = "</span>", | |||||
// BeforeLine = "<span class='st-line'>" , AfterLine = "</span>", | |||||
//}; | |||||
public NonEscapedString StackTrace(string stackTrace) | public NonEscapedString StackTrace(string stackTrace) | ||||
{ | { | ||||
try | try | ||||
@@ -24,8 +24,6 @@ namespace DotNetCore.CAP.Dashboard | |||||
Register(SucceededState.StateName, SucceededRenderer); | Register(SucceededState.StateName, SucceededRenderer); | ||||
Register(FailedState.StateName, FailedRenderer); | Register(FailedState.StateName, FailedRenderer); | ||||
Register(ProcessingState.StateName, ProcessingRenderer); | Register(ProcessingState.StateName, ProcessingRenderer); | ||||
Register(EnqueuedState.StateName, EnqueuedRenderer); | |||||
Register(ScheduledState.StateName, ScheduledRenderer); | |||||
BackgroundStateColors.Add(EnqueuedState.StateName, "#F5F5F5"); | BackgroundStateColors.Add(EnqueuedState.StateName, "#F5F5F5"); | ||||
BackgroundStateColors.Add(SucceededState.StateName, "#EDF7ED"); | BackgroundStateColors.Add(SucceededState.StateName, "#EDF7ED"); | ||||
@@ -204,49 +202,5 @@ namespace DotNetCore.CAP.Dashboard | |||||
return new NonEscapedString(builder.ToString()); | return new NonEscapedString(builder.ToString()); | ||||
} | } | ||||
private static NonEscapedString EnqueuedRenderer(HtmlHelper helper, IDictionary<string, string> stateData) | |||||
{ | |||||
return new NonEscapedString( | |||||
$"<dl class=\"dl-horizontal\"><dt>Queue:</dt><dd>{helper.QueueLabel(stateData["Queue"])}</dd></dl>"); | |||||
} | |||||
private static NonEscapedString ScheduledRenderer(HtmlHelper helper, IDictionary<string, string> stateData) | |||||
{ | |||||
var enqueueAt = Helper.DeserializeDateTime(stateData["EnqueueAt"]); | |||||
return new NonEscapedString( | |||||
$"<dl class=\"dl-horizontal\"><dt>Enqueue at:</dt><dd data-moment=\"{Helper.ToTimestamp(enqueueAt)}\">{enqueueAt}</dd></dl>"); | |||||
} | |||||
private static NonEscapedString AwaitingRenderer(HtmlHelper helper, IDictionary<string, string> stateData) | |||||
{ | |||||
var builder = new StringBuilder(); | |||||
builder.Append("<dl class=\"dl-horizontal\">"); | |||||
if (stateData.ContainsKey("ParentId")) | |||||
{ | |||||
builder.Append($"<dt>Parent</dt><dd>{helper.JobIdLink(stateData["ParentId"])}</dd>"); | |||||
} | |||||
if (stateData.ContainsKey("NextState")) | |||||
{ | |||||
var nextState = JsonConvert.DeserializeObject<IState>( | |||||
stateData["NextState"], | |||||
new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }); | |||||
builder.Append($"<dt>Next State</dt><dd>{helper.StateLabel(nextState.Name)}</dd>"); | |||||
} | |||||
if (stateData.ContainsKey("Options")) | |||||
{ | |||||
builder.Append($"<dt>Options</dt><dd><code>{helper.HtmlEncode(stateData["Options"])}</code></dd>"); | |||||
} | |||||
builder.Append("</dl>"); | |||||
return new NonEscapedString(builder.ToString()); | |||||
} | |||||
} | } | ||||
} | } |
@@ -104,7 +104,7 @@ WriteLiteral("\r\n<div class=\"row\">\r\n <div class=\"col-md-3\">\r\n | |||||
#line 35 "..\..\Dashboard\Pages\PublishedPage.cshtml" | #line 35 "..\..\Dashboard\Pages\PublishedPage.cshtml" | ||||
Write(Html.JobsSidebar(MessageType.Publish)); | |||||
Write(Html.MessagesSidebar(MessageType.Publish)); | |||||
#line default | #line default | ||||
@@ -106,7 +106,7 @@ WriteLiteral("\r\n<div class=\"row\">\r\n <div class=\"col-md-3\">\r\n | |||||
#line 37 "..\..\Dashboard\Pages\ReceivedPage.cshtml" | #line 37 "..\..\Dashboard\Pages\ReceivedPage.cshtml" | ||||
Write(Html.JobsSidebar(MessageType.Subscribe)); | |||||
Write(Html.MessagesSidebar(MessageType.Subscribe)); | |||||
#line default | #line default | ||||