Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Implement deletion of entries
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminaaron committed May 23, 2024
1 parent cbffd05 commit f9eff44
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,19 @@ <h3>Report</h3>
})
}

async function buildRemovalCell(td, sKey, pKey) {
td.textContent = "x"
td.addEventListener("click", async function() {
if (confirm("Do you want to remove this entry?")) {
console.log("Removing entry:", sKey, pKey)
searchSubjectNodeRecursively(userProfile, sKey, (node) => {
delete node[pKey]
})
await finalizeProfileChanges()
}
})
}

function buildProfileTableRecursively(node, depth, table) {
let subject = node["@id"]
for (let [predicate, objectOrArray] of Object.entries(node)) {
Expand All @@ -382,24 +395,13 @@ <h3>Report</h3>
await finalizeProfileChanges()
}
})
tds[maxDepth + 2].textContent = "x"
tds[maxDepth + 2].addEventListener("click", async function() {
if (confirm("Do you want to remove this entry?")) {
// TODO
}
})
buildRemovalCell(tds[maxDepth + 2], subject, predicate)
continue
}
for (let arrayElement of objectOrArray) {
let tds = buildRowAndColumns(table)
let label = dfShortUriToLabel(predicate)
tds[depth].textContent = label
tds[maxDepth + 2].textContent = "x"
tds[maxDepth + 2].addEventListener("click", async function() {
if (confirm(`Do you want to remove this entire ${label}?`)) {
// TODO
}
})
tds[depth].textContent = dfShortUriToLabel(predicate)
buildRemovalCell(tds[maxDepth + 2], subject, predicate)
buildProfileTableRecursively(arrayElement, depth + 1, table)
}
}
Expand Down

0 comments on commit f9eff44

Please sign in to comment.