outlineWidth: 0,
color: 'black'
},
- xaxis: { showLabels : false,},
+ xaxis: { showLabels : false },
yaxis: { showLabels : false },
pie: {
show : true,
position : 'sw'
},
legend: {
+ noColumns: 3,
position : 'se',
backgroundColor : '#D2E8FF',
- margin: 0
+ margin: 0,
+ labelFormatter: PieGraph.pie_legend_formatter.bind(PieGraph)
}
},
initialize: function(prop) {
this.jobs = prop.jobs;
this.title = prop.hasOwnProperty('title') ? prop.title : null;
this.container = document.getElementById(prop.container_id);
+ this.legend_container = prop.hasOwnProperty('legend_container_id') ? $('#' + prop.legend_container_id) : null;
this.series = this.prepare_series();
this.draw_grah();
},
if (this.title) {
graph_options.title = this.title;
}
+ if (this.legend_container) {
+ graph_options.legend.container = this.legend_container;
+ }
this.pie = Flotr.draw(this.container, this.series, graph_options);
+ Flotr.EventAdapter.observe(this.container, 'flotr:click', PieGraph.pie_mouse_handler.bind(PieGraph));
+ },
+ destroy: function() {
+ Flotr.EventAdapter.stopObserving(this.container, 'flotr:click');
+ this.pie.destroy();
}
});
},
pie_track_formatter: function(e) {
return e.series.label;
+ },
+ pie_legend_formatter: function(label) {
+ var type = label.split(' ')[0];
+ var a = document.createElement('A');
+ a.href = this.get_addr_by_type(type);
+ a.className = 'raw';
+ text = document.createTextNode(label);
+ a.appendChild(text);
+ return a.outerHTML;
+ },
+ pie_mouse_handler: function(e) {
+ var type = e.hit.series.label.split(' ')[0];
+ window.location.href = this.get_addr_by_type(type);
+ return false;
+ },
+ get_addr_by_type: function(type) {
+ return '/web/job/history/?type=' + type;
}
}
stats: null,
txt: null,
pie: null,
+ txt: null,
noval: '-',
ids: {
clients: {
most: 'pool_most',
jobs: 'pool_jobs'
},
- pie_summary: 'jobs_summary_graph'
+ pie_summary: {
+ container_id: 'jobs_summary_graph',
+ legend_container_id: 'jobs_summary_legend'
+ }
},
last_jobs_table: null,
dbtype: {
mysql: 'MySQL',
sqlite: 'SQLite'
},
+ set_text: function(txt) {
+ this.txt = txt;
+ },
update_all: function(statistics) {
this.stats = statistics;
this.update_pie_jobstatus();
},
update_pie_jobstatus: function() {
if (this.pie != null) {
- this.pie.pie.destroy();
+ this.pie.destroy();
}
this.pie = new GraphPieClass({
jobs: this.stats.jobs_summary,
- container_id: this.ids.pie_summary
+ container_id: this.ids.pie_summary.container_id,
+ legend_container_id: this.ids.pie_summary.legend_container_id,
+ title: this.txt.js_sum_title
});
}
};
msgid "Configure console"
msgstr "Configure console"
+
+msgid "Mode:"
+msgstr "Mode:"
+
+msgid "Reset table mode"
+msgstr "Reset table mode"
+
+msgid "Jobs terminated normally"
+msgstr "Jobs terminated normally"
+
+msgid "Jobs with warning"
+msgstr "Jobs with warning"
+
+msgid "Jobs finished with error"
+msgstr "Jobs finished with error"
+
+msgid "Jobs running"
+msgstr "Jobs running"
+
+msgid "Jobs canceled"
+msgstr "Jobs canceled"
msgid "Configure console"
msgstr "Configure console"
+
+msgid "Mode:"
+msgstr "Mode:"
+
+msgid "Reset table mode"
+msgstr "Reset table mode"
+
+msgid "Jobs terminated normally"
+msgstr "Jobs terminated normally"
+
+msgid "Jobs with warning"
+msgstr "Jobs with warning"
+
+msgid "Jobs finished with error"
+msgstr "Jobs finished with error"
+
+msgid "Jobs running"
+msgstr "Jobs running"
+
+msgid "Jobs canceled"
+msgstr "Jobs canceled"
msgid "Configure console"
msgstr "Konfiguruj konsolę"
+
+msgid "Mode:"
+msgstr "Tryb:"
+
+msgid "Reset table mode"
+msgstr "Resetuj tryb tabeli"
+
+msgid "Jobs terminated normally"
+msgstr "Zadania zakończone normalnie"
+
+msgid "Jobs with warning"
+msgstr "Zadania z ostrzeżeniami"
+
+msgid "Jobs finished with error"
+msgstr "Zadania zakończone z błędem"
+
+msgid "Jobs running"
+msgstr "Zadania uruchomione"
+
+msgid "Jobs canceled"
+msgstr "Zadania anulowane"
msgid "Configure console"
msgstr "Configurar console"
+msgid "Mode:"
+msgstr "Mode:"
+
+msgid "Reset table mode"
+msgstr "Reset table mode"
+
+msgid "Jobs terminated normally"
+msgstr "Jobs terminated normally"
+
+msgid "Jobs with warning"
+msgstr "Jobs with warning"
+
+msgid "Jobs finished with error"
+msgstr "Jobs finished with error"
+
+msgid "Jobs running"
+msgstr "Jobs running"
+
+msgid "Jobs canceled"
+msgstr "Jobs canceled"
msgid "Status request timed out. The most probably the Bacula director is not available or it is not running."
msgstr "Истекло время ожидания запроса. Вероятно, клиент Bacula не доступен или не запущен."
+msgid "Mode:"
+msgstr "Mode:"
+
+msgid "Reset table mode"
+msgstr "Reset table mode"
+
+msgid "Jobs terminated normally"
+msgstr "Jobs terminated normally"
+
+msgid "Jobs with warning"
+msgstr "Jobs with warning"
+
+msgid "Jobs finished with error"
+msgstr "Jobs finished with error"
+
+msgid "Jobs running"
+msgstr "Jobs running"
+
+msgid "Jobs canceled"
+msgstr "Jobs canceled"
msgid "To use the console page please configure bbconsjson binary file path on the API side."
msgstr "Чтобы использовать страницу консоли, настройте путь к бинарным файлам bbconsjson на стороне API."
oData = response;
if ('<%=get_class($this->Service->getRequestedPage())%>' == 'Dashboard') {
Statistics.grab_statistics(oData, JobStatus.get_states());
+ Dashboard.set_text({
+ js_sum_title: '<%[ Job status summary ]%>'
+ });
Dashboard.update_all(Statistics);
}
<div class="w3-panel">
<div class="w3-row-padding" style="margin:0 -16px">
<div class="w3-third">
- <h5><%[ Job status summary ]%></h5>
<div class="dashboard_graph">
<div id="jobs_summary_graph"></div>
+ <div id="jobs_summary_legend"></div>
</div>
<div class="w3-card-4 w3-padding-16 w3-margin-top w3-margin-bottom">
<header class="w3-container w3-light-grey w3-half w3-left">
],
ids: {
job_list: 'job_list',
- job_list_body: 'job_list_body'
+ job_list_body: 'job_list_body',
+ table_mode: 'table_mode'
},
data: [],
table: null,
this.set_table();
this.set_bulk_actions();
this.set_events();
+ this.set_filters();
}
},
set_events: function() {
this.table = $('#' + this.ids.job_list).DataTable({
data: this.data,
deferRender: true,
- dom: 'lB<"table_toolbar">frtip',
+ dom: 'lB<"table_toolbar"><"#table_mode">frtip',
stateSave: true,
buttons: [
'copy', 'csv', 'colvis'
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
- if (column[0][0] == 14) {
+ if (column[0][0] == 14) { // NOTE: this column is used also in filters (@see oJobHistoryList.set_mode())
column.data().unique().sort().each(function (d, j) {
if (column.search() == '^' + dtEscapeRegex(d) + '$') {
select.append('<option value="' + d + '" title="' + JobStatus.get_desc(d) + '" selected>' + d + '</option>');
actions: '<%[ Actions ]%>',
ok: '<%[ OK ]%>'
});
+ },
+ set_mode: function(type) {
+ var types = {
+ ok: '<%[ Jobs terminated normally ]%>',
+ warning: '<%[ Jobs with warning ]%>',
+ error: '<%[ Jobs finished with error ]%>',
+ running: '<%[ Jobs running ]%>',
+ cancel: '<%[ Jobs canceled ]%>'
+ }
+ var container = document.getElementById(this.ids.table_mode);
+ var mode = document.createTextNode(' <%[ Mode: ]%> ' + types[type] + ' ');
+ container.appendChild(mode);
+ var label = document.createTextNode(' <%[ Reset table mode ]%>');
+ var a = document.createElement('A');
+ a.className = 'w3-button w3-green';
+ a.href = 'javascript:void(0)';
+ a.addEventListener('click', function(e) {
+ $.fn.dataTable.ext.search.pop();
+ this.table.columns().search('').draw();
+ container.style.display = 'none';
+ }.bind(this));
+ var img = document.createElement('I');
+ img.className = 'fas fa-sync-alt';
+ a.appendChild(img);
+ a.appendChild(label);
+ container.appendChild(a);
+ },
+ set_filters: function() {
+ var jss = '';
+ var type = get_url_param('type');
+ var search_func;
+ switch (type) {
+ case 'ok':
+ search_func = function(settings, search_data, index, row_data, counter) {
+ var jobstatus = search_data[14];
+ var joberrors = search_data[18];
+ return (JobStatus.is_ok(jobstatus) && joberrors == 0);
+ };
+ break;
+ case 'error':
+ search_func = function(settings, search_data, index, row_data, counter) {
+ var jobstatus = search_data[14];
+ return JobStatus.is_error(jobstatus);
+ };
+ break;
+ case 'warning':
+ search_func = function(settings, search_data, index, row_data, counter) {
+ var jobstatus = search_data[14];
+ var joberrors = search_data[18];
+ return ((JobStatus.is_ok(jobstatus) && joberrors > 0) || JobStatus.is_warning(jobstatus));
+ };
+ break;
+ case 'cancel':
+ search_func = function(settings, search_data, index, row_data, counter) {
+ var jobstatus = search_data[14];
+ return JobStatus.is_cancel(jobstatus);
+ };
+ break;
+ case 'running':
+ search_func = function(settings, search_data, index, row_data, counter) {
+ var jobstatus = search_data[14];
+ return (JobStatus.is_running(jobstatus) || JobStatus.is_waiting(jobstatus));
+ };
+ break;
+ }
+ var container = document.getElementById(this.ids.table_mode);
+ if (search_func) {
+ $.fn.dataTable.ext.search.push(search_func);
+ this.table.columns().search('').draw();
+ this.set_mode(type);
+ container.style.display = '';
+ } else {
+ container.style.display = 'none';
+ }
}
};
MonitorParams = {jobs: null};
#jobs_summary_graph {
height: 380px;
z-index: 0;
+ cursor: pointer;
}
.monospace {