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
8 changes: 1 addition & 7 deletions src/containers/Tenant/Diagnostics/Diagnostics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,7 @@ function Diagnostics(props: DiagnosticsProps) {
}}
allowNotSelected={true}
/>
<AutoRefreshControl
onManualRefresh={() => {
//this is needed to collect healthcheck if it is disabled by default https://github.com/ydb-platform/ydb-embedded-ui/issues/1889
const event = new CustomEvent('diagnosticsRefresh');
document.dispatchEvent(event);
}}
/>
<AutoRefreshControl />
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {AlertProps} from '@gravity-ui/uikit';
import {Alert, Button, Flex, Icon, Popover, Skeleton} from '@gravity-ui/uikit';

Expand Down Expand Up @@ -52,36 +50,12 @@ export function HealthcheckPreview(props: HealthcheckPreviewProps) {
{
//FIXME https://github.com/ydb-platform/ydb-embedded-ui/issues/1889
pollingInterval: healthcheckPreviewDisabled ? undefined : autoRefreshInterval,
skip: healthcheckPreviewDisabled,
},
);

const [getHealthcheckQuery, {currentData: manualData, isFetching: isFetchingManually}] =
healthcheckApi.useLazyGetHealthcheckInfoQuery();

React.useEffect(() => {
if (healthcheckPreviewDisabled) {
getHealthcheckQuery({database: tenantName});
}
}, [healthcheckPreviewDisabled, tenantName, getHealthcheckQuery]);
const loading = isFetching && data === undefined;

React.useEffect(() => {
const fetchHealthcheck = () => {
if (healthcheckPreviewDisabled) {
getHealthcheckQuery({database: tenantName});
}
};
document.addEventListener('diagnosticsRefresh', fetchHealthcheck);
return () => {
document.removeEventListener('diagnosticsRefresh', fetchHealthcheck);
};
}, [tenantName, healthcheckPreviewDisabled, getHealthcheckQuery]);

const loading =
(isFetching && data === undefined) || (isFetchingManually && manualData === undefined);

const selfCheckResult: SelfCheckResult =
data?.self_check_result || manualData?.self_check_result || SelfCheckResult.UNSPECIFIED;
const selfCheckResult: SelfCheckResult = data?.self_check_result || SelfCheckResult.UNSPECIFIED;

const modifier = selfCheckResult.toLowerCase();

Expand Down
Loading