Skip to content

Commit

Permalink
fix: disable autorefresh for ydb_ru
Browse files Browse the repository at this point in the history
  • Loading branch information
Raubzeug committed Jan 30, 2025
1 parent 85f19c3 commit 6cafdba
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,10 @@

border-radius: 4px;
}
&__icon-warn {
color: var(--g-color-text-warning);
}
&__icon-wrapper {
display: flex;
}
}
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 {useClusterBaseInfo} from '../../../../../store/reducers/cluster/cluster';
import {cn} from '../../../../../utils/cn';
import {useAutoRefreshInterval} from '../../../../../utils/hooks';
import {useHealthcheck} from '../useHealthcheck';
Expand All @@ -19,8 +20,10 @@ interface HealthcheckDetailsProps {

export function HealthcheckDetails({tenantName}: HealthcheckDetailsProps) {
const [autoRefreshInterval] = useAutoRefreshInterval();
const {name} = useClusterBaseInfo();
const {issueTrees, loading, error} = useHealthcheck(tenantName, {
autorefresh: autoRefreshInterval,
//FIXME https://github.com/ydb-platform/ydb-embedded-ui/issues/1889
autorefresh: name === 'ydb_ru' ? undefined : autoRefreshInterval,
});

const renderContent = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ import {
TriangleExclamationFill,
} from '@gravity-ui/icons';
import type {IconData} from '@gravity-ui/uikit';
import {Icon} from '@gravity-ui/uikit';
import {Icon, Popover} from '@gravity-ui/uikit';

import {DiagnosticCard} from '../../../../../components/DiagnosticCard/DiagnosticCard';
import {ResponseError} from '../../../../../components/Errors/ResponseError';
import {Loader} from '../../../../../components/Loader';
import {useClusterBaseInfo} from '../../../../../store/reducers/cluster/cluster';
import {healthcheckApi} from '../../../../../store/reducers/healthcheckInfo/healthcheckInfo';
import {SelfCheckResult} from '../../../../../types/api/healthcheck';
import {cn} from '../../../../../utils/cn';
import {useAutoRefreshInterval} from '../../../../../utils/hooks';

import i18n from './i18n';

import CircleExclamationIcon from '@gravity-ui/icons/svgs/circle-exclamation.svg';

import './Healthcheck.scss';

const b = cn('healthcheck');
Expand All @@ -38,14 +41,21 @@ const icons: Record<SelfCheckResult, IconData> = {
export function HealthcheckPreview(props: HealthcheckPreviewProps) {
const {tenantName, active} = props;
const [autoRefreshInterval] = useAutoRefreshInterval();

const {name} = useClusterBaseInfo();
const healthcheckPreviewAutorefreshDisabled = name === 'ydb_ru';

const {
currentData: data,
isFetching,
error,
} = healthcheckApi.useGetHealthcheckInfoQuery(
{database: tenantName},
{
pollingInterval: autoRefreshInterval,
//FIXME https://github.com/ydb-platform/ydb-embedded-ui/issues/1889
pollingInterval: healthcheckPreviewAutorefreshDisabled
? undefined
: autoRefreshInterval,
},
);

Expand All @@ -56,6 +66,22 @@ export function HealthcheckPreview(props: HealthcheckPreviewProps) {
<div className={b('preview-header')}>
<div className={b('preview-title-wrapper')}>
<div className={b('preview-title')}>{i18n('title.healthcheck')}</div>
{/* FIXME https://github.com/ydb-platform/ydb-embedded-ui/issues/1889 */}
{autoRefreshInterval && healthcheckPreviewAutorefreshDisabled ? (
<Popover
content={'Autorefresh is disabled. Please update healthcheck manually.'}
placement={['top']}
className={b('icon-wrapper')}
>
{() => (
<Icon
size={16}
className={b('icon-warn')}
data={CircleExclamationIcon}
/>
)}
</Popover>
) : null}
</div>
</div>
);
Expand Down

0 comments on commit 6cafdba

Please sign in to comment.