@@ -11,6 +11,7 @@ import {
1111 TENANT_QUERY_TABS_ID ,
1212} from '../../../store/reducers/tenant/constants' ;
1313import { setDiagnosticsTab , setQueryTab , setTenantPage } from '../../../store/reducers/tenant/tenant' ;
14+ import type { IQueryResult } from '../../../types/store/query' ;
1415import createToast from '../../../utils/createToast' ;
1516import { insertSnippetToEditor } from '../../../utils/monaco/insertSnippet' ;
1617import { transformPath } from '../ObjectSummary/transformPath' ;
@@ -21,19 +22,23 @@ import type {TemplateFn} from './schemaQueryTemplates';
2122import {
2223 addTableIndex ,
2324 alterAsyncReplicationTemplate ,
25+ alterStreamingQuerySettingsTemplate ,
26+ alterStreamingQueryText ,
2427 alterTableTemplate ,
2528 alterTopicTemplate ,
2629 alterTransferTemplate ,
2730 createAsyncReplicationTemplate ,
2831 createCdcStreamTemplate ,
2932 createColumnTableTemplate ,
3033 createExternalTableTemplate ,
34+ createStreamingQueryTemplate ,
3135 createTableTemplate ,
3236 createTopicTemplate ,
3337 createTransferTemplate ,
3438 createViewTemplate ,
3539 dropAsyncReplicationTemplate ,
3640 dropExternalTableTemplate ,
41+ dropStreamingQueryTemplate ,
3742 dropTableIndex ,
3843 dropTableTemplate ,
3944 dropTopicTemplate ,
@@ -53,6 +58,8 @@ interface ActionsAdditionalParams {
5358 schemaData ?: SchemaData [ ] ;
5459 isSchemaDataLoading ?: boolean ;
5560 hasMonitoring ?: boolean ;
61+ streamingQueryData ?: IQueryResult ;
62+ isStreamingQueryTextLoading ?: boolean ;
5663}
5764
5865interface BindActionParams {
@@ -74,6 +81,7 @@ const bindActions = (
7481 getConfirmation,
7582 getConnectToDBDialog,
7683 schemaData,
84+ streamingQueryData,
7785 } = additionalEffects ;
7886
7987 const inputQuery = ( tmpl : TemplateFn ) => ( ) => {
@@ -82,7 +90,7 @@ const bindActions = (
8290 dispatch ( setTenantPage ( TENANT_PAGES_IDS . query ) ) ;
8391 dispatch ( setQueryTab ( TENANT_QUERY_TABS_ID . newQuery ) ) ;
8492 setActivePath ( params . path ) ;
85- insertSnippetToEditor ( tmpl ( { ...params , schemaData} ) ) ;
93+ insertSnippetToEditor ( tmpl ( { ...params , schemaData, streamingQueryData } ) ) ;
8694 } ;
8795 if ( getConfirmation ) {
8896 const confirmedPromise = getConfirmation ( ) ;
@@ -129,6 +137,10 @@ const bindActions = (
129137 dropTopic : inputQuery ( dropTopicTemplate ) ,
130138 createView : inputQuery ( createViewTemplate ) ,
131139 dropView : inputQuery ( dropViewTemplate ) ,
140+ createStreamingQuery : inputQuery ( createStreamingQueryTemplate ) ,
141+ alterStreamingQuerySettings : inputQuery ( alterStreamingQuerySettingsTemplate ) ,
142+ alterStreamingQueryText : inputQuery ( alterStreamingQueryText ) ,
143+ dropStreamingQuery : inputQuery ( dropStreamingQueryTemplate ) ,
132144 dropIndex : inputQuery ( dropTableIndex ) ,
133145 addTableIndex : inputQuery ( addTableIndex ) ,
134146 createCdcStream : inputQuery ( createCdcStreamTemplate ) ,
@@ -219,6 +231,7 @@ export const getActions =
219231 } ,
220232 { text : i18n ( 'actions.createTopic' ) , action : actions . createTopic } ,
221233 { text : i18n ( 'actions.createView' ) , action : actions . createView } ,
234+ { text : i18n ( 'actions.createStreamingQuery' ) , action : actions . createStreamingQuery } ,
222235 ] ;
223236
224237 const alterTableGroupItem = {
@@ -334,6 +347,25 @@ export const getActions =
334347 [ copyItem , { text : i18n ( 'actions.dropIndex' ) , action : actions . dropIndex } ] ,
335348 ] ;
336349
350+ const STREAMING_QUERY_SET : ActionsSet = [
351+ [ copyItem ] ,
352+ [
353+ {
354+ text : i18n ( 'actions.alterStreamingQuerySettings' ) ,
355+ action : actions . alterStreamingQuerySettings ,
356+ } ,
357+ getActionWithLoader ( {
358+ text : i18n ( 'actions.alterStreamingQueryText' ) ,
359+ action : actions . alterStreamingQueryText ,
360+ isLoading : additionalEffects . isStreamingQueryTextLoading ,
361+ } ) ,
362+ {
363+ text : i18n ( 'actions.dropStreamingQuery' ) ,
364+ action : actions . dropStreamingQuery ,
365+ } ,
366+ ] ,
367+ ] ;
368+
337369 const JUST_COPY : ActionsSet = [ copyItem ] ;
338370
339371 // verbose mapping to guarantee a correct actions set for new node types
@@ -362,7 +394,7 @@ export const getActions =
362394
363395 view : VIEW_SET ,
364396
365- streaming_query : JUST_COPY ,
397+ streaming_query : STREAMING_QUERY_SET ,
366398 } ;
367399
368400 return nodeTypeToActions [ type ] ;
0 commit comments