From c7490f78c8dc3a0eb183e567e558f3a85a963a19 Mon Sep 17 00:00:00 2001 From: Maxime Bloch Date: Sun, 22 Sep 2019 03:16:48 +0200 Subject: [PATCH] code cleanup --- watcher/static/index.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/watcher/static/index.js b/watcher/static/index.js index 2e54462..ce44fc9 100644 --- a/watcher/static/index.js +++ b/watcher/static/index.js @@ -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 = ` `;