@@ -72,6 +72,7 @@ export interface Props {
7272 executionTime ?: number
7373 emptyCommand ?: boolean
7474 db ?: number
75+ hideFields ?: string [ ]
7576 toggleOpen : ( ) => void
7677 toggleFullScreen : ( ) => void
7778 setSelectedValue : ( type : WBQueryType , value : string ) => void
@@ -80,6 +81,11 @@ export interface Props {
8081 onQueryProfile : ( type : ProfileQueryType ) => void
8182}
8283
84+ export const HIDE_FIELDS = {
85+ viewType : 'viewType' ,
86+ profiler : 'profiler' ,
87+ }
88+
8389const getExecutionTimeString = ( value : number ) : string => {
8490 if ( value < 1 ) {
8591 return '0.001 msec'
@@ -137,6 +143,7 @@ const QueryCardHeader = (props: Props) => {
137143 onQueryReRun,
138144 onQueryProfile,
139145 db,
146+ hideFields = [ ] ,
140147 } = props
141148
142149 const { visualizations = [ ] } = useSelector ( appPluginsSelector )
@@ -410,54 +417,58 @@ const QueryCardHeader = (props: Props) => {
410417 </ RiTooltip >
411418 ) }
412419 </ FlexItem >
413- < FlexItem
414- className = { cx ( styles . buttonIcon , styles . viewTypeIcon ) }
415- onClick = { onDropDownViewClick }
416- >
417- { isOpen && canCommandProfile && ! summaryText && (
418- < div className = { styles . dropdownWrapper } >
419- < div className = { styles . dropdown } >
420- < ProfileSelect
421- placeholder = { profileOptions [ 0 ] . inputDisplay }
422- onChange = { ( value : ProfileQueryType | string ) =>
423- onQueryProfile ( value as ProfileQueryType )
424- }
425- options = { profileOptions }
426- data-testid = "run-profile-type"
427- valueRender = { ( { option, isOptionValue } ) => {
428- if ( isOptionValue ) {
429- return option . dropdownDisplay as JSX . Element
420+ { ! hideFields ?. includes ( HIDE_FIELDS . profiler ) && (
421+ < FlexItem
422+ className = { cx ( styles . buttonIcon , styles . viewTypeIcon ) }
423+ onClick = { onDropDownViewClick }
424+ >
425+ { isOpen && canCommandProfile && ! summaryText && (
426+ < div className = { styles . dropdownWrapper } >
427+ < div className = { styles . dropdown } >
428+ < ProfileSelect
429+ placeholder = { profileOptions [ 0 ] . inputDisplay }
430+ onChange = { ( value : ProfileQueryType | string ) =>
431+ onQueryProfile ( value as ProfileQueryType )
430432 }
431- return option . inputDisplay as JSX . Element
432- } }
433- />
433+ options = { profileOptions }
434+ data-testid = "run-profile-type"
435+ valueRender = { ( { option, isOptionValue } ) => {
436+ if ( isOptionValue ) {
437+ return option . dropdownDisplay as JSX . Element
438+ }
439+ return option . inputDisplay as JSX . Element
440+ } }
441+ />
442+ </ div >
434443 </ div >
435- </ div >
436- ) }
437- </ FlexItem >
438- < FlexItem
439- className = { cx ( styles . buttonIcon , styles . viewTypeIcon ) }
440- onClick = { onDropDownViewClick }
441- >
442- { isOpen && options . length > 1 && ! summaryText && (
443- < div className = { styles . dropdownWrapper } >
444- < div className = { styles . dropdown } >
445- < ProfileSelect
446- options = { modifiedOptions }
447- valueRender = { ( { option, isOptionValue } ) => {
448- if ( isOptionValue ) {
449- return option . dropdownDisplay as JSX . Element
450- }
451- return option . inputDisplay as JSX . Element
452- } }
453- value = { selectedValue }
454- onChange = { ( value : string ) => onChangeView ( value ) }
455- data-testid = "select-view-type"
456- />
444+ ) }
445+ </ FlexItem >
446+ ) }
447+ { ! hideFields ?. includes ( HIDE_FIELDS . viewType ) && (
448+ < FlexItem
449+ className = { cx ( styles . buttonIcon , styles . viewTypeIcon ) }
450+ onClick = { onDropDownViewClick }
451+ >
452+ { isOpen && options . length > 1 && ! summaryText && (
453+ < div className = { styles . dropdownWrapper } >
454+ < div className = { styles . dropdown } >
455+ < ProfileSelect
456+ options = { modifiedOptions }
457+ valueRender = { ( { option, isOptionValue } ) => {
458+ if ( isOptionValue ) {
459+ return option . dropdownDisplay as JSX . Element
460+ }
461+ return option . inputDisplay as JSX . Element
462+ } }
463+ value = { selectedValue }
464+ onChange = { ( value : string ) => onChangeView ( value ) }
465+ data-testid = "select-view-type"
466+ />
467+ </ div >
457468 </ div >
458- </ div >
459- ) }
460- </ FlexItem >
469+ ) }
470+ </ FlexItem >
471+ ) }
461472 < FlexItem
462473 className = { styles . buttonIcon }
463474 onClick = { onDropDownViewClick }
0 commit comments