Skip to content

Commit

Permalink
Removed duplicated help link (#8799)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoBiscosi committed Nov 12, 2024
1 parent 173e0aa commit b33cd7f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 28 deletions.
3 changes: 1 addition & 2 deletions http_src/vue/page-flow-historical.vue
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,8 @@ const map_table_def_columns = async (columns) => {
for (let i = 0; i < flow_risks.length; i++) {
const flow_risk = flow_risks[i];
const flow_risk_label = (flow_risk.label || flow_risk.value);
const flow_risk_help = (flow_risk.help);
const flow_risk_remediation = (flow_risk.remediation);
res.push(`${flow_risk_label} ${flow_risk_help} ${flow_risk_remediation}`);
res.push(`${flow_risk_label} ${flow_risk_remediation}`);
}
return res.join(', ');
},
Expand Down
2 changes: 1 addition & 1 deletion httpdocs/dist
Submodule dist updated 1 files
+2 −2 ntopng.js
1 change: 1 addition & 0 deletions scripts/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ local lang = {
["denied"] = "Denied",
["description"] = "Description",
["destination"] = "Destination",
["detected_issues"] = "Detected Issues",
["developer"] = "Developer",
["device"] = "Device",
["device_ip"] = "Device IP",
Expand Down
2 changes: 1 addition & 1 deletion scripts/lua/flow_details.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ else
local msg = string.format('<td> %s </td><td style=\"text-align: center;\"> %s </td><td> %s %s %s</td>',
score_alert.message .. alert_source,
'<span style="color:' .. severity.color .. '">' .. score_alert.score .. '</span>',
riskLabel, (score_alert.alert_risk > 0 and flow_risk_utils.get_documentation_link(alert_risk, alert_src)) or '',
riskLabel, (score_alert.alert_risk > 0 and flow_risk_utils.get_remediation_documentation_link(alert_risk, alert_src)) or '',
status_icon or '')
print(msg)

Expand Down
7 changes: 3 additions & 4 deletions scripts/lua/modules/alert_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,8 @@ function alert_utils.formatFlowAlertMessage(ifid, alert, alert_json, add_score,

-- Add the link to the documentation
if alert_risk and alert_risk > 0 then
msg = string.format("%s %s %s",
msg, flow_risk_utils.get_documentation_link(alert_risk, alert_src),
flow_risk_utils.get_remediation_documentation_link(alert_risk, alert_src))
msg = string.format("%s %s",
msg, flow_risk_utils.get_remediation_documentation_link(alert_risk, alert_src))
local info_msg = alert_utils.get_flow_risk_info(alert_risk, alert_json)

-- Add check info_msg ~= alert.info to avoid duplicated in description msg
Expand Down Expand Up @@ -819,7 +818,7 @@ function alert_utils.format_other_alerts(alert_bitmap, predominant_alert, alert_
if alert_risk > 0 then -- source is nDPI
if not no_html then
message = string.format("%s %s", message,
flow_risk_utils.get_documentation_link(alert_risk, "nDPI"))
flow_risk_utils.get_remediation_documentation_link(alert_risk, "nDPI"))
end
local info_msg = alert_utils.get_flow_risk_info(alert_risk, alert_json)
if not isEmptyString(info_msg) then
Expand Down
17 changes: 0 additions & 17 deletions scripts/lua/modules/flow_risk_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,6 @@ local clock_start = os.clock()

-- ##############################################

function flow_risk_utils.get_documentation_link(risk_id, source)

local url = ""

if (source == "ntopng") then
url = string.format("https://www.ntop.org/guides/ntopng/remediations/ntopng_flow_risks.html#risk-%.3u", risk_id)
else
url = string.format("https://www.ntop.org/guides/ntopng/remediations/ndpi_flow_risks.html#risk-%.3u", risk_id)
end

local link = string.format('<a href="%s" target="_blank"><i class="fas fa-lg fa-question-circle"></i></a>', url)

return link
end

-- ##############################################

function flow_risk_utils.get_remediation_documentation_link(risk_id, source)
local url = ""
if (source == "ntopng") then
Expand Down
3 changes: 1 addition & 2 deletions scripts/lua/modules/historical_flow_details_formatter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ end
local function format_historical_issues(flow_details, flow)
local alert_store_utils = require "alert_store_utils"
local alert_entities = require "alert_entities"
local alert_consts = require "alert_consts"
local format_utils = require "format_utils"
local alert_store_instances = alert_store_utils.all_instances_factory()
local alert_utils = require "alert_utils"
Expand Down Expand Up @@ -378,7 +377,7 @@ local function format_historical_issues(flow_details, flow)
end

flow_details[#flow_details + 1] = {
name = i18n('total_flow_score'),
name = i18n('detected_issues'),
values = {html}
}

Expand Down
1 change: 0 additions & 1 deletion scripts/lua/modules/historical_flow_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ local function dt_format_flow_risk(flow_risk_id)
title = title,
label = title,
value = cur_risk_id,
help = flow_risk_utils.get_documentation_link(cur_risk_id, ""),
remediation = flow_risk_utils.get_remediation_documentation_link(cur_risk_id, "")
}

Expand Down

0 comments on commit b33cd7f

Please sign in to comment.