From b8fa0246803dab40cf57d40b45984c53046f2d55 Mon Sep 17 00:00:00 2001 From: "Dzial Techniczny WMW Projekt s.c" Date: Tue, 10 Dec 2019 11:34:53 +0100 Subject: Plugins directory and local modifications --- plugins/Bigboard/Asset/js/BoardPolling.js | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 plugins/Bigboard/Asset/js/BoardPolling.js (limited to 'plugins/Bigboard/Asset/js/BoardPolling.js') diff --git a/plugins/Bigboard/Asset/js/BoardPolling.js b/plugins/Bigboard/Asset/js/BoardPolling.js new file mode 100644 index 00000000..6d5499fd --- /dev/null +++ b/plugins/Bigboard/Asset/js/BoardPolling.js @@ -0,0 +1,43 @@ +Kanboard.BoardPolling = function(app) { + this.app = app; +}; + +Kanboard.BoardPolling.prototype.execute = function() { + if (this.app.hasId("board")) { + var interval = parseInt($("#board").attr("data-check-interval")); + + if (interval > 0) { + window.setInterval(this.check.bind(this), interval * 1000); + } + } +}; + +Kanboard.BoardPolling.prototype.check = function() { + if (KB.utils.isVisible() && !this.app.get("BoardDragAndDrop").savingInProgress) { + var self = this; + if (!$("#app-loading-icon").length) this.app.showLoadingIcon(); + var pollsinprogress=0; + + $("table.board-project").each(function() { + var boardId = $(this).attr("data-project-id") + var url = $(this).attr("data-check-url"); + pollsinprogress++; + $.ajax({ + cache: false, + url: url, + statusCode: { + 200: function(data) { + pollsinprogress--; + if (pollsinprogress <= 0) self.app.hideLoadingIcon(); + self.app.get("BoardDragAndDrop").refresh(boardId, data); + }, + 304: function () { + pollsinprogress--; + if (pollsinprogress <= 0) self.app.hideLoadingIcon(); + } + } + }); + }); + if (pollsinprogress <= 0) self.app.hideLoadingIcon(); + } +}; -- cgit v1.2.3