mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Implement timeseries tabular view
This commit is contained in:
parent
e64c2c8fd7
commit
0872c162b5
10 changed files with 143 additions and 63 deletions
9
httpdocs/js/bootstrap-datatable.js
vendored
9
httpdocs/js/bootstrap-datatable.js
vendored
|
|
@ -107,12 +107,14 @@
|
|||
, filter: o.filter
|
||||
}) );
|
||||
if(o.url !== "") {
|
||||
var req_data = (typeof o.post === "function") ? o.post() : o.post;
|
||||
|
||||
$.ajax({
|
||||
url: o.url
|
||||
// ------------- Start ntop Patch ---------------
|
||||
, type: "GET"
|
||||
, dataType: "json"
|
||||
, data: $.extend({}, o.post, {
|
||||
, data: $.extend({}, req_data, {
|
||||
currentPage: o.currentPage
|
||||
, perPage: o.perPage
|
||||
, sortColumn: (o.sort.length > 0) ? o.sort[0][0] : null
|
||||
|
|
@ -121,7 +123,10 @@
|
|||
, filter: o.filter
|
||||
})
|
||||
, success: function( res ) {
|
||||
that.resultset = res;
|
||||
if(o.dataAdapter)
|
||||
res = o.dataAdapter(res, o);
|
||||
|
||||
that.resultset = res;
|
||||
// ------------- Start ntop Patch ---------------
|
||||
if(!res || res === undefined || !res.data || (res.data.length == 0 && !o.forceTable) ) {
|
||||
// ------------- End ntop Patch -----------------
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ function attachStackedChartCallback(chart, schema_name, chart_id, zoom_reset_id,
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!first_load || chart.is_zoomed) {
|
||||
if(!first_load || (!has_initial_zoom && chart.is_zoomed)) {
|
||||
var epoch = params.epoch_begin + (params.epoch_end - params.epoch_begin) / 2;
|
||||
params.epoch_begin = Math.floor(epoch - max_interval / 2);
|
||||
params.epoch_end = Math.ceil(epoch + max_interval / 2);
|
||||
|
|
@ -703,10 +703,59 @@ function attachStackedChartCallback(chart, schema_name, chart_id, zoom_reset_id,
|
|||
first_load = false;
|
||||
} else {
|
||||
/* Reload datatable */
|
||||
if(flows_dt)
|
||||
flows_dt.render();
|
||||
if(flows_dt.data("datatable"))
|
||||
flows_dt.data("datatable").render();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function updateGraphsTableView(graph_table, view, graph_params, nindex_buttons) {
|
||||
if(view.columns) {
|
||||
var url = http_prefix + (view.nindex_view ? "/lua/enterprise/get_flows.lua" : "/lua/enterprise/get_ts_table.lua");
|
||||
|
||||
var columns = view.columns.map(function(col) {
|
||||
return {
|
||||
title: col[1],
|
||||
field: col[0],
|
||||
sortable: col[2],
|
||||
css: { textAlign: col[3], width: col[4], },
|
||||
};
|
||||
});
|
||||
|
||||
/* Force reinstantiation */
|
||||
graph_table.removeData('datatable');
|
||||
graph_table.html("");
|
||||
|
||||
graph_table.datatable({
|
||||
title: "",
|
||||
url: url,
|
||||
post: function() {
|
||||
var params = $.extend({}, graph_params);
|
||||
delete params.ts_compare;
|
||||
delete params.initial_point;
|
||||
params.limit = 1; // TODO make specific query
|
||||
// TODO change topk
|
||||
// TODO disable statistics
|
||||
params.detail_view = view.id;
|
||||
|
||||
return params;
|
||||
},
|
||||
loadingYOffset: 40,
|
||||
columns: columns,
|
||||
buttons: view.nindex_view ? [nindex_buttons, ] : [],
|
||||
tableCallback: function() {
|
||||
var data = this.resultset;
|
||||
var stats_div = $("#chart1-flows-stats");
|
||||
|
||||
if(data && data.stats && data.stats.loading_time) {
|
||||
$("#flows-load-time").html(data.stats.loading_time);
|
||||
$("#flows-processed-records").html(data.stats.num_records_processed);
|
||||
stats_div.show();
|
||||
} else
|
||||
stats_div.hide();
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
httpdocs/js/jquery_bootstrap.min.js
vendored
2
httpdocs/js/jquery_bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
httpdocs/js/ntop.min.js
vendored
2
httpdocs/js/ntop.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue