@@ -72,6 +72,7 @@ export interface Props {
72
72
executionTime ?: number
73
73
emptyCommand ?: boolean
74
74
db ?: number
75
+ hideFields ?: string [ ]
75
76
toggleOpen : ( ) => void
76
77
toggleFullScreen : ( ) => void
77
78
setSelectedValue : ( type : WBQueryType , value : string ) => void
@@ -80,6 +81,11 @@ export interface Props {
80
81
onQueryProfile : ( type : ProfileQueryType ) => void
81
82
}
82
83
84
+ export const HIDE_FIELDS = {
85
+ viewType : 'viewType' ,
86
+ profiler : 'profiler' ,
87
+ }
88
+
83
89
const getExecutionTimeString = ( value : number ) : string => {
84
90
if ( value < 1 ) {
85
91
return '0.001 msec'
@@ -137,6 +143,7 @@ const QueryCardHeader = (props: Props) => {
137
143
onQueryReRun,
138
144
onQueryProfile,
139
145
db,
146
+ hideFields = [ ] ,
140
147
} = props
141
148
142
149
const { visualizations = [ ] } = useSelector ( appPluginsSelector )
@@ -410,54 +417,58 @@ const QueryCardHeader = (props: Props) => {
410
417
</ RiTooltip >
411
418
) }
412
419
</ 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 )
430
432
}
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 >
434
443
</ 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 >
457
468
</ div >
458
- </ div >
459
- ) }
460
- </ FlexItem >
469
+ ) }
470
+ </ FlexItem >
471
+ ) }
461
472
< FlexItem
462
473
className = { styles . buttonIcon }
463
474
onClick = { onDropDownViewClick }
0 commit comments