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
0d165b7e
Commit
0d165b7e
authored
Sep 05, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update dashboard
parent
c3a6a11b
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
1671 additions
and
348 deletions
+1671
-348
cap.js
src/DotNetCore.CAP/Dashboard/Content/js/cap.js
+2
-2
DashboardMetrics.cs
src/DotNetCore.CAP/Dashboard/DashboardMetrics.cs
+75
-88
DashboardRoutes.cs
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
+8
-2
HtmlHelper.cs
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
+19
-12
IMonitoringApi.cs
src/DotNetCore.CAP/Dashboard/IMonitoringApi.cs
+14
-23
JobHistoryRenderer.cs
src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs
+3
-3
MessagesSidebarMenu.cs
src/DotNetCore.CAP/Dashboard/MessagesSidebarMenu.cs
+57
-0
DeletedJobDto.cs
src/DotNetCore.CAP/Dashboard/Monitoring/DeletedJobDto.cs
+0
-17
MessageDto.cs
src/DotNetCore.CAP/Dashboard/Monitoring/MessageDto.cs
+22
-0
MessageQueryDto.cs
src/DotNetCore.CAP/Dashboard/Monitoring/MessageQueryDto.cs
+22
-0
QueueWithTopEnqueuedJobsDto.cs
...e.CAP/Dashboard/Monitoring/QueueWithTopEnqueuedJobsDto.cs
+0
-10
StatisticsDto.cs
src/DotNetCore.CAP/Dashboard/Monitoring/StatisticsDto.cs
+10
-9
NavigationMenu.cs
src/DotNetCore.CAP/Dashboard/NavigationMenu.cs
+14
-10
AwaitingJobsPage.cshtml
src/DotNetCore.CAP/Dashboard/Pages/AwaitingJobsPage.cshtml
+0
-159
HomePage.cshtml
src/DotNetCore.CAP/Dashboard/Pages/HomePage.cshtml
+5
-5
HomePage.generated.cs
src/DotNetCore.CAP/Dashboard/Pages/HomePage.generated.cs
+6
-6
PublishedPage.cs
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs
+33
-0
PublishedPage.cshtml
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml
+122
-0
PublishedPage1.generated.cs
...otNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs
+372
-0
ReceivedPage.cs
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs
+33
-0
ReceivedPage.cshtml
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cshtml
+121
-0
ReceivedPage.generated.cs
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs
+372
-0
_Paginator.generated.cs
src/DotNetCore.CAP/Dashboard/Pages/_Paginator.generated.cs
+248
-0
_PerPageSelector.generated.cs
...NetCore.CAP/Dashboard/Pages/_PerPageSelector.generated.cs
+106
-0
UrlHelper.cs
src/DotNetCore.CAP/Dashboard/UrlHelper.cs
+7
-2
No files found.
src/DotNetCore.CAP/Dashboard/Content/js/cap.js
View file @
0d165b7e
...
@@ -112,8 +112,8 @@
...
@@ -112,8 +112,8 @@
RealtimeGraph
.
prototype
=
Object
.
create
(
BaseGraph
.
prototype
);
RealtimeGraph
.
prototype
=
Object
.
create
(
BaseGraph
.
prototype
);
RealtimeGraph
.
prototype
.
appendHistory
=
function
(
statistics
)
{
RealtimeGraph
.
prototype
.
appendHistory
=
function
(
statistics
)
{
var
newSucceeded
=
parseInt
(
statistics
[
"
succeeded:count
"
].
intValue
);
var
newSucceeded
=
parseInt
(
statistics
[
"
published_
succeeded:count
"
].
intValue
);
var
newFailed
=
parseInt
(
statistics
[
"
failed:count
"
].
intValue
);
var
newFailed
=
parseInt
(
statistics
[
"
published_
failed:count
"
].
intValue
);
if
(
this
.
_succeeded
!==
null
&&
this
.
_failed
!==
null
)
{
if
(
this
.
_succeeded
!==
null
&&
this
.
_failed
!==
null
)
{
var
succeeded
=
newSucceeded
-
this
.
_succeeded
;
var
succeeded
=
newSucceeded
-
this
.
_succeeded
;
...
...
src/DotNetCore.CAP/Dashboard/DashboardMetrics.cs
View file @
0d165b7e
...
@@ -12,17 +12,19 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -12,17 +12,19 @@ namespace DotNetCore.CAP.Dashboard
static
DashboardMetrics
()
static
DashboardMetrics
()
{
{
AddMetric
(
ServerCount
);
AddMetric
(
ServerCount
);
AddMetric
(
RecurringJobCount
);
AddMetric
(
RetriesCount
);
AddMetric
(
RetriesCount
);
AddMetric
(
EnqueuedCountOrNull
);
AddMetric
(
FailedCountOrNull
);
AddMetric
(
PublishedFailedCountOrNull
);
AddMetric
(
EnqueuedAndQueueCount
);
AddMetric
(
ReceivedFailedCountOrNull
);
AddMetric
(
ScheduledCount
);
AddMetric
(
ProcessingCount
);
AddMetric
(
PublishedProcessingCount
);
AddMetric
(
SucceededCount
);
AddMetric
(
ReceivedProcessingCount
);
AddMetric
(
FailedCount
);
AddMetric
(
DeletedCount
);
AddMetric
(
PublishedSucceededCount
);
AddMetric
(
AwaitingCount
);
AddMetric
(
ReceivedSucceededCount
);
AddMetric
(
PublishedFailedCount
);
AddMetric
(
ReceivedFailedCount
);
}
}
public
static
void
AddMetric
(
DashboardMetric
metric
)
public
static
void
AddMetric
(
DashboardMetric
metric
)
...
@@ -44,7 +46,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -44,7 +46,7 @@ namespace DotNetCore.CAP.Dashboard
}
}
public
static
readonly
DashboardMetric
ServerCount
=
new
DashboardMetric
(
public
static
readonly
DashboardMetric
ServerCount
=
new
DashboardMetric
(
"servers:count"
,
"servers:count"
,
"Metrics_Servers"
,
"Metrics_Servers"
,
page
=>
new
Metric
(
page
.
Statistics
.
Servers
.
ToString
(
"N0"
))
page
=>
new
Metric
(
page
.
Statistics
.
Servers
.
ToString
(
"N0"
))
{
{
...
@@ -55,11 +57,6 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -55,11 +57,6 @@ namespace DotNetCore.CAP.Dashboard
:
null
:
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
(
public
static
readonly
DashboardMetric
RetriesCount
=
new
DashboardMetric
(
"retries:count"
,
"retries:count"
,
"Metrics_Retries"
,
"Metrics_Retries"
,
...
@@ -83,97 +80,87 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -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
(
public
static
readonly
DashboardMetric
Published
FailedCountOrNull
=
new
DashboardMetric
(
"failed:count-or-null"
,
"
publish_
failed:count-or-null"
,
"Metrics_FailedJobs"
,
"Metrics_FailedJobs"
,
page
=>
page
.
Statistics
.
Failed
>
0
page
=>
page
.
Statistics
.
Published
Failed
>
0
?
new
Metric
(
page
.
Statistics
.
Failed
.
ToString
(
"N0"
))
?
new
Metric
(
page
.
Statistics
.
Published
Failed
.
ToString
(
"N0"
))
{
{
Style
=
MetricStyle
.
Danger
,
Style
=
MetricStyle
.
Danger
,
Highlighted
=
true
,
Highlighted
=
true
,
Title
=
string
.
Format
(
Strings
.
Metrics_FailedCountOrNull
,
page
.
Statistics
.
Failed
)
Title
=
string
.
Format
(
Strings
.
Metrics_FailedCountOrNull
,
page
.
Statistics
.
Published
Failed
)
}
}
:
null
);
:
null
);
public
static
readonly
DashboardMetric
EnqueuedAndQueueCount
=
new
DashboardMetric
(
public
static
readonly
DashboardMetric
ReceivedFailedCountOrNull
=
new
DashboardMetric
(
"enqueued-queues:count"
,
"received_failed:count-or-null"
,
"Metrics_EnqueuedQueuesCount"
,
"Metrics_FailedJobs"
,
page
=>
new
Metric
(
$"
{
page
.
Statistics
.
Enqueued
:
N0
}
/
{
page
.
Statistics
.
Queues
:
N0
}
"
)
page
=>
page
.
Statistics
.
ReceivedFailed
>
0
{
?
new
Metric
(
page
.
Statistics
.
ReceivedFailed
.
ToString
(
"N0"
))
Style
=
page
.
Statistics
.
Enqueued
>
0
?
MetricStyle
.
Info
:
MetricStyle
.
Default
,
{
Highlighted
=
page
.
Statistics
.
Enqueued
>
0
Style
=
MetricStyle
.
Danger
,
});
Highlighted
=
true
,
Title
=
string
.
Format
(
Strings
.
Metrics_FailedCountOrNull
,
page
.
Statistics
.
ReceivedFailed
)
public
static
readonly
DashboardMetric
ScheduledCount
=
new
DashboardMetric
(
}
"scheduled:count"
,
:
null
);
"Metrics_ScheduledJobs"
,
page
=>
new
Metric
(
page
.
Statistics
.
Scheduled
.
ToString
(
"N0"
))
//----------------------------------------------------
{
Style
=
page
.
Statistics
.
Scheduled
>
0
?
MetricStyle
.
Info
:
MetricStyle
.
Default
public
static
readonly
DashboardMetric
PublishedProcessingCount
=
new
DashboardMetric
(
});
"publish_processing:count"
,
public
static
readonly
DashboardMetric
ProcessingCount
=
new
DashboardMetric
(
"processing:count"
,
"Metrics_ProcessingJobs"
,
"Metrics_ProcessingJobs"
,
page
=>
new
Metric
(
page
.
Statistics
.
Processing
.
ToString
(
"N0"
))
page
=>
new
Metric
(
page
.
Statistics
.
P
ublishedP
rocessing
.
ToString
(
"N0"
))
{
{
Style
=
page
.
Statistics
.
Processing
>
0
?
MetricStyle
.
Warning
:
MetricStyle
.
Default
Style
=
page
.
Statistics
.
P
ublishedP
rocessing
>
0
?
MetricStyle
.
Warning
:
MetricStyle
.
Default
});
});
public
static
readonly
DashboardMetric
SucceededCount
=
new
DashboardMetric
(
public
static
readonly
DashboardMetric
ReceivedProcessingCount
=
new
DashboardMetric
(
"succeeded:count"
,
"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"
,
"Metrics_SucceededJobs"
,
page
=>
new
Metric
(
page
.
Statistics
.
Succeeded
.
ToString
(
"N0"
))
page
=>
new
Metric
(
page
.
Statistics
.
Published
Succeeded
.
ToString
(
"N0"
))
{
{
IntValue
=
page
.
Statistics
.
Succeeded
IntValue
=
page
.
Statistics
.
Published
Succeeded
});
});
public
static
readonly
DashboardMetric
FailedCount
=
new
DashboardMetric
(
public
static
readonly
DashboardMetric
ReceivedSucceededCount
=
new
DashboardMetric
(
"failed:count"
,
"received_succeeded:count"
,
"Metrics_FailedJobs"
,
"Metrics_SucceededJobs"
,
page
=>
new
Metric
(
page
.
Statistics
.
Failed
.
ToString
(
"N0"
))
page
=>
new
Metric
(
page
.
Statistics
.
ReceivedSucceeded
.
ToString
(
"N0"
))
{
{
IntValue
=
page
.
Statistics
.
Failed
,
IntValue
=
page
.
Statistics
.
ReceivedSucceeded
Style
=
page
.
Statistics
.
Failed
>
0
?
MetricStyle
.
Danger
:
MetricStyle
.
Default
,
});
Highlighted
=
page
.
Statistics
.
Failed
>
0
});
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
())
public
static
readonly
DashboardMetric
PublishedFailedCount
=
new
DashboardMetric
(
{
"publish_failed:count"
,
var
storageConnection
=
connection
as
IStorageConnection
;
"Metrics_FailedJobs"
,
if
(
storageConnection
!=
null
)
page
=>
new
Metric
(
page
.
Statistics
.
PublishedFailed
.
ToString
(
"N0"
))
{
{
awaitingCount
=
storageConnection
.
GetSetCount
(
"awaiting"
);
IntValue
=
page
.
Statistics
.
PublishedFailed
,
}
Style
=
page
.
Statistics
.
PublishedFailed
>
0
?
MetricStyle
.
Danger
:
MetricStyle
.
Default
,
}
Highlighted
=
page
.
Statistics
.
PublishedFailed
>
0
return
new
Metric
(
awaitingCount
.
ToString
(
"N0"
))
{
Style
=
awaitingCount
>
0
?
MetricStyle
.
Info
:
MetricStyle
.
Default
};
});
});
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
});
}
}
}
}
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
View file @
0d165b7e
...
@@ -74,7 +74,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -74,7 +74,7 @@ namespace DotNetCore.CAP.Dashboard
#
region
Razor
pages
and
commands
#
region
Razor
pages
and
commands
Routes
.
AddRazorPage
(
"/jobs/enqueued"
,
x
=>
new
QueuesPage
());
//
Routes.AddRazorPage("/jobs/enqueued", x => new QueuesPage());
//Routes.AddRazorPage(
//Routes.AddRazorPage(
// "/jobs/enqueued/fetched/(?<Queue>.+)",
// "/jobs/enqueued/fetched/(?<Queue>.+)",
// x => new FetchedJobsPage(x.Groups["Queue"].Value));
// x => new FetchedJobsPage(x.Groups["Queue"].Value));
...
@@ -105,7 +105,13 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -105,7 +105,13 @@ namespace DotNetCore.CAP.Dashboard
// "/jobs/scheduled/delete",
// "/jobs/scheduled/delete",
// (client, jobId) => client.ChangeState(jobId, CreateDeletedState(), ScheduledState.StateName));
// (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(
//Routes.AddClientBatchCommand(
// "/jobs/succeeded/requeue",
// "/jobs/succeeded/requeue",
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), SucceededState.StateName));
// (client, jobId) => client.ChangeState(jobId, CreateEnqueuedState(), SucceededState.StateName));
...
...
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
View file @
0d165b7e
...
@@ -29,9 +29,16 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -29,9 +29,16 @@ namespace DotNetCore.CAP.Dashboard
return
RenderPartial
(
new
Breadcrumbs
(
title
,
items
));
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
)
public
NonEscapedString
SidebarMenu
(
IEnumerable
<
Func
<
RazorPage
,
MenuItem
>>
items
)
...
@@ -52,17 +59,17 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -52,17 +59,17 @@ namespace DotNetCore.CAP.Dashboard
return
RenderPartial
(
new
InlineMetric
(
metric
));
return
RenderPartial
(
new
InlineMetric
(
metric
));
}
}
//
public NonEscapedString Paginator(Pager pager)
public
NonEscapedString
Paginator
(
Pager
pager
)
//
{
{
//
if (pager == null) throw new ArgumentNullException(nameof(pager));
if
(
pager
==
null
)
throw
new
ArgumentNullException
(
nameof
(
pager
));
//
return RenderPartial(new Paginator(pager));
return
RenderPartial
(
new
Paginator
(
pager
));
//
}
}
//
public NonEscapedString PerPageSelector(Pager pager)
public
NonEscapedString
PerPageSelector
(
Pager
pager
)
//
{
{
//
if (pager == null) throw new ArgumentNullException(nameof(pager));
if
(
pager
==
null
)
throw
new
ArgumentNullException
(
nameof
(
pager
));
//
return RenderPartial(new PerPageSelector(pager));
return
RenderPartial
(
new
PerPageSelector
(
pager
));
//
}
}
public
NonEscapedString
RenderPartial
(
RazorPage
partialPage
)
public
NonEscapedString
RenderPartial
(
RazorPage
partialPage
)
{
{
...
...
src/DotNetCore.CAP/Dashboard/IMonitoringApi.cs
View file @
0d165b7e
...
@@ -6,32 +6,23 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -6,32 +6,23 @@ namespace DotNetCore.CAP.Dashboard
{
{
public
interface
IMonitoringApi
public
interface
IMonitoringApi
{
{
IList
<
QueueWithTopEnqueuedJobsDto
>
Queues
();
IList
<
ServerDto
>
Servers
();
IList
<
ServerDto
>
Servers
();
JobDetailsDto
JobDetails
(
string
jobId
);
StatisticsDto
GetStatistics
();
JobList
<
EnqueuedJobDto
>
EnqueuedJobs
(
string
queue
,
int
from
,
int
perPage
);
StatisticsDto
GetStatistics
();
JobList
<
FetchedJobDto
>
FetchedJobs
(
string
queue
,
int
from
,
int
perPage
);
IList
<
MessageDto
>
Messages
(
MessageQueryDto
queryDto
);
JobList
<
ProcessingJobDto
>
ProcessingJobs
(
int
from
,
int
count
);
JobList
<
ScheduledJobDto
>
ScheduledJobs
(
int
from
,
int
count
);
int
PublishedFailedCount
();
JobList
<
SucceededJobDto
>
SucceededJobs
(
int
from
,
int
count
);
int
PublishedProcessingCount
();
JobList
<
FailedJobDto
>
FailedJobs
(
int
from
,
int
count
);
int
PublishedSucceededCount
();
JobList
<
DeletedJobDto
>
DeletedJobs
(
int
from
,
int
count
);
long
ScheduledCount
();
int
ReceivedFailedCount
();
long
EnqueuedCount
(
string
queue
);
int
ReceivedProcessingCount
();
long
FetchedCount
(
string
queue
);
int
ReceivedSucceededCount
();
long
FailedCount
();
long
ProcessingCount
();
long
SucceededListCount
();
IDictionary
<
DateTime
,
int
>
SucceededByDatesCount
();
long
DeletedListCount
();
IDictionary
<
DateTime
,
int
>
FailedByDatesCount
();
IDictionary
<
DateTime
,
int
>
HourlySucceededJobs
();
IDictionary
<
DateTime
,
long
>
SucceededByDatesCount
();
IDictionary
<
DateTime
,
int
>
HourlyFailedJobs
();
IDictionary
<
DateTime
,
long
>
FailedByDatesCount
();
IDictionary
<
DateTime
,
long
>
HourlySucceededJobs
();
IDictionary
<
DateTime
,
long
>
HourlyFailedJobs
();
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs
View file @
0d165b7e
...
@@ -20,7 +20,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -20,7 +20,7 @@ namespace DotNetCore.CAP.Dashboard
[
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessage
(
"Microsoft.Performance"
,
"CA1810:InitializeReferenceTypeStaticFieldsInline"
)]
[
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessage
(
"Microsoft.Performance"
,
"CA1810:InitializeReferenceTypeStaticFieldsInline"
)]
static
JobHistoryRenderer
()
static
JobHistoryRenderer
()
{
{
Register
(
Succe
ss
edState
.
StateName
,
SucceededRenderer
);
Register
(
Succe
ed
edState
.
StateName
,
SucceededRenderer
);
Register
(
FailedState
.
StateName
,
FailedRenderer
);
Register
(
FailedState
.
StateName
,
FailedRenderer
);
Register
(
ProcessingState
.
StateName
,
ProcessingRenderer
);
Register
(
ProcessingState
.
StateName
,
ProcessingRenderer
);
Register
(
EnqueuedState
.
StateName
,
EnqueuedRenderer
);
Register
(
EnqueuedState
.
StateName
,
EnqueuedRenderer
);
...
@@ -29,7 +29,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -29,7 +29,7 @@ namespace DotNetCore.CAP.Dashboard
//Register(AwaitingState.StateName, AwaitingRenderer);
//Register(AwaitingState.StateName, AwaitingRenderer);
BackgroundStateColors
.
Add
(
EnqueuedState
.
StateName
,
"#F5F5F5"
);
BackgroundStateColors
.
Add
(
EnqueuedState
.
StateName
,
"#F5F5F5"
);
BackgroundStateColors
.
Add
(
Succe
ss
edState
.
StateName
,
"#EDF7ED"
);
BackgroundStateColors
.
Add
(
Succe
ed
edState
.
StateName
,
"#EDF7ED"
);
BackgroundStateColors
.
Add
(
FailedState
.
StateName
,
"#FAEBEA"
);
BackgroundStateColors
.
Add
(
FailedState
.
StateName
,
"#FAEBEA"
);
BackgroundStateColors
.
Add
(
ProcessingState
.
StateName
,
"#FCEFDC"
);
BackgroundStateColors
.
Add
(
ProcessingState
.
StateName
,
"#FCEFDC"
);
BackgroundStateColors
.
Add
(
ScheduledState
.
StateName
,
"#E0F3F8"
);
BackgroundStateColors
.
Add
(
ScheduledState
.
StateName
,
"#E0F3F8"
);
...
@@ -37,7 +37,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -37,7 +37,7 @@ namespace DotNetCore.CAP.Dashboard
//BackgroundStateColors.Add(AwaitingState.StateName, "#F5F5F5");
//BackgroundStateColors.Add(AwaitingState.StateName, "#F5F5F5");
ForegroundStateColors
.
Add
(
EnqueuedState
.
StateName
,
"#999"
);
ForegroundStateColors
.
Add
(
EnqueuedState
.
StateName
,
"#999"
);
ForegroundStateColors
.
Add
(
Succe
ss
edState
.
StateName
,
"#5cb85c"
);
ForegroundStateColors
.
Add
(
Succe
ed
edState
.
StateName
,
"#5cb85c"
);
ForegroundStateColors
.
Add
(
FailedState
.
StateName
,
"#d9534f"
);
ForegroundStateColors
.
Add
(
FailedState
.
StateName
,
"#d9534f"
);
ForegroundStateColors
.
Add
(
ProcessingState
.
StateName
,
"#f0ad4e"
);
ForegroundStateColors
.
Add
(
ProcessingState
.
StateName
,
"#f0ad4e"
);
ForegroundStateColors
.
Add
(
ScheduledState
.
StateName
,
"#5bc0de"
);
ForegroundStateColors
.
Add
(
ScheduledState
.
StateName
,
"#5bc0de"
);
...
...
src/DotNetCore.CAP/Dashboard/MessagesSidebarMenu.cs
0 → 100644
View file @
0d165b7e
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
});
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/Monitoring/DeletedJobDto.cs
deleted
100644 → 0
View file @
c3a6a11b
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
;
}
}
}
src/DotNetCore.CAP/Dashboard/Monitoring/MessageDto.cs
0 → 100644
View file @
0d165b7e
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
;
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/Monitoring/MessageQueryDto.cs
0 → 100644
View file @
0d165b7e
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
;
}
}
}
src/DotNetCore.CAP/Dashboard/Monitoring/QueueWithTopEnqueuedJobsDto.cs
deleted
100644 → 0
View file @
c3a6a11b
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
;
}
}
}
src/DotNetCore.CAP/Dashboard/Monitoring/StatisticsDto.cs
View file @
0d165b7e
...
@@ -2,14 +2,15 @@
...
@@ -2,14 +2,15 @@
{
{
public
class
StatisticsDto
public
class
StatisticsDto
{
{
public
long
Servers
{
get
;
set
;
}
public
int
Servers
{
get
;
set
;
}
public
long
Recurring
{
get
;
set
;
}
public
long
Enqueued
{
get
;
set
;
}
public
int
PublishedSucceeded
{
get
;
set
;
}
public
long
Queues
{
get
;
set
;
}
public
int
ReceivedSucceeded
{
get
;
set
;
}
public
long
Scheduled
{
get
;
set
;
}
public
long
Processing
{
get
;
set
;
}
public
int
PublishedFailed
{
get
;
set
;
}
public
long
Succeeded
{
get
;
set
;
}
public
int
ReceivedFailed
{
get
;
set
;
}
public
long
Failed
{
get
;
set
;
}
public
long
Deleted
{
get
;
set
;
}
public
int
PublishedProcessing
{
get
;
set
;
}
public
int
ReceivedProcessing
{
get
;
set
;
}
}
}
}
}
src/DotNetCore.CAP/Dashboard/NavigationMenu.cs
View file @
0d165b7e
...
@@ -10,26 +10,30 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -10,26 +10,30 @@ namespace DotNetCore.CAP.Dashboard
static
NavigationMenu
()
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
[]
Metrics
=
new
[]
{
{
DashboardMetrics
.
EnqueuedCountOrNull
,
DashboardMetrics
.
PublishedSucceededCount
,
DashboardMetrics
.
FailedCountOrNull
DashboardMetrics
.
Published
FailedCountOrNull
}
}
});
});
Items
.
Add
(
page
=>
new
MenuItem
(
Strings
.
NavigationMenu_Re
tries
,
page
.
Url
.
To
(
"/retries"
))
Items
.
Add
(
page
=>
new
MenuItem
(
Strings
.
NavigationMenu_Re
ceived
,
page
.
Url
.
LinkToReceived
(
))
{
{
Active
=
page
.
RequestPath
.
StartsWith
(
"/retries"
),
Active
=
page
.
RequestPath
.
StartsWith
(
"/received"
),
Metric
=
DashboardMetrics
.
RetriesCount
Metrics
=
new
[]
{
DashboardMetrics
.
ReceivedSucceededCount
,
DashboardMetrics
.
ReceivedFailedCountOrNull
}
});
});
Items
.
Add
(
page
=>
new
MenuItem
(
Strings
.
NavigationMenu_Re
curringJobs
,
page
.
Url
.
To
(
"/recurring
"
))
Items
.
Add
(
page
=>
new
MenuItem
(
Strings
.
NavigationMenu_Re
tries
,
page
.
Url
.
To
(
"/retries
"
))
{
{
Active
=
page
.
RequestPath
.
StartsWith
(
"/re
curring
"
),
Active
=
page
.
RequestPath
.
StartsWith
(
"/re
tries
"
),
Metric
=
DashboardMetrics
.
Re
curringJob
Count
Metric
=
DashboardMetrics
.
Re
tries
Count
});
});
Items
.
Add
(
page
=>
new
MenuItem
(
Strings
.
NavigationMenu_Servers
,
page
.
Url
.
To
(
"/servers"
))
Items
.
Add
(
page
=>
new
MenuItem
(
Strings
.
NavigationMenu_Servers
,
page
.
Url
.
To
(
"/servers"
))
...
...
src/DotNetCore.CAP/Dashboard/Pages/AwaitingJobsPage.cshtml
deleted
100644 → 0
View file @
c3a6a11b
@* 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>
src/DotNetCore.CAP/Dashboard/Pages/HomePage.cshtml
View file @
0d165b7e
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
@inherits RazorPage
@inherits RazorPage
@{
@{
Layout = new LayoutPage(Strings.HomePage_Title);
Layout = new LayoutPage(Strings.HomePage_Title);
IDictionary<DateTime,
long
> succeeded = null;
IDictionary<DateTime,
int
> succeeded = null;
IDictionary<DateTime,
long
> failed = null;
IDictionary<DateTime,
int
> failed = null;
var period = Query("period") ?? "day";
var period = Query("period") ?? "day";
...
@@ -41,12 +41,12 @@
...
@@ -41,12 +41,12 @@
</div>
</div>
}
}
<h3>@Strings.HomePage_RealtimeGraph</h3>
<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.Published
Failed"
data-succeeded-string="@Strings.HomePage_GraphHover_Succeeded"
data-succeeded-string="@Strings.HomePage_GraphHover_Succeeded"
data-failed-string="@Strings.HomePage_GraphHover_Failed"></div>
data-failed-string="@Strings.HomePage_GraphHover_Failed"></div>
<div style="display: none;">
<div style="display: none;">
<span data-metric="succeeded:count"></span>
<span data-metric="
published_
succeeded:count"></span>
<span data-metric="failed:count"></span>
<span data-metric="
published_
failed:count"></span>
</div>
</div>
<h3>
<h3>
...
...
src/DotNetCore.CAP/Dashboard/Pages/HomePage.generated.cs
View file @
0d165b7e
...
@@ -73,8 +73,8 @@ WriteLiteral("\r\n");
...
@@ -73,8 +73,8 @@ WriteLiteral("\r\n");
#
line
9
"..\..\Dashboard\Pages\HomePage.cshtml"
#
line
9
"..\..\Dashboard\Pages\HomePage.cshtml"
Layout
=
new
LayoutPage
(
Strings
.
HomePage_Title
);
Layout
=
new
LayoutPage
(
Strings
.
HomePage_Title
);
IDictionary
<
DateTime
,
long
>
succeeded
=
null
;
IDictionary
<
DateTime
,
int
>
succeeded
=
null
;
IDictionary
<
DateTime
,
long
>
failed
=
null
;
IDictionary
<
DateTime
,
int
>
failed
=
null
;
var
period
=
Query
(
"period"
)
??
"day"
;
var
period
=
Query
(
"period"
)
??
"day"
;
...
@@ -172,7 +172,7 @@ WriteLiteral("</h3>\r\n <div id=\"realtimeGraph\" data-succeeded=\"");
...
@@ -172,7 +172,7 @@ WriteLiteral("</h3>\r\n <div id=\"realtimeGraph\" data-succeeded=\"");
#
line
44
"..\..\Dashboard\Pages\HomePage.cshtml"
#
line
44
"..\..\Dashboard\Pages\HomePage.cshtml"
Write
(
Statistics
.
Succeeded
);
Write
(
Statistics
.
Published
Succeeded
);
#
line
default
#
line
default
...
@@ -182,7 +182,7 @@ WriteLiteral("\" data-failed=\"");
...
@@ -182,7 +182,7 @@ WriteLiteral("\" data-failed=\"");
#
line
44
"..\..\Dashboard\Pages\HomePage.cshtml"
#
line
44
"..\..\Dashboard\Pages\HomePage.cshtml"
Write
(
Statistics
.
Failed
);
Write
(
Statistics
.
Published
Failed
);
#
line
default
#
line
default
...
@@ -209,8 +209,8 @@ WriteLiteral("\"\r\n data-failed-string=\"");
...
@@ -209,8 +209,8 @@ WriteLiteral("\"\r\n data-failed-string=\"");
#
line
hidden
#
line
hidden
WriteLiteral
(
@"""></div>
WriteLiteral
(
@"""></div>
<div style=""display: none;"">
<div style=""display: none;"">
<span data-metric=""succeeded:count""></span>
<span data-metric=""
published_
succeeded:count""></span>
<span data-metric=""failed:count""></span>
<span data-metric=""
published_
failed:count""></span>
</div>
</div>
<h3>
<h3>
...
...
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs
0 → 100644
View file @
0d165b7e
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
();
}
}
}
}
src/DotNetCore.CAP/Dashboard/Pages/P
rocessingJobs
Page.cshtml
→
src/DotNetCore.CAP/Dashboard/Pages/P
ublished
Page.cshtml
View file @
0d165b7e
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True *@
@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True *@
@using System
@using System
@using
System.Linq
@using
DotNetCore.CAP.Models;
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard
@using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Monitoring
@using DotNetCore.CAP.Dashboard.Resources
@using DotNetCore.CAP.Dashboard.Resources
@inherits RazorPage
@inherits RazorPage
@{
@{
Layout = new LayoutPage(Strings.
ProcessingJob
sPage_Title);
Layout = new LayoutPage(Strings.
SucceededMessage
sPage_Title);
int from, perPage;
int from, perPage;
int.TryParse(Query("from"), out from);
int.TryParse(Query("from"), out from);
int.TryParse(Query("count"), out perPage);
int.TryParse(Query("count"), out perPage);
string name = Query("name");
string content = Query("content");
var monitor = Storage.GetMonitoringApi();
var monitor = Storage.GetMonitoringApi();
var pager = new Pager(from, perPage, monitor.ProcessingCount());
var pager = new Pager(from, perPage, GetTotal(monitor));
var processingJobs = monitor.ProcessingJobs(pager.FromRecord, pager.RecordsPerPage);
var total = 0;
var servers = monitor.Servers();
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="row">
<div class="col-md-3">
<div class="col-md-3">
@Html.JobsSidebar()
@Html.JobsSidebar(
MessageType.Publish
)
</div>
</div>
<div class="col-md-9">
<div class="col-md-9">
<h1 class="page-header">@Strings.
ProcessingJob
sPage_Title</h1>
<h1 class="page-header">@Strings.
SucceededMessage
sPage_Title</h1>
@if (
pager.TotalPage
Count == 0)
@if (
succeededMessages.
Count == 0)
{
{
<div class="alert alert-info">
<div class="alert alert-info">
@Strings.
Processing
JobsPage_NoJobs
@Strings.
Succeeded
JobsPage_NoJobs
</div>
</div>
}
}
else
else
{
{
<div class="js-jobs-list">
<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">
<div class="btn-toolbar btn-toolbar-top">
<button class="js-jobs-list-command btn btn-sm btn-primary"
<button class="js-jobs-list-command btn btn-sm btn-primary"
data-url="@Url.To("/
jobs/processing
/requeue")"
data-url="@Url.To("/
published
/requeue")"
data-loading-text="@Strings.Common_Enqueueing"
data-loading-text="@Strings.Common_Enqueueing"
disabled="disabled">
disabled="disabled">
<span class="glyphicon glyphicon-repeat"></span>
<span class="glyphicon glyphicon-repeat"></span>
@Strings.Common_RequeueJobs
@Strings.Common_RequeueJobs
</button>
</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)
@Html.PerPageSelector(pager)
</div>
</div>
...
@@ -60,62 +78,43 @@
...
@@ -60,62 +78,43 @@
<table class="table">
<table class="table">
<thead>
<thead>
<tr>
<tr>
<th
class="min-width
">
<th
style="width:60px;
">
<input type="checkbox" class="js-jobs-list-select-all" />
<input type="checkbox" class="js-jobs-list-select-all" />
</th>
</th>
<th
class="min-width">@Strings.Common_Id
</th>
<th
>名称
</th>
<th
class="min-width">@Strings.Common_Server
</th>
<th
>内容
</th>
<th
>@Strings.Common_Job
</th>
<th
class="min-width">重试次数
</th>
<th class="
align-right">@Strings.ProcessingJobsPage_Table_Started
</th>
<th class="
min-width align-right">过期时间
</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
@foreach (var
job in processingJob
s)
@foreach (var
message in succeededMessage
s)
{
{
<tr class="js-jobs-list-row
@(!job.Value.InProcessingState ? "obsolete-data" : null) @(job.Value.InProcessingState ? "hover" : null)
">
<tr class="js-jobs-list-row
hover
">
<td>
<td>
@if (job.Value.InProcessingState)
<input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@message.Id" />
{
<input type="checkbox" class="js-jobs-list-checkbox" name="jobs[]" value="@job.Key" />
}
</td>
</td>
<td class="min-width">
<td class="word-break">
@Html.JobIdLink(job.Key)
@message.Name
@if (!job.Value.InProcessingState)
</td>
<td>
@message.Content
</td>
<td>
@message.Retries
</td>
<td class="align-right">
@if (message.ExpiresAt.HasValue)
{
{
<span title="@Strings.Common_JobStateChanged_Text" class="glyphicon glyphicon-question-sign"></span>
@Html.RelativeTime(message.ExpiresAt.Value)
}
}
</td>
</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>
</tr>
}
}
</tbody>
</tbody>
</table>
</table>
</div>
</div>
@Html.Paginator(pager)
@Html.Paginator(pager)
</div>
</div>
}
}
...
...
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs
0 → 100644
View file @
0d165b7e
This diff is collapsed.
Click to expand it.
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs
0 → 100644
View file @
0d165b7e
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
();
}
}
}
}
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cshtml
0 → 100644
View file @
0d165b7e
@* 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>
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs
0 → 100644
View file @
0d165b7e
This diff is collapsed.
Click to expand it.
src/DotNetCore.CAP/Dashboard/Pages/_Paginator.generated.cs
0 → 100644
View file @
0d165b7e
#
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
src/DotNetCore.CAP/Dashboard/Pages/_PerPageSelector.generated.cs
0 → 100644
View file @
0d165b7e
#
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
src/DotNetCore.CAP/Dashboard/UrlHelper.cs
View file @
0d165b7e
...
@@ -31,9 +31,14 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -31,9 +31,14 @@ namespace DotNetCore.CAP.Dashboard
return
To
(
"/jobs/details/"
+
jobId
);
return
To
(
"/jobs/details/"
+
jobId
);
}
}
public
string
LinkTo
Queues
()
public
string
LinkTo
Published
()
{
{
return
To
(
"/jobs/enqueued"
);
return
To
(
"/published/succeeded"
);
}
public
string
LinkToReceived
()
{
return
To
(
"/received/succeeded"
);
}
}
public
string
Queue
(
string
queue
)
public
string
Queue
(
string
queue
)
...
...
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