Skip to content

Commit 7fefc4f

Browse files
authored
Merge branch 'main' into astandrik.2459
2 parents 043851a + ac5f23a commit 7fefc4f

File tree

7 files changed

+39
-16
lines changed

7 files changed

+39
-16
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ on:
22
push:
33
branches:
44
- main
5-
- hotfix/v[0-9]+.[0-9]+.[0-9]+ # match branches in format hotfix/v6.20.10
5+
- hotfix/v[0-9]+.[0-9]+.[0-9]+* # match branches in format hotfix/v6.20.10 and hotfix/v6.20.10-hotfix.1
66

77
name: Release
88

src/containers/Tenant/Query/QueryEditor/QueryEditor.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
useTypedSelector,
4040
} from '../../../../utils/hooks';
4141
import {useChangedQuerySettings} from '../../../../utils/hooks/useChangedQuerySettings';
42+
import {useDisableOidcStreaming} from '../../../../utils/hooks/useDisableOidcStreaming';
4243
import {useLastQueryExecutionSettings} from '../../../../utils/hooks/useLastQueryExecutionSettings';
4344
import {DEFAULT_QUERY_SETTINGS, QUERY_ACTIONS, QUERY_MODES} from '../../../../utils/query';
4445
import {useCurrentSchema} from '../../TenantContext';
@@ -94,10 +95,14 @@ export default function QueryEditor(props: QueryEditorProps) {
9495
const [lastExecutedQueryText, setLastExecutedQueryText] = React.useState<string>('');
9596
const [isQueryStreamingEnabled] = useSetting<boolean>(ENABLE_QUERY_STREAMING);
9697

98+
// Temporary check: disable streaming if backend parameter contains "oidc"
99+
const isOidcBackend = useDisableOidcStreaming();
100+
97101
const isStreamingEnabled =
98102
useStreamingAvailable() &&
99103
isQueryStreamingEnabled &&
100-
querySettings.queryMode === QUERY_MODES.query;
104+
querySettings.queryMode === QUERY_MODES.query &&
105+
!isOidcBackend;
101106

102107
const [sendQuery] = queryApi.useUseSendQueryMutation();
103108
const [streamQuery] = queryApi.useUseStreamQueryMutation();

src/containers/Tenant/Query/QuerySettingsDialog/TimeoutLabel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {HelpMark, Switch} from '@gravity-ui/uikit';
33
import {cn} from '../../../../utils/cn';
44
import {ENABLE_QUERY_STREAMING} from '../../../../utils/constants';
55
import {useSetting} from '../../../../utils/hooks';
6+
import {useDisableOidcStreaming} from '../../../../utils/hooks/useDisableOidcStreaming';
67

78
import {QUERY_SETTINGS_FIELD_SETTINGS} from './constants';
89
import i18n from './i18n';
@@ -20,7 +21,12 @@ interface TimeoutLabelProps {
2021
export function TimeoutLabel({isDisabled, isChecked, onToggle}: TimeoutLabelProps) {
2122
const [isQueryStreamingEnabled] = useSetting<boolean>(ENABLE_QUERY_STREAMING);
2223

23-
if (isQueryStreamingEnabled) {
24+
// Temporary check: disable streaming UI if backend parameter contains "oidc"
25+
const isOidcBackend = useDisableOidcStreaming();
26+
27+
const shouldShowStreamingUI = isQueryStreamingEnabled && !isOidcBackend;
28+
29+
if (shouldShowStreamingUI) {
2430
return (
2531
<div className={b('switch-title')}>
2632
<Switch

src/containers/Tenant/Tenant.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,7 @@ export function Tenant(props: TenantProps) {
5252
getTenantSummaryState,
5353
);
5454

55-
// TODO: name is used together with database to keep old links valid, do not remove
56-
const {database: queryDatabase, schema, name, handleDatabaseChange} = useTenantQueryParams();
57-
58-
React.useEffect(() => {
59-
if (name && !queryDatabase) {
60-
handleDatabaseChange(name);
61-
}
62-
}, [queryDatabase, name, handleDatabaseChange]);
63-
64-
const database = queryDatabase ?? name;
55+
const {database, schema} = useTenantQueryParams();
6556

6657
if (!database) {
6758
throw new Error('Tenant name is not defined');

src/containers/Tenant/useTenantQueryParams.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,16 @@ export function useTenantQueryParams() {
6161
[setQueryParams],
6262
);
6363

64+
React.useEffect(() => {
65+
if (name && !database) {
66+
setQueryParams({database: name, name: undefined}, 'replaceIn');
67+
}
68+
}, [database, name, setQueryParams]);
69+
6470
return {
6571
showHealthcheck,
6672
handleShowHealthcheckChange,
67-
database,
73+
database: database || name,
6874
handleDatabaseChange,
6975
showGrantAccess,
7076
handleShowGrantAccessChange,
@@ -76,6 +82,5 @@ export function useTenantQueryParams() {
7682
handleIssuesFilterChange,
7783
aclSubject,
7884
handleAclSubjectChange,
79-
name,
8085
};
8186
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {StringParam, useQueryParams} from 'use-query-params';
2+
3+
/**
4+
* Temporary hook to check if streaming should be disabled for OIDC backends
5+
* Returns true if the backend parameter contains "oidc"
6+
*/
7+
export const useDisableOidcStreaming = () => {
8+
const [{backend}] = useQueryParams({backend: StringParam});
9+
return backend && backend.includes('oidc');
10+
};

src/utils/hooks/useQueryExecutionSettings.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
querySettingsRestoreSchema,
1515
} from '../query';
1616

17+
import {useDisableOidcStreaming} from './useDisableOidcStreaming';
1718
import {useSetting} from './useSetting';
1819

1920
export const useQueryExecutionSettings = () => {
@@ -24,6 +25,11 @@ export const useQueryExecutionSettings = () => {
2425
const [useShowPlanToSvg] = useSetting<boolean>(USE_SHOW_PLAN_SVG_KEY);
2526
const [enableQueryStreaming] = useSetting<boolean>(ENABLE_QUERY_STREAMING);
2627

28+
// Temporary check: disable streaming behavior if backend parameter contains "oidc"
29+
const isOidcBackend = useDisableOidcStreaming();
30+
31+
const effectiveStreamingEnabled = enableQueryStreaming && !isOidcBackend;
32+
2733
const setQueryExecutionSettings = React.useCallback(
2834
(settings: QuerySettings) => {
2935
setSettings({
@@ -39,7 +45,7 @@ export const useQueryExecutionSettings = () => {
3945
const settings: QuerySettings = {
4046
...validatedSettings,
4147
timeout:
42-
enableQueryStreaming && validatedSettings.queryMode === QUERY_MODES.query
48+
effectiveStreamingEnabled && validatedSettings.queryMode === QUERY_MODES.query
4349
? validatedSettings.timeout || null
4450
: validatedSettings.timeout || undefined,
4551
statisticsMode: useShowPlanToSvg ? STATISTICS_MODES.full : validatedSettings.statisticsMode,

0 commit comments

Comments
 (0)