From e3d74c0caa78255cf2dc03b18e9af7019b623c81 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Wed, 16 Dec 2020 16:58:06 -0500 Subject: [PATCH] Closes #83663 by adding a prepend label to the search bar in service overview (#86143) --- .../components/app/service_overview/index.tsx | 10 +++++++++- .../shared/KueryBar/Typeahead/index.js | 16 ++++++++++++---- .../public/components/shared/KueryBar/index.tsx | 3 ++- .../apm/public/components/shared/search_bar.tsx | 4 ++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/apm/public/components/app/service_overview/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/index.tsx index 6db5b1ae7bc7c..976fb127604aa 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/index.tsx @@ -5,10 +5,12 @@ */ import { EuiFlexGroup, EuiFlexItem, EuiPage, EuiPanel } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; import React from 'react'; import { useTrackPageview } from '../../../../../observability/public'; import { isRumAgentName } from '../../../../common/agent_name'; import { AnnotationsContextProvider } from '../../../context/annotations/annotations_context'; +import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context'; import { ChartPointerEventContextProvider } from '../../../context/chart_pointer_event/chart_pointer_event_context'; import { LatencyChart } from '../../shared/charts/latency_chart'; import { TransactionBreakdownChart } from '../../shared/charts/transaction_breakdown_chart'; @@ -38,10 +40,16 @@ export function ServiceOverview({ useTrackPageview({ app: 'apm', path: 'service_overview' }); useTrackPageview({ app: 'apm', path: 'service_overview', delay: 15000 }); + const { transactionType } = useApmServiceContext(); + const transactionTypeLabel = i18n.translate( + 'xpack.apm.serviceOverview.searchBar.transactionTypeLabel', + { defaultMessage: 'Type: {transactionType}', values: { transactionType } } + ); + return ( - + diff --git a/x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/index.js b/x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/index.js index 741df4ca2eb8c..58039bce66219 100644 --- a/x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/index.js +++ b/x-pack/plugins/apm/public/components/shared/KueryBar/Typeahead/index.js @@ -156,7 +156,13 @@ export class Typeahead extends Component { }; render() { - const { placeholder } = this.props; + const { + disabled, + isLoading, + placeholder, + prepend, + suggestions, + } = this.props; return ( - {this.props.isLoading && ( + {isLoading && ( ); diff --git a/x-pack/plugins/apm/public/components/shared/search_bar.tsx b/x-pack/plugins/apm/public/components/shared/search_bar.tsx index 686df42cf3b8a..6382f4937ac0e 100644 --- a/x-pack/plugins/apm/public/components/shared/search_bar.tsx +++ b/x-pack/plugins/apm/public/components/shared/search_bar.tsx @@ -15,11 +15,11 @@ const SearchBarFlexGroup = styled(EuiFlexGroup)` `${theme.eui.euiSizeM} ${theme.eui.euiSizeM} -${theme.eui.gutterTypes.gutterMedium} ${theme.eui.euiSizeM}`}; `; -export function SearchBar() { +export function SearchBar(props: { prepend?: React.ReactNode | string }) { return ( - +