@@ -393,48 +393,57 @@ impl egui_table::TableDelegate for DataFusionTableDelegate<'_> {
393
393
} ) ;
394
394
395
395
header_ui ( ui, |ui| {
396
- egui:: Sides :: new ( ) . show (
397
- ui,
398
- |ui| {
399
- ui. label ( egui:: RichText :: new ( name) . strong ( ) . monospace ( ) ) ;
400
-
401
- if let Some ( dir_icon) = current_sort_direction. map ( SortDirection :: icon) {
402
- ui. add_space ( -5.0 ) ;
403
- ui. small_icon (
404
- dir_icon,
405
- Some (
406
- ui. design_tokens ( )
407
- . color ( re_ui:: ColorToken :: blue ( re_ui:: Scale :: S450 ) ) ,
408
- ) ,
409
- ) ;
410
- }
411
- } ,
412
- |ui| {
413
- egui:: containers:: menu:: MenuButton :: from_button (
414
- ui. small_icon_button_widget ( & re_ui:: icons:: MORE ) ,
415
- )
416
- . ui ( ui, |ui| {
417
- for sort_direction in SortDirection :: iter ( ) {
418
- let already_sorted =
419
- Some ( & sort_direction) == current_sort_direction;
420
-
421
- if ui
422
- . add_enabled_ui ( !already_sorted, |ui| {
423
- sort_direction. menu_button ( ui)
424
- } )
425
- . inner
426
- . clicked ( )
427
- {
428
- self . new_blueprint . sort_by = Some ( SortBy {
429
- column : column_name. to_owned ( ) ,
430
- direction : sort_direction,
431
- } ) ;
432
- ui. close ( ) ;
433
- }
396
+ egui:: Sides :: new ( )
397
+ . show (
398
+ ui,
399
+ |ui| {
400
+ let response = ui. label ( egui:: RichText :: new ( name) . strong ( ) . monospace ( ) ) ;
401
+
402
+ if let Some ( dir_icon) = current_sort_direction. map ( SortDirection :: icon)
403
+ {
404
+ ui. add_space ( -5.0 ) ;
405
+ ui. small_icon (
406
+ dir_icon,
407
+ Some (
408
+ ui. design_tokens ( )
409
+ . color ( re_ui:: ColorToken :: blue ( re_ui:: Scale :: S450 ) ) ,
410
+ ) ,
411
+ ) ;
434
412
}
435
- } ) ;
436
- } ,
437
- ) ;
413
+
414
+ response
415
+ } ,
416
+ |ui| {
417
+ egui:: containers:: menu:: MenuButton :: from_button (
418
+ ui. small_icon_button_widget ( & re_ui:: icons:: MORE ) ,
419
+ )
420
+ . ui ( ui, |ui| {
421
+ for sort_direction in SortDirection :: iter ( ) {
422
+ let already_sorted =
423
+ Some ( & sort_direction) == current_sort_direction;
424
+
425
+ if ui
426
+ . add_enabled_ui ( !already_sorted, |ui| {
427
+ sort_direction. menu_button ( ui)
428
+ } )
429
+ . inner
430
+ . clicked ( )
431
+ {
432
+ self . new_blueprint . sort_by = Some ( SortBy {
433
+ column : column_name. to_owned ( ) ,
434
+ direction : sort_direction,
435
+ } ) ;
436
+ ui. close ( ) ;
437
+ }
438
+ }
439
+ } ) ;
440
+ } ,
441
+ )
442
+ . 0
443
+ } )
444
+ . inner
445
+ . on_hover_ui ( |ui| {
446
+ column_descriptor_ui ( ui, desc) ;
438
447
} ) ;
439
448
}
440
449
}
@@ -481,3 +490,94 @@ impl egui_table::TableDelegate for DataFusionTableDelegate<'_> {
481
490
re_ui:: DesignTokens :: table_line_height ( ) + CELL_MARGIN . sum ( ) . y
482
491
}
483
492
}
493
+
494
+ fn column_descriptor_ui ( ui : & mut egui:: Ui , column : & ColumnDescriptorRef < ' _ > ) {
495
+ match * column {
496
+ ColumnDescriptorRef :: RowId ( desc) => {
497
+ let re_sorbet:: RowIdColumnDescriptor { is_sorted } = desc;
498
+
499
+ header_property_ui ( ui, "Type" , "row id" ) ;
500
+ header_property_ui ( ui, "Sorted" , sorted_text ( * is_sorted) ) ;
501
+ }
502
+ ColumnDescriptorRef :: Time ( desc) => {
503
+ let re_sorbet:: IndexColumnDescriptor {
504
+ timeline,
505
+ datatype,
506
+ is_sorted,
507
+ } = desc;
508
+
509
+ header_property_ui ( ui, "Type" , "index" ) ;
510
+ header_property_ui ( ui, "Timeline" , timeline. name ( ) ) ;
511
+ header_property_ui ( ui, "Sorted" , sorted_text ( * is_sorted) ) ;
512
+ datatype_ui ( ui, & column. display_name ( ) , datatype) ;
513
+ }
514
+ ColumnDescriptorRef :: Component ( desc) => {
515
+ let re_sorbet:: ComponentColumnDescriptor {
516
+ store_datatype,
517
+ component_name,
518
+ entity_path,
519
+ archetype_name,
520
+ archetype_field_name,
521
+ is_static,
522
+ is_indicator,
523
+ is_tombstone,
524
+ is_semantically_empty,
525
+ } = desc;
526
+
527
+ header_property_ui ( ui, "Type" , "component" ) ;
528
+ header_property_ui ( ui, "Component" , component_name. full_name ( ) ) ;
529
+ header_property_ui ( ui, "Entity path" , entity_path. to_string ( ) ) ;
530
+ datatype_ui ( ui, & column. display_name ( ) , store_datatype) ;
531
+ header_property_ui (
532
+ ui,
533
+ "Archetype" ,
534
+ archetype_name. map ( |a| a. full_name ( ) ) . unwrap_or ( "-" ) ,
535
+ ) ;
536
+ //TODO(#9978): update this if we rename this descriptor field.
537
+ header_property_ui (
538
+ ui,
539
+ "Archetype field" ,
540
+ archetype_field_name. map ( |a| a. as_str ( ) ) . unwrap_or ( "-" ) ,
541
+ ) ;
542
+ header_property_ui ( ui, "Static" , is_static. to_string ( ) ) ;
543
+ header_property_ui ( ui, "Indicator" , is_indicator. to_string ( ) ) ;
544
+ header_property_ui ( ui, "Tombstone" , is_tombstone. to_string ( ) ) ;
545
+ header_property_ui ( ui, "Empty" , is_semantically_empty. to_string ( ) ) ;
546
+ }
547
+ }
548
+ }
549
+
550
+ fn sorted_text ( sorted : bool ) -> & ' static str {
551
+ if sorted { "true" } else { "unknown" }
552
+ }
553
+
554
+ fn header_property_ui ( ui : & mut egui:: Ui , label : & str , value : impl AsRef < str > ) {
555
+ egui:: Sides :: new ( ) . show ( ui, |ui| ui. strong ( label) , |ui| ui. monospace ( value. as_ref ( ) ) ) ;
556
+ }
557
+
558
+ fn datatype_ui ( ui : & mut egui:: Ui , column_name : & str , datatype : & arrow:: datatypes:: DataType ) {
559
+ egui:: Sides :: new ( ) . show (
560
+ ui,
561
+ |ui| ui. strong ( "Datatype" ) ,
562
+ |ui| {
563
+ // We don't want the copy button to stand out next to the other properties. The copy
564
+ // icon already indicates that it's a button.
565
+ ui. visuals_mut ( ) . widgets . inactive . fg_stroke =
566
+ ui. visuals_mut ( ) . widgets . noninteractive . fg_stroke ;
567
+
568
+ if ui
569
+ . add (
570
+ egui:: Button :: image_and_text (
571
+ re_ui:: icons:: COPY . as_image ( ) ,
572
+ egui:: RichText :: new ( re_arrow_util:: format_data_type ( datatype) ) . monospace ( ) ,
573
+ )
574
+ . image_tint_follows_text_color ( true ) ,
575
+ )
576
+ . clicked ( )
577
+ {
578
+ ui. ctx ( ) . copy_text ( format ! ( "{datatype:#?}" ) ) ;
579
+ re_log:: info!( "Copied full datatype of column `{column_name}` to clipboard" ) ;
580
+ }
581
+ } ,
582
+ ) ;
583
+ }
0 commit comments