@@ -62,6 +62,26 @@ export function KueryBar() {
6262
6363 const { indexPattern } = useDynamicIndexPattern ( processorEvent ) ;
6464
65+ const placeholder = i18n . translate ( 'xpack.apm.kueryBar.placeholder' , {
66+ defaultMessage : `Search {event, select,
67+ transaction {transactions}
68+ metric {metrics}
69+ error {errors}
70+ other {transactions, errors and metrics}
71+ } (E.g. {queryExample})` ,
72+ values : {
73+ queryExample : example ,
74+ event : processorEvent
75+ }
76+ } ) ;
77+
78+ // The bar should be disabled when viewing the service map
79+ const disabled = / \/ s e r v i c e - m a p $ / . test ( location . pathname ) ;
80+ const disabledPlaceholder = i18n . translate (
81+ 'xpack.apm.kueryBar.disabledPlaceholder' ,
82+ { defaultMessage : 'Search is not available for service maps' }
83+ ) ;
84+
6585 async function onChange ( inputValue : string , selectionStart : number ) {
6686 if ( indexPattern == null ) {
6787 return ;
@@ -123,23 +143,13 @@ export function KueryBar() {
123143 return (
124144 < Container >
125145 < Typeahead
146+ disabled = { disabled }
126147 isLoading = { state . isLoadingSuggestions }
127148 initialValue = { urlParams . kuery }
128149 onChange = { onChange }
129150 onSubmit = { onSubmit }
130151 suggestions = { state . suggestions }
131- placeholder = { i18n . translate ( 'xpack.apm.kueryBar.placeholder' , {
132- defaultMessage : `Search {event, select,
133- transaction {transactions}
134- metric {metrics}
135- error {errors}
136- other {transactions, errors and metrics}
137- } (E.g. {queryExample})` ,
138- values : {
139- queryExample : example ,
140- event : processorEvent
141- }
142- } ) }
152+ placeholder = { disabled ? disabledPlaceholder : placeholder }
143153 />
144154 </ Container >
145155 ) ;
0 commit comments