Skip to content

core: extend page title module functionalities #5121

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

Merged
merged 6 commits into from
Jul 12, 2021

Conversation

yatbear
Copy link
Member

@yatbear yatbear commented Jul 10, 2021

Extend PageTitleModule to be used by TensorBoard.corp and TensorBoard.dev surfaces.

  • Uses TensorBoard as default page/tab title;

  • If specified (and non-empty), flag window_title will overwrite page title in all cases;

  • If specified (and non-empty), uses the given Tensorboard brand name as page title, e.g. TensorBoard.corp;

  • Uses non-empty experiment name to name the single experiment ${experimentName} - ${tensorboardBrandName}, example:

Screen Shot 2021-07-12 at 2 05 23 PM

For Googlers, please refer to issue b/189246978.

  Extend PageTitleModule to be used by TensorBoard.corp and
  TensorBoard.dev surfaces with the following additional support:
    - Allows service specific suffix in page title, e.g. `TensorBoard.corp`.
    - Uses non-empty experiment name to name the single experiment
    dashboard page.
@google-cla google-cla bot added the cla: yes label Jul 10, 2021
@yatbear yatbear requested a review from psybuzz July 10, 2021 04:55
return experimentName;
} else {
return this.tbServiceName
? `TensorBoard.${this.tbServiceName}`
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of making the service name only the part after "TensorBoard.", could we make it the entire string? As a hypothetical example, something like "Vertex TensorBoard" might be desired one day, which does not begin with the "TensorBoard." prefix.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 - also, for consistency maybe nice to refer to this as the "brand" (like tbBrandName) since that's the term we've used for the header logo text, historically:

<span class="brand">TensorBoard</span>

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point!

return experimentName;
} else {
return this.tbServiceName
? `TensorBoard.${this.tbServiceName}`
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 - also, for consistency maybe nice to refer to this as the "brand" (like tbBrandName) since that's the term we've used for the header logo text, historically:

<span class="brand">TensorBoard</span>

Copy link
Contributor

@psybuzz psybuzz left a comment

Choose a reason for hiding this comment

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

Nice work

map(([env, experimentName]) => {
const tbBrandName = this.customBrandName
? this.customBrandName
: 'TensorBoard';
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're using this hardcoded string again on L93, could we extract it into something like const DEFAULT_BRAND_NAME = 'TensorBoard' near the top of the file?

optional: this.customBrandName || DEFAULT_BRAND_NAME also works and is shorter, if you prefer

constructor(private readonly store: Store<State>) {}
constructor(
private readonly store: Store<State>,
@Optional() @Inject(TB_BRAND_NAME) readonly customBrandName: string
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: is it possible to make private readonly?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

);
});

it('uses `Tensorboard` as default tab title', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, could we also add a test case covering the comparison route, specifically? Right now it just shows the brand name, but might be worth considering something fancier later.

Copy link
Member Author

Choose a reason for hiding this comment

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

SG, added a test case :)

  also rename the `tab title` to `page title` for consistency
@yatbear yatbear merged commit e7b2551 into tensorflow:master Jul 12, 2021
@yatbear yatbear deleted the page_title branch July 12, 2021 23:56
@yatbear yatbear restored the page_title branch July 13, 2021 00:03
@yatbear yatbear deleted the page_title branch July 13, 2021 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants