File tree Expand file tree Collapse file tree 3 files changed +17
-20
lines changed
Expand file tree Collapse file tree 3 files changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -40,15 +40,27 @@ export class DeviceInfo extends BaseInfo {
4040 ) ;
4141
4242 const layer = this . device . viewgraph . getLayer ( ) ;
43+ const showIp = this . device . getType ( ) !== DeviceType . Switch ;
44+ const showMac = layer === Layer . Link ;
4345
44- if ( layer == Layer . Link ) {
45- this . device . interfaces . forEach ( ( iface ) =>
46+ if ( showIp ) {
47+ this . device . interfaces . forEach ( ( iface ) => {
4648 this . information . addField (
47- TOOLTIP_KEYS . MAC_ADDRESS ,
49+ TOOLTIP_KEYS . IP_ADDRESS + ( iface . name ? ` (${ iface . name } )` : "" ) ,
50+ iface . ip . toString ( ) ,
51+ TOOLTIP_KEYS . IP_ADDRESS ,
52+ ) ;
53+ } ) ;
54+ }
55+
56+ if ( showMac ) {
57+ this . device . interfaces . forEach ( ( iface ) => {
58+ this . information . addField (
59+ TOOLTIP_KEYS . MAC_ADDRESS + ( iface . name ? ` (${ iface . name } )` : "" ) ,
4860 iface . mac . toString ( ) ,
4961 TOOLTIP_KEYS . MAC_ADDRESS ,
50- ) ,
51- ) ;
62+ ) ;
63+ } ) ;
5264 }
5365 }
5466
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import { GlobalContext } from "../../context";
2020import { DataHost } from "../data-devices" ;
2121import { dropPacket } from "../packet" ;
2222import { DeviceInfo } from "../../graphics/renderables/device_info" ;
23- import { TOOLTIP_KEYS } from "../../utils/constants/tooltips_constants" ;
2423import { TcpSegment } from "../../packets/tcp" ;
2524import {
2625 TcpListener ,
@@ -84,13 +83,6 @@ export class ViewHost extends ViewNetworkDevice {
8483 const programList = getProgramList ( this . viewgraph , this . id ) ;
8584
8685 const info = new DeviceInfo ( this ) ;
87- this . interfaces . forEach ( ( iface ) =>
88- info . addField (
89- TOOLTIP_KEYS . IP_ADDRESS ,
90- iface . ip . toString ( ) ,
91- TOOLTIP_KEYS . IP_ADDRESS ,
92- ) ,
93- ) ;
9486
9587 info . addProgramRunner ( this , programList ) ;
9688
Original file line number Diff line number Diff line change @@ -59,13 +59,6 @@ export class ViewRouter extends ViewNetworkDevice {
5959
6060 showInfo ( ) : void {
6161 const info = new DeviceInfo ( this ) ;
62- this . interfaces . forEach ( ( iface ) =>
63- info . addField (
64- TOOLTIP_KEYS . IP_ADDRESS ,
65- iface . ip ?. octets . join ( "." ) ,
66- TOOLTIP_KEYS . IP_ADDRESS ,
67- ) ,
68- ) ;
6962
7063 info . addProgressBar (
7164 TOOLTIP_KEYS . PACKET_QUEUE_USAGE ,
You can’t perform that action at this time.
0 commit comments