From 938733e8628387f34d7197883a1bd4fe77ad94cd Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Fri, 26 Jun 2020 12:55:36 -0700 Subject: [PATCH] [Metrics UI] Fix EuiTheme type issue (#69735) Co-authored-by: Elastic Machine --- .../components/autocomplete_field/suggestion_item.tsx | 10 +++++----- .../public/components/logging/log_highlights_menu.tsx | 2 +- .../inventory_view/components/dropdown_button.tsx | 10 +++++----- .../waffle/metric_control/custom_metric_form.tsx | 10 +++++----- .../waffle/metric_control/metrics_edit_mode.tsx | 4 ++-- .../components/waffle/metric_control/mode_switcher.tsx | 4 ++-- .../metrics/inventory_view/components/waffle/node.tsx | 4 ++-- .../components/waffle/waffle_sort_controls.tsx | 6 +++--- .../components/waffle/waffle_time_controls.tsx | 8 ++++---- .../infra/public/pages/metrics/metric_detail/index.tsx | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx b/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx index f14494a8abc4..4bcb7a7ec8a0 100644 --- a/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx +++ b/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx @@ -104,15 +104,15 @@ const getEuiIconType = (suggestionType: QuerySuggestionTypes) => { const getEuiIconColor = (theme: any, suggestionType: QuerySuggestionTypes): string => { switch (suggestionType) { case QuerySuggestionTypes.Field: - return theme.eui.euiColorVis7; + return theme?.eui.euiColorVis7; case QuerySuggestionTypes.Value: - return theme.eui.euiColorVis0; + return theme?.eui.euiColorVis0; case QuerySuggestionTypes.Operator: - return theme.eui.euiColorVis1; + return theme?.eui.euiColorVis1; case QuerySuggestionTypes.Conjunction: - return theme.eui.euiColorVis2; + return theme?.eui.euiColorVis2; case QuerySuggestionTypes.RecentSearch: default: - return theme.eui.euiColorMediumShade; + return theme?.eui.euiColorMediumShade; } }; diff --git a/x-pack/plugins/infra/public/components/logging/log_highlights_menu.tsx b/x-pack/plugins/infra/public/components/logging/log_highlights_menu.tsx index 608a22a79c47..7beead461cb2 100644 --- a/x-pack/plugins/infra/public/components/logging/log_highlights_menu.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_highlights_menu.tsx @@ -166,7 +166,7 @@ const goToNextHighlightLabel = i18n.translate( const ActiveHighlightsIndicator = euiStyled(EuiIcon).attrs(({ theme }) => ({ type: 'checkInCircleFilled', size: 'm', - color: theme.eui.euiColorAccent, + color: theme?.eui.euiColorAccent, }))` padding-left: ${(props) => props.theme.eui.paddingSizes.xs}; `; diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/dropdown_button.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/dropdown_button.tsx index f0bc404dc379..6e3ebee2dcb4 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/dropdown_button.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/dropdown_button.tsx @@ -11,7 +11,7 @@ import { withTheme, EuiTheme } from '../../../../../../observability/public'; interface Props { label: string; onClick: () => void; - theme: EuiTheme; + theme: EuiTheme | undefined; children: ReactNode; } @@ -21,18 +21,18 @@ export const DropdownButton = withTheme(({ onClick, label, theme, children }: Pr alignItems="center" gutterSize="none" style={{ - border: theme.eui.euiFormInputGroupBorder, - boxShadow: `0px 3px 2px ${theme.eui.euiTableActionsBorderColor}, 0px 1px 1px ${theme.eui.euiTableActionsBorderColor}`, + border: theme?.eui.euiFormInputGroupBorder, + boxShadow: `0px 3px 2px ${theme?.eui.euiTableActionsBorderColor}, 0px 1px 1px ${theme?.eui.euiTableActionsBorderColor}`, }} > {label} diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.tsx index 4e7bdeddd624..a785cb31c3cf 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.tsx @@ -52,7 +52,7 @@ const AGGREGATION_LABELS = { }; interface Props { - theme: EuiTheme; + theme: EuiTheme | undefined; metric?: SnapshotCustomMetricInput; fields: IFieldType[]; customMetrics: SnapshotCustomMetricInput[]; @@ -158,8 +158,8 @@ export const CustomMetricForm = withTheme(
-
+
; onEdit: (metric: SnapshotCustomMetricInput) => void; @@ -28,7 +28,7 @@ export const MetricsEditMode = withTheme(
{options.map((option) => (
- {option.text} + {option.text}
))} {customMetrics.map((metric) => ( diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/mode_switcher.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/mode_switcher.tsx index acb740f1750c..d1abcade5d66 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/mode_switcher.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/mode_switcher.tsx @@ -15,7 +15,7 @@ import { } from '../../../../../../../../../legacy/common/eui_styled_components'; interface Props { - theme: EuiTheme; + theme: EuiTheme | undefined; onEdit: () => void; onAdd: () => void; onSave: () => void; @@ -32,7 +32,7 @@ export const ModeSwitcher = withTheme( return (
diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/node.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/node.tsx index 5f526197cbfb..e7bee82a9f0f 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/node.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/node.tsx @@ -152,8 +152,8 @@ const ValueInner = euiStyled.button` border: none; &:focus { outline: none !important; - border: ${(params) => params.theme.eui.euiFocusRingSize} solid - ${(params) => params.theme.eui.euiFocusRingColor}; + border: ${(params) => params.theme?.eui.euiFocusRingSize} solid + ${(params) => params.theme?.eui.euiFocusRingColor}; box-shadow: none; } `; diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx index b5e6aacd0e6f..a45ac0cee72d 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx @@ -107,7 +107,7 @@ export const WaffleSortControls = ({ sort, onChange }: Props) => { }; interface SwitchContainerProps { - theme: EuiTheme; + theme: EuiTheme | undefined; children: ReactNode; } @@ -115,8 +115,8 @@ const SwitchContainer = withTheme(({ children, theme }: SwitchContainerProps) => return (
{children} diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_time_controls.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_time_controls.tsx index fac1e086101e..da044b1cf99e 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_time_controls.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_time_controls.tsx @@ -12,7 +12,7 @@ import { withTheme, EuiTheme } from '../../../../../../../observability/public'; import { useWaffleTimeContext } from '../../hooks/use_waffle_time'; interface Props { - theme: EuiTheme; + theme: EuiTheme | undefined; } export const WaffleTimeControls = withTheme(({ theme }: Props) => { @@ -56,9 +56,9 @@ export const WaffleTimeControls = withTheme(({ theme }: Props) => { diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx index 4ae96f733382..60c8041fb5ef 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx @@ -27,7 +27,7 @@ const DetailPageContent = euiStyled(PageContent)` `; interface Props { - theme: EuiTheme; + theme: EuiTheme | undefined; match: { params: { type: string;