cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

ui: use TimeScaleState reducer to align time window across pages

Open koorosh opened this issue 3 years ago • 3 comments

Before, there was globalTimeScale local setting that was used to track time window changes in different places (ie statements, transactions and metrics pages). But Metrics page has many components that still rely on logic implemented in TimeScaleState reducer and MetricsTimeManager component that manages how to update moving time window in Db Console. As result, two places exist that track time window changes and they are not synced. It caused issues related to selecting custom time ranges on Metrics page.

This change does following:

  • remove globalTimeScale local setting as a duplicate of TimeScaleState reducer.
  • use TimeScaleState's logic to set and get current values of time window in SQL Activity pages.

Release note: None

On a video below you can see the result where changing time range in different places updates it across all pages. Also it shows that it works if user selects predefined relative time option or selects custom time range.

https://user-images.githubusercontent.com/3106437/183712012-23d966e9-07d6-4c83-8476-bf1a7ed1c4db.mov

koorosh avatar Aug 09 '22 16:08 koorosh

This change is Reviewable

cockroach-teamcity avatar Aug 09 '22 16:08 cockroach-teamcity

bors r+

koorosh avatar Aug 11 '22 06:08 koorosh

Build failed (retrying...):

craig[bot] avatar Aug 11 '22 09:08 craig[bot]

Build failed:

craig[bot] avatar Aug 11 '22 13:08 craig[bot]

bors r+

koorosh avatar Aug 11 '22 15:08 koorosh

Build failed (retrying...):

craig[bot] avatar Aug 11 '22 16:08 craig[bot]

Build failed (retrying...):

craig[bot] avatar Aug 11 '22 17:08 craig[bot]

Build failed (retrying...):

craig[bot] avatar Aug 11 '22 17:08 craig[bot]

Canceled.

craig[bot] avatar Aug 11 '22 18:08 craig[bot]

bors r+ 🙏🏼

koorosh avatar Aug 12 '22 07:08 koorosh

Build succeeded:

craig[bot] avatar Aug 12 '22 11:08 craig[bot]

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 dacefa720780a645b56c9d8cdac152b31737107b to blathers/backport-release-22.1-85826: 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 22.1.x failed. See errors above.


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

blathers-crl[bot] avatar Aug 12 '22 11:08 blathers-crl[bot]

This PR undoes the proper object construction from local settings that existed in globalTimeScale.ts. This means if a user refreshes the page and we construct the timescale from session storage, certain properties of the timescale won't function properly, and the page will actually crash if fixedWindowEnd is non-null. I'll reintroduce this construction in another PR that should be backported.

xinhaoz avatar Aug 25 '22 20:08 xinhaoz

FYI @xinhaoz this PR was followed by this other PR https://github.com/cockroachdb/cockroach/pull/86157 that did some fixes for the reload part

maryliag avatar Aug 26 '22 03:08 maryliag