-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Feature Helper: add route and build page #5760
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
Conversation
| ], | ||
| deps = [ | ||
| "//tensorboard/webapp:app_state", | ||
| "//tensorboard/webapp/angular:expect_angular_material_checkbox", |
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.
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
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.
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.
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.
So I am not doing this now.
tensorboard/webapp/routes/index.ts
Outdated
| path: '/flags/', | ||
| ngComponent: FeatureFlagPageContainer as Type<Component>, | ||
| defaultRoute: false, | ||
| deepLinkProvider: new DashboardDeepLinkProvider(), |
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.
just curious about what happens if we remove deepLinkProvider here. (I did that and it seems to work the same way as before).
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.
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.
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.
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).
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.
Ok. Removed.
qihach64
left a comment
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.
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.
tensorboard/webapp/routes/index.ts
Outdated
| deepLinkProvider: new DashboardDeepLinkProvider(), | ||
| }, | ||
| { | ||
| routeKind: RouteKind.UNKNOWN, |
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.
Can you add a new RouteKind?
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.
Oh yea, I meant to go back and do this. Done.
tensorboard/webapp/routes/index.ts
Outdated
| routeKind: RouteKind.UNKNOWN, | ||
| path: '/flags/', | ||
| ngComponent: FeatureFlagPageContainer as Type<Component>, | ||
| defaultRoute: false, |
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.
Do you need to specify defaultRoute? (Is false just the default value for defaultRoute if it is unspecified?)
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.
It is the default. Removed.
| @@ -0,0 +1,33 @@ | |||
| load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary") | |||
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.
The practice we have been doing is to put components in the "views" subfolder. in this case: tensorboard/webapp/feature_flag/views/BUILD
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.
Changed.
| import {State} from '../../app_state'; | ||
| import {getFeatureFlags} from '../store/feature_flag_selectors'; | ||
| @Component({ | ||
| selector: 'feature_flag_page', |
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.
feature_flag_page => feature-flag-page for element names.
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.
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 |
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.
similarly, feature_flag_page_component => feature-flag-page-component for element names.
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.
Done.
| @NgModule({ | ||
| declarations: [FeatureFlagPageComponent, FeatureFlagPageContainer], | ||
| imports: [CommonModule, MatCheckboxModule], | ||
| exports: [FeatureFlagPageComponent], |
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.
I'm a little confused why exports and entryComponents are not FeatureFlagPageContainer (since this is the top-level component here)
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.
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", |
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.
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.
JamesHollyer
left a comment
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.
Thanks guys.
| @@ -0,0 +1,33 @@ | |||
| load("//tensorboard/defs:defs.bzl", "tf_ng_module", "tf_sass_binary") | |||
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.
Changed.
| ], | ||
| deps = [ | ||
| "//tensorboard/webapp:app_state", | ||
| "//tensorboard/webapp/angular:expect_angular_material_checkbox", |
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.
So I am not doing this now.
| import {State} from '../../app_state'; | ||
| import {getFeatureFlags} from '../store/feature_flag_selectors'; | ||
| @Component({ | ||
| selector: 'feature_flag_page', |
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.
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 |
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.
Done.
| @NgModule({ | ||
| declarations: [FeatureFlagPageComponent, FeatureFlagPageContainer], | ||
| imports: [CommonModule, MatCheckboxModule], | ||
| exports: [FeatureFlagPageComponent], |
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.
Good catch. When I first built this for testing routing I only built the component. Changed.
tensorboard/webapp/routes/index.ts
Outdated
| deepLinkProvider: new DashboardDeepLinkProvider(), | ||
| }, | ||
| { | ||
| routeKind: RouteKind.UNKNOWN, |
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.
Oh yea, I meant to go back and do this. Done.
tensorboard/webapp/routes/index.ts
Outdated
| routeKind: RouteKind.UNKNOWN, | ||
| path: '/flags/', | ||
| ngComponent: FeatureFlagPageContainer as Type<Component>, | ||
| defaultRoute: false, |
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.
It is the default. Removed.
tensorboard/webapp/routes/index.ts
Outdated
| path: '/flags/', | ||
| ngComponent: FeatureFlagPageContainer as Type<Component>, | ||
| defaultRoute: false, | ||
| deepLinkProvider: new DashboardDeepLinkProvider(), |
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.
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.
| srcs = [ | ||
| "feature_flag_page_component.ts", | ||
| "feature_flag_page_container.ts", | ||
| "feature_flag_page_module.ts", |
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.
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.
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.
Done.
| ) | ||
|
|
||
| tf_ng_module( | ||
| name = "feature_flag_page", |
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.
Name it just "views" and therefore make it the default target. So others can refer to it as "//tensorboard/webapp/feature_flag/views"
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.
Done.
tensorboard/webapp/routes/index.ts
Outdated
| path: '/flags/', | ||
| ngComponent: FeatureFlagPageContainer as Type<Component>, | ||
| defaultRoute: false, | ||
| deepLinkProvider: new DashboardDeepLinkProvider(), |
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.
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).
JamesHollyer
left a comment
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.
Thanks Brian!
| srcs = [ | ||
| "feature_flag_page_component.ts", | ||
| "feature_flag_page_container.ts", | ||
| "feature_flag_page_module.ts", |
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.
Done.
tensorboard/webapp/routes/index.ts
Outdated
| path: '/flags/', | ||
| ngComponent: FeatureFlagPageContainer as Type<Component>, | ||
| defaultRoute: false, | ||
| deepLinkProvider: new DashboardDeepLinkProvider(), |
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.
Ok. Removed.
| ) | ||
|
|
||
| tf_ng_module( | ||
| name = "feature_flag_page", |
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.
Done.
* Feature Helper: add route and build page * fix lint issues * fix BUILD lint issues * CR * BUILD lint * CR2 * BUILD lint
* Feature Helper: add route and build page * fix lint issues * fix BUILD lint issues * CR * BUILD lint * CR2 * BUILD lint
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:
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