]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Fix refreshing job status only when actions tab is open
authorMarcin Haba <marcin.haba@bacula.pl>
Tue, 5 Nov 2019 05:33:09 +0000 (06:33 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 14 Dec 2019 14:59:52 +0000 (15:59 +0100)
gui/baculum/protected/Web/JavaScript/misc.js
gui/baculum/protected/Web/Pages/JobHistoryView.page

index 9e701aedb9206461e10361e82e5762e24ad8cdcf..b9d2a30b4e367a993606904107680ebbc670fcda 100644 (file)
@@ -814,6 +814,10 @@ W3TabsCommon = {
                                tab_btns[i].classList.remove(this.css.tab_item_hover);
                        }
                }
+       },
+       is_open: function(item_id) {
+               var display = document.getElementById(item_id).style.display;
+               return (display === 'block' || display === '');
        }
 };
 
@@ -825,6 +829,9 @@ W3Tabs = {
        },
        open: function(btn_id, item_id) {
                W3TabsCommon.open.call(this, btn_id, item_id);
+       },
+       is_open: function(item_id) {
+               return W3TabsCommon.is_open(item_id);
        }
 };
 
index 9e0f01c2086cce720293a3715ecf435dabfeaf01..ef91e59707cb92ee32cb310b7373320089da87d1 100644 (file)
@@ -9,7 +9,7 @@
        <h3>[<%[ JobId ]%> <%=$this->getJobId()%>] <%[ Job: ]%> <%=$this->getJobName()%> &nbsp;</h3>
        <div class="w3-bar w3-green w3-margin-bottom">
                <a class="w3-bar-item w3-button tab_btn" href="<%=$this->Service->constructUrl('JobHistoryList')%>"><i class="fa fa-angle-left"></i></a>
-               <button id="btn_job_actions" type="button" class="w3-bar-item w3-button tab_btn w3-grey" onclick="W3Tabs.open(this.id, 'job_actions');"><%[ Actions ]%></button>
+               <button id="btn_job_actions" type="button" class="w3-bar-item w3-button tab_btn w3-grey" onclick="W3Tabs.open(this.id, 'job_actions'); job_callback_func(); oRunningJobStatus.init_refresh();"><%[ Actions ]%></button>
                <com:TActiveLinkButton
                        CssClass="w3-bar-item w3-button tab_btn"
                        Attributes.onclick="W3Tabs.open(this.id, 'job_config'); clear_node('#fileset_config div.directive_field'); clear_node('#schedule_config div.directive_field');"
@@ -175,7 +175,9 @@ var oRunningJobStatus = {
        },
        refresh_status: function() {
                var cb = <%=$this->RunningJobStatusCb->ActiveControl->Javascript%>;
-               cb.dispatch();
+               if (W3Tabs.is_open('job_actions')) {
+                       cb.dispatch();
+               }
        },
        update: function(data) {
                this.set_data(data);
@@ -452,7 +454,7 @@ $(function() {
                        var job_callback_func = function(force) {
                                var callback = <%=$this->RefreshJobLog->ActiveControl->Javascript%>;
                                var reload = document.getElementById('<%=$this->RunningIcon->ClientID%>').style.display != 'none';
-                               if (reload || force) {
+                               if ((reload && W3Tabs.is_open('job_actions')) || force) {
                                        callback.dispatch();
                                }
                        }