From 4a6765f53e4b975b37c2ed3329b64a26758b25c7 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Tue, 18 Aug 2026 08:53:58 +0200 Subject: [PATCH] NC polling: update run timestamps in place without reloading admin page --- template/admin_tabs.tpl | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/template/admin_tabs.tpl b/template/admin_tabs.tpl index 5340a2f..ef8aea9 100644 --- a/template/admin_tabs.tpl +++ b/template/admin_tabs.tpl @@ -43,9 +43,33 @@ } function initNCConnectorPolling(){ - var section=document.getElementById('nc-connector');if(!section)return;var lastSeen=null;var endpoint='plugins/bratonien_tools/nc-connector-status.php'; - function wizardIsOpen(){var dialog=document.getElementById('bratonien-nc-wizard-dialog');if(dialog&&dialog.open)return true;try{return sessionStorage.getItem('bratonienNcWizardOpen')==='1';}catch(e){return false;}} - function poll(){fetch(endpoint+'?_='+Date.now(),{credentials:'same-origin',cache:'no-store'}).then(function(response){if(!response.ok)throw new Error('HTTP '+response.status);return response.json();}).then(function(data){var timestamp=parseInt(data.timestamp||0,10);if(!timestamp)return;if(lastSeen===null){lastSeen=timestamp;return;}if(timestamp>lastSeen){lastSeen=timestamp;if(!wizardIsOpen())window.location.reload();}}).catch(function(){});} + var section=document.getElementById('nc-connector');if(!section)return; + var endpoint='plugins/bratonien_tools/nc-connector-status.php'; + + function valueNodeForLabel(labelText){ + var labels=[].slice.call(section.querySelectorAll('.bratonien-label')); + for(var i=0;i