]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add job name parameter to monitor
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 18 Nov 2019 20:13:17 +0000 (21:13 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 14 Dec 2019 15:02:16 +0000 (16:02 +0100)
gui/baculum/protected/Web/Pages/ClientList.page
gui/baculum/protected/Web/Pages/ClientView.page
gui/baculum/protected/Web/Pages/Dashboard.page
gui/baculum/protected/Web/Pages/JobHistoryList.page
gui/baculum/protected/Web/Pages/JobHistoryView.page
gui/baculum/protected/Web/Pages/JobView.page
gui/baculum/protected/Web/Pages/Monitor.php
gui/baculum/protected/Web/Pages/PoolList.page
gui/baculum/protected/Web/Portlets/JobGraphs.tpl

index eb3d238a1ebbeea9e8a8e3fb943e2ab7d4d1488b..23e190792d12e5f4db78849d1515d2cf3fea7573 100644 (file)
@@ -156,7 +156,7 @@ var oClientList = {
                });
        }
 };
-MonitorParams = ['clients'];
+MonitorParams = {clients: null};
 $(function() {
        MonitorCalls.push(function() { oClientList.init(); });
 });
index 6483620cedafd8ea026a382e9bf7bb2a98cdd53d..2b1c38f6b942440c46e40e1cdfa02fac881613f9 100644 (file)
@@ -681,7 +681,7 @@ var oJobForClientList = {
                });
        }
 };
-MonitorParams = ['jobs'];
+MonitorParams = {jobs: null};
 $(function() {
        MonitorCalls.push(function() { oJobForClientList.init(<%=$this->getClientId()%>); });
 });
index 84e09bb66a428551db1ccc9c9709a986638d312b..303f562905b3d795e62f6b90507f3c1ccf815556 100644 (file)
                </div>
        </div>
 <script type="text/javascript">
-MonitorParams = ['jobs', 'clients', 'pools', 'job_totals', 'dbsize'];
+MonitorParams = {
+       jobs: null,
+       clients: null,
+       pools: null,
+       job_totals: null,
+       dbsize: null
+};
 </script>
 </com:TContent>
index 20d214bb07c3b572ae0f7f15243055a31004fc6c..a169027e3df0eea201a3002e2d24c6f81a3c7262 100644 (file)
@@ -218,7 +218,7 @@ var oJobList = {
                });
        }
 };
-MonitorParams = ['jobs'];
+MonitorParams = {jobs: null};
 $(function() {
        MonitorCalls.push(function() { oJobList.init(); });
 });
index 819d99b7e8ae90a44ff7cbdd0a76e1654d6db92f..b5705e04d892ee3bf482ba6c03b3f966f5ad2562 100644 (file)
@@ -406,7 +406,11 @@ function init_graphical_running_job_status(data, tab_data) {
 
 oRunningJobStatus.init();
 
-MonitorParams = ['jobs'];
+MonitorParams = {
+       jobs: {
+               name: ['<%=$this->getJobName()%>']
+       }
+};
 $(function() {
        MonitorCalls.push(function() { oRunningJobStatus.refresh_status(); });
 });
index 1bdc394f45e75c058492aafdce4fa1a8ea37c800..b363c8f2411c0378275dfaab25525f3ba9b0de9e 100644 (file)
@@ -246,7 +246,11 @@ var oJobHistoryList = {
                });
        }
 };
-MonitorParams = ['jobs'];
+MonitorParams = {
+       jobs: {
+               name: ['<%=$this->getJobName()%>']
+       }
+};
 $(function() {
        MonitorCalls.push(function() { oJobHistoryList.init('<%=$this->getJobName()%>'); });
 });
