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

Update web viewer links #5738

Merged
merged 6 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ To get an auto-generated PR description you can put "copilot:summary" or "copilo
* [ ] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [ ] I've included a screenshot or gif (if applicable)
* [ ] I have tested the web demo (if applicable):
* Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/{{pr.number}}/index.html)
* Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/{{pr.number}}/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/{{pr.number}}/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* Using newly built examples: [rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}/index.html)
* Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [ ] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
* [ ] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on_push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ jobs:
Please report any issues you find.

## Example Hosted App
https://app.rerun.io/commit/${{ env.SHORT_SHA }}
https://rerun.io/viewer/commit/${{ env.SHORT_SHA }}

## Wheels can be installed with:
```
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,11 @@ jobs:
short_commit_hash=$(echo ${{ needs.version.outputs.release-commit }} | cut -c1-7)

if [ ${{ inputs.release-type }} = "final" ]; then
web_app_link="https://app.rerun.io/version/${{ needs.version.outputs.final }}"
web_app_link="https://rerun.io/viewer/version/${{ needs.version.outputs.final }}"
rerun_io_docs_link="https://rerun.io/docs"
py_docs_link="https://ref.rerun.io/docs/python/${{ needs.version.outputs.final }}"
else
web_app_link="https://app.rerun.io/commit/$short_commit_hash"
web_app_link="https://rerun.io/viewer/commit/$short_commit_hash"
rerun_io_docs_link="https://rerun.io/preview/$short_commit_hash/docs"
py_docs_link="https://ref.rerun.io/docs/python/dev"
fi
Expand Down
38 changes: 24 additions & 14 deletions crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,26 +728,36 @@ impl App {

#[cfg(target_arch = "wasm32")]
fn run_copy_direct_link_command(&mut self, store_context: Option<&StoreContext<'_>>) {
let location = eframe::web::web_location();
let mut href = location.origin;
if location.host == "app.rerun.io" {
// links to `app.rerun.io` can be made into permanent links:
let path = if self.build_info.is_final() {
// final release, use version tag
format!("version/{}", self.build_info.version)
} else {
// not a final release, use commit hash
format!("commit/{}", self.build_info.short_git_hash())
};
href = format!("{href}/{path}");
}
let location = web_sys::window().unwrap().location();
let origin = location.origin().unwrap();
let host = location.host().unwrap();
let pathname = location.pathname().unwrap();

let hosted_viewer_path = if self.build_info.is_final() {
// final release, use version tag
format!("version/{}", self.build_info.version)
} else {
// not a final release, use commit hash
format!("commit/{}", self.build_info.short_git_hash())
};

// links to `app.rerun.io` can be made into permanent links:
let href = if host == "app.rerun.io" {
format!("https://app.rerun.io/{hosted_viewer_path}")
} else if host == "rerun.io" && pathname.starts_with("/viewer") {
format!("https://rerun.io/viewer/{hosted_viewer_path}")
} else {
format!("{origin}{pathname}")
};

let direct_link = match store_context
.map(|ctx| ctx.recording)
.and_then(|rec| rec.data_source.as_ref())
{
Some(SmartChannelSource::RrdHttpStream { url }) => format!("{href}/?url={url}"),
Some(SmartChannelSource::RrdHttpStream { url }) => format!("{href}?url={url}"),
_ => href,
};

self.re_ui
.egui_ctx
.output_mut(|o| o.copied_text = direct_link.clone());
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ snippet: my-example
### Screenshot links

If a screenshot shows an example or snippet which is runnable and built on CI, then you can turn the screenshot
to a link to `app.rerun.io` pointing at the example using the `data-inline-viewer` attribute.
to a link to `rerun.io/viewer` pointing at the example using the `data-inline-viewer` attribute.

Add the attribute to any `<picture>` element like so:

Expand Down
2 changes: 1 addition & 1 deletion docs/content/getting-started/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The configuration we use for wgpu can be influenced in the following ways:
On the web we prefer WebGPU and fall back automatically to WebGL if no support for WebGPU was detected.
- For instance, you can try `rerun --renderer=gl` or for the web viewer respectively `rerun --web-viewer --renderer=webgl`.
- Alternatively, for the native viewer you can also use the `WGPU_BACKEND` environment variable with the above values.
- The web viewer is configured by the `renderer=<backend>` url argument, e.g. [https://app.rerun.io/?renderer=webgl]
- The web viewer is configured by the `renderer=<backend>` url argument, e.g. [https://rerun.io/viewer?renderer=webgl&speculative-link]
- `WGPU_POWER_PREF`: Overwrites the power setting used for choosing a graphics adapter, must be `high` or `low`. (Default is `high`)

We recommend setting these only if you're asked to try them or know what you're doing,
Expand Down
2 changes: 1 addition & 1 deletion docs/content/getting-started/what-is-rerun.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ order: 0
---
To get a feeling of what you can do with Rerun
- browse the [example gallery](/examples) or
- try Rerun directly [in your browser](https://app.rerun.io/).
- try Rerun directly [in your browser](/viewer?speculative-link).

## What is Rerun?

Expand Down
2 changes: 1 addition & 1 deletion examples/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Each example downloads it's own data, so no additional steps are needed.
For the simplest possible examples showing how to use each api,
check out [Types](/docs/reference/types).

You can try these examples live at <https://app.rerun.io/>.
You can try these examples live at [rerun.io/viewer](/viewer).
"""
examples = [
"arkit_scenes",
Expand Down
22 changes: 11 additions & 11 deletions examples/python/notebook/cube.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"\n",
"import numpy as np\n",
"import rerun as rr # pip install rerun-sdk\n",
"import rerun.blueprint as rrb"
"import rerun.blueprint as rrb\n"
]
},
{
Expand All @@ -31,7 +31,7 @@
"source": [
"## Optional: start a local web-viewer server\n",
"\n",
"By default, Rerun will use a copy of the viewer hosted at [https://app.rerun.io](https://app.rerun.io).\n",
"By default, Rerun will use a copy of the viewer hosted at [https://rerun.io/viewer](https://rerun.io/viewer).\n",
"This is generally preferable as it will work more seamlessly even if you\n",
"are connected to a notebook instance on a remote machine. However there\n",
"are some cases where this won't work such as running from source, or\n",
Expand All @@ -48,7 +48,7 @@
"metadata": {},
"outputs": [],
"source": [
"# rr.start_web_viewer_server()"
"# rr.start_web_viewer_server()\n"
]
},
{
Expand Down Expand Up @@ -117,7 +117,7 @@
" ]\n",
" )\n",
"\n",
" return ColorGrid(positions.T, colors.T.astype(np.uint8))"
" return ColorGrid(positions.T, colors.T.astype(np.uint8))\n"
]
},
{
Expand All @@ -144,7 +144,7 @@
"for t in range(STEPS):\n",
" rr.set_time_sequence(\"step\", t)\n",
" cube = build_color_grid(10, 10, 10, twist=twists[t])\n",
" rr.log(\"cube\", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))"
" rr.log(\"cube\", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))\n"
]
},
{
Expand All @@ -164,7 +164,7 @@
"metadata": {},
"outputs": [],
"source": [
"rr.notebook_show()"
"rr.notebook_show()\n"
]
},
{
Expand All @@ -186,7 +186,7 @@
},
"outputs": [],
"source": [
"rr.notebook_show(width=400, height=400)"
"rr.notebook_show(width=400, height=400)\n"
]
},
{
Expand Down Expand Up @@ -217,7 +217,7 @@
" v_grid = build_color_grid(3, 3, 10, twist=twists[t])\n",
" rr.log(\"v_grid\", rr.Points3D(v_grid.positions, colors=v_grid.colors, radii=0.5))\n",
"\n",
"rr.notebook_show()"
"rr.notebook_show()\n"
]
},
{
Expand Down Expand Up @@ -247,7 +247,7 @@
" collapse_panels=True\n",
")\n",
"\n",
"rr.notebook_show(blueprint=blueprint)"
"rr.notebook_show(blueprint=blueprint)\n"
]
},
{
Expand All @@ -269,7 +269,7 @@
"metadata": {},
"outputs": [],
"source": [
"rrb.Spatial3DView(name=\"Horizontal grid\", origin=\"h_grid\")"
"rrb.Spatial3DView(name=\"Horizontal grid\", origin=\"h_grid\")\n"
]
},
{
Expand Down Expand Up @@ -298,7 +298,7 @@
"\n",
"bp = rrb.Blueprint(collapse_panels=True)\n",
"\n",
"rec.notebook_show(blueprint=bp)"
"rec.notebook_show(blueprint=bp)\n"
jprochazk marked this conversation as resolved.
Show resolved Hide resolved
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions rerun_py/src/python_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ fn version() -> String {

/// Get a url to an instance of the web-viewer
///
/// This may point to app.rerun.io or localhost depending on
/// This may point to rerun.io/viewer or localhost depending on
/// whether [`start_web_viewer_server()`] was called.
#[pyfunction]
fn get_app_url() -> String {
Expand All @@ -1068,12 +1068,12 @@ fn get_app_url() -> String {

let build_info = re_build_info::build_info!();
if let Some(short_git_hash) = build_info.git_hash.get(..7) {
format!("https://app.rerun.io/commit/{short_git_hash}")
format!("https://rerun.io/viewer/commit/{short_git_hash}")
} else {
re_log::warn_once!(
"No valid git hash found in build info. Defaulting to app.rerun.io for app url."
"No valid git hash found in build info. Defaulting to rerun.io/viewer for app url."
);
"https://app.rerun.io".to_owned()
"https://rerun.io/viewer".to_owned()
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/generate_pr_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def generate_pr_summary(github_token: str, github_repository: str, pr_number: in
app_blob = viewer_bucket.blob(f"commit/{commit_short}/index.html")
if app_blob.exists():
print(f"Found web assets commit: {commit_short}")
found["hosted_app"] = f"https://app.rerun.io/commit/{commit_short}"
found["hosted_app"] = f"https://rerun.io/viewer/commit/{commit_short}"

# Check if there are rerun_c libraries
rerun_libraries_blobs = [
Expand Down
2 changes: 1 addition & 1 deletion scripts/screenshot_compare/build_screenshot_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

- The screenshots listed in .fbs files (crates/re_types/definitions/rerun/**/*.fbs),
and the corresponding snippets in the docs (docs/snippets/*.rs)
- The `app.rerun.io` examples, as built by the `re_build_examples` script.
- The `rerun.io/viewer` examples, as built by the `re_build_examples` script.

The comparisons are generated in the `compare_screenshot` directory. Use the `--serve`
option to show them in a browser.
Expand Down
Loading