Skip to content

Commit

Permalink
Deprecate recompose part 1 (#50806) (#52436)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Dec 6, 2019
1 parent d1c2ac3 commit 0e0b931
Show file tree
Hide file tree
Showing 274 changed files with 6,526 additions and 6,174 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ describe('RedirectToNodeLogs component', () => {
);

expect(component).toMatchInlineSnapshot(`
<Redirect
push={false}
to="/logs?logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)&sourceId=default"
/>
`);
<Redirect
push={false}
to="/logs?logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)&sourceId=default"
/>
`);
});

it('renders a redirect with the correct container filter', () => {
Expand All @@ -47,11 +47,11 @@ describe('RedirectToNodeLogs component', () => {
);

expect(component).toMatchInlineSnapshot(`
<Redirect
push={false}
to="/logs?logFilter=(expression:'CONTAINER_FIELD:%20CONTAINER_ID',kind:kuery)&sourceId=default"
/>
`);
<Redirect
push={false}
to="/logs?logFilter=(expression:'CONTAINER_FIELD:%20CONTAINER_ID',kind:kuery)&sourceId=default"
/>
`);
});

it('renders a redirect with the correct pod filter', () => {
Expand All @@ -60,11 +60,11 @@ describe('RedirectToNodeLogs component', () => {
);

expect(component).toMatchInlineSnapshot(`
<Redirect
push={false}
to="/logs?logFilter=(expression:'POD_FIELD:%20POD_ID',kind:kuery)&sourceId=default"
/>
`);
<Redirect
push={false}
to="/logs?logFilter=(expression:'POD_FIELD:%20POD_ID',kind:kuery)&sourceId=default"
/>
`);
});

it('renders a redirect with the correct position', () => {
Expand All @@ -75,11 +75,11 @@ describe('RedirectToNodeLogs component', () => {
);

expect(component).toMatchInlineSnapshot(`
<Redirect
push={false}
to="/logs?logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404))&sourceId=default"
/>
`);
<Redirect
push={false}
to="/logs?logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404))&sourceId=default"
/>
`);
});

it('renders a redirect with the correct user-defined filter', () => {
Expand All @@ -92,11 +92,11 @@ describe('RedirectToNodeLogs component', () => {
);

expect(component).toMatchInlineSnapshot(`
<Redirect
push={false}
to="/logs?logFilter=(expression:'(HOST_FIELD:%20HOST_NAME)%20and%20(FILTER_FIELD:FILTER_VALUE)',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404))&sourceId=default"
/>
`);
<Redirect
push={false}
to="/logs?logFilter=(expression:'(HOST_FIELD:%20HOST_NAME)%20and%20(FILTER_FIELD:FILTER_VALUE)',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404))&sourceId=default"
/>
`);
});

it('renders a redirect with the correct custom source id', () => {
Expand All @@ -107,11 +107,11 @@ describe('RedirectToNodeLogs component', () => {
);

expect(component).toMatchInlineSnapshot(`
<Redirect
push={false}
to="/logs?logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)&sourceId=SOME-OTHER-SOURCE"
/>
`);
<Redirect
push={false}
to="/logs?logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)&sourceId=SOME-OTHER-SOURCE"
/>
`);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { EuiBadge } from '@elastic/eui';
import * as React from 'react';
import { pure } from 'recompose';
import styled from 'styled-components';

import * as i18n from './translations';
Expand Down Expand Up @@ -39,7 +38,7 @@ export type AndOr = 'and' | 'or';

/** Displays AND / OR in a round badge */
// Ref: https://github.com/elastic/eui/issues/1655
export const AndOrBadge = pure<{ type: AndOr }>(({ type }) => {
export const AndOrBadge = React.memo<{ type: AndOr }>(({ type }) => {
return (
<RoundedBadge data-test-subj="and-or-badge" color="hollow">
{type === 'and' ? i18n.AND : i18n.OR}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { mount, shallow } from 'enzyme';
import { mount } from 'enzyme';
import toJson from 'enzyme-to-json';
import * as React from 'react';

Expand All @@ -15,12 +15,12 @@ import { ArrowBody, ArrowHead } from '.';
describe('arrows', () => {
describe('ArrowBody', () => {
test('renders correctly against snapshot', () => {
const wrapper = shallow(
const wrapper = mount(
<TestProviders>
<ArrowBody height={3} />
</TestProviders>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(toJson(wrapper.find('ArrowBody'))).toMatchSnapshot();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { EuiIcon } from '@elastic/eui';
import * as React from 'react';
import { pure } from 'recompose';
import styled from 'styled-components';

/** Renders the body (non-pointy part) of an arrow */
Expand All @@ -21,7 +20,7 @@ ArrowBody.displayName = 'ArrowBody';
export type ArrowDirection = 'arrowLeft' | 'arrowRight';

/** Renders the head of an arrow */
export const ArrowHead = pure<{
export const ArrowHead = React.memo<{
direction: ArrowDirection;
}>(({ direction }) => (
<EuiIcon color="subdued" data-test-subj="arrow-icon" size="s" type={direction} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { EuiText } from '@elastic/eui';
import * as React from 'react';
import { pure } from 'recompose';
import styled from 'styled-components';

import { DraggableBadge } from '../draggables';
Expand Down Expand Up @@ -36,7 +35,7 @@ FingerprintLabel.displayName = 'FingerprintLabel';
* 'tls.client_certificate.fingerprint.sha1'
* 'tls.server_certificate.fingerprint.sha1'
*/
export const CertificateFingerprint = pure<{
export const CertificateFingerprint = React.memo<{
eventId: string;
certificateType: CertificateType;
contextId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import React from 'react';

import {
Chart,
BarSeries,
Expand Down Expand Up @@ -63,6 +62,7 @@ export const BarChartBaseComponent = ({
...chartDefaultSettings,
...get('configs.settings', chartConfigs),
};

return chartConfigs.width && chartConfigs.height ? (
<Chart>
<Settings {...settings} />
Expand Down Expand Up @@ -116,6 +116,7 @@ export const BarChartComponent = ({
}) => {
const customHeight = get('customHeight', configs);
const customWidth = get('customWidth', configs);

return checkIfAnyValidSeriesExist(barChart) ? (
<AutoSizer detectAnyWindowResize={false} content>
{({ measureRef, content: { height, width } }) => (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('UtilityBar', () => {
</TestProviders>
);

expect(toJson(wrapper)).toMatchSnapshot();
expect(toJson(wrapper.find('UtilityBar'))).toMatchSnapshot();
});

test('it applies border styles when border is true', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import React from 'react';

import { Bar, BarProps } from './styles';

export interface UtilityBarProps extends BarProps {
interface UtilityBarProps extends BarProps {
children: React.ReactNode;
}

export const UtilityBar = React.memo<UtilityBarProps>(({ border, children }) => (
<Bar border={border}>{children}</Bar>
));

UtilityBar.displayName = 'UtilityBar';
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('UtilityBarAction', () => {
</TestProviders>
);

expect(toJson(wrapper)).toMatchSnapshot();
expect(toJson(wrapper.find('UtilityBarAction'))).toMatchSnapshot();
});

test('it renders a popover', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const Popover = React.memo<UtilityBarActionProps>(
);
}
);

Popover.displayName = 'Popover';

export interface UtilityBarActionProps extends LinkIconProps {
Expand Down Expand Up @@ -71,4 +72,5 @@ export const UtilityBarAction = React.memo<UtilityBarActionProps>(
</BarAction>
)
);

UtilityBarAction.displayName = 'UtilityBarAction';

0 comments on commit 0e0b931

Please sign in to comment.