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

@@ -65,7 +65,7 @@ class MainMenuItem extends MainMenu {
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
}
@@ -425,11 +425,7 @@ class Content {
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:Cell = new Cell()
@@ -437,10 +433,7 @@ class Content {
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
@@ -449,10 +442,7 @@ class Content {
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)
@@ -460,10 +450,7 @@ class Content {
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:Cell = new Cell()
@@ -476,10 +463,7 @@ class Content {
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:Cell = new Cell()
@@ -491,11 +475,18 @@ class Content {
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(cell.createCell())
tr.appendChild(td)
var cell:Cell = new Cell()
cell.child = true
cell.childType = "EDIT"
cell.value = "{{.button.edit}}"
var editTd = cell.createCell()
var editButton = (editTd.firstChild as HTMLInputElement)
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)
});
@@ -582,6 +573,14 @@ class Cell {
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 as HTMLInputElement).type = "button";
(element as HTMLInputElement).value = this.value;
(element as HTMLInputElement).className = "mapping-edit-button";
break
}
td.appendChild(element)