Skip to content

Commit

Permalink
fix(Navigation/ReplicatedTable): attribute /@tablet_error_count shoul…
Browse files Browse the repository at this point in the history
…d affect tablet errors count [YTFRONT-4447]
  • Loading branch information
ma-efremoff committed Nov 26, 2024
1 parent df05b14 commit 5860748
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {CancelTokenSource} from 'axios';
import reduce_ from 'lodash/reduce';

import CancelHelper, {isCancelled} from '../../../../../utils/cancel-helper';
import {getPath} from '../../../../../store/selectors/navigation';
Expand Down Expand Up @@ -123,19 +122,24 @@ function loadTabletErrorsCountOfReplicatedTable({
}: LoadTabletErrorOptions): TabletErrorsThunkAction {
return (dispatch) => {
return wrapApiPromiseByToaster(
ytApiV3Id.get(YTApiId.navigationTabletErrorsCountReplicatedTable, {
parameters: {
path: `${path}/@replicas`,
attributes: ['error_count'],
},
ytApiV3Id.executeBatch<number>(YTApiId.navigationTabletErrorsCountReplicatedTable, {
requests: [
{
command: 'get',
parameters: {
path: `${path}/@replicas/@error_count`,
},
},
{command: 'get', parameters: {path: `${path}/@tablet_error_count`}},
],
cancellation: saveCancelTokenSource,
}),
{
toasterName: 'tablet_errors_count',
skipSuccessToast: true,
},
).then((data: Record<string, {error_count?: number}>) => {
const count = reduce_(data, (acc, item) => acc + (item.error_count ?? 0), 0);
).then((results) => {
const count = results.reduce((acc, {output = 0}) => acc + output, 0);
dispatch(updateTabletErrrosCount(count, path));
});
};
Expand Down

0 comments on commit 5860748

Please # to comment.