diff --git a/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessage.tsx b/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessage.tsx index 2c96fd69ff..567e094e8a 100644 --- a/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessage.tsx +++ b/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessage.tsx @@ -22,11 +22,19 @@ import { getPartitionsByTopicName, getTopicMessageSchemaFetched, } from 'redux/reducers/topics/selectors'; +import Select, { SelectOption } from 'components/common/Select/Select'; import useAppParams from 'lib/hooks/useAppParams'; import validateMessage from './validateMessage'; import * as S from './SendMessage.styled'; +type FieldValues = Partial<{ + key: string; + content: string; + headers: string; + partition: number | string; +}>; + const SendMessage: React.FC = () => { const dispatch = useAppDispatch(); const { clusterName, topicName } = useAppParams(); @@ -46,6 +54,10 @@ const SendMessage: React.FC = () => { getPartitionsByTopicName(state, topicName) ); const schemaIsFetched = useAppSelector(getTopicMessageSchemaFetched); + const selectPartitionOptions: Array = partitions.map((p) => { + const value = String(p.partition); + return { value, label: value }; + }); const keyDefaultValue = React.useMemo(() => { if (!schemaIsFetched || !messageSchema) { @@ -70,12 +82,11 @@ const SendMessage: React.FC = () => { }, [messageSchema, schemaIsFetched]); const { - register, handleSubmit, formState: { isSubmitting, isDirty }, control, reset, - } = useForm({ + } = useForm({ mode: 'onChange', defaultValues: { key: keyDefaultValue, @@ -156,24 +167,30 @@ const SendMessage: React.FC = () => {
-
-