update counters when downloads initiate from search page
This commit is contained in:
@@ -11,6 +11,9 @@ const buttonHandler = (event, type) => {
|
||||
let url = element.getAttribute("path");
|
||||
let row, data = {};
|
||||
let removeRow = true;
|
||||
if (element.getAttribute("id") == "download-action-button"){
|
||||
helper.getCounters();
|
||||
}
|
||||
if (row = element.closest('.table-row-search')) {
|
||||
if (element.className == 'icon-clipboard') {
|
||||
const clippy = new Clipboard(element, row.dataset.link);
|
||||
|
||||
@@ -51,7 +51,7 @@ class contentTable {
|
||||
div.appendChild(document.createTextNode(helper.t('No items')));
|
||||
this.table.appendChild(div);
|
||||
}
|
||||
createHeading(prefix = "table-heading"):HTMLElement {
|
||||
createHeading(prefix = "table-heading"): HTMLElement {
|
||||
let thead = document.createElement("section");
|
||||
thead.classList.add(this.headingClass);
|
||||
let headRow = document.createElement("header");
|
||||
@@ -134,16 +134,17 @@ class contentTable {
|
||||
|
||||
}
|
||||
|
||||
createActionButton(name: string, path: string, data: string):HTMLElement {
|
||||
createActionButton(name: string, path: string, data: string): HTMLElement {
|
||||
let button = document.createElement("button");
|
||||
button.classList.add("icon-" + name);
|
||||
button.setAttribute("path", path);
|
||||
button.setAttribute("data", data);
|
||||
button.setAttribute("data", data || "nodata");
|
||||
if (name == 'refresh') {
|
||||
name = helper.t('Redownload');
|
||||
}
|
||||
button.setAttribute("data-tippy-content", helper.ucfirst(name));
|
||||
button.setAttribute("title", helper.ucfirst(name));
|
||||
button.setAttribute("id", name + "-action-button");
|
||||
return button;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,13 @@ const helper = {
|
||||
counter.innerHTML = '<div class="number">' + data[key] + '</div>';
|
||||
}
|
||||
},
|
||||
getCounters() {
|
||||
let url = helper.generateUrl("apps/ncdownloader/counters");
|
||||
Http.getInstance(url).setMethod("GET").setHandler(function (data) {
|
||||
if (data["counter"])
|
||||
helper.updateCounter(data["counter"]);
|
||||
}).send();
|
||||
},
|
||||
html2DOM: function (htmlString) {
|
||||
const parser = new window.DOMParser();
|
||||
let doc = parser.parseFromString(htmlString, "text/html")
|
||||
|
||||
Reference in New Issue
Block a user