import { QueryDataSourceForHolder } from '@/services/data/tuples/query-data-source-types' ; import { Topic , TopicType } from '@/services/data/tuples/topic-types' ; import { DropdownOption } from '@/widgets/basic/types' ; import { useForceUpdate } from '@/widgets/basic/utils' ; import { TuplePropertyDropdown } from '@/widgets/tuple-workbench/tuple-editor' ; import React from 'react' ; import { useTopicEventBus } from '../topic-event-bus' ; import { TopicEventTypes } from '../topic-event-bus-types' ; export const TopicDataSourceInput = ( props ) => { const { topic , dataSources } = props ; const { fire } = useTopicEventBus ( ) ; const forceUpdate = useForceUpdate ( ) ; const onDataSourceChange = ( option ) => { topic . dataSourceId = option . value as TopicType ; fire ( TopicEventTypes . TOPIC_DATA_SOURCE_CHANGED , topic ) ; forceUpdate ( ) ; } ; const options = dataSources . map ( dataSource => { return { value : dataSource . dataSourceId , label : dataSource . dataSourceCode } ; } ) ; return < TuplePropertyDropdown value = { topic . dataSourceId || '' } options = { options } onChange = { onDataSourceChange } / > ; } ;