Fixes data retention preferences (#7628)

This commit is contained in:
Matteo Biscosi 2023-07-05 21:01:13 +00:00
parent ba9bba89bc
commit 2df85dee12
2 changed files with 25 additions and 57 deletions

View file

@ -468,42 +468,6 @@ if auth.has_capability(auth.capabilities.preferences) then
-- ================================================================================
function printDataRetention()
print('<form method="post">')
print('<table class="table">')
print('<thead class="table-primary"><tr><th colspan=2 class="info">' .. i18n("prefs.data_retention") ..
'</th></tr></thead>')
prefsInputFieldPrefs(subpage_active.entries["flow_data_retention"].title,
subpage_active.entries["flow_data_retention"].description, "ntopng.prefs.",
"flows_and_alerts_data_retention_days", data_retention_utils.getDefaultRetention(), "number", nil, nil, nil,
{
min = 1,
max = 365 * 10
})
prefsInputFieldPrefs(subpage_active.entries["ts_data_retention"].title,
subpage_active.entries["ts_data_retention"].description, "ntopng.prefs.",
"ts_and_stats_data_retention_days", data_retention_utils.getDefaultRetention(), "number", nil, nil, nil, {
min = 1,
max = 365 * 10
})
print(
'<tr><th colspan=2 style="text-align:right;"><button type="submit" class="btn btn-primary" style="width:115px" disabled="disabled">' ..
i18n("save") .. '</button></th></tr>')
print('</table>')
print [[<input name="csrf" type="hidden" value="]]
print(ntop.getRandomCSRFValue())
print [[" />
</form>]]
end
-- ================================================================================
-- #####################
local function printMenuEntriesPrefs()
@ -1515,8 +1479,16 @@ if auth.has_capability(auth.capabilities.preferences) then
subpage_active.entries["influxdb_query_timeout"].description, "ntopng.prefs.", "influx_query_timeout", "10",
"number", influx_active, nil, nil, {
min = 1
})
prefsInputFieldPrefs(subpage_active.entries["ts_data_retention"].title,
subpage_active.entries["ts_data_retention"].description, "ntopng.prefs.",
"ts_and_stats_data_retention_days", data_retention_utils.getDefaultRetention(), "number", nil, nil, nil, {
min = 1,
max = 365 * 10
})
print('<thead class="table-primary"><tr><th colspan=2 class="info">' .. i18n('prefs.interfaces_timeseries') ..
'</th></tr></thead>')
@ -1930,6 +1902,15 @@ if auth.has_capability(auth.capabilities.preferences) then
local showAggregateFlowsPrefs = ntop.isEnterpriseXL() and ntop.isClickHouseEnabled()
prefsInputFieldPrefs(subpage_active.entries["flow_data_retention"].title,
subpage_active.entries["flow_data_retention"].description, "ntopng.prefs.",
"flows_and_alerts_data_retention_days", data_retention_utils.getDefaultRetention(), "number", nil, nil, nil,
{
min = 1,
max = 365 * 10
})
prefsInputFieldPrefs(subpage_active.entries["aggregated_flows_data_retention"].title,
subpage_active.entries["aggregated_flows_data_retention"].description, "ntopng.prefs.",
"aggregated_flows_data_retention_days", data_retention_utils.getAggregatedFlowsDataRetention(), "number",
@ -2056,10 +2037,6 @@ if auth.has_capability(auth.capabilities.preferences) then
printNetworkBehaviour()
end
if (tab == "retention") then
printDataRetention()
end
if (tab == "misc") then
printMisc()
end