diff --git a/src/containers/Heatmap/Heatmap.tsx b/src/containers/Heatmap/Heatmap.tsx index 671ffed8d2..30b182bbbb 100644 --- a/src/containers/Heatmap/Heatmap.tsx +++ b/src/containers/Heatmap/Heatmap.tsx @@ -4,6 +4,7 @@ import {Checkbox, Select} from '@gravity-ui/uikit'; import {ResponseError} from '../../components/Errors/ResponseError'; import {Loader} from '../../components/Loader'; +import {selectAutoRefreshInterval} from '../../store/reducers/autoRefreshControl'; import {heatmapApi, setHeatmapOptions} from '../../store/reducers/heatmap'; import {hideTooltip, showTooltip} from '../../store/reducers/tooltip'; import type {IHeatmapMetricValue} from '../../types/store/heatmap'; @@ -29,11 +30,11 @@ export const Heatmap = ({path}: HeatmapProps) => { const itemsContainer = React.createRef(); - const {autorefresh} = useTypedSelector((state) => state.schema); + const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval); const {currentData, isFetching, error} = heatmapApi.useGetHeatmapTabletsInfoQuery( {path}, - {pollingInterval: autorefresh}, + {pollingInterval: autoRefreshInterval}, ); const loading = isFetching && currentData === undefined; diff --git a/src/containers/Nodes/Nodes.tsx b/src/containers/Nodes/Nodes.tsx index 5f99b7737b..cadeb8845f 100644 --- a/src/containers/Nodes/Nodes.tsx +++ b/src/containers/Nodes/Nodes.tsx @@ -13,6 +13,7 @@ import {ResizeableDataTable} from '../../components/ResizeableDataTable/Resizeab import {Search} from '../../components/Search'; import {TableWithControlsLayout} from '../../components/TableWithControlsLayout/TableWithControlsLayout'; import {UptimeFilter} from '../../components/UptimeFIlter'; +import {selectAutoRefreshInterval} from '../../store/reducers/autoRefreshControl'; import {nodesApi} from '../../store/reducers/nodes/nodes'; import {filterNodes} from '../../store/reducers/nodes/selectors'; import type {NodesSortParams} from '../../store/reducers/nodes/types'; @@ -58,7 +59,7 @@ export const Nodes = ({path, additionalNodesProps = {}}: NodesProps) => { const isClusterNodes = !path; const problemFilter = useTypedSelector((state) => state.settings.problemFilter); - const {autorefresh} = useTypedSelector((state) => state.schema); + const autorefresh = useTypedSelector(selectAutoRefreshInterval); const [useNodesEndpoint] = useSetting(USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY); diff --git a/src/containers/Storage/Storage.tsx b/src/containers/Storage/Storage.tsx index 4e55b3c498..debbc249ca 100644 --- a/src/containers/Storage/Storage.tsx +++ b/src/containers/Storage/Storage.tsx @@ -5,6 +5,7 @@ import {ArrayParam, StringParam, useQueryParams, withDefault} from 'use-query-pa import {AccessDenied} from '../../components/Errors/403'; import {ResponseError} from '../../components/Errors/ResponseError'; import {TableWithControlsLayout} from '../../components/TableWithControlsLayout/TableWithControlsLayout'; +import {selectAutoRefreshInterval} from '../../store/reducers/autoRefreshControl'; import type {NodesSortParams} from '../../store/reducers/nodes/types'; import {selectNodesMap} from '../../store/reducers/nodesList'; import {STORAGE_TYPES, VISIBLE_ENTITIES} from '../../store/reducers/storage/constants'; @@ -62,7 +63,7 @@ interface StorageProps { } export const Storage = ({additionalNodesProps, tenant, nodeId}: StorageProps) => { - const {autorefresh} = useTypedSelector((state) => state.schema); + const autorefresh = useTypedSelector(selectAutoRefreshInterval); const [queryParams, setQueryParams] = useQueryParams({ type: StringParam, visible: StringParam, diff --git a/src/containers/Tablets/Tablets.tsx b/src/containers/Tablets/Tablets.tsx index 1eb9bf4c42..d6c0ebf841 100644 --- a/src/containers/Tablets/Tablets.tsx +++ b/src/containers/Tablets/Tablets.tsx @@ -10,6 +10,7 @@ import {InternalLink} from '../../components/InternalLink'; import {ResizeableDataTable} from '../../components/ResizeableDataTable/ResizeableDataTable'; import {TableSkeleton} from '../../components/TableSkeleton/TableSkeleton'; import routes, {createHref} from '../../routes'; +import {selectAutoRefreshInterval} from '../../store/reducers/autoRefreshControl'; import {selectTabletsWithFqdn, tabletsApi} from '../../store/reducers/tablets'; import {ETabletState} from '../../types/api/tablet'; import type {TTabletStateInfo} from '../../types/api/tablet'; @@ -145,7 +146,7 @@ interface TabletsProps { } export function Tablets({nodeId, path, className}: TabletsProps) { - const {autorefresh} = useTypedSelector((state) => state.schema); + const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval); let params: TabletsApiRequestParams = {}; const node = nodeId === undefined ? undefined : String(nodeId); @@ -157,7 +158,7 @@ export function Tablets({nodeId, path, className}: TabletsProps) { const {currentData, isFetching, error} = tabletsApi.useGetTabletsInfoQuery( Object.keys(params).length === 0 ? skipToken : params, { - pollingInterval: autorefresh, + pollingInterval: autoRefreshInterval, }, ); diff --git a/src/containers/Tenant/Diagnostics/Autorefresh/AutorefreshControl.tsx b/src/containers/Tenant/Diagnostics/Autorefresh/AutorefreshControl.tsx index c46a40a899..40c75436b3 100644 --- a/src/containers/Tenant/Diagnostics/Autorefresh/AutorefreshControl.tsx +++ b/src/containers/Tenant/Diagnostics/Autorefresh/AutorefreshControl.tsx @@ -2,7 +2,10 @@ import {ArrowsRotateLeft} from '@gravity-ui/icons'; import {Button, Select} from '@gravity-ui/uikit'; import {api} from '../../../../store/reducers/api'; -import {setAutorefreshInterval} from '../../../../store/reducers/schema/schema'; +import { + selectAutoRefreshInterval, + setAutoRefreshInterval, +} from '../../../../store/reducers/autoRefreshControl'; import {cn} from '../../../../utils/cn'; import {useTypedDispatch, useTypedSelector} from '../../../../utils/hooks'; @@ -18,7 +21,7 @@ interface AutorefreshControlProps { export function AutorefreshControl({className}: AutorefreshControlProps) { const dispatch = useTypedDispatch(); - const autorefresh = useTypedSelector((state) => state.schema.autorefresh); + const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval); return (