add edit button to mapping table and refactor cell creation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-12 13:22:51 +11:00
parent ce5b12d8b8
commit 32c3d779c0
5 changed files with 107 additions and 86 deletions

View File

@@ -70,7 +70,7 @@ var MainMenuItem = /** @class */ (function (_super) {
this.tableHeader = ["{{.users.table.username}}", "{{.users.table.password}}", "{{.users.table.web}}", "{{.users.table.pms}}", "{{.users.table.m3u}}", "{{.users.table.xml}}", "{{.users.table.api}}"];
break;
case "mapping":
this.tableHeader = ["BULK", "{{.mapping.table.chNo}}", "{{.mapping.table.logo}}", "{{.mapping.table.channelName}}", "{{.mapping.table.playlist}}", "{{.mapping.table.groupTitle}}", "{{.mapping.table.xmltvFile}}", "{{.mapping.table.xmltvID}}"];
this.tableHeader = ["BULK", "{{.mapping.table.chNo}}", "{{.mapping.table.logo}}", "{{.mapping.table.channelName}}", "{{.mapping.table.playlist}}", "{{.mapping.table.groupTitle}}", "{{.mapping.table.xmltvFile}}", "{{.mapping.table.xmltvID}}", "{{.mapping.table.edit}}"];
break;
}
//console.log(this.menuKey, this.tableHeader);
@@ -363,39 +363,27 @@ var Content = /** @class */ (function () {
cell.child = true;
cell.childType = "IMG";
cell.imageURL = data[key]["tvg-logo"];
var td = cell.createCell();
td.setAttribute('onclick', 'javascript: openPopUp("mapping", this)');
td.id = key;
tr.appendChild(td);
tr.appendChild(cell.createCell());
// Kanalname
var cell = new Cell();
cell.child = true;
cell.childType = "P";
cell.className = data[key]["x-category"];
cell.value = data[key]["x-name"];
var td = cell.createCell();
td.setAttribute('onclick', 'javascript: openPopUp("mapping", this)');
td.id = key;
tr.appendChild(td);
tr.appendChild(cell.createCell());
// Playlist
var cell = new Cell();
cell.child = true;
cell.childType = "P";
//cell.value = data[key]["_file.m3u.name"]
cell.value = getValueFromProviderFile(data[key]["_file.m3u.id"], "m3u", "name");
var td = cell.createCell();
td.setAttribute('onclick', 'javascript: openPopUp("mapping", this)');
td.id = key;
tr.appendChild(td);
tr.appendChild(cell.createCell());
// Gruppe (group-title)
var cell = new Cell();
cell.child = true;
cell.childType = "P";
cell.value = data[key]["x-group-title"];
var td = cell.createCell();
td.setAttribute('onclick', 'javascript: openPopUp("mapping", this)');
td.id = key;
tr.appendChild(td);
tr.appendChild(cell.createCell());
// XMLTV Datei
var cell = new Cell();
cell.child = true;
@@ -406,10 +394,7 @@ var Content = /** @class */ (function () {
else {
cell.value = data[key]["x-xmltv-file"];
}
var td = cell.createCell();
td.setAttribute('onclick', 'javascript: openPopUp("mapping", this)');
td.id = key;
tr.appendChild(td);
tr.appendChild(cell.createCell());
// XMLTV Kanal
var cell = new Cell();
cell.child = true;
@@ -420,10 +405,17 @@ var Content = /** @class */ (function () {
value = data[key]["x-mapping"].substring(0, 20) + "...";
}
cell.value = value;
var td = cell.createCell();
td.setAttribute('onclick', 'javascript: openPopUp("mapping", this)');
td.id = key;
tr.appendChild(td);
tr.appendChild(cell.createCell());
var cell = new Cell();
cell.child = true;
cell.childType = "EDIT";
cell.value = "{{.button.edit}}";
var editTd = cell.createCell();
var editButton = editTd.firstChild;
editButton.setAttribute('onclick', 'javascript: openPopUp("mapping", this)');
editButton.setAttribute("id", key);
editButton.setAttribute("aria-label", "Edit " + data[key]["x-name"]);
tr.appendChild(editTd);
rows.push(tr);
});
break;
@@ -485,6 +477,12 @@ var Cell = /** @class */ (function () {
element.setAttribute("onerror", "javascript: this.onerror=null;this.src=''");
//onerror="this.onerror=null;this.src='missing.gif';"
}
break;
case "EDIT":
element = document.createElement("INPUT");
element.type = "button";
element.value = this.value;
element.className = "mapping-edit-button";
}
td.appendChild(element);
}
@@ -800,7 +798,13 @@ function applyTableAccessibility(table, sectionName) {
cells[c].setAttribute("data-cell-type", "image");
}
else {
cells[c].removeAttribute("data-cell-type");
var actionButton = cells[c].querySelector("input.mapping-edit-button, button.mapping-edit-button");
if (actionButton != null) {
cells[c].setAttribute("data-cell-type", "action");
}
else {
cells[c].removeAttribute("data-cell-type");
}
}
}
if (cells[c].getAttribute("onclick") != null) {