Skip to content

Conversation

@JamesHollyer
Copy link
Contributor

  • Motivation for features / changes
    Adding a page which helps to see which flags are enabled, allow flag changes, and enable more persistent flag settings. This change adds the page and displays which flags are enabled. The check boxes are currently not functional.

  • Technical description of changes
    This PR adds the route in the angular app. The python web server still does not recognize this path so it is only accessible with in app routing. When the angular app is loaded the routing works. The page simply uses the getFeatureFlags selector to get which flags are enabled and loops through each to display their status.

  • Screenshots of UI changes
    Currently the page looks like this:

Screen Shot 2022-06-15 at 11 30 42 AM

It is subject to change.

  • Detailed steps to verify changes work correctly (as executed by you)
    I added a link which takes me to the page for testing. This link was not added into the PR.

  • Alternate designs / implementations considered

],
deps = [
"//tensorboard/webapp:app_state",
"//tensorboard/webapp/angular:expect_angular_material_checkbox",
Copy link
Contributor

Choose a reason for hiding this comment

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

The visibility rule suggests

New users should instead use the newer MDC-based version. See go/angular-mdc/usage

So we should probably use "material_mdc_checkbox" instead

Copy link
Contributor

Choose a reason for hiding this comment

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

We have to discuss the "should we use mdc?" question as a team. Up to now we've been trying to ignore MDC and internal requests to migrate to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I am not doing this now.

path: '/flags/',
ngComponent: FeatureFlagPageContainer as Type<Component>,
defaultRoute: false,
deepLinkProvider: new DashboardDeepLinkProvider(),
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious about what happens if we remove deepLinkProvider here. (I did that and it seems to work the same way as before).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This allows for parameters. For instance it would allow us to type in /flags/?enableLinkTime. However, since we don't have the routing going we can only navigate here from a button so this does not really make a difference. I would like to leave it in the hopes that one day we do get the routing working.

Copy link
Contributor

Choose a reason for hiding this comment

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

Even if you do find a need for deep links in feature flags, I don't think DashboardDeepLinkProvider will be the one you use (it's specifically for deep links for the dashboard view).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Removed.

Copy link
Contributor

@qihach64 qihach64 left a comment

Choose a reason for hiding this comment

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

Thanks for making the ff page. I also tested the FE routing on both OSS tb and tb.corp by using <a routerLink=['/flags']> on the home page and it works nicely!

However, I'm still having trouble making the FE routing work with initial page load of /flags. I was able to avoid the 404 error and hook up the Angular app to the Python web servers of OSS tb and tb.corp, but for some reason the FE routing didn't kick in after the page gets loaded.

