Skip to content

Commit

Permalink
Fixes topology map not correctly working
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoBiscosi committed May 16, 2024
1 parent 9082f2d commit cfc112e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
2 changes: 2 additions & 0 deletions http_src/vue/ntop_vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { default as PageHostsList } from "./page-hosts-list.vue"
import { default as PageFlowsList } from "./page-flows-list.vue"
import { default as PageSNMPInterfaces } from "./page-snmp-interfaces.vue"
import { default as PageSNMPTopology } from "./page-snmp-topology.vue"
import { default as PageSNMPTopologyMap } from "./page-snmp-topology-map.vue"
import { default as PageSNMPSimilarity } from "./page-snmp-similarity.vue"
import { default as PageSNMPDevices } from "./page-snmp-devices.vue"
import { default as PageBlacklists } from "./page-blacklists.vue"
Expand Down Expand Up @@ -136,6 +137,7 @@ let ntopVue = {
PageSNMPUsage: PageSNMPUsage,
PageSNMPInterfaces: PageSNMPInterfaces,
PageSNMPTopology: PageSNMPTopology,
PageSNMPTopologyMap: PageSNMPTopologyMap,
PageSNMPSimilarity: PageSNMPSimilarity,
PageFlowsList: PageFlowsList,
PageSNMPDevices: PageSNMPDevices,
Expand Down
62 changes: 62 additions & 0 deletions http_src/vue/page-snmp-topology-map.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!--
(C) 2013-23 - ntop.org
-->

<template>
<div class="row">
<div class="col-md-12 col-lg-12">
<div class="card card-shadow">
<div class="card-body">
<NetworkMap ref="service_map" :empty_message="no_services_message" :event_listeners="event_listeners"
:page_csrf="context.csrf" :url="topology_url" :url_params="url_params" :map_id="map_id">
</NetworkMap>
</div>
<div class="card-footer">
<NoteList :note_list="note_list"> </NoteList>
</div>
</div>
</div>
</div>
</template>

<script setup>
/* Imports */
import { ref } from "vue";
import { default as NoteList } from "./note-list.vue";
import { default as NetworkMap } from "./network-map.vue";
import { ntopng_url_manager } from "../services/context/ntopng_globals_services.js";
/* ******************************************************************** */
/* Consts */
const _i18n = (t) => i18n(t);
const no_services_message = _i18n('map_page.no_services')
const note_list = [
_i18n("snmp.snmp_lldp_cdp_descr"),
_i18n("snmp.snmp_lldp_cdp_zoom_descr"),
_i18n("snmp.snmp_lldp_cdp_node_color"),
]
const map_id = ref('topology-map')
const url_params = ntopng_url_manager.get_url_object()
const topology_url = `${http_prefix}/lua/pro/rest/v2/get/snmp/topology_map.lua`
const snmp_device_url = `${http_prefix}/lua/pro/enterprise/snmp_device_details.lua?ip=%ip`
const click_device = function(item) {
ntopng_url_manager.go_to_url(snmp_device_url.replace('%ip', item.nodes[0]));
}
const event_listeners = {
'doubleClick': click_device
}
const props = defineProps({
context: Object,
});
const context = ref({
csrf: props.context.csrf,
ifid: props.context.ifid,
});
</script>
2 changes: 1 addition & 1 deletion scripts/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7529,7 +7529,7 @@ local lang = {
["snmp_level"] = "Security Level",
["snmp_lldp_cdp_descr"] = "Device topology information is available when the <A HREF=\"https://en.wikipedia.org/wiki/Link_Layer_Discovery_Protocol\">LLDP</A> / <A HREF=\"https://en.wikipedia.org/wiki/Cisco_Discovery_Protocol\">CDP</A> MIB is present on the monitored device.",
["snmp_lldp_cdp_no_node"] = "The selected node has not been polled via SNMP",
["snmp_lldp_cdp_node_color"] = "The node color represents the device model.",
["snmp_lldp_cdp_node_color"] = "The node color represents the status of the interface.<br><ul><li><span style='color:green'>Up</span></li><li><span style='color:red'>Down</span></li><li><span style='color:blue'>Up in use</span></li><li><span style='color:#495057'>Unknown</span></li>",
["snmp_lldp_cdp_zoom_descr"] = "Click on a node to explore the device, use the mouse wheel to zoom, drag clicking on an empty area.",
["snmp_monitor_disable_confirm"] = "Do you really want to disable port status monitoring on SNMP device %{device}?",
["snmp_monitor_enable_confirm"] = "Do you really want to enable port status monitoring on SNMP device %{device}? Alerts will be generated whenever a port changes state.",
Expand Down

0 comments on commit cfc112e

Please sign in to comment.