Skip to content

Commit 741992d

Browse files
authored
Disable query bar on service map routes (#60118) (#60151)
1 parent 942ac82 commit 741992d

File tree

1 file changed

+22
-12
lines changed
  • x-pack/legacy/plugins/apm/public/components/shared/KueryBar

1 file changed

+22
-12
lines changed

x-pack/legacy/plugins/apm/public/components/shared/KueryBar/index.tsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = /\/service-map$/.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

Comments
 (0)