@@ -298,11 +298,9 @@ impl Discovery {
298298
299299 if let Some ( oui) = & self . oui {
300300 let oui_res = oui. lookup_by_mac ( & n. mac ) ;
301- if let Ok ( oui_res) = oui_res {
302- if let Some ( oui_res) = oui_res {
303- let cn = oui_res. company_name . clone ( ) ;
304- n. vendor = cn;
305- }
301+ if let Ok ( Some ( oui_res) ) = oui_res {
302+ let cn = oui_res. company_name . clone ( ) ;
303+ n. vendor = cn;
306304 }
307305 }
308306 }
@@ -395,11 +393,12 @@ impl Discovery {
395393 self . scrollbar_state = self . scrollbar_state . position ( index) ;
396394 }
397395
398- fn make_table < ' a > (
399- scanned_ips : & ' a Vec < ScannedIp > ,
396+ fn make_table (
397+ scanned_ips : & Vec < ScannedIp > ,
400398 cidr : Option < Ipv4Cidr > ,
401399 ip_num : i32 ,
402- ) -> Table < ' a > {
400+ is_scanning : bool ,
401+ ) -> Table {
403402 let header = Row :: new ( vec ! [ "ip" , "mac" , "hostname" , "vendor" ] )
404403 . style ( Style :: default ( ) . fg ( Color :: Yellow ) )
405404 . top_margin ( 1 )
@@ -423,6 +422,22 @@ impl Discovery {
423422 ] ) ) ;
424423 }
425424
425+ let mut scan_title = vec ! [
426+ Span :: styled( "|" , Style :: default ( ) . fg( Color :: Yellow ) ) ,
427+ "◉ " . green( ) ,
428+ Span :: styled(
429+ format!( "{}" , scanned_ips. len( ) ) ,
430+ Style :: default ( ) . fg( Color :: Red ) ,
431+ ) ,
432+ Span :: styled( "|" , Style :: default ( ) . fg( Color :: Yellow ) ) ,
433+ ] ;
434+ if is_scanning {
435+ scan_title. push ( " ⣿(" . yellow ( ) ) ;
436+ scan_title. push ( format ! ( "{}" , ip_num) . red ( ) ) ;
437+ scan_title. push ( format ! ( "/{}" , cidr_length) . green ( ) ) ;
438+ scan_title. push ( ")" . yellow ( ) ) ;
439+ }
440+
426441 let table = Table :: new (
427442 rows,
428443 [
@@ -454,17 +469,9 @@ impl Discovery {
454469 . position ( ratatui:: widgets:: block:: Position :: Bottom ) ,
455470 )
456471 . title (
457- ratatui:: widgets:: block:: Title :: from ( Line :: from ( vec ! [
458- Span :: styled( "|" , Style :: default ( ) . fg( Color :: Yellow ) ) ,
459- Span :: styled( format!( "{}" , ip_num) , Style :: default ( ) . fg( Color :: Green ) ) ,
460- Span :: styled(
461- format!( "/{}" , cidr_length) ,
462- Style :: default ( ) . fg( Color :: Green ) ,
463- ) ,
464- Span :: styled( " ip|" , Style :: default ( ) . fg( Color :: Yellow ) ) ,
465- ] ) )
466- . position ( ratatui:: widgets:: block:: Position :: Top )
467- . alignment ( Alignment :: Left ) ,
472+ ratatui:: widgets:: block:: Title :: from ( Line :: from ( scan_title) )
473+ . position ( ratatui:: widgets:: block:: Position :: Top )
474+ . alignment ( Alignment :: Left ) ,
468475 )
469476 . title (
470477 ratatui:: widgets:: block:: Title :: from ( Line :: from ( vec ! [
@@ -716,7 +723,8 @@ impl Component for Discovery {
716723 table_rect. y += 1 ;
717724 table_rect. height -= 1 ;
718725
719- let table = Self :: make_table ( & self . scanned_ips , self . cidr , self . ip_num ) ;
726+ let table =
727+ Self :: make_table ( & self . scanned_ips , self . cidr , self . ip_num , self . is_scanning ) ;
720728 f. render_stateful_widget ( table, table_rect, & mut self . table_state ) ;
721729
722730 // -- SCROLLBAR
0 commit comments