-
Notifications
You must be signed in to change notification settings - Fork 13
feat(TopQueries): add limit, sort on backend #1737
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
@@ -127,7 +127,7 @@ | |||
"@gravity-ui/tsconfig": "^1.0.0", | |||
"@playwright/test": "^1.42.1", | |||
"@testing-library/jest-dom": "^6.4.6", | |||
"@testing-library/react": "^14.2.2", | |||
"@testing-library/react": "^16.0.1", |
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.
Without it there is a warning when using renderHook
function
}, | ||
{pollingInterval: autoRefreshInterval}, | ||
); | ||
|
||
const loading = isFetching && currentData === undefined; |
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.
isLoading
query param isn't false
when data initially loaded, but filters change. So when we change sort order and load new data, there is no-data
message instead of loader. isFetching && currentData === undefined;
prevents it
1428454
to
42f35bb
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.
Copilot reviewed 14 out of 29 changed files in this pull request and generated no suggestions.
Files not reviewed (15)
- package.json: Language not supported
- src/containers/Tenant/Diagnostics/TopQueries/columns/i18n/en.json: Language not supported
- src/containers/Tenant/Diagnostics/TopQueries/i18n/en.json: Language not supported
- src/containers/Tenant/Diagnostics/TopShards/columns/i18n/en.json: Language not supported
- src/containers/Tenant/Diagnostics/TopShards/columns/columns.tsx: Evaluated as low risk
- src/containers/Tenant/Diagnostics/TopShards/columns/i18n/index.ts: Evaluated as low risk
- src/containers/Storage/StorageNodes/StorageNodesTable.tsx: Evaluated as low risk
- src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopQueries.tsx: Evaluated as low risk
- src/containers/Storage/Storage.tsx: Evaluated as low risk
- src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopShards.tsx: Evaluated as low risk
- src/containers/Tenant/Diagnostics/TopShards/TopShards.tsx: Evaluated as low risk
- src/containers/Tenant/Diagnostics/TopQueries/TopQueriesData.tsx: Evaluated as low risk
- src/containers/Tenant/Diagnostics/TopQueries/RunningQueriesData.tsx: Evaluated as low risk
- src/containers/Storage/StorageGroups/StorageGroupsTable.tsx: Evaluated as low risk
- src/containers/Tenant/Diagnostics/TopQueries/columns/columns.tsx: Evaluated as low risk
...column, | ||
sortable: isSortableTopQueriesProperty(column.name), | ||
})); | ||
const columns = getTopQueriesColumns(); |
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.
Columns are recreated on every render - this could be memoized
@@ -28,6 +31,32 @@ import {defaultSortNode, getDefaultSortGroup} from './utils'; | |||
|
|||
import './Storage.scss'; | |||
|
|||
export function useStorageSort< |
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.
Maybe move it to hooks folder? Not to expand component file with hooks. Large files with all-in-one have worse readability
const [groupsSort, handleGroupsSort] = useTableSort(groupsSortParams, (params) => | ||
setGroupSort(params as StorageSortParams), | ||
); | ||
const [nodesSort, handleNodesSort] = useStorageSort(nodesSortParams, setNodeSort); |
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.
Maybe istead of nesting hooks we could do more straightforward:
function fromTableSort<T extends NodesSortParams | StorageSortParams>(
sort: SortOrder[] | undefined,
): T | undefined {
if (!sort?.[0]) {
return undefined;
}
return {
sortValue: sort[0].columnId,
sortOrder: sort[0].order,
} as T;
}
const [nodesSort, handleNodesSort] = useTableSort({
initialSortColumn: nodesSortParams.sortValue,
initialSortOrder: nodesSortParams.sortOrder,
multiple: false,
onSort: (sort) => setNodeSort(fromTableSort<NodesSortParams>(sort)),
});
const [groupsSort, handleGroupsSort] = useTableSort({
initialSortColumn: groupsSortParams.sortValue,
initialSortOrder: groupsSortParams.sortOrder,
multiple: false,
onSort: (sort) => setGroupSort(fromTableSort<StorageSortParams>(sort)),
});
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.
Current version works as before, I don't see the reason to make it beautiful, since you are deleting it anyway in #1693
Closes #1700
Stand: https://nda.ya.ru/t/eyQNOFQ17AB7E2
CI Results
Test Status: β PASSED
π Full Report
π No changes in tests. π
Bundle Size: πΊ
Current: 65.86 MB | Main: 65.85 MB
Diff: +0.01 MB (0.02%)
βΉοΈ CI Information