Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"include-component-in-tag": false,
"pull-request-title-pattern": "chore(${branch}): release ${version}",
"packages": {
".": {}
".": {
"release-as": "9.6.3-hotfix.1"
}
}
}
8 changes: 1 addition & 7 deletions src/containers/Tenant/Diagnostics/Diagnostics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,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
12 changes: 11 additions & 1 deletion src/containers/Tenant/Tenant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,24 @@ interface TenantProps {
additionalNodesProps?: AdditionalNodesProps;
}

// eslint-disable-next-line complexity
export function Tenant(props: TenantProps) {
const [summaryVisibilityState, dispatchSummaryVisibilityAction] = React.useReducer(
paneVisibilityToggleReducerCreator(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED),
undefined,
getTenantSummaryState,
);

const {database, schema} = useTenantQueryParams();
// TODO: name is used together with database to keep old links valid, do not remove
const {database: queryDatabase, schema, name, handleDatabaseChange} = useTenantQueryParams();

React.useEffect(() => {
if (name && !queryDatabase) {
handleDatabaseChange(name);
}
}, [queryDatabase, name, handleDatabaseChange]);

const database = queryDatabase ?? name;

if (!database) {
throw new Error('Tenant name is not defined');
Expand Down
4 changes: 3 additions & 1 deletion src/containers/Tenant/useTenantQueryParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import React from 'react';
import {BooleanParam, StringParam, useQueryParams} from 'use-query-params';

export function useTenantQueryParams() {
const [{showHealthcheck, database, schema, view, issuesFilter}, setQueryParams] =
const [{showHealthcheck, database, schema, view, issuesFilter, name}, setQueryParams] =
useQueryParams({
showHealthcheck: BooleanParam,
database: StringParam,
schema: StringParam,
view: StringParam,
issuesFilter: StringParam,
name: StringParam,
});
const handleShowHealthcheckChange = React.useCallback(
(value?: boolean) => {
Expand Down Expand Up @@ -55,5 +56,6 @@ export function useTenantQueryParams() {
handleHealthcheckViewChange,
issuesFilter,
handleIssuesFilterChange,
name,
};
}