Skip to content

Commit

Permalink
V.18.18
Browse files Browse the repository at this point in the history
  • Loading branch information
jgyates committed Oct 30, 2023
1 parent c3d574a commit ad6b2fe
Show file tree
Hide file tree
Showing 9 changed files with 921 additions and 809 deletions.
2 changes: 1 addition & 1 deletion data/controller/Evolution_Liquid_Cooled.json
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@
"comment2": "'bounds_reg' is optional but allows the user interface to bounds check the data before sending it to genmon",
"comment3": "'tooltip' is optional but allows the user interface to display more information regarding the input.",
"reg": "023e",
"input_title": "Minutes",
"input_title": "Exercise Duration",
"type": "int",
"length": 2,
"bounds_regex":"^([1][2-9])|([2-5][0-9])|([6][0])$",
Expand Down
7 changes: 3 additions & 4 deletions genmonlib/custom_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ def GetButtons(self):
return {}

# Validate buttons before sending to the web app
return_buttons = {}
return_buttons = []
for button in button_list:

if not "onewordcommand" in button.keys():
Expand Down Expand Up @@ -1358,9 +1358,8 @@ def GetButtons(self):
if CommandError:
continue

# TODO fix this
#return_buttons.append(button)
return_buttons[button["onewordcommand"]] = button["title"]
return_buttons.append(button)

return return_buttons

except Exception as e1:
Expand Down
2 changes: 1 addition & 1 deletion genmonlib/generac_HPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ def GetStartInfo(self, NoTile=False):

if not NoTile:

StartInfo["buttons"] = {}
StartInfo["buttons"] = []