deepLinkProvider: new DashboardDeepLinkProvider(),
},
{
routeKind: RouteKind.UNKNOWN,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a new RouteKind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yea, I meant to go back and do this. Done.

routeKind: RouteKind.UNKNOWN,
path: '/flags/',
ngComponent: FeatureFlagPageContainer as Type<Component>,
defaultRoute: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to specify defaultRoute? (Is false just the default value for defaultRoute if it is unspecified?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the default. Removed.

@@ -0,0 +1,33 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary")
Copy link
Contributor

Choose a reason for hiding this comment

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

The practice we have been doing is to put components in the "views" subfolder. in this case: tensorboard/webapp/feature_flag/views/BUILD

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

import {State} from '../../app_state';
import {getFeatureFlags} from '../store/feature_flag_selectors';
@Component({
selector: 'feature_flag_page',
Copy link
Contributor

Choose a reason for hiding this comment

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

feature_flag_page => feature-flag-page for element names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh! Didn't even notice since this selector is actually never used.

import {getFeatureFlags} from '../store/feature_flag_selectors';
@Component({
selector: 'feature_flag_page',
template: `<feature_flag_page_component
Copy link
Contributor

Choose a reason for hiding this comment

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

similarly, feature_flag_page_component => feature-flag-page-component for element names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@NgModule({
declarations: [FeatureFlagPageComponent, FeatureFlagPageContainer],
imports: [CommonModule, MatCheckboxModule],
exports: [FeatureFlagPageComponent],
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little confused why exports and entryComponents are not FeatureFlagPageContainer (since this is the top-level component here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. When I first built this for testing routing I only built the component. Changed.

],
deps = [
"//tensorboard/webapp:app_state",
"//tensorboard/webapp/angular:expect_angular_material_checkbox",
Copy link
Contributor

Choose a reason for hiding this comment

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

We have to discuss the "should we use mdc?" question as a team. Up to now we've been trying to ignore MDC and internal requests to migrate to them.

Copy link
Contributor Author

@JamesHollyer JamesHollyer left a comment

Choose a reason for hiding this comment

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

Thanks guys.

@@ -0,0 +1,33 @@
load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

],
deps = [
"//tensorboard/webapp:app_state",
"//tensorboard/webapp/angular:expect_angular_material_checkbox",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I am not doing this now.

import {State} from '../../app_state';
import {getFeatureFlags} from '../store/feature_flag_selectors';
@Component({
selector: 'feature_flag_page',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh! Didn't even notice since this selector is actually never used.

import {getFeatureFlags} from '../store/feature_flag_selectors';
@Component({
selector: 'feature_flag_page',
template: `<feature_flag_page_component
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@NgModule({
declarations: [FeatureFlagPageComponent, FeatureFlagPageContainer],
imports: [CommonModule, MatCheckboxModule],
exports: [FeatureFlagPageComponent],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. When I first built this for testing routing I only built the component. Changed.

deepLinkProvider: new DashboardDeepLinkProvider(),
},
{
routeKind: RouteKind.UNKNOWN,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yea, I meant to go back and do this. Done.

routeKind: RouteKind.UNKNOWN,
path: '/flags/',
ngComponent: FeatureFlagPageContainer as Type<Component>,
defaultRoute: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the default. Removed.

path: '/flags/',
ngComponent: FeatureFlagPageContainer as Type<Component>,
defaultRoute: false,
deepLinkProvider: new DashboardDeepLinkProvider(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This allows for parameters. For instance it would allow us to type in /flags/?enableLinkTime. However, since we don't have the routing going we can only navigate here from a button so this does not really make a difference. I would like to leave it in the hopes that one day we do get the routing working.

@JamesHollyer JamesHollyer requested a review from bmd3k June 16, 2022 15:43
srcs = [
"feature_flag_page_component.ts",
"feature_flag_page_container.ts",
"feature_flag_page_module.ts",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be ok to just name this feature_flag_module, with the assumption that if other files are added to the view they are likely to be included in the same module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

)

tf_ng_module(
name = "feature_flag_page",
Copy link
Contributor

Choose a reason for hiding this comment

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

Name it just "views" and therefore make it the default target. So others can refer to it as "//tensorboard/webapp/feature_flag/views"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

path: '/flags/',
ngComponent: FeatureFlagPageContainer as Type<Component>,
defaultRoute: false,
deepLinkProvider: new DashboardDeepLinkProvider(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Even if you do find a need for deep links in feature flags, I don't think DashboardDeepLinkProvider will be the one you use (it's specifically for deep links for the dashboard view).

Copy link
Contributor Author

@JamesHollyer JamesHollyer left a comment

Choose a reason for hiding this comment

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

Thanks Brian!

srcs = [
"feature_flag_page_component.ts",
"feature_flag_page_container.ts",
"feature_flag_page_module.ts",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

path: '/flags/',
ngComponent: FeatureFlagPageContainer as Type<Component>,
defaultRoute: false,
deepLinkProvider: new DashboardDeepLinkProvider(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Removed.

)

tf_ng_module(
name = "feature_flag_page",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@JamesHollyer JamesHollyer merged commit 063aba3 into tensorflow:master Jun 17, 2022
yatbear pushed a commit to yatbear/tensorboard that referenced this pull request Mar 27, 2023
* Feature Helper: add route and build page

* fix lint issues

* fix BUILD lint issues

* CR

* BUILD lint

* CR2

* BUILD lint
dna2github pushed a commit to dna2fork/tensorboard that referenced this pull request May 1, 2023
* Feature Helper: add route and build page

* fix lint issues

* fix BUILD lint issues

* CR

* BUILD lint

* CR2

* BUILD lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants