Skip to content

Commit

Permalink
Merge branch 'master' into cross_cluster_search
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Jun 26, 2020
2 parents f304e3a + 59925da commit 13d676d
Show file tree
Hide file tree
Showing 95 changed files with 2,661 additions and 915 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.dscFieldDetails__barContainer {
// Constrains value to the flex item, and allows for truncation when necessary
min-width: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
* under the License.
*/
import React from 'react';
import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import { EuiText, EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { StringFieldProgressBar } from './string_progress_bar';
import { Bucket } from './types';
import { IndexPatternField } from '../../../../../data/public';
import './discover_field_bucket.scss';

interface Props {
bucket: Bucket;
Expand All @@ -47,18 +48,40 @@ export function DiscoverFieldBucket({ field, bucket, onAddFilter }: Props) {

return (
<>
<EuiFlexGroup gutterSize="xs" responsive={false}>
<EuiFlexItem className="eui-textTruncate">
<EuiText size="xs" className="eui-textTruncate">
{bucket.display === '' ? emptyTxt : bucket.display}
</EuiText>
<EuiFlexGroup justifyContent="spaceBetween" responsive={false} gutterSize="s">
<EuiFlexItem className="dscFieldDetails__barContainer" grow={1}>
<EuiFlexGroup justifyContent="spaceBetween" gutterSize="xs" responsive={false}>
<EuiFlexItem grow={1} className="eui-textTruncate">
<EuiText
title={
bucket.display === ''
? emptyTxt
: `${bucket.display}: ${bucket.count} (${bucket.percent}%)`
}
size="xs"
className="eui-textTruncate"
>
{bucket.display === '' ? emptyTxt : bucket.display}
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false} className="eui-textTruncate">
<EuiText color="secondary" size="xs" className="eui-textTruncate">
{bucket.percent}%
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
<StringFieldProgressBar
value={bucket.value}
percent={bucket.percent}
count={bucket.count}
/>
</EuiFlexItem>
{field.filterable && (
<EuiFlexItem grow={false}>
<div>
<EuiButtonIcon
iconSize="s"
iconType="magnifyWithPlus"
iconType="plusInCircle"
onClick={() => onAddFilter(field, bucket.value, '+')}
aria-label={addLabel}
data-test-subj={`plus-${field.name}-${bucket.value}`}
Expand All @@ -73,7 +96,7 @@ export function DiscoverFieldBucket({ field, bucket, onAddFilter }: Props) {
/>
<EuiButtonIcon
iconSize="s"
iconType="magnifyWithMinus"
iconType="minusInCircle"
onClick={() => onAddFilter(field, bucket.value, '-')}
aria-label={removeLabel}
data-test-subj={`minus-${field.name}-${bucket.value}`}
Expand All @@ -90,7 +113,7 @@ export function DiscoverFieldBucket({ field, bucket, onAddFilter }: Props) {
</EuiFlexItem>
)}
</EuiFlexGroup>
<StringFieldProgressBar percent={bucket.percent} count={bucket.count} />
<EuiSpacer size="s" />
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { EuiLink, EuiSpacer, EuiIconTip, EuiText } from '@elastic/eui';
import { EuiLink, EuiIconTip, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { DiscoverFieldBucket } from './discover_field_bucket';
import { getWarnings } from './lib/get_warnings';
Expand Down Expand Up @@ -78,7 +78,6 @@ export function DiscoverFieldDetails({

{details.visualizeUrl && (
<>
<EuiSpacer size={'s'} />
<EuiLink
onClick={() => {
getServices().core.application.navigateToApp(details.visualizeUrl.app, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@
}
}

/*
Fixes EUI known issue https://github.com/elastic/eui/issues/1749
*/
.dscProgressBarTooltip__anchor {
display: block;
}


.dscFieldSearch {
padding: $euiSizeS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,18 @@
* under the License.
*/
import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiProgress, EuiText, EuiToolTip } from '@elastic/eui';
import { EuiProgress } from '@elastic/eui';

interface Props {
percent: number;
count: number;
value: string;
}

export function StringFieldProgressBar(props: Props) {
export function StringFieldProgressBar({ value, percent, count }: Props) {
const ariaLabel = `${value}: ${count} (${percent}%)`;

return (
<EuiToolTip
anchorClassName="dscProgressBarTooltip__anchor"
content={props.count}
delay="regular"
position="right"
>
<EuiFlexGroup alignItems="center" responsive={false}>
<EuiFlexItem>
<EuiProgress
value={props.percent}
max={100}
color="secondary"
aria-hidden={true}
size="l"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText size="xs">{props.percent}%</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiToolTip>
<EuiProgress value={percent} max={100} color="secondary" aria-label={ariaLabel} size="s" />
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -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};
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { withTheme, EuiTheme } from '../../../../../../observability/public';
interface Props {
label: string;
onClick: () => void;
theme: EuiTheme;
theme: EuiTheme | undefined;
children: ReactNode;
}

Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const AGGREGATION_LABELS = {
};

interface Props {
theme: EuiTheme;
theme: EuiTheme | undefined;
metric?: SnapshotCustomMetricInput;
fields: IFieldType[];
customMetrics: SnapshotCustomMetricInput[];
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '../../../../../../../../../legacy/common/eui_styled_components';

interface Props {
theme: EuiTheme;
theme: EuiTheme | undefined;
onEdit: () => void;
onAdd: () => void;
onSave: () => void;
Expand All @@ -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,
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ export const WaffleSortControls = ({ sort, onChange }: Props) => {
};

interface SwitchContainerProps {
theme: EuiTheme;
theme: EuiTheme | undefined;
children: ReactNode;
}

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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DetailPageContent = euiStyled(PageContent)`
`;

interface Props {
theme: EuiTheme;
theme: EuiTheme | undefined;
match: {
params: {
type: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ function mockClient() {
} as unknown) as Pick<SavedObjectsClientContract, 'find' | 'bulkGet'>;
}

describe('loader', () => {
// Failing: See https://github.com/elastic/kibana/issues/70104
describe.skip('loader', () => {
describe('loadIndexPatterns', () => {
it('should not load index patterns that are already loaded', async () => {
const cache = await loadIndexPatterns({
Expand Down
Loading

0 comments on commit 13d676d

Please sign in to comment.