status-icon with statuscode, use entire row as link to parameters

This commit is contained in:
Daniel
2025-04-16 13:31:24 +02:00
parent 8747b0e7f8
commit 3be94ba3f6
7 changed files with 184 additions and 102 deletions

View File

@ -46,11 +46,13 @@ function createContent(s, message) {
var component = message.components[i];
if (!("title" in component))
component.title = component.name;
if (!("command" in component))
if (!("command" in component))
component.command = component.name;
createFunc = window['create_' + component.type + '_row']
if (createFunc)
content.appendChild(createFunc(s, component))
if (createFunc) {
let row = createFunc(s, component);
content.appendChild(row);
}
}
return content;
}
@ -74,7 +76,6 @@ function create_group_row(s, component) {
}
// Creates row-element containing link.
var title = component.title;
var row = document.createElement('row');
@ -148,11 +149,12 @@ function create_rdlink_row(s, component) {
var left = createTitle(component, 1);
left.id = component.name;
left.name = component.title; // or setAttribute('name'.. ?
// left.onclick = function () {
// getGroup(s, component.title);
// }
return appendToContent(component, left, createParElement(component));
let row = appendToContent(component, left, createParElement(component));
row.onclick = function () {
getGroup(s, component.title);
}
row.classList.add('row-clickable');
return row;
}
function create_pushbutton_row(s, component) {
@ -338,9 +340,11 @@ function posTextfield(s, left) {
console.log("%cfunction: posTextfield", "color:white;background:salmon");
}
var content = swiper[s].slides[swiper[s].activeIndex].childNodes[1];
var row = left.parentNode;
content.scrollTop = row.offsetTop - 30;
// var content = swiper[s].slides[swiper[s].activeIndex].childNodes[1];
// var row = left.parentNode;
// content.scrollTop = row.offsetTop - 30;
// ---------------------> Not working anymore since swiper was removed!!!
}
function resizeTextfield(input) {
@ -506,35 +510,29 @@ function createTitle(component, modules) {
// At the modules-block a status-icon is added
var left = document.createElement('span');
// var status_icon = document.createElement('p');
// status_icon.classList.add("status-icon");
if (component.info) {
left.classList.add("col-left", "event-toggle-info");
// if (component.info) {
// left.classList.add("col-left", "event-toggle-info");
left.onclick = function () {
var infoBox = left.parentNode.childNodes[0];
if (infoBox.style.display == "none") {
infoBox.style.display = "block";
} else {
infoBox.style.display = "none";
}
}
// left.onclick = function () {
// var infoBox = left.parentNode.childNodes[0];
// if (infoBox.style.display == "none") {
// infoBox.style.display = "block";
// } else {
// infoBox.style.display = "none";
// }
// }
left.innerHTML = component.title + "<sup><b>(i)</b></sup>";
}
// left.innerHTML = component.title + "<sup><b>(i)</b></sup>";
// }
var title = component.title;
if (modules) {
var icon_status = '<img class = "modules-icon status-icon" src="res/icon_status.png">';
var icon_edit = '<img class = "modules-icon edit-icon" src="res/icon_edit.png">';
var icon_info = '<img class = "modules-icon info-icon" src="res/icon_info.png" onclick = getGroup(1,"' + title + '")>';
var icon_status = '<img name = ' + title + ':status class = "modules-icon status-icon" src="res/icon_status.png">';
left.innerHTML = '<span class = "modules-title">' + component.title + '</span>';
if (component.statusname) {
left.innerHTML += icon_status;
left.innerHTML = icon_status;
}
left.innerHTML += icon_edit;
left.innerHTML += icon_info;
left.innerHTML += '<span class = "modules-title">' + component.title + '</span>';
} else {
left.innerHTML = component.title;
}
@ -587,6 +585,7 @@ function appendToContent(component, left, right) {
row.appendChild(createInfo(component));
}
row.appendChild(left);
console.log(component);
row.appendChild(right);
return row;
}