Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mediactl
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
medientechnik
ext-lib
mediactl
Commits
6836f5b9
Commit
6836f5b9
authored
7 months ago
by
David Huss
Browse files
Options
Downloads
Patches
Plain Diff
Add uptime display
parent
22ee1c71
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
static/modules/system.js
+20
-0
20 additions, 0 deletions
static/modules/system.js
static/style.css
+1
-1
1 addition, 1 deletion
static/style.css
templates/index.html
+1
-0
1 addition, 0 deletions
templates/index.html
with
22 additions
and
1 deletion
static/modules/system.js
+
20
−
0
View file @
6836f5b9
...
...
@@ -65,6 +65,8 @@ class System {
if
(
this
.
power
==
"
off
"
)
{
this
.
onPowerOff
(
this
);
updateStatus
(
this
.
status_display
,
"
off
"
,
"
off
"
);
let
uptime_display
=
document
.
getElementById
(
"
uptime-display
"
);
uptime_display
.
classList
.
add
(
"
hidden
"
);
}
if
(
this
.
power
==
"
unknown
"
)
{
this
.
onPowerUnknown
(
this
);
...
...
@@ -87,6 +89,24 @@ class System {
updateStatus
(
this
.
status_display
,
"
stopping...
"
,
"
stopping...
"
);
}
}
// Update the Uptime if the system is on
if
(
this
.
power
==
"
on
"
&&
'
power-time
'
in
system_status
)
{
let
uptime_display
=
document
.
getElementById
(
"
uptime-display
"
);
uptime_display
.
classList
.
remove
(
"
hidden
"
);
let
power_up
=
Date
.
parse
(
system_status
[
'
power-time
'
]);
let
now
=
new
Date
();
let
t
=
now
-
power_up
;
console
.
log
(
t
);
let
minutes
=
Math
.
round
(
t
/
1000
/
60
,
0
);
if
(
minutes
<
240
)
{
uptime_display
.
innerHTML
=
`on for
${
minutes
}
min`
;
}
else
{
let
hours
=
Math
.
round
(
minutes
/
60
,
1
);
uptime_display
.
innerHTML
=
`on for
${
hours
}
h`
;
}
}
};
// Health Changes
...
...
This diff is collapsed.
Click to expand it.
static/style.css
+
1
−
1
View file @
6836f5b9
...
...
@@ -49,7 +49,7 @@ header {
text-transform
:
uppercase
;
font-size
:
1.2em
;
}
.time-display
{
.time-display
,
#uptime-display
{
margin
:
0
;
padding
:
0
;
}
...
...
This diff is collapsed.
Click to expand it.
templates/index.html
+
1
−
0
View file @
6836f5b9
...
...
@@ -31,6 +31,7 @@
<div
class=
"title"
>
<h1>
Extended Library
</h1>
<p
class=
"time-display"
></p>
<p
id=
"uptime-display"
></p>
</div>
<button
id=
"power-off-button"
class=
"rectangle-button danger"
>
POWER OFF
</button>
...
...
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