-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new files for register display
Added new files for register display Minor format update to web UI
- Loading branch information
Showing
5 changed files
with
272 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* BEGIN RESET*/ | ||
html, body, div, span, applet, object, iframe, | ||
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | ||
a, abbr, acronym, address, big, cite, code, | ||
del, dfn, em, img, ins, kbd, q, s, samp, | ||
strike, strong, sub, sup, tt, var, | ||
b, u, i, center, | ||
dl, dt, dd, ol, ul, li, | ||
fieldset, form, label, legend, | ||
table, caption, tbody, tfoot, thead, tr, th, td, | ||
article, aside, canvas, details, embed, | ||
figure, figcaption, footer, header, hgroup, | ||
menu, nav, output, ruby, section, summary, | ||
time, mark, audio, video { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
font-size: 100%; | ||
font: inherit; | ||
vertical-align: baseline; | ||
} | ||
/* HTML5 display-role reset for older browsers */ | ||
article, aside, details, figcaption, figure, | ||
footer, header, hgroup, menu, nav, section { | ||
display: block; | ||
} | ||
body { | ||
line-height: 1; | ||
} | ||
ol, ul { | ||
list-style: none; | ||
} | ||
blockquote, q { | ||
quotes: none; | ||
} | ||
blockquote:before, blockquote:after, | ||
q:before, q:after { | ||
content: ''; | ||
content: none; | ||
} | ||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0; | ||
} | ||
input { | ||
font-size: 100%; | ||
font: inherit; | ||
vertical-align: baseline; | ||
} | ||
/* END RESET*/ | ||
body { | ||
font-size: 18px; | ||
font-weight: bold; | ||
font-family: Arial; | ||
background-color: white; | ||
margin: 0; | ||
} | ||
header, | ||
footer { | ||
background-color: #f1f1f1; | ||
clear: left; | ||
text-align: center; | ||
font-size: 20px | ||
} | ||
a { | ||
font-style: italic; | ||
} | ||
h1 { | ||
font-style: italic; | ||
font-size: 20px | ||
} | ||
p { | ||
font-size: 18px; | ||
} | ||
/* */ | ||
|
||
|
||
|
||
/* Hack for firefox*/ | ||
:-moz-tree-row(hover),#days, #hours, #minutes, #quietmode, #daysep, #timesep, #modesep { | ||
padding: 0px; | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | ||
"http://www.w3.org/TR/html4/strict.dtd"> | ||
<html> | ||
|
||
<head> | ||
<title>Generator Registers</title> | ||
<!-- Menu --> | ||
<header id="myheader"></header> | ||
<script type="text/javascript" src="internal.js?version=1.051"></script> | ||
<!-- <script src="http://code.jquery.com/jquery-1.12.4.min.js"></script> --> | ||
<script src="jquery-1.12.4.min.js"></script> | ||
<link rel="stylesheet" type="text/css" href="internal.css?version=1.003"> | ||
<link rel="icon" href="favicon.ico"> | ||
</head> | ||
|
||
<body> | ||
<p id="mydisplay"></p> | ||
</body> | ||
|
||
<footer id="footer"></footer> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
// internal.js - javascrip source for generator internals | ||
// Define header | ||
document.getElementById("myheader").innerHTML = | ||
'<header>Generator Registers</header>'; | ||
|
||
window.onload = init; | ||
var baseurl = "" | ||
var GlobalBaseRegisters; | ||
var InitOK = false; | ||
|
||
var BLACK = '<font color="black">'; | ||
var RED = '<font color="red">'; | ||
var ORANGE = '<font color="ORANGE">'; | ||
var ColorInfo = []; | ||
|
||
|
||
|
||
//***************************************************************************** | ||
// called on window.onload | ||
// sets up listener events (click menu) and inits the default page | ||
//***************************************************************************** | ||
function init(){ | ||
// the code to be called when the dom has loaded | ||
|
||
baseurl = window.location.protocol + "//" + window.location.host + "/" + "cmd/"; | ||
setInterval(GetDisplayValues, 1000); // Called every 1 sec | ||
setInterval(AgeEntries, (2000)); // Called every 2 sec | ||
document.getElementById("mydisplay").innerHTML = GetDisplayValues(); | ||
|
||
// Create Footer Links | ||
var myFooter = document.getElementById("footer"); | ||
var a = document.createElement('a'); | ||
a.href = "https://github.com/jgyates/genmon"; | ||
a.innerHTML = "GenMon Project on GitHub"; | ||
myFooter.appendChild(a); | ||
|
||
var option = document.createElement("p"); | ||
option.id = "linksep"; | ||
myFooter.appendChild(option); | ||
document.getElementById("linksep").innerHTML = " "; | ||
|
||
|
||
var myFooter = document.getElementById("footer"); | ||
var a = document.createElement('a'); | ||
a.href = window.location.protocol + "//" + window.location.host | ||
a.innerHTML = "Generator Monitor"; | ||
myFooter.appendChild(a); | ||
|
||
} | ||
|
||
//***************************************************************************** | ||
// GetDisplayValues - updates display based on command sent to server | ||
//***************************************************************************** | ||
function GetDisplayValues() | ||
{ | ||
var url = baseurl.concat("registers_json"); | ||
$.getJSON(url,function(result){ | ||
|
||
var RegData = result; | ||
|
||
var textOut = "<ul>"; | ||
for (var i = 0; i < RegData.Registers["Base Registers"].length; i++) { | ||
|
||
if ((i % 4) == 0){ | ||
textOut += "<li>"; | ||
} | ||
|
||
var Str1 = JSON.stringify(RegData.Registers["Base Registers"][i]); | ||
if (InitOK == true) { | ||
var Str2 = JSON.stringify(GlobalBaseRegisters.Registers["Base Registers"][i]); | ||
//console.log("Checking %s and %s", Str1, Str2); | ||
if (Str1 != Str2) { | ||
Str1 = RED + Str1 + '</font>'; | ||
ColorInfo[i].Time = new Date(); | ||
ColorInfo[i].Color = RED | ||
} | ||
else { | ||
|
||
Str1 = ColorInfo[i].Color + Str1 + '</font>'; | ||
} | ||
} | ||
textOut += Str1 + ' ' + ' ' + ' ' + ' '; | ||
|
||
if ((i % 4) == 3){ | ||
textOut += "<li>"; | ||
} | ||
else if (i == (RegData.Registers["Base Registers"].length - 1)) { | ||
textOut += "<li>"; | ||
} | ||
} | ||
textOut += "</ul>"; | ||
|
||
var jsonStr = JSON.stringify(RegData.Registers["Base Registers"], null, 4); | ||
//var jsonStr = JSON.stringify(RegData, null, 4); | ||
//var RegData = JSON.parse(result); | ||
document.getElementById("mydisplay").innerHTML = textOut; | ||
|
||
GlobalBaseRegisters = RegData; | ||
if (InitOK == false) { | ||
InitOK = true; | ||
for (var i = 0; i < GlobalBaseRegisters.Registers["Base Registers"].length; i++) { | ||
ColorInfo[i] = new Object; | ||
ColorInfo[i].Time = new Date(); | ||
ColorInfo[i].Color = BLACK; | ||
} | ||
} | ||
}); | ||
} | ||
//***************************************************************************** | ||
// AgeEntries - updates colors of output based on time elapsed | ||
//***************************************************************************** | ||
function AgeEntries() | ||
{ | ||
if (InitOK == false) { | ||
return | ||
} | ||
|
||
var CurrentTime = new Date(); | ||
|
||
for (var i = 0; i < GlobalBaseRegisters.Registers["Base Registers"].length; i++) { | ||
|
||
var difference = CurrentTime.getTime() - ColorInfo[i].Time.getTime(); | ||
var secondsDifference = Math.floor(difference/1000); | ||
|
||
if (ColorInfo[i].Color == ORANGE) { | ||
if (secondsDifference > 10) { | ||
ColorInfo[i].Color = BLACK; | ||
} | ||
} | ||
if (ColorInfo[i].Color == RED) { | ||
if (secondsDifference > 5) { | ||
ColorInfo[i].Color = ORANGE; | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
} | ||
|