Skip to content

Commit

Permalink
Add a new Uri variant to FileSource
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Nov 22, 2024
1 parent 5d97c41 commit 56279c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions crates/store/re_log_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ impl std::fmt::Display for PythonVersion {
pub enum FileSource {
Cli,

/// The user clicked on a recording URI in the viewer.
Uri,

DragAndDrop {
/// The [`ApplicationId`] that the viewer heuristically recommends should be used when loading
/// this data source, based on the surrounding context.
Expand Down Expand Up @@ -463,7 +466,7 @@ impl FileSource {
recommended_application_id,
..
} => recommended_application_id.as_ref(),
Self::Cli | Self::Sdk => None,
Self::Cli | Self::Uri | Self::Sdk => None,
}
}

Expand All @@ -478,7 +481,7 @@ impl FileSource {
recommended_recording_id,
..
} => recommended_recording_id.as_ref(),
Self::Cli | Self::Sdk => None,
Self::Cli | Self::Uri | Self::Sdk => None,
}
}

Expand All @@ -491,7 +494,7 @@ impl FileSource {
| Self::DragAndDrop {
force_store_info, ..
} => *force_store_info,
Self::Cli | Self::Sdk => false,
Self::Cli | Self::Uri | Self::Sdk => false,
}
}
}
Expand Down Expand Up @@ -538,6 +541,7 @@ impl std::fmt::Display for StoreSource {
Self::RustSdk { rustc_version, .. } => write!(f, "Rust SDK (rustc {rustc_version})"),
Self::File { file_source, .. } => match file_source {
FileSource::Cli => write!(f, "File via CLI"),
FileSource::Uri => write!(f, "File via URI"),
FileSource::DragAndDrop { .. } => write!(f, "File via drag-and-drop"),
FileSource::FileDialog { .. } => write!(f, "File via file dialog"),
FileSource::Sdk => write!(f, "File via SDK"),
Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_component_ui/src/recording_uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn singleline_view_recording_uri(

if response.clicked() {
let data_source = re_data_source::DataSource::from_uri(
re_log_types::FileSource::Cli,
re_log_types::FileSource::Uri,
value.uri().to_owned(),
);

Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_viewer/src/viewer_analytics/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub fn open_recording(
S::RustSdk { .. } => "rust_sdk".to_owned(),
S::File { file_source } => match file_source {
re_log_types::FileSource::Cli => "file_cli".to_owned(),
re_log_types::FileSource::Uri => "file_uri".to_owned(),
re_log_types::FileSource::DragAndDrop { .. } => "file_drag_and_drop".to_owned(),
re_log_types::FileSource::FileDialog { .. } => "file_dialog".to_owned(),
re_log_types::FileSource::Sdk => "file_sdk".to_owned(),
Expand Down

0 comments on commit 56279c4

Please sign in to comment.