index 33924948b03fe5a8c5188dbb922aedd54ec592da..da6d0e8cc446525f4a3cac354dbb1feab24a35e9 100644 (file)
@@ -46,10 +46,19 @@ class Monitor extends BaculumWebPage {
 
                $error = null;
                $params = $this->Request->contains('params') ? $this->Request['params'] : array();
-               if (in_array('jobs', $params)) {
+               if (is_array($params) && key_exists('jobs', $params)) {
                        $job_params = array('jobs');
+                       $job_query = array();
+                       if (is_array($params['jobs']) && key_exists('name', $params['jobs']) && is_array($params['jobs']['name'])) {
+                               for ($i = 0; $i < count($params['jobs']['name']); $i++) {
+                                       $job_query['name'] = $params['jobs']['name'][$i];
+                               }
+                       }
                        if ($this->Request->contains('use_limit') && $this->Request['use_limit'] == 1) {
-                               $job_params[] = '?limit=' . $job_limit;
+                               $job_query['limit'] = $job_limit;
+                       }
+                       if (count($job_query) > 0) {
+                               $job_params[] = '?' . http_build_query($job_query);
                        }
                        $result = $this->getModule('api')->get($job_params);
                        if ($result->error === 0) {
@@ -66,7 +75,7 @@ class Monitor extends BaculumWebPage {
                                $error = $result;
                        }
                }
-               if (!$error && in_array('clients', $params)) {
+               if (!$error && key_exists('clients', $params)) {
                        $result = $this->getModule('api')->get(array('clients'));
                        if ($result->error === 0) {
                                $monitor_data['clients'] = $result->output;
@@ -74,7 +83,7 @@ class Monitor extends BaculumWebPage {
                                $error = $result;
                        }
                }
-               if (!$error && in_array('pools', $params)) {
+               if (!$error && key_exists('pools', $params)) {
                        $result = $this->getModule('api')->get(array('pools'));
                        if ($result->error === 0) {
                                $monitor_data['pools'] = $result->output;
@@ -82,7 +91,7 @@ class Monitor extends BaculumWebPage {
                                $error = $result;
                        }
                }
-               if (!$error && in_array('job_totals', $params)) {
+               if (!$error && key_exists('job_totals', $params)) {
                        $result = $this->getModule('api')->get(array('jobs', 'totals'));
                        if ($result->error === 0) {
                                $monitor_data['jobtotals'] = $result->output;
@@ -90,7 +99,7 @@ class Monitor extends BaculumWebPage {
                                $error = $result;
                        }
                }
-               if (!$error && $_SESSION['admin'] && in_array('dbsize', $params)) {
+               if (!$error && $_SESSION['admin'] && key_exists('dbsize', $params)) {
                        $result = $this->getModule('api')->get(array('dbsize'));
                        if ($result->error === 0) {
                                $monitor_data['dbsize'] = $result->output;
@@ -101,7 +110,7 @@ class Monitor extends BaculumWebPage {
 
                $running_job_states = $this->Application->getModule('misc')->getRunningJobStates();
 
-               if (in_array('jobs', $params)) {
+               if (key_exists('jobs', $params)) {
                        for ($i = 0; $i < count($monitor_data['jobs']); $i++) {
                                if (!in_array($monitor_data['jobs'][$i]->jobstatus, $running_job_states)) {
                                        $monitor_data['terminated_jobs'][] = $monitor_data['jobs'][$i];
index 3c17b18aa2888d9bcbd9d696eacbff6735d51f4e..ef219b7b7893debf48642d2875643a12c8e499ac 100644 (file)
@@ -158,7 +158,7 @@ var oPoolList = {
                });
        }
 };
-MonitorParams = ['pools'];
+MonitorParams = {pools: null};
 $(function() {
        MonitorCalls.push(function() { oPoolList.init(); });
 });
index d011824d5024807dbf3329448ccde8869622aac0..63aedbe60e249d432fe55047f94385457abd0026 100644 (file)
@@ -69,7 +69,7 @@
 <div id="legend_container" class="w3-margin-left"></div>
 <div id="graphs_container" style="height: 500px; margin-top: 60px;"></div>
 <script type="text/javascript">
-       MonitorParams = ['jobs'];
+       MonitorParams = {jobs: null};
        var graph_lang = {
                job_size: {
                        graph_title: '<%[ Graph: ]%> <%[ Job size / Time ]%>',