Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/containers/Heatmap/Heatmap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -29,11 +30,11 @@ export const Heatmap = ({path}: HeatmapProps) => {

const itemsContainer = React.createRef<HTMLDivElement>();

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;
Expand Down
3 changes: 2 additions & 1 deletion src/containers/Nodes/Nodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/containers/Storage/Storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/containers/Tablets/Tablets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand All @@ -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,
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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 (
<div className={b(null, className)}>
<Button
Expand All @@ -33,9 +36,9 @@ export function AutorefreshControl({className}: AutorefreshControlProps) {
</Button.Icon>
</Button>
<Select
value={[String(autorefresh)]}
value={[String(autoRefreshInterval)]}
onUpdate={(v) => {
dispatch(setAutorefreshInterval(Number(v)));
dispatch(setAutoRefreshInterval(Number(v)));
}}
width={85}
>
Expand Down
5 changes: 3 additions & 2 deletions src/containers/Tenant/Diagnostics/Consumers/Consumers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {ResponseError} from '../../../../components/Errors/ResponseError';
import {Loader} from '../../../../components/Loader';
import {ResizeableDataTable} from '../../../../components/ResizeableDataTable/ResizeableDataTable';
import {Search} from '../../../../components/Search';
import {selectAutoRefreshInterval} from '../../../../store/reducers/autoRefreshControl';
import {
selectPreparedConsumersData,
selectPreparedTopicStats,
Expand Down Expand Up @@ -35,10 +36,10 @@ export const Consumers = ({path, type}: ConsumersProps) => {

const [searchValue, setSearchValue] = React.useState('');

const {autorefresh} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const {currentData, isFetching, error} = topicApi.useGetTopicQuery(
{path},
{pollingInterval: autorefresh},
{pollingInterval: autoRefreshInterval},
);
const loading = isFetching && currentData === undefined;
const consumers = useTypedSelector((state) => selectPreparedConsumersData(state, path));
Expand Down
6 changes: 4 additions & 2 deletions src/containers/Tenant/Diagnostics/Describe/Describe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {shallowEqual} from 'react-redux';

import {ResponseError} from '../../../../components/Errors/ResponseError';
import {Loader} from '../../../../components/Loader';
import {selectAutoRefreshInterval} from '../../../../store/reducers/autoRefreshControl';
import {describeApi} from '../../../../store/reducers/describe';
import {selectSchemaMergedChildrenPaths} from '../../../../store/reducers/schema/schema';
import type {EPathType} from '../../../../types/api/schema';
Expand All @@ -24,7 +25,8 @@ interface IDescribeProps {
}

const Describe = ({tenant, type}: IDescribeProps) => {
const {autorefresh, currentSchemaPath} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const {currentSchemaPath} = useTypedSelector((state) => state.schema);

const isEntityWithMergedImpl = isEntityWithMergedImplementation(type);

Expand All @@ -41,7 +43,7 @@ const Describe = ({tenant, type}: IDescribeProps) => {
paths = [path, ...mergedChildrenPaths];
}
const {currentData, isFetching, error} = describeApi.useGetDescribeQuery(paths, {
pollingInterval: autorefresh,
pollingInterval: autoRefreshInterval,
});
const loading = isFetching && currentData === undefined;
const currentDescribe = currentData;
Expand Down
5 changes: 3 additions & 2 deletions src/containers/Tenant/Diagnostics/Network/Network.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {Link} from 'react-router-dom';
import {ResponseError} from '../../../../components/Errors/ResponseError';
import {Illustration} from '../../../../components/Illustration';
import {ProblemFilter} from '../../../../components/ProblemFilter';
import {selectAutoRefreshInterval} from '../../../../store/reducers/autoRefreshControl';
import {networkApi} from '../../../../store/reducers/network/network';
import {
ProblemFilterValues,
Expand All @@ -31,7 +32,7 @@ interface NetworkProps {
path: string;
}
export function Network({path}: NetworkProps) {
const {autorefresh} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const filter = useTypedSelector(selectProblemFilter);
const dispatch = useTypedDispatch();

Expand All @@ -40,7 +41,7 @@ export function Network({path}: NetworkProps) {
const [showRacks, setShowRacks] = React.useState(false);

const {currentData, isFetching, error} = networkApi.useGetNetworkInfoQuery(path, {
pollingInterval: autorefresh,
pollingInterval: autoRefreshInterval,
});
const loading = isFetching && currentData === undefined;

Expand Down
8 changes: 5 additions & 3 deletions src/containers/Tenant/Diagnostics/Overview/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {shallowEqual} from 'react-redux';
import {ResponseError} from '../../../../components/Errors/ResponseError';
import {TableIndexInfo} from '../../../../components/InfoViewer/schemaInfo';
import {Loader} from '../../../../components/Loader';
import {selectAutoRefreshInterval} from '../../../../store/reducers/autoRefreshControl';
import {olapApi} from '../../../../store/reducers/olapStats';
import {overviewApi} from '../../../../store/reducers/overview/overview';
import {selectSchemaMergedChildrenPaths} from '../../../../store/reducers/schema/schema';
Expand All @@ -31,14 +32,15 @@ interface OverviewProps {
}

function Overview({type, tenantName}: OverviewProps) {
const {autorefresh, currentSchemaPath} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const {currentSchemaPath} = useTypedSelector((state) => state.schema);

const schemaPath = currentSchemaPath || tenantName;
const olapParams =
isTableType(type) && isColumnEntityType(type) ? {path: schemaPath} : skipToken;
const {currentData: olapData, isFetching: olapIsFetching} = olapApi.useGetOlapStatsQuery(
olapParams,
{pollingInterval: autorefresh},
{pollingInterval: autoRefreshInterval},
);
const olapStatsLoading = olapIsFetching && olapData === undefined;
const {result: olapStats} = olapData || {result: undefined};
Expand All @@ -65,7 +67,7 @@ function Overview({type, tenantName}: OverviewProps) {
isFetching,
error: overviewError,
} = overviewApi.useGetOverviewQuery(paths, {
pollingInterval: autorefresh,
pollingInterval: autoRefreshInterval,
});
const overviewLoading = isFetching && currentData === undefined;
const {data: rawData, additionalData} = currentData || {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {LabelWithPopover} from '../../../../../components/LabelWithPopover';
import {LagPopoverContent} from '../../../../../components/LagPopoverContent';
import {Loader} from '../../../../../components/Loader';
import {SpeedMultiMeter} from '../../../../../components/SpeedMultiMeter';
import {selectAutoRefreshInterval} from '../../../../../store/reducers/autoRefreshControl';
import {selectPreparedTopicStats, topicApi} from '../../../../../store/reducers/topic';
import type {IPreparedTopicStats} from '../../../../../types/store/topic';
import {cn} from '../../../../../utils/cn';
Expand Down Expand Up @@ -70,10 +71,11 @@ const prepareBytesWrittenInfo = (data: IPreparedTopicStats): Array<InfoViewerIte
};

export const TopicStats = () => {
const {autorefresh, currentSchemaPath} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const {currentSchemaPath} = useTypedSelector((state) => state.schema);
const {currentData, isFetching, error} = topicApi.useGetTopicQuery(
{path: currentSchemaPath},
{pollingInterval: autorefresh},
{pollingInterval: autoRefreshInterval},
);
const loading = isFetching && currentData === undefined;
const data = useTypedSelector((state) => selectPreparedTopicStats(state, currentSchemaPath));
Expand Down
5 changes: 3 additions & 2 deletions src/containers/Tenant/Diagnostics/Partitions/Partitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {skipToken} from '@reduxjs/toolkit/query';
import {ResponseError} from '../../../../components/Errors/ResponseError';
import {ResizeableDataTable} from '../../../../components/ResizeableDataTable/ResizeableDataTable';
import {TableSkeleton} from '../../../../components/TableSkeleton/TableSkeleton';
import {selectAutoRefreshInterval} from '../../../../store/reducers/autoRefreshControl';
import {nodesListApi, selectNodesMap} from '../../../../store/reducers/nodesList';
import {partitionsApi, setSelectedConsumer} from '../../../../store/reducers/partitions/partitions';
import {selectConsumersNames, topicApi} from '../../../../store/reducers/topic';
Expand Down Expand Up @@ -39,7 +40,7 @@ export const Partitions = ({path}: PartitionsProps) => {
>([]);

const consumers = useTypedSelector((state) => selectConsumersNames(state, path));
const {autorefresh} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const {selectedConsumer} = useTypedSelector((state) => state.partitions);
const {
currentData: topicData,
Expand Down Expand Up @@ -71,7 +72,7 @@ export const Partitions = ({path}: PartitionsProps) => {
currentData: partitionsData,
isFetching: partitionsIsFetching,
error: partitionsError,
} = partitionsApi.useGetPartitionsQuery(params, {pollingInterval: autorefresh});
} = partitionsApi.useGetPartitionsQuery(params, {pollingInterval: autoRefreshInterval});
const partitionsLoading = partitionsIsFetching && partitionsData === undefined;
const rawPartitions = partitionsData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';

import {ResponseError} from '../../../../../components/Errors/ResponseError';
import {Loader} from '../../../../../components/Loader';
import {selectAutoRefreshInterval} from '../../../../../store/reducers/autoRefreshControl';
import {cn} from '../../../../../utils/cn';
import {useTypedSelector} from '../../../../../utils/hooks';
import {useHealthcheck} from '../useHealthcheck';
Expand All @@ -18,8 +19,10 @@ interface HealthcheckDetailsProps {
}

export function HealthcheckDetails({tenantName}: HealthcheckDetailsProps) {
const {autorefresh} = useTypedSelector((state) => state.schema);
const {issueTrees, loading, error} = useHealthcheck(tenantName, {autorefresh});
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const {issueTrees, loading, error} = useHealthcheck(tenantName, {
autorefresh: autoRefreshInterval,
});

const renderContent = () => {
if (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {Icon} from '@gravity-ui/uikit';
import {DiagnosticCard} from '../../../../../components/DiagnosticCard/DiagnosticCard';
import {ResponseError} from '../../../../../components/Errors/ResponseError';
import {Loader} from '../../../../../components/Loader';
import {selectAutoRefreshInterval} from '../../../../../store/reducers/autoRefreshControl';
import {healthcheckApi} from '../../../../../store/reducers/healthcheckInfo/healthcheckInfo';
import {SelfCheckResult} from '../../../../../types/api/healthcheck';
import {cn} from '../../../../../utils/cn';
Expand All @@ -37,15 +38,15 @@ const icons: Record<SelfCheckResult, IconData> = {

export function HealthcheckPreview(props: HealthcheckPreviewProps) {
const {tenantName, active} = props;
const {autorefresh} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const {
currentData: data,
isFetching,
error,
} = healthcheckApi.useGetHealthcheckInfoQuery(
{database: tenantName},
{
pollingInterval: autorefresh,
pollingInterval: autoRefreshInterval,
},
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {selectAutoRefreshInterval} from '../../../../../store/reducers/autoRefreshControl';
import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../../../../store/reducers/tenant/constants';
import {topNodesApi} from '../../../../../store/reducers/tenantOverview/topNodes/topNodes';
import type {AdditionalNodesProps} from '../../../../../types/additionalProps';
Expand All @@ -19,12 +20,12 @@ interface TopNodesByCpuProps {
export function TopNodesByCpu({path, additionalNodesProps}: TopNodesByCpuProps) {
const query = useSearchQuery();

const {autorefresh} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const columns = getTopNodesByCpuColumns(additionalNodesProps?.getNodeRef);

const {currentData, isFetching, error} = topNodesApi.useGetTopNodesQuery(
{tenant: path, sortValue: 'CPU'},
{pollingInterval: autorefresh},
{pollingInterval: autoRefreshInterval},
);

const loading = isFetching && currentData === undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {selectAutoRefreshInterval} from '../../../../../store/reducers/autoRefreshControl';
import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../../../../store/reducers/tenant/constants';
import {topNodesApi} from '../../../../../store/reducers/tenantOverview/topNodes/topNodes';
import type {AdditionalNodesProps} from '../../../../../types/additionalProps';
Expand All @@ -19,12 +20,12 @@ interface TopNodesByLoadProps {
export function TopNodesByLoad({path, additionalNodesProps}: TopNodesByLoadProps) {
const query = useSearchQuery();

const {autorefresh} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const columns = getTopNodesByLoadColumns(additionalNodesProps?.getNodeRef);

const {currentData, isFetching, error} = topNodesApi.useGetTopNodesQuery(
{tenant: path, sortValue: 'LoadAverage'},
{pollingInterval: autorefresh},
{pollingInterval: autoRefreshInterval},
);

const loading = isFetching && currentData === undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import {useHistory, useLocation} from 'react-router';

import {parseQuery} from '../../../../../routes';
import {selectAutoRefreshInterval} from '../../../../../store/reducers/autoRefreshControl';
import {changeUserInput} from '../../../../../store/reducers/executeQuery';
import {
TENANT_DIAGNOSTICS_TABS_IDS,
Expand Down Expand Up @@ -34,12 +35,12 @@ export function TopQueries({path}: TopQueriesProps) {

const query = parseQuery(location);

const {autorefresh} = useTypedSelector((state) => state.schema);
const autoRefreshInterval = useTypedSelector(selectAutoRefreshInterval);
const columns = getTenantOverviewTopQueriesColumns();

const {currentData, isFetching, error} = topQueriesApi.useGetOverviewTopQueriesQuery(
{database: path},
{pollingInterval: autorefresh},
{pollingInterval: autoRefreshInterval},
);

const loading = isFetching && currentData === undefined;
Expand Down
Loading