-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: save filters on cache for Transactions page #73003
Conversation
0194c10
to
945a9ee
Compare
945a9ee
to
bf778b8
Compare
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.
Nice refactoring! 🚀. Just some nits and questions
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @Azhng and @maryliag)
pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx, line 116 at r1 (raw file):
/** * Get Filters from Query String and if it's different from current * filters calls the onFilterChange function.
"if it's different from filters calls the onFilterChange function", something feels missing in that sentence
pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx, line 131 at r1 (raw file):
const filtersQueryString = getFiltersFromQueryString(history.location.search); const searchParams = new URLSearchParams(history.location.search); const hasFilter = searchParams.get("app") || undefined;
quick question: why are we only check "app"here? :thinking: , doesn't the
searchParams` also include other things like "node" and "regions" etc. ?
pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx, line 466 at r1 (raw file):
export const updateSortSettingQueryParamsOnTab = ( tab: string, ss: SortSetting,
nit: s/ss/sortSetting/
? I feel we don't really have much abbreviation across the entire code base
pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx, line 467 at r1 (raw file):
tab: string, ss: SortSetting, defaultSS: SortSetting,
ditto
bf778b8
to
c62fcb4
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @Azhng)
pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx, line 116 at r1 (raw file):
Previously, Azhng (Archer Zhang) wrote…
"if it's different from filters calls the onFilterChange function", something feels missing in that sentence
Changed
pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx, line 131 at r1 (raw file):
Previously, Azhng (Archer Zhang) wrote…
quick question: why are we only check "app"
here? :thinking: , doesn't the
searchParams` also include other things like "node" and "regions" etc. ?
Good catch, initially I was always adding app, so it was easy to use that to check if we had any filter, but I updated now so it checks for any filter
pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx, line 466 at r1 (raw file):
Previously, Azhng (Archer Zhang) wrote…
nit:
s/ss/sortSetting/
? I feel we don't really have much abbreviation across the entire code base
done
pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx, line 467 at r1 (raw file):
Previously, Azhng (Archer Zhang) wrote…
ditto
done
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.
Reviewed 1 of 11 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @Azhng and @maryliag)
pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx, line 131 at r1 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
Good catch, initially I was always adding app, so it was easy to use that to check if we had any filter, but I updated now so it checks for any filter
Nice!
pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx, line 179 at r2 (raw file):
* @param history */ export const updateFiltersQueryParamsOnTab = (
same nit
pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx, line 421 at r2 (raw file):
/** * Get Sort Setting from Query String and if it's different from current * sortSetting calls the onSortChange function.
super nit: "if it's different ...., then calls the onSortChange function"
pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx, line 464 at r2 (raw file):
* @param history */ export const updateSortSettingQueryParamsOnTab = (
super nit: s/updateSortSettingQueryParamsOnTab/updateSortSettingQueryParamsOnTabChange/
pkg/ui/workspaces/cluster-ui/src/transactionsPage/transactionsPage.tsx, line 182 at r2 (raw file):
} updateQueryParamsOnTabSwitch(): void {
Hmm, it seems like we are updating query params more than just when we switch tabs? So perhaps we can drop OnTabSwitch
suffix here?
c62fcb4
to
7b4cb6f
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @Azhng)
pkg/ui/workspaces/cluster-ui/src/queryFilter/filter.tsx, line 179 at r2 (raw file):
Previously, Azhng (Archer Zhang) wrote…
same nit
same as other comment
pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx, line 421 at r2 (raw file):
Previously, Azhng (Archer Zhang) wrote…
super nit: "if it's different ...., then calls the onSortChange function"
Done.
pkg/ui/workspaces/cluster-ui/src/sortedtable/sortedtable.tsx, line 464 at r2 (raw file):
Previously, Azhng (Archer Zhang) wrote…
super nit:
s/updateSortSettingQueryParamsOnTab/updateSortSettingQueryParamsOnTabChange/
I named this on purpose, because it's not on the event of TabChange, is during any updated events when you're on a specific Tab. So I'm keeping this name as is :)
pkg/ui/workspaces/cluster-ui/src/transactionsPage/transactionsPage.tsx, line 182 at r2 (raw file):
Previously, Azhng (Archer Zhang) wrote…
Hmm, it seems like we are updating query params more than just when we switch tabs? So perhaps we can drop
OnTabSwitch
suffix here?
Done.
Previously, a sort selection was not maintained when the page change (e.g. changing tabs/pages). This commits saves the selected value to be used. Partially adresses cockroachdb#71851 Release note: None
7b4cb6f
to
1cd2a34
Compare
bors r+ |
Build failed (retrying...): |
Build failed (retrying...): |
Build failed (retrying...): |
Build succeeded: |
Previously, a sort selection was not maintained when
the page change (e.g. changing tabs/pages).
This commits saves the selected value to be used.
Partially adresses #71851
Release note: None