Skip to content

Commit b3cf9f6

Browse files
[Metrics UI] Fix EuiTheme type issue (elastic#69735)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 14699f7 commit b3cf9f6

File tree

10 files changed

+30
-30
lines changed

10 files changed

+30
-30
lines changed

x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ const getEuiIconType = (suggestionType: QuerySuggestionTypes) => {
104104
const getEuiIconColor = (theme: any, suggestionType: QuerySuggestionTypes): string => {
105105
switch (suggestionType) {
106106
case QuerySuggestionTypes.Field:
107-
return theme.eui.euiColorVis7;
107+
return theme?.eui.euiColorVis7;
108108
case QuerySuggestionTypes.Value:
109-
return theme.eui.euiColorVis0;
109+
return theme?.eui.euiColorVis0;
110110
case QuerySuggestionTypes.Operator:
111-
return theme.eui.euiColorVis1;
111+
return theme?.eui.euiColorVis1;
112112
case QuerySuggestionTypes.Conjunction:
113-
return theme.eui.euiColorVis2;
113+
return theme?.eui.euiColorVis2;
114114
case QuerySuggestionTypes.RecentSearch:
115115
default:
116-
return theme.eui.euiColorMediumShade;
116+
return theme?.eui.euiColorMediumShade;
117117
}
118118
};

x-pack/plugins/infra/public/components/logging/log_highlights_menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const goToNextHighlightLabel = i18n.translate(
166166
const ActiveHighlightsIndicator = euiStyled(EuiIcon).attrs(({ theme }) => ({
167167
type: 'checkInCircleFilled',
168168
size: 'm',
169-
color: theme.eui.euiColorAccent,
169+
color: theme?.eui.euiColorAccent,
170170
}))`
171171
padding-left: ${(props) => props.theme.eui.paddingSizes.xs};
172172
`;

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/dropdown_button.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { withTheme, EuiTheme } from '../../../../../../observability/public';
1111
interface Props {
1212
label: string;
1313
onClick: () => void;
14-
theme: EuiTheme;
14+
theme: EuiTheme | undefined;
1515
children: ReactNode;
1616
}
1717

@@ -21,18 +21,18 @@ export const DropdownButton = withTheme(({ onClick, label, theme, children }: Pr
2121
alignItems="center"
2222
gutterSize="none"
2323
style={{
24-
border: theme.eui.euiFormInputGroupBorder,
25-
boxShadow: `0px 3px 2px ${theme.eui.euiTableActionsBorderColor}, 0px 1px 1px ${theme.eui.euiTableActionsBorderColor}`,
24+
border: theme?.eui.euiFormInputGroupBorder,
25+
boxShadow: `0px 3px 2px ${theme?.eui.euiTableActionsBorderColor}, 0px 1px 1px ${theme?.eui.euiTableActionsBorderColor}`,
2626
}}
2727
>
2828
<EuiFlexItem
2929
grow={false}
3030
style={{
3131
padding: 12,
32-
background: theme.eui.euiFormInputGroupLabelBackground,
32+
background: theme?.eui.euiFormInputGroupLabelBackground,
3333
fontSize: '0.75em',
3434
fontWeight: 600,
35-
color: theme.eui.euiTitleColor,
35+
color: theme?.eui.euiTitleColor,
3636
}}
3737
>
3838
{label}

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const AGGREGATION_LABELS = {
5252
};
5353

5454
interface Props {
55-
theme: EuiTheme;
55+
theme: EuiTheme | undefined;
5656
metric?: SnapshotCustomMetricInput;
5757
fields: IFieldType[];
5858
customMetrics: SnapshotCustomMetricInput[];
@@ -158,8 +158,8 @@ export const CustomMetricForm = withTheme(
158158
</EuiPopoverTitle>
159159
<div
160160
style={{
161-
padding: theme.eui.paddingSizes.m,
162-
borderBottom: `${theme.eui.euiBorderWidthThin} solid ${theme.eui.euiBorderColor}`,
161+
padding: theme?.eui.paddingSizes.m,
162+
borderBottom: `${theme?.eui.euiBorderWidthThin} solid ${theme?.eui.euiBorderColor}`,
163163
}}
164164
>
165165
<EuiFormRow
@@ -219,11 +219,11 @@ export const CustomMetricForm = withTheme(
219219
/>
220220
</EuiFormRow>
221221
</div>
222-
<div style={{ padding: theme.eui.paddingSizes.m, textAlign: 'right' }}>
222+
<div style={{ padding: theme?.eui.paddingSizes.m, textAlign: 'right' }}>
223223
<EuiButtonEmpty
224224
onClick={onCancel}
225225
size="s"
226-
style={{ paddingRight: theme.eui.paddingSizes.xl }}
226+
style={{ paddingRight: theme?.eui.paddingSizes.xl }}
227227
>
228228
<FormattedMessage
229229
id="xpack.infra.waffle.customMetrics.cancelLabel"

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/metrics_edit_mode.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from '../../../../../../../../../legacy/common/eui_styled_components';
1515

1616
interface Props {
17-
theme: EuiTheme;
17+
theme: EuiTheme | undefined;
1818
customMetrics: SnapshotCustomMetricInput[];
1919
options: Array<{ text: string; value: string }>;
2020
onEdit: (metric: SnapshotCustomMetricInput) => void;
@@ -28,7 +28,7 @@ export const MetricsEditMode = withTheme(
2828
<div style={{ width: 256 }}>
2929
{options.map((option) => (
3030
<div key={option.value} style={{ padding: '14px 14px 13px 36px' }}>
31-
<span style={{ color: theme.eui.euiButtonColorDisabled }}>{option.text}</span>
31+
<span style={{ color: theme?.eui.euiButtonColorDisabled }}>{option.text}</span>
3232
</div>
3333
))}
3434
{customMetrics.map((metric) => (

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/mode_switcher.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '../../../../../../../../../legacy/common/eui_styled_components';
1616

1717
interface Props {
18-
theme: EuiTheme;
18+
theme: EuiTheme | undefined;
1919
onEdit: () => void;
2020
onAdd: () => void;
2121
onSave: () => void;
@@ -32,7 +32,7 @@ export const ModeSwitcher = withTheme(
3232
return (
3333
<div
3434
style={{
35-
borderTop: `${theme.eui.euiBorderWidthThin} solid ${theme.eui.euiBorderColor}`,
35+
borderTop: `${theme?.eui.euiBorderWidthThin} solid ${theme?.eui.euiBorderColor}`,
3636
padding: 12,
3737
}}
3838
>

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/node.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ const ValueInner = euiStyled.button`
152152
border: none;
153153
&:focus {
154154
outline: none !important;
155-
border: ${(params) => params.theme.eui.euiFocusRingSize} solid
156-
${(params) => params.theme.eui.euiFocusRingColor};
155+
border: ${(params) => params.theme?.eui.euiFocusRingSize} solid
156+
${(params) => params.theme?.eui.euiFocusRingColor};
157157
box-shadow: none;
158158
}
159159
`;

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,16 @@ export const WaffleSortControls = ({ sort, onChange }: Props) => {
107107
};
108108

109109
interface SwitchContainerProps {
110-
theme: EuiTheme;
110+
theme: EuiTheme | undefined;
111111
children: ReactNode;
112112
}
113113

114114
const SwitchContainer = withTheme(({ children, theme }: SwitchContainerProps) => {
115115
return (
116116
<div
117117
style={{
118-
padding: theme.eui.paddingSizes.m,
119-
borderTop: `1px solid ${theme.eui.euiBorderColor}`,
118+
padding: theme?.eui.paddingSizes.m,
119+
borderTop: `1px solid ${theme?.eui.euiBorderColor}`,
120120
}}
121121
>
122122
{children}

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_time_controls.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { withTheme, EuiTheme } from '../../../../../../../observability/public';
1212
import { useWaffleTimeContext } from '../../hooks/use_waffle_time';
1313

1414
interface Props {
15-
theme: EuiTheme;
15+
theme: EuiTheme | undefined;
1616
}
1717

1818
export const WaffleTimeControls = withTheme(({ theme }: Props) => {
@@ -56,9 +56,9 @@ export const WaffleTimeControls = withTheme(({ theme }: Props) => {
5656
<EuiFlexItem
5757
grow={false}
5858
style={{
59-
border: theme.eui.euiFormInputGroupBorder,
60-
boxShadow: `0px 3px 2px ${theme.eui.euiTableActionsBorderColor}, 0px 1px 1px ${theme.eui.euiTableActionsBorderColor}`,
61-
marginRight: theme.eui.paddingSizes.m,
59+
border: theme?.eui.euiFormInputGroupBorder,
60+
boxShadow: `0px 3px 2px ${theme?.eui.euiTableActionsBorderColor}, 0px 1px 1px ${theme?.eui.euiTableActionsBorderColor}`,
61+
marginRight: theme?.eui.paddingSizes.m,
6262
}}
6363
data-test-subj="waffleDatePicker"
6464
>

x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const DetailPageContent = euiStyled(PageContent)`
2727
`;
2828

2929
interface Props {
30-
theme: EuiTheme;
30+
theme: EuiTheme | undefined;
3131
match: {
3232
params: {
3333
type: string;

0 commit comments

Comments
 (0)