Diverse Anpassungen besonders bei SEAWebClientGroup

This commit is contained in:
Daniel
2025-04-24 14:50:27 +02:00
parent 58ee8130e6
commit 0d5ffd72a8
8 changed files with 760 additions and 932 deletions

View File

@ -69,16 +69,12 @@ function handleUpdateMessage(src, message) {
// id-message: Confirms establishment of SSE-connection and determines
// specific ID of the client
case "id":
for (var i = 0; i < swiper.length; i++) {
swiper[i].removeAllSlides();
}
clientID = message.id;
if ("device" in message) {
if (message.device == "_inst_select") {
clientTitle = "select instrument";
console.log('IDselect')
pushInitCommand("getblock?path=_inst_select&", "instrument selection");
menuMode = true;
sizeChange();
} else {
clientTitle = message.instrument + " " + message.device;
@ -208,11 +204,6 @@ function updateValues(message, src) {
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) {
@ -232,17 +223,29 @@ function updateValues(message, src) {
}
}
elem.actualValue = value;
resizeTextfield(elem);
resize_textfield(elem);
} else if (type == "checkbox") {
let row = elem.parentNode.parentNode;
let row = elem.closest('div');
row.style.backgroundColor = "white";
console.log('receive: ', value);
// console.log('CBX', elem.name, message, Boolean(value && value != 'false'));
elem.checked = Boolean(value && value != 'false');
// elem.checked = Boolean(value && value != 'false');
if (value === 'False') {
elem.checked = false;
} else {
elem.checked = true;
}
} else if (type == "enum") {
elem.style.display = "block";
let row = elem.parentNode.parentNode;
let row = elem.closest('div');
row.style.backgroundColor = "white";
elem.value = value;
let options = elem.childNodes;
for (var j = 0; j < options.length; j++) {
if (options[j].label == value) {
elem.value = j + 1;
}
}
}
}
}
@ -253,7 +256,6 @@ function updateStatus(component) {
let status_icon = matches[0];
let row = status_icon.closest(".row");
let right = row.lastChild;
right.classList.remove('col-right-disabled');
let statusCode = component.statuscode;
// Update status info, visible when mouse cursor is hovering over status icon
@ -262,11 +264,19 @@ function updateStatus(component) {
status_info.innerHTML = component.formatted;
}
status_icon.classList.remove('status-icon-disabled');
status_icon.classList.remove('status-icon-idle');
status_icon.classList.remove('status-icon-warn');
status_icon.classList.remove('status-icon-busy');
status_icon.classList.remove('status-icon-error');
row.classList.remove('row-disabled');
right.classList.remove = 'col-right-disabled';
switch (statusCode) {
case 0:
status_icon.classList.add('status-icon-disabled');
row.classList.add('row-disabled');
right.innerHTML = 'col-right-disabled';
right.classList.add = 'col-right-disabled';
break;
case 1:
status_icon.classList.add('status-icon-idle');
@ -355,17 +365,21 @@ function successHandler(s, message) {
// appendToGridElement(2, "", "parameters", createContent({components:[]}));
} else {
// In the module-block a parameter was selected
showParams = true;
// -> write parameter-block to grid-element2
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
showParams = true;
adjustGrid();
if (nColumns == 1 || nColumns == 2 || nColumns == 3) {
// elements[1].style.display = "none"; // hide modules
// elements[2].style.display = "inline-block"; // show parameters
// style(2,"100vw","100vh");
document.getElementById('close-cross').innerHTML = '<img class = "icon-close" src="res/icon_close.png">';
} else if (nColumns == 2 || nColumns == 3) {
} else {
}
// else if (nColumns == 2 || nColumns == 3) {
// adjustGrid();
// } else {
// adjustGrid();
// }
}
nextInitCommand();
// Request for updates.

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
var MAXBLOCK = 4; // max number of blocks
var elements = []; // grid elements
var swiper = []; // This array contains main-swiper-Instances.
// var swiper = []; // This array contains main-swiper-Instances.
var hostPort = ""; // Address and port of static html-file.
var clientID = ""; // ID given by server when SSE-connection is established.
var clientTitle = ""; // Contains name of instrument and device.
@ -12,7 +12,6 @@ var getUpdatesGraphics = true;
var initCommands = [];
var loadingShown = true;
var writePermission = false;
var menuMode = false;
var panelOn = true;
var firstState = 0;
var showParams = false;
@ -127,22 +126,7 @@ function nextInitCommand() {
var loadingScreen = document.getElementsByClassName("loading-div")[0];
loadingScreen.style.display = "none";
loadingShown = false;
/* Not working without swiper, necessary??? */
// if (location.hash) { // there was a #hash part
// var slideNames = location.hash.substr(1);
// gotoGroups(slideNames);
// }
console.log("loading finished");
// function gotoGroups(slideNames) {
// slideNames = slideNames.split("%20");
// var l = Math.min(MAXBLOCK,slideNames.length);
// document.title = "SEA "+ clientTitle + " " + slideNames.join(" ");
// for (var s=0; s<l; s++) {
// getGroup(s, slideNames[s]);
// }
// }
}
}
@ -165,9 +149,9 @@ window.onload = function() {
let crossElement = document.getElementById("close-cross");
if(window.hideRightPart){
if (window.hideRightPart){
document.body.removeChild(crossElement);
}else{
} else {
crossElement.onclick = function(){
if (showParams) {
showParams = false;
@ -176,32 +160,27 @@ window.onload = function() {
if (window.wideGraphs) {
window.wideGraphs = false;
document.getElementById('close-cross').innerHTML = '<img class = "icon-close" src="res/icon_sinus.png">';
document.getElementsByClassName('log-icon-container')[0].classList.remove("log-icon-container-hidden");
} else {
window.wideGraphs = true;
document.getElementById('close-cross').innerHTML = '<img class = "icon-close" src="res/icon_modules.png">';
document.getElementsByClassName('log-icon-container')[0].classList.add("log-icon-container-hidden");
}
}
if (elements[0].style.display == "inline-block") { // only graphics is visible
elements[0].style.display = "none"; // hide graphics
elements[1].style.display = "inline-block"; // show modules
elements[2].style.display = "none"; // hide parameters
} else if (elements[1].style.display == "inline-block") { // only modules are visible
elements[0].style.display = "inline-block"; // show graphics
elements[1].style.display = "none"; // hide modules
elements[2].style.display = "none"; // hide parameters
} else if (elements[2].style.display == "inline-block") { // only parameters are visible
elements[0].style.display = "none"; // hide graphics
elements[1].style.display = "inline-block"; // show modules
elements[2].style.display = "none"; // hide parameters
}
adjustGrid();
}
}
let logIcon = document.getElementById("log-icon-container");
let logIcon = document.getElementsByClassName("log-icon-container")[0];
logIcon.onclick = function(){
elements[3].classList.toggle('grid-element-3-visible');
}
if (window.showConsole) {
window.showConsole = false;
} else {
window.showConsole = true;
// Initialize?
}
adjustGrid();
}
var homeButton = document.getElementById("home-icon");
@ -209,33 +188,6 @@ window.onload = function() {
window.location = "/select_experiment";
};
buildUpdateConnection();
// if (location.hash) {
// console.log("hash in url", location.hash);
// initSlides = location.hash.substring(1);
// } else {
// initSlides = "";
// }
// // Initialisation will be continued, when SSE-connection is established
// // and id-message is obtained.
// // (see also at SEAWebClientCommunication.js)
// addEventListener("popstate", function (e) {
// if (e.state) {
// if (loadingShown) {
// if (initSlides != e.state.funarg) {
// console.log("hash mismatch", initSlides, e.state.funarg);
// initSlides = e.state.funarg;
// }
// } else {
// console.log("popstate", e.state.func, e.state.funarg);
// window[e.state.func](e.state.funarg);
// }
// } else {
// document.title = "SEA "+ clientTitle;
// for (var s=0; s<MAXBLOCK; s++) {
// swiper[s].slideTo(defaultSlidePos(s));
// }
// }
// })
};
function toggleHeader() {

View File

@ -44,10 +44,6 @@ function determineViewportSize() {
if (height > MINHEIGHT) {
nRows = 2;
}
if (menuMode) {
nRows = 1;
nColumns = 1;
}
}
function sizeChange() {
@ -68,108 +64,110 @@ function adjustGrid() {
style(0,"100vw","100vh");
style(1); // hide
style(2); // hide
// style(3); // hide
style(3); // hide
return;
}
switch (nColumns) {
case 1:
if (menuMode) {
leftWidth = Math.min(100, MINWIDTH / width * 100);
style(1,leftWidth + "vw","100vh");
if (window['showConsole']) {
if (showParams) {
style(0); // hide
style(1); // hide
style(2,"100vw","50vh");
style(3,"100vw","50vh");
} else {
style(0); // hide
style(1,"100vw","50vh");
style(2); // hide
style(3,"100vw","50vh");
}
} else {
// we may want to switch to 90vh on safari ios (workaround)
style(0); // hide
style(1,"100vw","100vh");
style(2); // hide
// style(3); // hide
}
if (showParams) {
style(0); // hide
style(1); // hide
style(2,"100vw","100vh");
style(3); // hide
} else {
style(0); // hide
style(1,"100vw","100vh");
style(2); // hide
style(3); // hide
}
}
break;
case 2:
case 3:
rightWidth = Math.min(50, MINWIDTH / width * 100);
leftWidth = 100 - rightWidth;
if (nRows == 1 || !window['showConsole']) {
if (showParams) {
style(0,leftWidth + "vw","100vh");
style(1); // hide
style(2,rightWidth + "vw","100vh");
// style(3); // hide
if (window['showConsole']) {
if (nRows == 1) {
if (showParams) {
style(0,leftWidth + "vw","100vh");
style(1); // hide
style(2,rightWidth + "vw","50vh");
style(3,rightWidth + "vw","50vh");
} else {
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","50vh");
style(2); // hide
style(3,rightWidth + "vw","50vh");
}
} else {
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","100vh");
style(2); // hide
// style(3); // hide
if (showParams) {
style(0,leftWidth + "vw","100vh");
style(1); // hide
style(2,rightWidth + "vw","50vh");
style(3,rightWidth + "vw","50vh");
} else {
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","50vh");
style(2); // hide
style(3,rightWidth + "vw","50vh");
}
}
} else {
// if (showParams) {
// style(0,leftWidth + "vw","100vh");
// style(1); // hide
// style(2,rightWidth + "vw","50vh");
// style(3,rightWidth + "vw","50vh");
// } else {
// style(0,leftWidth + "vw","100vh");
// style(1,rightWidth + "vw","50vh");
// style(2); // hide
// style(3,rightWidth + "vw","50vh");
// }
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","50vh");
style(2,rightWidth + "vw","50vh");
// style(3); // hide
if (nRows == 1) {
if (showParams) {
style(0,leftWidth + "vw","100vh");
style(1); // hide
style(2,rightWidth + "vw","100vh");
style(3); // hide
} else {
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","100vh");
style(2); // hide
style(3); // hide
}
} else {
if (showParams) {
style(0,leftWidth + "vw","100vh");
style(1); // hide
style(2,rightWidth + "vw","100vh");
style(3); // hide
} else {
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","100vh");
style(2); // hide
style(3); // hide
}
}
}
break;
case 3:
rightWidth = MINWIDTH / width * 100;
leftWidth = 100 - rightWidth;
if (nRows == 1 || !window['showConsole']) {
if (showParams) {
style(0,leftWidth + "vw","100vh");
style(1); // hide
style(2,rightWidth + "vw","100vh");
// style(3); // hide
} else {
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","100vh");
style(2); // hide
// style(3); // hide
}
} else {
// if (showParams) {
// style(0,leftWidth + "vw","100vh");
// style(1); // hide
// style(2,rightWidth + "vw","50vh");
// style(3,rightWidth + "vw","50vh");
// } else {
// style(0,leftWidth + "vw","100vh");
// style(1,rightWidth + "vw","50vh");
// style(2); // hide
// style(3,rightWidth + "vw","50vh");
// }
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","50vh");
style(2,rightWidth + "vw","50vh");
// style(3); // hide
}
break;
case 4:
rightWidth = MINWIDTH / width * 100;
leftWidth = 100 - 2 * rightWidth;
// if (nRows == 1 || !window['showConsole']) {
if (window['showConsole']) {
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","50vh");
style(2,rightWidth + "vw","50vh");
style(3,100 - leftWidth + "vw","50vh");
} else {
style(0,leftWidth + "vw","100vh");
style(1,rightWidth + "vw","100vh");
// if (window['showConsole']) {
// style(2); // hide
// style(3,rightWidth + "vw","100vh");
// } else {
style(2,rightWidth + "vw","100vh");
// style(3); // hide
// }
// } else {
// style(0,leftWidth + "vw","100vh");
// style(1,rightWidth + "vw","50vh");
// style(2,rightWidth + "vw","50vh");
// style(3,(2 * rightWidth) + "vw","50vh");
// }
style(2,rightWidth + "vw","100vh");
style(3); // hide
}
break;
default:
break;