Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable selecting data sources and blueprints and recordings in them #5646

Merged
merged 21 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions crates/re_build_search_index/src/ingest/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ impl Docstrings {
}

// if `path` is an alias, get the qualified path
let Some(path) = self.aliases.get(path) else {
return None;
};
let path = self.aliases.get(path)?;

self.docstrings.get(path)
}
Expand Down
7 changes: 7 additions & 0 deletions crates/re_data_store/src/store_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ impl SizeBytes for ClusterCellCache {
}
}

impl SizeBytes for DataStore {
#[inline]
fn heap_size_bytes(&self) -> u64 {
self.timeless_size_bytes() + self.temporal_size_bytes() // approximate
}
}

impl DataStore {
/// Returns the number of timeless index rows stored across this entire store, i.e. the sum of
/// the number of rows across all of its timeless indexed tables.
Expand Down
2 changes: 2 additions & 0 deletions crates/re_data_ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ re_log.workspace = true
re_log_types.workspace = true
re_query.workspace = true
re_renderer.workspace = true
re_smart_channel.workspace = true
re_tracing.workspace = true
re_types = { workspace = true, features = [
"egui_plot", # Needed to draw marker shapes.
] }
re_types_core.workspace = true
re_ui.workspace = true
re_viewer_context.workspace = true

Expand Down
63 changes: 63 additions & 0 deletions crates/re_data_ui/src/data_source.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
use re_log_types::StoreKind;
use re_viewer_context::{UiVerbosity, ViewerContext};

use crate::item_ui::entity_db_button_ui;

impl crate::DataUi for re_smart_channel::SmartChannelSource {
fn data_ui(
&self,
ctx: &ViewerContext<'_>,
ui: &mut egui::Ui,
verbosity: UiVerbosity,
_query: &re_data_store::LatestAtQuery,
_store: &re_data_store::DataStore,
) {
ui.label(self.to_string());

if verbosity == UiVerbosity::Small {
return;
}

// TODO(emilk): show if we're still connected to this data source

// Find all stores from this data source
// (e.g. find the recordings and blueprint in this .rrd file).
let mut recordings = vec![];
let mut blueprints = vec![];

for other in ctx
.store_context
.bundle
.entity_dbs_from_channel_source(self)
{
match other.store_kind() {
StoreKind::Recording => {
recordings.push(other);
}
StoreKind::Blueprint => {
blueprints.push(other);
}
}
}

{
ui.add_space(8.0);
ui.strong("Recordings in this data source");
ui.indent("recordings", |ui| {
for entity_db in recordings {
entity_db_button_ui(ctx, ui, entity_db, true);
}
});
}

{
ui.add_space(8.0);
ui.strong("Blueprints in this data source");
ui.indent("blueprints", |ui| {
for entity_db in blueprints {
entity_db_button_ui(ctx, ui, entity_db, true);
}
});
}
}
}
114 changes: 100 additions & 14 deletions crates/re_data_ui/src/entity_db.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
impl crate::DataUi for re_entity_db::EntityDb {
use re_entity_db::EntityDb;
use re_log_types::StoreKind;
use re_types::SizeBytes;
use re_viewer_context::ViewerContext;

use crate::item_ui::{data_source_button_ui, entity_db_button_ui};

impl crate::DataUi for EntityDb {
fn data_ui(
&self,
ctx: &re_viewer_context::ViewerContext<'_>,
ctx: &ViewerContext<'_>,
ui: &mut egui::Ui,
verbosity: re_viewer_context::UiVerbosity,
_query: &re_data_store::LatestAtQuery,
Expand All @@ -22,13 +29,9 @@ impl crate::DataUi for re_entity_db::EntityDb {
}

egui::Grid::new("entity_db").num_columns(2).show(ui, |ui| {
re_ui.grid_left_hand_label(ui, &format!("{} ID", self.store_id().kind));
ui.label(self.store_id().to_string());
ui.end_row();

if let Some(data_source) = &self.data_source {
re_ui.grid_left_hand_label(ui, "Data source");
ui.label(data_source.to_string());
{
re_ui.grid_left_hand_label(ui, &format!("{} ID", self.store_id().kind));
ui.label(self.store_id().to_string());
ui.end_row();
}

Expand All @@ -54,12 +57,95 @@ impl crate::DataUi for re_entity_db::EntityDb {
ui.label(store_source.to_string());
ui.end_row();

// We are in the recordings menu, we know the kind
if false {
re_ui.grid_left_hand_label(ui, "Kind");
ui.label(store_kind.to_string());
ui.end_row();
re_ui.grid_left_hand_label(ui, "Kind");
ui.label(store_kind.to_string());
ui.end_row();
}

{
re_ui.grid_left_hand_label(ui, "Size");
ui.label(re_format::format_bytes(self.total_size_bytes() as _))
.on_hover_text(
"Approximate size in RAM (decompressed).\n\
If you hover an entity in the streams view (bottom panel) you can see the size of individual entities.");
ui.end_row();
}

if let Some(data_source) = &self.data_source {
re_ui.grid_left_hand_label(ui, "Data source");
data_source_button_ui(ctx, ui, data_source);
ui.end_row();
}
});

if ctx.store_context.is_active(self.store_id()) {
ui.add_space(8.0);
match self.store_kind() {
StoreKind::Recording => {
ui.label("This is the active recording");
}
StoreKind::Blueprint => {
ui.label("This is the active blueprint");
}
}
}

sibling_stores_ui(ctx, ui, self);
}
emilk marked this conversation as resolved.
Show resolved Hide resolved
}

/// Show the other stores in the same data source.
fn sibling_stores_ui(ctx: &ViewerContext<'_>, ui: &mut egui::Ui, entity_db: &EntityDb) {
let Some(data_source) = &entity_db.data_source else {
return;
};

// Find other stores from the same data source
// (e.g. find the blueprint in this .rrd file, if any).
let mut other_recordings = vec![];
let mut other_blueprints = vec![];

for other in ctx
.store_context
.bundle
.entity_dbs_from_channel_source(data_source)
{
if other.store_id() == entity_db.store_id() {
continue;
}
match other.store_kind() {
StoreKind::Recording => {
other_recordings.push(other);
}
StoreKind::Blueprint => {
other_blueprints.push(other);
}
}
}

if !other_recordings.is_empty() {
ui.add_space(8.0);
if entity_db.store_kind() == StoreKind::Recording {
ui.strong("Other recordings in this data source");
} else {
ui.strong("Recordings in this data source");
}
ui.indent("recordings", |ui| {
for entity_db in other_recordings {
entity_db_button_ui(ctx, ui, entity_db, true);
}
});
}
if !other_blueprints.is_empty() {
ui.add_space(8.0);
if entity_db.store_kind() == StoreKind::Blueprint {
ui.strong("Other blueprints in this data source");
} else {
ui.strong("Blueprints in this data source");
}
ui.indent("blueprints", |ui| {
for entity_db in other_blueprints {
entity_db_button_ui(ctx, ui, entity_db, true);
}
});
}
Expand Down
Loading
Loading