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
73949a41
Commit
73949a41
authored
Jan 15, 2020
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve dashboard
parent
d101c75c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
10 deletions
+18
-10
cap.js
src/DotNetCore.CAP.Dashboard/Content/js/cap.js
+1
-0
DashboardRequest.cs
src/DotNetCore.CAP.Dashboard/DashboardRequest.cs
+4
-1
DashboardRoutes.cs
src/DotNetCore.CAP.Dashboard/DashboardRoutes.cs
+9
-5
RazorPageDispatcher.cs
src/DotNetCore.CAP.Dashboard/RazorPageDispatcher.cs
+3
-3
RouteCollectionExtensions.cs
src/DotNetCore.CAP.Dashboard/RouteCollectionExtensions.cs
+1
-1
No files found.
src/DotNetCore.CAP.Dashboard/Content/js/cap.js
View file @
73949a41
...
...
@@ -652,4 +652,5 @@ $(function() {
function
nodeSwitch
(
id
)
{
console
.
log
(
`id:
${
id
}
`
);
document
.
cookie
=
`cap.node=
${
escape
(
id
)}
;`
;
window
.
location
.
reload
();
}
\ No newline at end of file
src/DotNetCore.CAP.Dashboard/DashboardRequest.cs
View file @
73949a41
...
...
@@ -3,6 +3,7 @@
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Http
;
...
...
@@ -11,6 +12,7 @@ namespace DotNetCore.CAP.Dashboard
public
abstract
class
DashboardRequest
{
public
abstract
string
Method
{
get
;
}
public
abstract
Dictionary
<
string
,
string
>
Cookies
{
get
;
}
public
abstract
string
Path
{
get
;
}
public
abstract
string
PathBase
{
get
;
}
...
...
@@ -28,10 +30,11 @@ namespace DotNetCore.CAP.Dashboard
public
CapDashboardRequest
(
HttpContext
context
)
{
_context
=
context
??
throw
new
ArgumentNullException
(
nameof
(
context
));
_context
=
context
??
throw
new
ArgumentNullException
(
nameof
(
context
));
}
public
override
string
Method
=>
_context
.
Request
.
Method
;
public
override
Dictionary
<
string
,
string
>
Cookies
=>
_context
.
Request
.
Cookies
.
ToDictionary
(
x
=>
x
.
Key
,
v
=>
v
.
Value
);
public
override
string
Path
=>
_context
.
Request
.
Path
.
Value
;
public
override
string
PathBase
=>
_context
.
Request
.
PathBase
.
Value
;
public
override
string
LocalIpAddress
=>
_context
.
Connection
.
LocalIpAddress
.
MapToIPv4
().
ToString
();
...
...
src/DotNetCore.CAP.Dashboard/DashboardRoutes.cs
View file @
73949a41
...
...
@@ -119,16 +119,20 @@ namespace DotNetCore.CAP.Dashboard
Routes
.
AddRazorPage
(
"/published/(?<StatusName>.+)"
,
x
=>
new
PublishedPage
(
x
.
Groups
[
"StatusName"
].
Value
));
x
=>
new
PublishedPage
(
x
.
UriMatch
.
Groups
[
"StatusName"
].
Value
));
Routes
.
AddRazorPage
(
"/received/(?<StatusName>.+)"
,
x
=>
new
ReceivedPage
(
x
.
Groups
[
"StatusName"
].
Value
));
x
=>
new
ReceivedPage
(
x
.
UriMatch
.
Groups
[
"StatusName"
].
Value
));
Routes
.
AddRazorPage
(
"/subscribers"
,
x
=>
new
SubscriberPage
());
Routes
.
AddRazorPage
(
"/nodes"
,
x
=>
{
var
id
=
x
.
Request
.
Cookies
[
"cap.node"
];
return
new
NodePage
(
id
);
});
Routes
.
AddRazorPage
(
"/nodes"
,
x
=>
new
NodePage
());
Routes
.
AddRazorPage
(
"/nodes/node/(?<Id>.+)"
,
x
=>
new
NodePage
(
x
.
Groups
[
"Id"
].
Value
));
Routes
.
AddRazorPage
(
"/nodes/node/(?<Id>.+)"
,
x
=>
new
NodePage
(
x
.
UriMatch
.
Groups
[
"Id"
].
Value
));
#
endregion
Razor
pages
and
commands
}
...
...
src/DotNetCore.CAP.Dashboard/RazorPageDispatcher.cs
View file @
73949a41
...
...
@@ -9,9 +9,9 @@ namespace DotNetCore.CAP.Dashboard
{
internal
class
RazorPageDispatcher
:
IDashboardDispatcher
{
private
readonly
Func
<
Match
,
RazorPage
>
_pageFunc
;
private
readonly
Func
<
DashboardContext
,
RazorPage
>
_pageFunc
;
public
RazorPageDispatcher
(
Func
<
Match
,
RazorPage
>
pageFunc
)
public
RazorPageDispatcher
(
Func
<
DashboardContext
,
RazorPage
>
pageFunc
)
{
_pageFunc
=
pageFunc
;
}
...
...
@@ -20,7 +20,7 @@ namespace DotNetCore.CAP.Dashboard
{
context
.
Response
.
ContentType
=
"text/html"
;
var
page
=
_pageFunc
(
context
.
UriMatch
);
var
page
=
_pageFunc
(
context
);
page
.
Assign
(
context
);
return
context
.
Response
.
WriteAsync
(
page
.
ToString
());
...
...
src/DotNetCore.CAP.Dashboard/RouteCollectionExtensions.cs
View file @
73949a41
...
...
@@ -11,7 +11,7 @@ namespace DotNetCore.CAP.Dashboard
public
static
void
AddRazorPage
(
this
RouteCollection
routes
,
string
pathTemplate
,
Func
<
Match
,
RazorPage
>
pageFunc
)
Func
<
DashboardContext
,
RazorPage
>
pageFunc
)
{
if
(
routes
==
null
)
{
...
...
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