Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
Website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
Website
Commits
0b7c1d52
Commit
0b7c1d52
authored
Apr 13, 2021
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
fixe ntp status page
parent
69a9c74e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
js/customElements/ntpGraph.js
+37
-31
37 additions, 31 deletions
js/customElements/ntpGraph.js
js/ntpMenu.js
+0
-15
0 additions, 15 deletions
js/ntpMenu.js
js/script.js
+0
-1
0 additions, 1 deletion
js/script.js
with
37 additions
and
47 deletions
js/customElements/ntpGraph.js
+
37
−
31
View file @
0b7c1d52
import
chart
from
'
chart.js
'
import
chart
from
'
chart.js
'
let
graphIndexCounter
=
0
;
class
NtpGraph
extends
HTMLElement
{
class
NtpGraph
extends
HTMLElement
{
constructor
()
{
constructor
()
{
super
();
super
();
...
@@ -9,15 +7,22 @@ class NtpGraph extends HTMLElement {
...
@@ -9,15 +7,22 @@ class NtpGraph extends HTMLElement {
let
ip
=
this
.
getAttribute
(
"
data-server-ip
"
);
let
ip
=
this
.
getAttribute
(
"
data-server-ip
"
);
this
.
innerHTML
=
`
this
.
innerHTML
=
`
<span
id="
${
graphIndexCounter
}
-Banner" data-index="
${
graphIndexCounter
}
"
class="ntpBanner">
${
ip
}
</span>
<span class="ntpBanner">
${
ip
}
</span>
<span
id="
${
graphIndexCounter
}
-Content"
class="ntpContent">
<span class="ntpContent">
<a target="_blank" href="https://www.ntppool.org/scores/
${
ip
}
" class="linkToNtpPool">Server auf dem NTP Pool anzeigen</a>
<a target="_blank" href="https://www.ntppool.org/scores/
${
ip
}
" class="linkToNtpPool">Server auf dem NTP Pool anzeigen</a>
<canvas
id="
${
graphIndexCounter
}
-
Delay"></canvas>
<canvas
class="graph
Delay"></canvas>
<canvas
id="
${
graphIndexCounter
}
-
Score"></canvas>
<canvas
class="graph
Score"></canvas>
</span>
</span>
`
;
`
;
let
currentIndex
=
graphIndexCounter
;
graphIndexCounter
++
;
this
.
querySelector
(
"
.ntpBanner
"
).
onclick
=
()
=>
{
let
contentElement
=
this
.
querySelector
(
"
.ntpContent
"
);
if
(
contentElement
.
classList
.
contains
(
"
visible
"
))
{
contentElement
.
classList
.
remove
(
"
visible
"
);
}
else
{
contentElement
.
classList
.
add
(
"
visible
"
);
}
let
xhr
=
new
XMLHttpRequest
();
let
xhr
=
new
XMLHttpRequest
();
...
@@ -37,8 +42,8 @@ class NtpGraph extends HTMLElement {
...
@@ -37,8 +42,8 @@ class NtpGraph extends HTMLElement {
yDelay
.
push
(
entry
[
"
offset
"
]);
yDelay
.
push
(
entry
[
"
offset
"
]);
});
});
this
.
drawPlot
(
currentIndex
+
"
-
Delay
"
,
x
,
yDelay
,
"
Delay
"
);
this
.
drawPlot
(
"
.graph
Delay
"
,
x
,
yDelay
,
"
Delay
"
);
this
.
drawPlot
(
currentIndex
+
"
-
Score
"
,
x
,
yScore
,
"
Score
"
);
this
.
drawPlot
(
"
.graph
Score
"
,
x
,
yScore
,
"
Score
"
);
}
}
...
@@ -47,9 +52,10 @@ class NtpGraph extends HTMLElement {
...
@@ -47,9 +52,10 @@ class NtpGraph extends HTMLElement {
xhr
.
send
();
xhr
.
send
();
}
}
}
drawPlot
(
elementName
,
x
,
y
,
title
)
{
drawPlot
(
elementName
,
x
,
y
,
title
)
{
let
ctx
=
document
.
getElementById
(
elementName
).
getContext
(
'
2d
'
);
let
ctx
=
this
.
querySelector
(
elementName
).
getContext
(
'
2d
'
);
new
Chart
(
ctx
,
{
new
Chart
(
ctx
,
{
type
:
'
line
'
,
type
:
'
line
'
,
...
...
This diff is collapsed.
Click to expand it.
js/ntpMenu.js
deleted
100644 → 0
+
0
−
15
View file @
69a9c74e
let
ntpNav
=
document
.
querySelectorAll
(
"
.ntpBanner
"
);
ntpNav
.
forEach
((
element
)
=>
{
element
.
onclick
=
function
(){
let
index
=
element
.
getAttribute
(
"
data-index
"
);
let
contentID
=
index
+
"
-Content
"
;
let
contentElement
=
document
.
getElementById
(
contentID
);
if
(
contentElement
.
classList
.
contains
(
"
visible
"
)){
contentElement
.
classList
.
remove
(
"
visible
"
);
}
else
{
contentElement
.
classList
.
add
(
"
visible
"
);
}
}
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/script.js
+
0
−
1
View file @
0b7c1d52
...
@@ -2,7 +2,6 @@ require("./burgerMenu");
...
@@ -2,7 +2,6 @@ require("./burgerMenu");
require
(
"
./error
"
);
require
(
"
./error
"
);
require
(
"
./imgPreview
"
);
require
(
"
./imgPreview
"
);
require
(
"
./includeHTML
"
);
require
(
"
./includeHTML
"
);
require
(
"
./ntpMenu
"
);
require
(
"
./viewPost
"
);
require
(
"
./viewPost
"
);
require
(
"
./customElements/ntpGraph
"
);
require
(
"
./customElements/ntpGraph
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment