diff --git a/http_src/utilities/map/info-utils.js b/http_src/utilities/map/info-utils.js new file mode 100644 index 0000000000..476580c9ee --- /dev/null +++ b/http_src/utilities/map/info-utils.js @@ -0,0 +1,30 @@ +/* + (C) 2013-24 - ntop.org + */ + +const flowInfo = { + 'Audio': "", + 'Video': "", + 'Desktop Sharing': "", +} + +/* *********************************** */ + +const addFlowInfoIcon = function(info) { + let formatted_info = info; + + if (info && flowInfo[info]) { + formatted_info = `${flowInfo[info]} ${info}`; + } + return formatted_info; +} + +/* *********************************** */ + +const infoUtils = function () { + return { + addFlowInfoIcon + }; +}(); + +export default infoUtils; \ No newline at end of file diff --git a/http_src/vue/page-aggregated-live-flows.vue b/http_src/vue/page-aggregated-live-flows.vue index 50b793f657..a9b997826b 100644 --- a/http_src/vue/page-aggregated-live-flows.vue +++ b/http_src/vue/page-aggregated-live-flows.vue @@ -50,9 +50,8 @@ import { ref, onMounted, onBeforeMount, computed, nextTick } from "vue"; import { ntopng_utility, ntopng_url_manager } from "../services/context/ntopng_globals_services.js"; import NtopUtils from "../utilities/ntop-utils"; import { default as TableWithConfig } from "./table-with-config.vue"; -import { default as Dropdown } from "./dropdown.vue"; import { default as Spinner } from "./spinner.vue"; - +import infoUtils from "../utilities/map/info-utils.js"; import { default as SelectSearch } from "./select-search.vue"; const props = defineProps({ @@ -346,8 +345,7 @@ const map_table_def_columns = async (columns) => { columns.push( { title_i18n: "info", sortable: true, name: 'info', data_field: 'info', class: ['text-nowrap'], responsivePriority: 1, render_func: (data_field) => { - - return `${data_field.label}` + return `${infoUtils.addFlowInfoIcon(data_field.label)}` } }); } @@ -395,6 +393,8 @@ const map_table_def_columns = async (columns) => { return NtopUtils.bytesToSize(data_field); } }); + + console.log(columns) return columns; } @@ -457,7 +457,7 @@ const format_flows_icon = function (data, rowData) { else if (selected_criteria.value.value == 5) url = `${http_prefix}/lua/flows_stats.lua?application=${rowData.application.id}&client=${rowData.client.ip}&server=${rowData.server.ip}&vlan=${rowData.vlan_id.id}`; else if (selected_criteria.value.value == 6) { - url = `${http_prefix}/lua/flows_stats.lua?flow_info=${rowData.info.id}`; + url = `${http_prefix}/lua/flows_stats.lua?flow_info=${NtopUtils.stripTags(rowData.info.id)}`; if (add_host) url = url + `&host=` + props.context.host; } else if (selected_criteria.value.value == 7) { diff --git a/http_src/vue/page-flows-list.vue b/http_src/vue/page-flows-list.vue index 0a7e020ebb..1ac290163e 100644 --- a/http_src/vue/page-flows-list.vue +++ b/http_src/vue/page-flows-list.vue @@ -39,6 +39,7 @@ import { default as dataUtils } from "../utilities/data-utils.js"; import { default as Spinner } from "./spinner.vue"; import formatterUtils from "../utilities/formatter-utils"; import NtopUtils from "../utilities/ntop-utils.js"; +import infoUtils from "../utilities/map/info-utils.js"; /* ************************************** */ @@ -227,9 +228,9 @@ const map_table_def_columns = (columns) => { "info": (value, row) => { let info = '' if (!dataUtils.isEmptyOrNull(value)) { - info = value - const periodic_map_url = `${http_prefix}/lua/pro/enterprise/network_maps.lua?map=periodicity_map&page=table` + info = infoUtils.addFlowInfoIcon(value); if (row.periodic_flow) { + const periodic_map_url = `${http_prefix}/lua/pro/enterprise/network_maps.lua?map=periodicity_map&page=table` const address = row.client.mac ? row.client.mac : row.client.host info = `${value} ${i18n("periodic_flow")}` } diff --git a/httpdocs/dist b/httpdocs/dist index 1af8814cd3..c85ce01a82 160000 --- a/httpdocs/dist +++ b/httpdocs/dist @@ -1 +1 @@ -Subproject commit 1af8814cd3efd2bacb19c2ca4a7db6324aef66bf +Subproject commit c85ce01a821553e918c79b47fb22a6ad7a52c81f diff --git a/include/AggregatedFlowsStats.h b/include/AggregatedFlowsStats.h index 6d2eaee645..24107a05f5 100644 --- a/include/AggregatedFlowsStats.h +++ b/include/AggregatedFlowsStats.h @@ -95,9 +95,9 @@ class AggregatedFlowsStats { if (proto_name) { free(proto_name); } proto_name = strdup(_proto_name); }; - inline void setInfoKey(char* _key) { + inline void setInfoKey(string _key) { if (info_key) { free(info_key); } - info_key = strdup(_key); + info_key = strdup(_key.c_str()); }; inline void setProtoKey(u_int64_t _key) { proto_key = _key; }; inline void setKey(u_int64_t _key) { key = _key; }; diff --git a/scripts/lua/modules/flow_utils.lua b/scripts/lua/modules/flow_utils.lua index 9af3f76b2c..ddc2c7665d 100644 --- a/scripts/lua/modules/flow_utils.lua +++ b/scripts/lua/modules/flow_utils.lua @@ -2776,3 +2776,16 @@ function shortFlowLabel(flow) end -- ####################### + +-- A one line flow description +-- This uses the information from flow.getInfo() +function format_flow_info_field(flow) + local info = "" + + if not isEmptyString(flow["info"]) then + + end + return info +end + +-- ####################### diff --git a/src/Flow.cpp b/src/Flow.cpp index d79656f661..279915a5a5 100644 --- a/src/Flow.cpp +++ b/src/Flow.cpp @@ -5499,7 +5499,7 @@ std::string Flow::getFlowInfo(bool isLuaRequest) { info_field = std::string(protos.ssh.client_signature); } } else if (isLuaRequest && hasRisk(NDPI_DESKTOP_OR_FILE_SHARING_SESSION)) { - info_field = std::string(" Desktop Sharing"); + info_field = std::string("Desktop Sharing"); } else if (isMining() && protos.mining.currency) { info_field = std::string(protos.mining.currency); } else if (isSIP()) { @@ -5512,15 +5512,15 @@ std::string Flow::getFlowInfo(bool isLuaRequest) { break; case ndpi_multimedia_audio_flow: - info_field = std::string(" Audio"); + info_field = std::string("Audio"); break; case ndpi_multimedia_video_flow: - info_field = std::string(" Video"); + info_field = std::string("Video"); break; case ndpi_multimedia_screen_sharing_flow: - info_field = std::string(" Desktop Sharing"); + info_field = std::string("Desktop Sharing"); break; } }