diff --git a/webui/src/main/js/filesTable.js b/webui/src/main/js/filesTable.js index 0b33e509..e5738a4d 100644 --- a/webui/src/main/js/filesTable.js +++ b/webui/src/main/js/filesTable.js @@ -62,8 +62,11 @@ function refreshTable() { } for (var [path, file] of filesByPath) { + + var unshareLink = "Unshare" + tableHtml += "" - tableHtml += ""+file.name+"" + tableHtml += ""+file.name+"
"+unshareLink+"" tableHtml += ""+file.size+"" tableHtml += ""+(file.comment != null)+"" tableHtml += "" @@ -86,3 +89,16 @@ function initFiles() { setTimeout(refreshTable, 1) } +function unshare(fileId) { + var file = filesByPath.get(fileId) + var xmlhttp = new XMLHttpRequest() + xmlhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + filesByPath.delete(fileId) + refreshTable() + } + } + xmlhttp.open("POST", "/MuWire/Files", true) + xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xmlhttp.send("action=unshare&path="+fileId) +}