diff --git a/packages/ui/src/shared/tablet-errors-manager.ts b/packages/ui/src/shared/tablet-errors-manager.ts index 0b48b43af5..8792165392 100644 --- a/packages/ui/src/shared/tablet-errors-manager.ts +++ b/packages/ui/src/shared/tablet-errors-manager.ts @@ -1,5 +1,5 @@ import axios, {AxiosResponse, CancelToken} from 'axios'; -import {YTError} from '../ytsaurus-ui.ui/types'; +import {YTError} from '../@types/types'; export const TABLET_ERRORS_MANAGER_POST_ACTIONS = new Set([ 'tablet_errors_by_bundle', @@ -22,14 +22,21 @@ export type TableMethodErrorsCount = { method_counts: Record; }; +export type TabletErrorsByBundleResponse = { + all_methods: Array; + presented_methods: Array; + errors: Array; + fixed_end_timestamp: unknown; + total_row_count: number; +}; + export type TabletErrorsBaseParams = { start_timestamp: number; end_timestamp: number; methods?: Array; count_limit: number; offset: number; - tablet_id?: string; - fixed_end_timestamp?: number; + fixed_end_timestamp?: unknown; }; export type TabletMethodError = { @@ -57,13 +64,11 @@ export type TabletError = { export type TabletErrorsApi = { tablet_errors_by_bundle: { - body: TabletErrorsBaseParams & {tablet_cell_bundle: string}; - response: { - errors: Array; - }; + body: TabletErrorsBaseParams & {tablet_cell_bundle: string; table_path?: string}; + response: TabletErrorsByBundleResponse; }; tablet_errors_by_table: { - body: TabletErrorsBaseParams & {table_path: string; table_id: string}; + body: TabletErrorsBaseParams & {table_path: string; table_id: string; tablet_id?: string}; response: MethodErrors; }; tablet_errors_by_table_and_timestamp: { diff --git a/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundle.tsx b/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundle.tsx index 4a365952b8..ff0075a9c0 100644 --- a/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundle.tsx +++ b/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundle.tsx @@ -14,11 +14,12 @@ import DataTableYT, { } from '../../components/DataTableYT/DataTableYT'; import Error from '../../components/Error/Error'; import { - getTabletErrorsByBundle, + getTabletErrorsByBundleData, getTabletErrorsByBundleError, getTabletErrorsByBundleLoaded, getTabletErrorsByBundleLoading, getTabletErrorsByBundleMethodsFilter, + getTabletErrorsByBundlePageCount, getTabletErrorsByBundlePageFilter, getTabletErrorsByBundleTimeRangeFilter, } from '../../store/selectors/tablet-errors/tablet-errors-by-bundle'; @@ -63,10 +64,11 @@ export function TabletErrorsByBundle({bundle}: {bundle: string}) { } function useTabletErrorsColumns(loading: boolean) { - const {errors: data = []} = useSelector(getTabletErrorsByBundle) ?? {}; + const {errors: data = []} = useSelector(getTabletErrorsByBundleData) ?? {}; const pageFilter = useSelector(getTabletErrorsByBundlePageFilter); const teMethods = useSelector(getTabletErrorsByBundleMethodsFilter); const teTime = useSelector(getTabletErrorsByBundleTimeRangeFilter); + const pageCount = useSelector(getTabletErrorsByBundlePageCount); const columns = React.useMemo(() => { type Method = keyof (typeof data)[number]['method_counts']; @@ -85,7 +87,7 @@ function useTabletErrorsColumns(loading: boolean) { column="Path" loading={loading} pageIndex={pageFilter} - pageCount={100} + pageCount={pageCount} /> ), render({row}) { @@ -126,7 +128,7 @@ function useTabletErrorsColumns(loading: boolean) { ]; return res; - }, [data, loading, teMethods, teTime]); + }, [data, loading, teMethods, teTime, pageCount]); return {data, columns}; } diff --git a/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundleToolbar.scss b/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundleToolbar.scss new file mode 100644 index 0000000000..c0bad50841 --- /dev/null +++ b/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundleToolbar.scss @@ -0,0 +1,5 @@ +.yt-tablet-errors-by-bundle-toolbar { + &__path-filter { + width: 300px; + } +} diff --git a/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundleToolbar.tsx b/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundleToolbar.tsx index ac88cd12d8..b78c091cbb 100644 --- a/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundleToolbar.tsx +++ b/packages/ui/src/ui/pages/tablet-errors-by-bundle/TabletErrorsByBundleToolbar.tsx @@ -7,10 +7,14 @@ import Select from '../../components/Select/Select'; import SimplePagination from '../../components/Pagination/SimplePagination'; import {Toolbar} from '../../components/WithStickyToolbar/Toolbar/Toolbar'; import {YTTimeline} from '../../components/common/YTTimeline'; +import TextInputWithDebounce from '../../components/TextInputWithDebounce/TextInputWithDebounce'; import { + getTabletErrorsByBundleData, getTabletErrorsByBundleMethodsFilter, + getTabletErrorsByBundlePageCount, getTabletErrorsByBundlePageFilter, + getTabletErrorsByBundleTablePathFilter, getTabletErrorsByBundleTimeRangeFilter, } from '../../store/selectors/tablet-errors/tablet-errors-by-bundle'; import { @@ -19,20 +23,9 @@ import { } from '../../store/reducers/tablet-errors/tablet-errors-by-bundle'; import {loadTabletErrorsByBundle} from '../../store/actions/tablet-errors/tablet-errors-by-bundle'; -const block = cn('yt-tablet-errors-toolbar'); +import './TabletErrorsByBundleToolbar.scss'; -const ALL_METHODS = [ - 'Execute', - 'Multiread', - 'PullRows', - 'GetTabletInfo', - 'ReadDynamicStore', - 'FetchTabletStores', - 'FetchTableRows', - 'GetOrderedTabletSafeTrimRowCount', - 'Write', - 'Trim', -].map((value) => ({value, text: value})); +const block = cn('yt-tablet-errors-by-bundle-toolbar'); export function TabletErrorsByBundleToolbar({ bundle, @@ -43,10 +36,19 @@ export function TabletErrorsByBundleToolbar({ }) { const dispatch = useDispatch(); + const {all_methods = []} = useSelector(getTabletErrorsByBundleData) ?? {}; const methodsFilter = useSelector(getTabletErrorsByBundleMethodsFilter); const timeRangeFilter = useSelector(getTabletErrorsByBundleTimeRangeFilter); const pageFilter = useSelector(getTabletErrorsByBundlePageFilter); - const {from, to} = useTabletErrorsLoad(bundle, {methodsFilter, timeRangeFilter, pageFilter}); + const tablePathFilter = useSelector(getTabletErrorsByBundleTablePathFilter); + const pageCount = useSelector(getTabletErrorsByBundlePageCount); + + const {from, to} = useTabletErrorsLoad(bundle, { + methodsFilter, + timeRangeFilter, + pageFilter, + tablePathFilter, + }); return (
@@ -54,9 +56,12 @@ export function TabletErrorsByBundleToolbar({ from={from} to={to} shortcut={timeRangeFilter.shortcutValue} - onUpdate={(data) => { - console.log({data}); - dispatch(tabletErrorsByBundleActions.updateFilter({timeRangeFilter: data})); + onUpdate={({from, to, shortcutValue}) => { + dispatch( + tabletErrorsByBundleActions.updateFilter({ + timeRangeFilter: {from, to, shortcutValue}, + }), + ); }} hasRuler={true} /> @@ -67,7 +72,7 @@ export function TabletErrorsByBundleToolbar({ { dispatch( tabletErrorsByBundleActions.updateFilter({pageFilter: v}), @@ -76,13 +81,31 @@ export function TabletErrorsByBundleToolbar({ /> ), }, + { + node: ( + { + dispatch( + tabletErrorsByBundleActions.updateFilter({ + tablePathFilter: value, + }), + ); + }} + /> + ), + }, { node: (