StartInfo["pages"] = {
"status": True,
Expand Down
2 changes: 1 addition & 1 deletion genmonlib/generac_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -4917,7 +4917,7 @@ def GetStartInfo(self, NoTile=False):

if not NoTile:

StartInfo["buttons"] = {}
StartInfo["buttons"] = []

StartInfo["pages"] = {
"status": True,
Expand Down
2 changes: 1 addition & 1 deletion genmonlib/generac_powerzone.py
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ def GetStartInfo(self, NoTile=False):

if not NoTile:

StartInfo["buttons"] = {}
StartInfo["buttons"] = []

StartInfo["pages"] = {
"status": True,
Expand Down
20 changes: 10 additions & 10 deletions static/genmon.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ p {
font-size: 18px;
}
button {
font-weight: bold;
font-size: 16px;
border-radius: 3.01px;
border: 0;
margin: 0 0 0 .5em;
font-family: inherit;
line-height: 1em;
padding: .75em .75em;
background: #bbbbbb;
cursor:pointer;
font-weight: bold !important;
font-size: 16px !important;
border-radius: 3.01px !important;
border: 0 !important;
margin: 0 0 0 .5em !important;
font-family: inherit !important;
line-height: 1em !important;
padding: .75em .75em !important;
background: #bbbbbb !important;
cursor:pointer !important;
}
ul {
list-style-type: none;
Expand Down
129 changes: 119 additions & 10 deletions static/genmon.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,18 +778,47 @@ function DisplayMaintenance(){
outstr += '<br><br>Reset:<br><br>';
outstr += '&nbsp;&nbsp;<button id="settimebutton" onClick="SetPowerLogReset();">Reset Power Log & Fuel Estimate</button>';
}

if (("buttons" in myGenerator) && !(Object.keys(myGenerator['buttons']).length === 0) ){
outstr += '<br><br>Generator Functions:<br><br>';
for (let key in myGenerator['buttons']) {
button_command = key
button_title = myGenerator['buttons'][key];
// todo use printSettingsField to setup "int" input with a button,
// add a function to check the input via regex,
/// modify SetClick to support sending new command
outstr += '&nbsp;&nbsp;<button id=' + button_command + ' onClick="SetClick(\'' + button_command + '\');">' + button_title + '</button><br><br>';
try{
if (("buttons" in myGenerator) && !(myGenerator['buttons'].length === 0)) {
outstr += '<br><br>Generator Functions:<br><br>';
for (let index in myGenerator['buttons']) {
button = myGenerator['buttons'][index];
button_command = button["onewordcommand"];
button_title = button["title"];
command_sequence = button["command_sequence"];

if ((command_sequence.length >= 1) && (command_sequence[0].hasOwnProperty("input_title"))){
// TODO WORK IN PROGRESS below this point
continue;
// this button has an input
for (let cmdidx in command_sequence){
// cycle through each command in command_sequence
command = command_sequence[cmdidx]
if ((command.hasOwnProperty("input_title")) && (command.hasOwnProperty("type"))) {
title = command["input_title"];
type = command["type"];
tooltip = ""
bounds = ""
if (command.hasOwnProperty("bounds_regex")){
bounds = command["bounds_regex"];
}
if (command.hasOwnProperty("tooltip")){
tooltip = command["tooltip"];
}
var default_value = 0
outstr += setupInputButton(cmdidx, button_command, type, title, default_value, tooltip, bounds )
}
}
} else {
outstr += '&nbsp;&nbsp;<button id=' + button_command + ' onClick="SetClick(\'' + button_command + '\');">' + button_title + '</button><br><br>';
}

}
}
} catch(err){
console.log("Error parsing buttons: " + err)
}

}

$("#mydisplay").html(outstr);
Expand All @@ -810,6 +839,86 @@ function DisplayMaintenance(){
}});
}

//*****************************************************************************
// called when validating input button
//*****************************************************************************
function validateInputButton(action, identifier, parent, bounds_regex){
console.log("Button Validation called: " + action + "," + identifier + ", " + parent)

switch (action) {
case "validate":
msg = "";
break;
case "click":
msg = "";
break;
case "change":
msg = "";
break;
default:
console.log("Error: Invalid action in validateInputButton!")
}

}

function submitButton(ctlid, identifier, parent){
try{
console.log("ID:" + ctlid + ", Index: " + identifier+ ", Parent: " + parent )
//console.log("value: " + document.getElementById(ctlid).value)
}
catch(err){
console.log("Error in submitButton: " + err)
}
}
//*****************************************************************************
// called to setup input button
//*****************************************************************************
function setupInputButton(identifier, parent, type, title, default_value, tooltip, bounds_regex ) {

var outstr = ""
try {

if (!(type === "int")){
// at the moment only "int" is supported
return outstr;
}

// this form is for the tool top support
var validationCallback = "validateInputButton(\'validate\', \'" + identifier + "\', \'" + parent + "\', \'" + bounds_regex + "\');";
var clickCallback = "validateInputButton(\'click\', \'" + identifier + "\', \'" + parent + "\', \'" + bounds_regex + "\')";
var changeCallback = "validateInputButton(\'change\', \'" + identifier + "\', \'" + parent + "\', \'" + bounds_regex + "\')";
var button_id = "button_" + identifier + "_" + parent;
var id = parent + "_" + identifier
var button_id = "button_" + id;
var input_id = "input_"+ id;
validation = 0

// TODO WORK IN PROGRESS
outstr += '<form class="idealforms" novalidate autocomplete="off" id="formButtons">';
//outstr += '<button onclick="submitButton(\'' + input_id + '\',\'' + identifier + '\', \'' + parent + '\');" id="' + button_id + '" >' + title + '</button>';
outstr += '<div class="field idealforms-field"">' +
'&nbsp;&nbsp;' +
//'onclick="' + clickCallback + ';" ' +
//'<button class="button" onclick="submitButton(\'' + input_id + '\',\'' + identifier + '\', \'' + parent + '\');" id="' + button_id + '" >' + title + '</button>' +
'<button class="button" onclick="' + clickCallback + ';" id="' + button_id + '" >' + title + '</button>' +
'&nbsp;&nbsp;' +
'<input id="' + input_id + '" style="width: 150px;" name="' + id + '" type="text" ' +
' onChange="' + changeCallback + ';" '+
(((typeof validation === 'undefined') || (validation==0)) ? 'onFocus="$(\'#'+input_id+'_tooltip\').show();" onBlur="$(\'#'+input_id+'_tooltip\').hide();" ' : 'data-idealforms-rules="' + validation + '" ') + '>' +
'<span class="error" style="display: none;"></span>' +
(((typeof tooltip !== 'undefined' ) && (tooltip.trim() != "")) ? '<span id="' + input_id + '_tooltip" class="tooltip" style="display: none;">' + replaceAll(tooltip, '"', '&quot;') + '</span>' : "") +
'</div>';
outstr += '</form>';
return outstr;


}
catch(err) {
console.log("Error in setupInputButton: " + err);
}

return outstr
}
//*****************************************************************************
// called when Monthly is clicked
//*****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion static/libraries.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit ad6b2fe

Please sign in to comment.