From: Marcin Haba Date: Sat, 10 Jul 2021 13:45:09 +0000 (+0200) Subject: baculum: Fix legend in job status pie chart on job view page X-Git-Tag: Release-11.0.6~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ed87bba304920c889af35bd204ec6de65a5e6da;p=thirdparty%2Fbacula.git baculum: Fix legend in job status pie chart on job view page Also add filtering by job after clicking on chart parts --- diff --git a/gui/baculum/protected/Web/JavaScript/misc.js b/gui/baculum/protected/Web/JavaScript/misc.js index bb2156b08..ad15369cb 100644 --- a/gui/baculum/protected/Web/JavaScript/misc.js +++ b/gui/baculum/protected/Web/JavaScript/misc.js @@ -267,7 +267,14 @@ var PieGraph = { return false; }, get_addr_by_type: function(type) { - return '/web/job/history/?type=' + type; + var job_regexp = new RegExp('/job/([^/?]+)/?'); + var path = decodeURIComponent(window.location.pathname); + var result = job_regexp.exec(path); + var job = ''; + if (result) { + job = '&job=' + result[1]; + } + return '/web/job/history/?type=' + type + job; } } diff --git a/gui/baculum/protected/Web/Pages/JobHistoryList.page b/gui/baculum/protected/Web/Pages/JobHistoryList.page index 5df42fdd4..512c749da 100644 --- a/gui/baculum/protected/Web/Pages/JobHistoryList.page +++ b/gui/baculum/protected/Web/Pages/JobHistoryList.page @@ -485,6 +485,16 @@ var oJobHistoryList = { a.href = 'javascript:void(0)'; a.addEventListener('click', function(e) { $.fn.dataTable.ext.search.pop(); + + // reset select filters + this.table.columns().every(function() { + var select = this.footer().querySelector('SELECT'); + if (select) { + select.value = ''; + $(select).trigger('change'); + } + }) + this.table.columns().search('').draw(); container.style.display = 'none'; }.bind(this)); @@ -536,6 +546,13 @@ var oJobHistoryList = { if (search_func) { $.fn.dataTable.ext.search.push(search_func); this.table.columns().search('').draw(); + var job = get_url_param('job'); + if (job) { + // set job filter + var select = this.table.column(2).footer().querySelector('SELECT'); + select.value = job; + $(select).trigger('change'); + } this.set_mode(type); container.style.display = ''; } else { diff --git a/gui/baculum/protected/Web/Pages/JobView.page b/gui/baculum/protected/Web/Pages/JobView.page index 8b517223f..dc50c0b9f 100644 --- a/gui/baculum/protected/Web/Pages/JobView.page +++ b/gui/baculum/protected/Web/Pages/JobView.page @@ -51,6 +51,7 @@
+
@@ -63,6 +64,7 @@ var oJobGraphs = { ids: { jobs_summary_graph : 'jobs_summary_graph', + jobs_summary_legend : 'jobs_summary_legend', job_size_graph : 'job_size_graph', job_files_graph : 'job_files_graph', job_actions: 'job_actions' @@ -253,6 +255,7 @@ var oJobGraphs = { this.graphs.job_summary = new GraphPieClass({ jobs: Statistics.jobs_summary, container_id: this.ids.jobs_summary_graph, + legend_container_id: this.ids.jobs_summary_legend, title: this.txt.job_summary.graph_title }); }, @@ -348,7 +351,7 @@ var oJobGraphs = { }, destroy_job_summary: function() { if (this.graphs.job_summary) { - this.graphs.job_summary.pie.destroy(); + this.graphs.job_summary.destroy(); } } };