Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
f2af45cc
Commit
f2af45cc
authored
Sep 15, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup code.
parent
f6ca2cc4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
175 deletions
+6
-175
DashboardRoutes.cs
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
+3
-86
HtmlHelper.cs
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
+1
-41
JobHistoryRenderer.cs
src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs
+0
-46
PublishedPage1.generated.cs
...otNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs
+1
-1
ReceivedPage.generated.cs
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs
+1
-1
No files found.
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
View file @
f2af45cc
...
...
@@ -87,37 +87,7 @@ namespace DotNetCore.CAP.Dashboard
var
id
=
int
.
Parse
(
x
.
UriMatch
.
Groups
[
"Id"
].
Value
);
var
message
=
x
.
Storage
.
GetConnection
().
GetReceivedMessageAsync
(
id
).
GetAwaiter
().
GetResult
();
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
(
"/published/requeue"
,
...
...
@@ -132,55 +102,7 @@ namespace DotNetCore.CAP.Dashboard
Routes
.
AddRazorPage
(
"/received/(?<StatusName>.+)"
,
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("/retries", x => new RetriesPage());
...
...
@@ -200,14 +122,9 @@ namespace DotNetCore.CAP.Dashboard
return
$"
{
GetContentFolderNamespace
(
contentFolder
)}
.
{
resourceName
}
"
;
}
//private static DeletedState CreateDeletedState()
//{
// return new DeletedState { Reason = "Triggered via Dashboard UI" };
//}
private
static
EnqueuedState
CreateEnqueuedState
()
{
return
new
EnqueuedState
();
// { Reason = "Triggered via Dashboard UI" };
return
new
EnqueuedState
();
}
private
static
Assembly
GetExecutingAssembly
()
...
...
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
View file @
f2af45cc
...
...
@@ -29,7 +29,7 @@ namespace DotNetCore.CAP.Dashboard
return
RenderPartial
(
new
Breadcrumbs
(
title
,
items
));
}
public
NonEscapedString
Job
sSidebar
(
MessageType
type
)
public
NonEscapedString
Message
sSidebar
(
MessageType
type
)
{
if
(
type
==
MessageType
.
Publish
)
{
...
...
@@ -82,24 +82,6 @@ namespace DotNetCore.CAP.Dashboard
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
)
{
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>"
);
}
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
)
{
return
Raw
(
$"<span data-moment=\"
{
Helper
.
ToTimestamp
(
value
)}
\">
{
value
}
</span>"
);
...
...
@@ -318,18 +290,6 @@ namespace DotNetCore.CAP.Dashboard
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
)
{
try
...
...
src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs
View file @
f2af45cc
...
...
@@ -24,8 +24,6 @@ namespace DotNetCore.CAP.Dashboard
Register
(
SucceededState
.
StateName
,
SucceededRenderer
);
Register
(
FailedState
.
StateName
,
FailedRenderer
);
Register
(
ProcessingState
.
StateName
,
ProcessingRenderer
);
Register
(
EnqueuedState
.
StateName
,
EnqueuedRenderer
);
Register
(
ScheduledState
.
StateName
,
ScheduledRenderer
);
BackgroundStateColors
.
Add
(
EnqueuedState
.
StateName
,
"#F5F5F5"
);
BackgroundStateColors
.
Add
(
SucceededState
.
StateName
,
"#EDF7ED"
);
...
...
@@ -204,49 +202,5 @@ namespace DotNetCore.CAP.Dashboard
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
());
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs
View file @
f2af45cc
...
...
@@ -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"
Write
(
Html
.
Job
sSidebar
(
MessageType
.
Publish
));
Write
(
Html
.
Message
sSidebar
(
MessageType
.
Publish
));
#
line
default
...
...
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs
View file @
f2af45cc
...
...
@@ -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"
Write
(
Html
.
Job
sSidebar
(
MessageType
.
Subscribe
));
Write
(
Html
.
Message
sSidebar
(
MessageType
.
Subscribe
));
#
line
default
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment