Änderungen für den Modul- und denParameterblock
This commit is contained in:
@ -1,9 +1,6 @@
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
// % COMMUNICATION
|
||||
|
||||
// local debugging: print the name of every executed funtion to the console
|
||||
var debug_communication_daniel = 0;
|
||||
|
||||
var timeoutID; // We need this ID to reset the timer every 30 seconds
|
||||
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
@ -11,10 +8,6 @@ var timeoutID; // We need this ID to reset the timer every 30 seconds
|
||||
|
||||
|
||||
function buildUpdateConnection() {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: buildUpdateConnection", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
// Establishes server-sent-event-connection, which is used for all sorts of
|
||||
// updates and exists as long as the client is running.
|
||||
// Executed at program start (see also SEAWebClientMain.js).
|
||||
@ -62,12 +55,7 @@ function buildUpdateConnection() {
|
||||
}
|
||||
|
||||
function handleUpdateMessage(src, message) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: handleUpdateMessage", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
// Handles incoming SSE-messages depending on type of message.
|
||||
|
||||
if (debugCommunication > 1) {
|
||||
console.log("%cfrom server (SSE): " + message.type,
|
||||
"color:white;background:lightgray", message);
|
||||
@ -183,10 +171,6 @@ function handleUpdateMessage(src, message) {
|
||||
}
|
||||
|
||||
function htmlEscape(str) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: htmlEscape", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
str = "" + str;
|
||||
if (!str) return "";
|
||||
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g,
|
||||
@ -194,10 +178,6 @@ function htmlEscape(str) {
|
||||
}
|
||||
|
||||
function resetTimer(src) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: resetTimer", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
// Executed every time a heartbeat-message is obtained.
|
||||
// If no heartbeat-messages are obtained for a certain amount of time,
|
||||
// an error-message is thrown.
|
||||
@ -213,10 +193,6 @@ function resetTimer(src) {
|
||||
}
|
||||
|
||||
function updateValues(message, src) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: updateValues", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
// Handles changes of parameter-values
|
||||
for (var i = 0; i < message.updates.length; i++) {
|
||||
let component = message.updates[i];
|
||||
@ -226,12 +202,17 @@ function updateValues(message, src) {
|
||||
// Check for status updates
|
||||
if (component.name.split(":")[1] == 'status') {
|
||||
updateStatus(component);
|
||||
|
||||
}
|
||||
|
||||
for (var j = 0; j < matches.length; j++) {
|
||||
let elem = matches[j];
|
||||
let type = elem.__ctype__; // -> Show Dom-Properties
|
||||
|
||||
// let text = htmlEscape(component.formatted);
|
||||
// if (text) {
|
||||
// elem.innerHTML = text;
|
||||
// }
|
||||
|
||||
if (type == "rdonly" || type == "rdlink") {
|
||||
let text = htmlEscape(component.formatted);
|
||||
if (text) {
|
||||
@ -268,9 +249,6 @@ function updateValues(message, src) {
|
||||
}
|
||||
|
||||
function updateStatus(component) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: updateStatus", "color:white;background:darkblue");
|
||||
}
|
||||
let matches = document.getElementsByName(component.name);
|
||||
let status_icon = matches[0];
|
||||
let row = status_icon.closest(".row");
|
||||
@ -310,10 +288,6 @@ function updateStatus(component) {
|
||||
// XMLHttpRequest
|
||||
|
||||
function reqJSON(s, url, successHandler, errorHandler) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: reqJSON", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
var xhr = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest()
|
||||
: new ActiveXObject('Microsoft.XMLHTTP');
|
||||
if (debugCommunication) {
|
||||
@ -340,10 +314,6 @@ function reqJSON(s, url, successHandler, errorHandler) {
|
||||
}
|
||||
|
||||
function reqJSONPOST(s, url, parameters, successHandler, errorHandler) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: reqJSONPOST", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
var xhr = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest()
|
||||
: new ActiveXObject('Microsoft.XMLHTTP');
|
||||
if (debugCommunication) {
|
||||
@ -370,12 +340,7 @@ function reqJSONPOST(s, url, parameters, successHandler, errorHandler) {
|
||||
xhr.send(parameters);
|
||||
}
|
||||
|
||||
|
||||
function successHandler(s, message) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: successHandler", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
// Handles incoming XMLHttp-messages depending on type of message.
|
||||
if (debugCommunication) {
|
||||
console.log("%cfrom server (reqJSON): " + message.type,
|
||||
@ -386,12 +351,12 @@ function successHandler(s, message) {
|
||||
case "draw":
|
||||
if (message.path == "main") {
|
||||
// Happens only initially or at device change.
|
||||
appendToGridElement(1, message.title, "main", createContent(1, message));
|
||||
appendToGridElement(2, "", "parameters", createContent(2, {components:[]}));
|
||||
appendToGridElement(1, message.title, "main", createContent(message));
|
||||
// appendToGridElement(2, "", "parameters", createContent({components:[]}));
|
||||
} else {
|
||||
// In the module-block a parameter was selected
|
||||
// -> write parameter-block to grid-element2
|
||||
isl = appendToGridElement(2, message.title, 'parameters', createContent(2, message));
|
||||
isl = appendToGridElement(2, message.title, 'parameters', createContent(message));
|
||||
if (nColumns == 1) {
|
||||
elements[1].style.display = "none"; // hide modules
|
||||
elements[2].style.display = "inline-block"; // show parameters
|
||||
@ -487,10 +452,6 @@ function successHandler(s, message) {
|
||||
}
|
||||
|
||||
function errorHandler(status) {
|
||||
if (debug_communication_daniel) {
|
||||
console.log("%cfunction: errorHandler", "color:white;background:darkblue");
|
||||
}
|
||||
|
||||
if (debugCommunication) {
|
||||
console.log("error", status);
|
||||
}
|
||||
|
Reference in New Issue
Block a user