Skip to content
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

ui/cluster-ui: fix routing to statement details page #70600

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

xinhaoz
Copy link
Member

@xinhaoz xinhaoz commented Sep 22, 2021

Partially addresses #68843

Previously, we used two different bases for the statement details page, which
depended on which route parameters were included. /statements/ was used when
the app name was included in the path, and otherwise /statement/ was used.
The database name was also optionally included in the path name, further
complicating routing to the statement details page as these optional route
params lead to the need to include all combinations of route parameters for
statement detail paths,

This commit turns all optional route parameters into query string parameters,
removing the necessity for different base paths and route param combinations.

Release note (ui change): For statement detail URLs, the app name and database
name are now query string parameters. The route to statement details is
now definitively /statement/:implicitTxn/:statement?{queryStringParams}.

e.g.
statement/true/SELECT%20city%2C%20id%20FROM%20vehicles%20WHERE%20city%20%3D%20%241?database=movr&app=movr

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@xinhaoz
Copy link
Member Author

xinhaoz commented Sep 22, 2021

Note that I pulled relevant changes from #70282, and have rebased that branch on top of this one, since it makes more sense to include those changes relevant to the routing here.

@xinhaoz xinhaoz requested a review from a team September 22, 2021 22:13
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @maryliag and @xinhaoz)


pkg/ui/workspaces/db-console/src/app.tsx, line 191 at r1 (raw file):

                  component={StatementDetails}
                />
                <Route

Instead of getting rid of the old routes, we should do a reroute, at least for now, in case users bookmark a statement they frequently check or something like that

Copy link
Member Author

@xinhaoz xinhaoz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)


pkg/ui/workspaces/db-console/src/app.tsx, line 191 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

Instead of getting rid of the old routes, we should do a reroute, at least for now, in case users bookmark a statement they frequently check or something like that

Done.

@xinhaoz xinhaoz requested a review from a team September 23, 2021 15:56
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

When there is no App selected on the filter, you're passing the value All as a parameters, and on the details page is not returning anything because it can find an app called All. Make sure that you're only passing parameters on the url if a value was selected

Reviewed 9 of 14 files at r1, 2 of 4 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

I notice the issue I mentioned above only happens when any of the other filters was selected (database, SQL type, etc). If no filter is selected the App is empty on the url and it works, so make sure that when any of the filters is selected, the App name is being handled properly

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)

@xinhaoz
Copy link
Member Author

xinhaoz commented Sep 24, 2021

@maryliag Done. Nice catch -- I was erroneously pulling the app name from the query string in the statements page, when that page still uses the route param.

@xinhaoz xinhaoz requested a review from a team September 24, 2021 19:15
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 14 files at r1, 2 of 4 files at r2, 4 of 6 files at r3, 1 of 2 files at r4, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @maryliag)

Partially addresses cockroachdb#68843

Previously, we used two different bases for the statement details page, which
depended on which route parameters were included. `/statements/` was used when
the app name was included in the path, and otherwise `/statement/` was used.
The database name was also optionally included in the path name, further
complicating routing to the statement details page as these optional route
params lead to the need to include all combinations of route parameters for
statement detail paths,

This commit turns all optional route parameters into query string parameters,
removing the necessity for different base paths and route param combinations.

Release note (ui change): For statement detail URLs, the app name and database
name are now query string parameters. The route to statement details is
now definitively `/statement/:implicitTxn/:statement?{queryStringParams}`.

e.g.
`statement/true/SELECT%20city%2C%20id%20FROM%20vehicles%20WHERE%20city%20%3D%20%241?database=movr&app=movr`
Copy link
Contributor

@Azhng Azhng left a comment

Choose a reason for hiding this comment

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

Hmm, is there anything special about implicitTxn that we want to make it part of the path instead of also turning it into query param ?

Reviewed 3 of 14 files at r1, 1 of 4 files at r2, 3 of 6 files at r3, 1 of 2 files at r4.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @Azhng and @maryliag)

@xinhaoz
Copy link
Member Author

xinhaoz commented Sep 27, 2021

bors r=maryliag

@craig
Copy link
Contributor

craig bot commented Sep 27, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Sep 27, 2021

Build succeeded:

@craig craig bot merged commit aca7e0e into cockroachdb:master Sep 27, 2021
@blathers-crl
Copy link

blathers-crl bot commented Sep 27, 2021

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from b7b53a5 to blathers/backport-release-21.2-70600: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

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.

4 participants