[Metrics UI] Fix EuiTheme type issue (#69735)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Chris Cowan 2020-06-26 12:55:36 -07:00 committed by GitHub
parent e4aaed6926
commit 938733e862
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 30 additions and 30 deletions

View file

@ -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;
}
};

View file

@ -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};
`;

View file

@ -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}`,
}}
>
<EuiFlexItem
grow={false}
style={{
padding: 12,
background: theme.eui.euiFormInputGroupLabelBackground,
background: theme?.eui.euiFormInputGroupLabelBackground,
fontSize: '0.75em',
fontWeight: 600,
color: theme.eui.euiTitleColor,
color: theme?.eui.euiTitleColor,
}}
>
{label}

View file

@ -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(
</EuiPopoverTitle>
<div
style={{
padding: theme.eui.paddingSizes.m,
borderBottom: `${theme.eui.euiBorderWidthThin} solid ${theme.eui.euiBorderColor}`,
padding: theme?.eui.paddingSizes.m,
borderBottom: `${theme?.eui.euiBorderWidthThin} solid ${theme?.eui.euiBorderColor}`,
}}
>
<EuiFormRow
@ -219,11 +219,11 @@ export const CustomMetricForm = withTheme(
/>
</EuiFormRow>
</div>
<div style={{ padding: theme.eui.paddingSizes.m, textAlign: 'right' }}>
<div style={{ padding: theme?.eui.paddingSizes.m, textAlign: 'right' }}>
<EuiButtonEmpty
onClick={onCancel}
size="s"
style={{ paddingRight: theme.eui.paddingSizes.xl }}
style={{ paddingRight: theme?.eui.paddingSizes.xl }}
>
<FormattedMessage
id="xpack.infra.waffle.customMetrics.cancelLabel"

View file

@ -14,7 +14,7 @@ import {
} from '../../../../../../../../../legacy/common/eui_styled_components';
interface Props {
theme: EuiTheme;
theme: EuiTheme | undefined;
customMetrics: SnapshotCustomMetricInput[];
options: Array<{ text: string; value: string }>;
onEdit: (metric: SnapshotCustomMetricInput) => void;
@ -28,7 +28,7 @@ export const MetricsEditMode = withTheme(
<div style={{ width: 256 }}>
{options.map((option) => (
<div key={option.value} style={{ padding: '14px 14px 13px 36px' }}>
<span style={{ color: theme.eui.euiButtonColorDisabled }}>{option.text}</span>
<span style={{ color: theme?.eui.euiButtonColorDisabled }}>{option.text}</span>
</div>
))}
{customMetrics.map((metric) => (

View file

@ -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 (
<div
style={{
borderTop: `${theme.eui.euiBorderWidthThin} solid ${theme.eui.euiBorderColor}`,
borderTop: `${theme?.eui.euiBorderWidthThin} solid ${theme?.eui.euiBorderColor}`,
padding: 12,
}}
>

View file

@ -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;
}
`;

View file

@ -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 (
<div
style={{
padding: theme.eui.paddingSizes.m,
borderTop: `1px solid ${theme.eui.euiBorderColor}`,
padding: theme?.eui.paddingSizes.m,
borderTop: `1px solid ${theme?.eui.euiBorderColor}`,
}}
>
{children}

View file

@ -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) => {
<EuiFlexItem
grow={false}
style={{
border: theme.eui.euiFormInputGroupBorder,
boxShadow: `0px 3px 2px ${theme.eui.euiTableActionsBorderColor}, 0px 1px 1px ${theme.eui.euiTableActionsBorderColor}`,
marginRight: theme.eui.paddingSizes.m,
border: theme?.eui.euiFormInputGroupBorder,
boxShadow: `0px 3px 2px ${theme?.eui.euiTableActionsBorderColor}, 0px 1px 1px ${theme?.eui.euiTableActionsBorderColor}`,
marginRight: theme?.eui.paddingSizes.m,
}}
data-test-subj="waffleDatePicker"
>

View file

@ -27,7 +27,7 @@ const DetailPageContent = euiStyled(PageContent)`
`;
interface Props {
theme: EuiTheme;
theme: EuiTheme | undefined;
match: {
params: {
type: string;