Skip to content

Conversation

@wchargin
Copy link
Contributor

@wchargin wchargin commented Jan 14, 2021

Backport of #4423 to 2.4. Cf. #4547.


Problem:
TensorBoard has a flag, path_prefix, which serves frontend and the data
endpoints at your specified, if the flag is passed, pathname. While
exact use case slips my mind, it is certainly used by dependents. Now,
the problem is that new Angular based TensorBoard has a custom router
for in-app navigation (we may add new routes for experiment list and
others) it is unaware of the path prefix.

Router works by matching set of predefined routes to current pathname
and finds a match. However, the configuration is unaware (rightfully) of
the path prefix and it results in zero match, which in turn cause
navigation to the default path, "/". This totally breaks the assumption
of the path prefix as all the request from the frontend will be sent to
"/data/..." as opposed to "[path_prefix]/data/..."

Remediation:
Previously, there was no reason to propagate the prefix information to
the frontend. Application only did hash changes and never required a
navigation. With this change, we now:

  • server side render meta tag that depicts the relative path to the root of the
    application
  • bootstrap Angular app from the relative root path and uses that information
    for matching routes and navigation

Tests:

  • manually tested with/without path_prefix
  • tested dynamic plugin with/without path_prefix (projector)

Co-authored-by: Stephan Lee stephanwlee@gmail.com

wchargin and others added 3 commits January 13, 2021 17:41
Summary:
Generated with `git restore -s origin/master .travis.yml .github/ ci/`,
plus the following manual changes:

  - removed the `build-data-server-pip` CI job, since 2.4 doesn’t have
    any Rust packages to build;
  - reinstated `flake8` for Python 3.5;
  - removed CI check for absence of `"@npm_angular_bazel//:index.bzl"`;
  - downgraded CI Bazel to 2.1.0 to match WORKSPACE file;
  - cherry-picked `test_pip_package.sh` changes for `--tf-version notf`.

Test Plan:
CI test run passed:
<https://github.com/tensorflow/tensorboard/runs/1699068256>

wchargin-branch: ci-backport-2.4
wchargin-source: a6833768fb4e5c516f426d5c32b4044063fcfefc
Problem:
TensorBoard has a flag, path_prefix, which serves frontend and the data
endpoints at your specified, if the flag is passed, pathname. While
exact use case slips my mind, it is certainly used by dependents. Now,
the problem is that new Angular based TensorBoard has a custom router
for in-app navigation (we may add new routes for experiment list and
others) it is unaware of the path prefix.

Router works by matching set of predefined routes to current pathname
and finds a match. However, the configuration is unaware (rightfully) of
the path prefix and it results in zero match, which in turn cause
navigation to the default path, "/". This totally breaks the assumption
of the path prefix as all the request from the frontend will be sent to
"/data/..." as opposed to "[path_prefix]/data/..."

Remediation:
Previously, there was no reason to propagate the prefix information to
the frontend. Application only did hash changes and never required a
navigation. With this change, we now:

- server side render `<meta>` tag that depicts the relative path to the root of
  the application.
- bootstrap Angular app from the relative root path and uses that information
  for matching routes and navigation
@google-cla google-cla bot added the cla: yes label Jan 14, 2021
Base automatically changed from wchargin-ci-backport-2.4 to 2.4 January 14, 2021 02:05
@wchargin wchargin requested a review from stephanwlee January 14, 2021 02:07
Copy link
Contributor

@stephanwlee stephanwlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You write beautiful code :P

image

@wchargin
Copy link
Contributor Author

And so fast, too!

@wchargin wchargin merged commit e27f3ae into 2.4 Jan 14, 2021
@wchargin wchargin deleted the wchargin-2.4-path-prefix branch January 14, 2021 02:31
@wchargin wchargin mentioned this pull request Jan 14, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants