Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
railgun-routing-server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
railgun-routing-server
Commits
82df789a
You need to sign in or sign up before continuing.
Commit
82df789a
authored
Aug 27, 2022
by
nanamicat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
6adc0611
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
2971 deletions
+57
-2971
web/src/app/api.service.ts
web/src/app/api.service.ts
+41
-2949
web/src/app/app.component.html
web/src/app/app.component.html
+4
-6
web/src/app/app.component.ts
web/src/app/app.component.ts
+9
-13
web/src/app/dashboard/dashboard.component.ts
web/src/app/dashboard/dashboard.component.ts
+2
-2
web/src/app/router/router.component.ts
web/src/app/router/router.component.ts
+1
-1
No files found.
web/src/app/api.service.ts
View file @
82df789a
This diff is collapsed.
Click to expand it.
web/src/app/app.component.html
View file @
82df789a
<mat-toolbar
color=
"primary"
>
Menu
</mat-toolbar>
<div
id=
"wrapper"
>
<mat-toolbar
color=
'primary'
>
Menu
</mat-toolbar>
<div
id=
'wrapper'
*ngIf=
'api.routers'
>
<mat-nav-list>
<a
mat-list-item
routerLink=
""
>
总览
</a>
<a
mat-list-item
[routerLink]=
"router.id.toString()"
*ngFor=
"let router of routers | async"
>
{{router.name}}
</a>
<a
mat-list-item
routerLink=
''
>
总览
</a>
<a
mat-list-item
[routerLink]=
'router.id.toString()'
*ngFor=
'let router of api.routers'
>
{{router.name}}
</a>
</mat-nav-list>
<router-outlet></router-outlet>
</div>
<!--<router-outlet></router-outlet>-->
web/src/app/app.component.ts
View file @
82df789a
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
ApiService
}
from
"
./api.service
"
;
import
{
firstValueFrom
}
from
"
rxjs
"
;
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
ApiService
}
from
'
./api.service
'
;
import
*
as
_
from
'
lodash
'
;
...
...
@@ -10,27 +9,24 @@ import * as _ from 'lodash';
styleUrls
:
[
'
./app.component.scss
'
]
})
export
class
AppComponent
implements
OnInit
{
routers
=
firstValueFrom
(
this
.
api
.
status
())
constructor
(
p
rivate
api
:
ApiService
)
{
constructor
(
p
ublic
api
:
ApiService
)
{
}
async
ngOnInit
()
{
const
protos
=
[]
const
routers
=
await
this
.
routers
;
await
this
.
api
.
init
();
const
protos
=
[];
const
routers
=
this
.
api
.
routers
;
for
(
const
from
of
routers
)
{
for
(
const
[
id1
,
peer
]
of
Object
.
entries
(
from
.
peers
))
{
const
id
=
parseInt
(
id1
);
const
reverse
=
routers
.
find
(
r
=>
r
.
id
===
id
)?.
peers
?.[
from
.
id
];
if
(
!
reverse
)
continue
;
const
link
=
this
.
api
.
link
(
from
.
id
,
id
)
;
const
link
=
this
.
api
.
connections
[
from
.
id
][
id
]
;
if
(
!
link
)
continue
;
// @ts-ignore
if
(
peer
.
reliability
*
reverse
.
reliability
<=
0.01
)
{
const
proto
=
link
.
split
(
'
,
'
)[
1
];
protos
.
push
(
proto
);
if
(
proto
===
'
wg
'
)
{
// console.log
}
protos
.
push
(
link
.
proto
);
}
}
}
...
...
web/src/app/dashboard/dashboard.component.ts
View file @
82df789a
...
...
@@ -14,7 +14,7 @@ import {Quality} from "../Quality";
export
class
DashboardComponent
implements
OnInit
{
routers
:
RouterStatus
[]
=
[];
displayedColumns
:
string
[]
=
[];
links
=
this
.
api
.
stat
us
().
pipe
(
links
=
this
.
api
.
stat
e
().
pipe
(
map
(
routers
=>
routers
.
map
(
router
=>
({
id
:
router
.
id
,
...
...
@@ -83,7 +83,7 @@ export class DashboardComponent implements OnInit {
}
async
ngOnInit
()
{
this
.
routers
=
await
firstValueFrom
(
this
.
api
.
stat
us
())
this
.
routers
=
await
firstValueFrom
(
this
.
api
.
stat
e
())
this
.
displayedColumns
=
[
'
name
'
,
'
id
'
].
concat
(
this
.
routers
.
map
(
r
=>
r
.
name
));
}
...
...
web/src/app/router/router.component.ts
View file @
82df789a
...
...
@@ -13,7 +13,7 @@ export class RouterComponent {
displayedColumns
:
string
[]
=
[
'
id
'
,
'
delay
'
,
'
loss
'
,
'
loss2
'
,
'
jitter
'
];
dataSource
=
this
.
id
.
pipe
(
switchMap
(
id
=>
this
.
api
.
stat
us
().
pipe
(
switchMap
(
id
=>
this
.
api
.
stat
e
().
pipe
(
map
(
routers
=>
Object
.
entries
(
routers
.
find
(
r
=>
r
.
id
==
id
)
!
.
peers
).
map
(([
id1
,
peer
])
=>
{
const
peerId
=
parseInt
(
id1
);
...
...
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