11import React , { useEffect , useState } from 'react' ;
2- import { TextInput } from '@patternfly/react-core' ;
2+ import { TextArea } from '@patternfly/react-core' ;
33
44import { IOptionsAdditionalFields , ITimes , Options , Toolbar , ToolbarItem } from '@kobsio/shared' ;
55import { IOptions } from '../../utils/interfaces' ;
@@ -12,11 +12,12 @@ interface ILogsToolbarProps {
1212const LogsToolbar : React . FunctionComponent < ILogsToolbarProps > = ( { options, setOptions } : ILogsToolbarProps ) => {
1313 const [ query , setQuery ] = useState < string > ( options . query ) ;
1414
15- // onEnter is used to detect if the user pressed the "ENTER" key. If this is the case we are calling the setOptions
16- // function to trigger the search.
17- // use "SHIFT" + "ENTER".
18- const onEnter = ( e : React . KeyboardEvent < HTMLInputElement > | undefined ) : void => {
15+ // onEnter is used to detect if the user pressed the "ENTER" key. If this is the case we will not add a newline.
16+ // Instead of this we are calling the setOptions function to trigger the search.
17+ // use "SHIFT" + "ENTER" to write multiple lines .
18+ const onEnter = ( e : React . KeyboardEvent < HTMLTextAreaElement > | undefined ) : void => {
1919 if ( e ?. key === 'Enter' && ! e . shiftKey ) {
20+ e . preventDefault ( ) ;
2021 setOptions ( { ...options , query : query } ) ;
2122 }
2223 } ;
@@ -42,8 +43,10 @@ const LogsToolbar: React.FunctionComponent<ILogsToolbarProps> = ({ options, setO
4243 return (
4344 < Toolbar usePageInsets = { true } >
4445 < ToolbarItem grow = { true } >
45- < TextInput
46+ < TextArea
4647 aria-label = "Query"
48+ resizeOrientation = "vertical"
49+ rows = { 1 }
4750 type = "text"
4851 value = { query }
4952 onChange = { ( value : string ) : void => setQuery ( value ) }
0 commit comments