-
Notifications
You must be signed in to change notification settings - Fork 376
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
Add command to copy direct link to fully qualified URL #4165
Changes from 3 commits
48156d9
56670bb
6a92815
64045c7
b96487c
9be675c
6279ad6
511ef39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -524,6 +524,10 @@ impl App { | |||
} | ||||
} | ||||
} | ||||
#[cfg(target_arch = "wasm32")] | ||||
UICommand::CopyDirectLink => { | ||||
self.run_copy_direct_link_command(store_context); | ||||
} | ||||
} | ||||
} | ||||
|
||||
|
@@ -562,6 +566,33 @@ impl App { | |||
} | ||||
} | ||||
|
||||
#[cfg(target_arch = "wasm32")] | ||||
fn run_copy_direct_link_command(&mut self, store_context: Option<&StoreContext<'_>>) { | ||||
let Some(SmartChannelSource::RrdHttpStream { url }) = store_context | ||||
.and_then(|ctx| ctx.recording) | ||||
.and_then(|rec| rec.data_source.as_ref()) | ||||
else { | ||||
self.toasts.add(toasts::Toast { | ||||
kind: toasts::ToastKind::Warning, | ||||
text: format!("Could not copy direct link, no recording is open"), | ||||
options: toasts::ToastOptions::with_ttl_in_seconds(4.0), | ||||
}); | ||||
return; | ||||
}; | ||||
let direct_link = match &self.startup_options.location { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it's an rerun/crates/re_viewer/src/app.rs Line 70 in 2969b83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like that |
||||
Some(eframe::Location { origin, .. }) => format!("{origin}/?url={url}"), | ||||
None => format!("https://app.rerun.io/?url={url}"), | ||||
}; | ||||
self.re_ui | ||||
.egui_ctx | ||||
.output_mut(|o| o.copied_text = direct_link.clone()); | ||||
self.toasts.add(toasts::Toast { | ||||
kind: toasts::ToastKind::Success, | ||||
text: format!("Copied {direct_link:?} to clipboard"), | ||||
options: toasts::ToastOptions::with_ttl_in_seconds(4.0), | ||||
}); | ||||
} | ||||
|
||||
fn memory_panel_ui( | ||||
&mut self, | ||||
ui: &mut egui::Ui, | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this really be an error? I would expect to just get a copy to the viewer in this case (
https://app.rerun.io
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, anything logged with
re_log::warn!
will also show up as a warning toastThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, changed it to default to
location.origin
by itself