@@ -12,8 +12,12 @@ import {
1212 ENABLE_CODE_ASSISTANT ,
1313 ENABLE_NETWORK_TABLE_KEY ,
1414 ENABLE_QUERY_STREAMING ,
15+ ENABLE_QUERY_STREAMING_OLD_BACKEND ,
1516 INVERTED_DISKS_KEY ,
1617 LANGUAGE_KEY ,
18+ OLD_BACKEND_CLUSTER_NAMES ,
19+ PAGE_IDS ,
20+ SECTION_IDS ,
1721 SHOW_DOMAIN_DATABASE_KEY ,
1822 SHOW_NETWORK_UTILIZATION ,
1923 THEME_KEY ,
@@ -137,6 +141,42 @@ export const enableQueryStreamingSetting: SettingProps = {
137141 description : i18n ( 'settings.editor.queryStreaming.description' ) ,
138142} ;
139143
144+ export const enableQueryStreamingOldBackendSetting : SettingProps = {
145+ settingKey : ENABLE_QUERY_STREAMING_OLD_BACKEND ,
146+ title : i18n ( 'settings.editor.queryStreaming.title' ) ,
147+ description : i18n ( 'settings.editor.queryStreaming.description' ) ,
148+ } ;
149+
150+ export function applyClusterSpecificQueryStreamingSetting (
151+ settings : YDBEmbeddedUISettings ,
152+ clusterName ?: string ,
153+ ) : YDBEmbeddedUISettings {
154+ const isOldBackendCluster = clusterName && OLD_BACKEND_CLUSTER_NAMES . includes ( clusterName ) ;
155+
156+ const queryStreamingSetting = isOldBackendCluster
157+ ? enableQueryStreamingOldBackendSetting
158+ : enableQueryStreamingSetting ;
159+
160+ return settings . map ( ( page ) => {
161+ // Look for the experiments page
162+ if ( page . id === PAGE_IDS . EXPERIMENTS ) {
163+ return createNextState ( page , ( draft ) => {
164+ // Find and replace the query streaming setting in experimentsSection
165+ const section = draft . sections [ 0 ] ; // experimentsSection
166+ const settingIndex = section . settings . findIndex (
167+ ( setting ) =>
168+ 'settingKey' in setting && setting . settingKey === ENABLE_QUERY_STREAMING ,
169+ ) ;
170+
171+ if ( settingIndex !== - 1 ) {
172+ section . settings [ settingIndex ] = queryStreamingSetting ;
173+ }
174+ } ) ;
175+ }
176+ return page ;
177+ } ) ;
178+ }
179+
140180export const showNetworkUtilizationSetting : SettingProps = {
141181 settingKey : SHOW_NETWORK_UTILIZATION ,
142182 title : i18n ( 'settings.showNetworkUtilization.title' ) ,
@@ -181,10 +221,11 @@ export const interfaceVersionInfoField: SettingsInfoFieldProps = {
181221} ;
182222
183223export const appearanceSection : SettingsSection = {
184- id : 'appearanceSection' ,
224+ id : SECTION_IDS . APPEARANCE ,
185225 title : i18n ( 'section.appearance' ) ,
186226 settings : [
187227 themeSetting ,
228+ languageSetting ,
188229 invertedDisksSetting ,
189230 binaryDataInPlainTextDisplay ,
190231 showDomainDatabase ,
@@ -193,7 +234,7 @@ export const appearanceSection: SettingsSection = {
193234} ;
194235
195236export const experimentsSection : SettingsSection = {
196- id : 'experimentsSection' ,
237+ id : SECTION_IDS . EXPERIMENTS ,
197238 title : i18n ( 'section.experiments' ) ,
198239 settings : [
199240 enableNetworkTable ,
@@ -204,42 +245,43 @@ export const experimentsSection: SettingsSection = {
204245} ;
205246
206247export const devSettingsSection : SettingsSection = {
207- id : 'devSettingsSection' ,
248+ id : SECTION_IDS . DEV_SETTINGS ,
208249 title : i18n ( 'section.dev-setting' ) ,
209250 settings : [ enableAutocompleteSetting , autocompleteOnEnterSetting ] ,
210251} ;
211252
212253export const aboutSettingsSection : SettingsSection = {
213- id : 'aboutSettingsSection' ,
254+ id : SECTION_IDS . ABOUT ,
214255 title : i18n ( 'section.about' ) ,
215256 settings : [ interfaceVersionInfoField ] ,
216257} ;
217258
218259export const generalPage : SettingsPage = {
219- id : 'generalPage' ,
260+ id : PAGE_IDS . GENERAL ,
220261 title : i18n ( 'page.general' ) ,
221262 icon : { data : StarFill , height : 14 , width : 14 } ,
222263 sections : [ appearanceSection ] ,
223264 hideTitle : true ,
224265} ;
225266
226267export const experimentsPage : SettingsPage = {
227- id : 'experimentsPage' ,
268+ id : PAGE_IDS . EXPERIMENTS ,
228269 title : i18n ( 'page.experiments' ) ,
229270 icon : { data : Flask } ,
230271 sections : [ experimentsSection ] ,
231272 hideTitle : true ,
232273} ;
233274
234275export const editorPage : SettingsPage = {
235- id : 'editorPage' ,
276+ id : PAGE_IDS . EDITOR ,
236277 title : i18n ( 'page.editor' ) ,
237278 icon : { data : PencilToSquare } ,
238279 sections : [ devSettingsSection ] ,
280+ hideTitle : true ,
239281} ;
240282
241283export const aboutPage : SettingsPage = {
242- id : 'aboutPage' ,
284+ id : PAGE_IDS . ABOUT ,
243285 title : i18n ( 'page.about' ) ,
244286 icon : { data : CircleInfo } ,
245287 sections : [ aboutSettingsSection ] ,
@@ -249,9 +291,11 @@ export const aboutPage: SettingsPage = {
249291export function getUserSettings ( {
250292 singleClusterMode,
251293 codeAssistantConfigured,
294+ clusterName,
252295} : {
253296 singleClusterMode : boolean ;
254297 codeAssistantConfigured ?: boolean ;
298+ clusterName ?: string ;
255299} ) {
256300 const experiments = singleClusterMode
257301 ? experimentsPage
@@ -266,7 +310,8 @@ export function getUserSettings({
266310 } )
267311 : editorPage ;
268312
269- const settings : YDBEmbeddedUISettings = [ generalPage , editor , experiments , aboutPage ] ;
313+ const baseSettings : YDBEmbeddedUISettings = [ generalPage , editor , experiments , aboutPage ] ;
270314
271- return settings ;
315+ // Apply cluster-specific query streaming logic
316+ return applyClusterSpecificQueryStreamingSetting ( baseSettings , clusterName ) ;
272317}
0 commit comments