code cleanup
This commit is contained in:
parent
e74c2f4634
commit
c7490f78c8
1 changed files with 6 additions and 12 deletions
|
@ -6,8 +6,6 @@ requirejs.config({
|
|||
waitSeconds: 3
|
||||
});
|
||||
|
||||
|
||||
|
||||
require(['jquery', 'socket.io'], function(jq, io) {
|
||||
|
||||
function getDurationString(link_data) {
|
||||
|
@ -48,21 +46,17 @@ require(['jquery', 'socket.io'], function(jq, io) {
|
|||
});
|
||||
|
||||
function addLink(link_id, link_data) {
|
||||
let start = new Date(link_data["start"] * 1000);
|
||||
let datestring = start.getHours() + ":" + start.getMinutes();
|
||||
let stop = undefined;
|
||||
let stopString = undefined;
|
||||
if (link_data["handoff"]) {
|
||||
stop = new Date(link_data["handoff"] * 1000);
|
||||
stopString = stop.getHours() + ":" + stop.getMinutes();
|
||||
let stop = "handoff" in link_data;
|
||||
|
||||
}
|
||||
let time = (stop ? "Time: " + getDurationString(link_data) : "Running");
|
||||
let icon = (stop ? "check" : "question");
|
||||
let style = (stop ? "style=\"color:green\"" : "");
|
||||
let html = `
|
||||
<div id='link-${link_id}' class="item">
|
||||
<div>${link_id}</div>
|
||||
<div class="link-time">${stop !== undefined ? "Time: " + getDurationString(link_data) : "Running"}</div>
|
||||
<div class="link-time">${time}</div>
|
||||
<div>
|
||||
<i class="link-status fas fa-${stop !== undefined ? "check" : "question"}" ${stop !== undefined ? "style=\"color:green\"" : ""}></i>
|
||||
<i class="link-status fas fa-${icon}" ${style}></i>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
|
Loading…
Reference in a new issue