Skip to content

Conversation

@rileyajones
Copy link
Contributor

  • Motivation for features / changes
    There is an existing page available at the route "/flags" on the frontend, however, the backend does support this route so it is functionally inaccessible.

  • Technical description of changes
    Rather than just serving that app at "/" I added a list of routes for the app to be served at.
    The meta tag content attribute is now generated using parameter which is closured during app startup.
    get_resource_apps now generates resource paths for ALL supported routes.
    Because of the logic in the clean_path function found in application.py which prevents paths from ending in "/" it is necessary to support routes which DO and DO NOT end with "/" slightly convoluting the logic.

  • Screenshots of UI changes
    image

  • Detailed steps to verify changes work correctly (as executed by you)
    Start the application and manually navigate to the "/flags" route. Assert that the page is rendered.

  • Alternate designs / implementations considered

@rileyajones rileyajones requested a review from JamesHollyer July 7, 2022 22:37
Comment on lines +43 to +53
export interface NavigateToFlags {
routeKind: RouteKind.FLAGS;
routeParams: {},
resetNamespacedState?: boolean;
}

export type ProgrammaticalNavigation =
| NavigateToExperiment
| NavigateToCompare
| NavigateToExperiments;
| NavigateToExperiments
| NavigateToFlags;
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 is not technically necessary but it does make the typing more accurate.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have strong feelings about this either way. However, I would have left this out because we do not want to programmatically navigate.

I can definitely see this being useful one day if we decide to have a secret button that navigates here or something. But, I think we can add it then.

Comment on lines +116 to +143
for app_path in APP_PATHS:
path_with_slash = (
app_path
if app_path.endswith("/")
else app_path + "/"
)
apps[path_with_slash + path] = functools.partial(
self._serve_index, content, app_path
)
continue

gzipped_asset_bytes = _gzip(content)
wsgi_app = functools.partial(
self._serve_asset, path, gzipped_asset_bytes
)
apps["/" + path] = wsgi_app
apps["/"] = apps["/index.html"]
for app_path in APP_PATHS:
path_with_slash = (
app_path
if app_path.endswith("/")
else app_path + "/"
)
apps[path_with_slash + path] = wsgi_app
for app_path in APP_PATHS:
if app_path.endswith("/"):
apps[app_path] = apps[app_path + "index.html"]
else:
apps[app_path] = apps[app_path + "/index.html"]
apps[app_path] = apps[app_path]
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 DEFINITELY needs a unit test

Copy link
Contributor

Choose a reason for hiding this comment

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

Unit test here would be great. I don't understand what line 143 does.

Copy link
Contributor

@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.

This LGTM. However, I am not familiar with this code enough to sign off on it. I am going to add Brian as a reviewer so sign off on the python piece.

Comment on lines +116 to +143
for app_path in APP_PATHS:
path_with_slash = (
app_path
if app_path.endswith("/")
else app_path + "/"
)
apps[path_with_slash + path] = functools.partial(
self._serve_index, content, app_path
)
continue

gzipped_asset_bytes = _gzip(content)
wsgi_app = functools.partial(
self._serve_asset, path, gzipped_asset_bytes
)
apps["/" + path] = wsgi_app
apps["/"] = apps["/index.html"]
for app_path in APP_PATHS:
path_with_slash = (
app_path
if app_path.endswith("/")
else app_path + "/"
)
apps[path_with_slash + path] = wsgi_app
for app_path in APP_PATHS:
if app_path.endswith("/"):
apps[app_path] = apps[app_path + "index.html"]
else:
apps[app_path] = apps[app_path + "/index.html"]
apps[app_path] = apps[app_path]
Copy link
Contributor

Choose a reason for hiding this comment

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

Unit test here would be great. I don't understand what line 143 does.

Comment on lines +43 to +53
export interface NavigateToFlags {
routeKind: RouteKind.FLAGS;
routeParams: {},
resetNamespacedState?: boolean;
}

export type ProgrammaticalNavigation =
| NavigateToExperiment
| NavigateToCompare
| NavigateToExperiments;
| NavigateToExperiments
| NavigateToFlags;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have strong feelings about this either way. However, I would have left this out because we do not want to programmatically navigate.

I can definitely see this being useful one day if we decide to have a secret button that navigates here or something. But, I think we can add it then.

@JamesHollyer JamesHollyer requested a review from bmd3k July 11, 2022 17:13
@rileyajones rileyajones marked this pull request as draft July 11, 2022 17:15
@rileyajones
Copy link
Contributor Author

@JamesHollyer I spoke with @bmd3k and @nfelt about this on Friday and we decided to use a query param and a modal instead to prevent the python routing code from diverging. That is also why I didn't bother adding a test btw.
I'm converting this to draft rather than closing in case we decide to come back to this.

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.

2 participants