Skip to content

Commit b0eaa3a

Browse files
committed
[Ingest Pipelines] migrate from scss to emotion (#234444)
Addresses #205027 • Migrate Ingest Pipelines UI styling from SCSS to Emotion across pipeline editor, processor form, processors tree, and test pipeline components; remove SCSS files and inline styles in TSX. • Fixed related test file ## Screenshots (Before | After) <img width="3271" height="1396" alt="image" src="https://github.com/user-attachments/assets/d2e4c9d9-4964-46f9-8e36-57239af7b4cb" /> <img width="3263" height="1396" alt="image" src="https://github.com/user-attachments/assets/18a3c7cd-115e-48a0-a46c-aec24eea5702" /> <img width="3263" height="1393" alt="image" src="https://github.com/user-attachments/assets/2fa8a0a2-b8fa-4041-bdb6-33bd13a11e54" /> <img width="3266" height="1393" alt="image" src="https://github.com/user-attachments/assets/1302d606-f9f3-4154-ac12-431daf887afa" /> <img width="3265" height="1396" alt="image" src="https://github.com/user-attachments/assets/0a0fe8dd-b84d-4449-9e32-f275dafb8a22" /> <img width="3261" height="1392" alt="image" src="https://github.com/user-attachments/assets/d1e57301-a87e-493c-8431-579e43cb2866" /> <img width="3264" height="1401" alt="image" src="https://github.com/user-attachments/assets/afe80157-0162-47b7-bb1f-6f40a8636303" /> (cherry picked from commit d92e0d1) # Conflicts: # x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/on_failure_processors_title.tsx # x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item/context_menu.tsx # x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item/pipeline_processors_editor_item.tsx # x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item_tooltip/pipeline_processors_editor_item_tooltip.tsx # x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/field_components/text_editor.tsx # x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/processors_tree/components/drop_zone_button.tsx # x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/processors_tree/processors_tree.tsx # x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/test_pipeline/documents_dropdown/documents_dropdown.tsx # x-pack/platform/plugins/shared/ingest_pipelines/public/application/sections/pipelines_list/flyout_content/flyout_footer.tsx
1 parent a4148fd commit b0eaa3a

34 files changed

+434
-418
lines changed

x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/__jest__/pipeline_processors_editor.test.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,22 @@ describe('Pipeline Editor', () => {
354354
expect(find(`processors>${processorIndex}.inlineTextInputNonEditableText`).text()).toBe(
355355
description
356356
);
357-
expect(
358-
(
359-
find(`processors>${processorIndex}.pipelineProcessorItemDescriptionContainer`).props()
360-
.className as string
361-
).includes('--displayNone')
362-
).toBe(!descriptionVisible);
357+
358+
const descriptionContainer = find(
359+
`processors>${processorIndex}.pipelineProcessorItemDescriptionContainer`
360+
);
361+
362+
expect(descriptionContainer.exists()).toBe(true);
363+
364+
if (descriptionVisible) {
365+
expect(
366+
window.getComputedStyle(descriptionContainer.getDOMNode()).getPropertyValue('display')
367+
).not.toBe('none');
368+
} else {
369+
expect(
370+
window.getComputedStyle(descriptionContainer.getDOMNode()).getPropertyValue('display')
371+
).toBe('none');
372+
}
363373
};
364374

365375
const assertScriptProcessor = createAssertForProcessor('0');

x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/_shared.scss

Lines changed: 0 additions & 3 deletions
This file was deleted.

x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/add_processor_button.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import React, { FunctionComponent } from 'react';
99
import { i18n } from '@kbn/i18n';
1010
import { EuiButtonEmpty, EuiButton } from '@elastic/eui';
11+
import { css } from '@emotion/react';
12+
1113
import { usePipelineProcessorsContext } from '../context';
1214

1315
export interface Props {
@@ -22,6 +24,12 @@ const addProcessorButtonLabel = i18n.translate(
2224
}
2325
);
2426

27+
const styles = {
28+
button: css`
29+
width: fit-content;
30+
`,
31+
};
32+
2533
export const AddProcessorButton: FunctionComponent<Props> = (props) => {
2634
const { onClick, renderButtonAsLink } = props;
2735
const {
@@ -45,7 +53,7 @@ export const AddProcessorButton: FunctionComponent<Props> = (props) => {
4553
return (
4654
<EuiButton
4755
data-test-subj="addProcessorButton"
48-
className="pipelineProcessorsEditor__tree__addProcessorButton"
56+
css={styles.button}
4957
disabled={editor.mode.id !== 'idle'}
5058
onClick={onClick}
5159
>

x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/on_failure_processors_title.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,30 @@
55
* 2.0.
66
*/
77

8-
import { EuiLink, EuiText, EuiTitle } from '@elastic/eui';
9-
import React, { FunctionComponent } from 'react';
8+
import { EuiLink, EuiText, EuiTitle, useEuiTheme } from '@elastic/eui';
9+
import type { FunctionComponent } from 'react';
10+
import React from 'react';
1011
import { i18n } from '@kbn/i18n';
1112
import { FormattedMessage } from '@kbn/i18n-react';
13+
import { css } from '@emotion/react';
1214

1315
import { useKibana } from '../../../../shared_imports';
1416

17+
const useStyles = () => {
18+
const { euiTheme } = useEuiTheme();
19+
return {
20+
title: css`
21+
padding-left: ${euiTheme.size.s};
22+
`,
23+
};
24+
};
25+
1526
export const OnFailureProcessorsTitle: FunctionComponent = () => {
1627
const { services } = useKibana();
28+
const styles = useStyles();
1729

1830
return (
19-
<div className="pipelineEditor__onFailureTitle">
31+
<div css={styles.title}>
2032
<EuiTitle size="xs">
2133
<h4>
2234
<FormattedMessage

x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item/context_menu.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
* 2.0.
66
*/
77

8-
import classNames from 'classnames';
9-
import React, { FunctionComponent, useState } from 'react';
8+
import type { FunctionComponent } from 'react';
9+
import React, { useState } from 'react';
10+
import { css } from '@emotion/react';
1011

1112
import { EuiContextMenuItem, EuiContextMenuPanel, EuiPopover, EuiButtonIcon } from '@elastic/eui';
1213

@@ -22,14 +23,19 @@ interface Props {
2223
'data-test-subj'?: string;
2324
}
2425

26+
const getStyles = ({ hidden }: { hidden?: boolean }) => ({
27+
container: hidden
28+
? css`
29+
display: none;
30+
`
31+
: undefined,
32+
});
33+
2534
export const ContextMenu: FunctionComponent<Props> = (props) => {
2635
const { showAddOnFailure, onDuplicate, onAddOnFailure, onDelete, disabled, hidden } = props;
36+
const styles = getStyles({ hidden });
2737
const [isOpen, setIsOpen] = useState<boolean>(false);
2838

29-
const containerClasses = classNames({
30-
'pipelineProcessorsEditor__item--displayNone': hidden,
31-
});
32-
3339
const contextMenuItems = [
3440
<EuiContextMenuItem
3541
data-test-subj="duplicateButton"
@@ -70,7 +76,7 @@ export const ContextMenu: FunctionComponent<Props> = (props) => {
7076
].filter(Boolean) as JSX.Element[];
7177

7278
return (
73-
<div className={containerClasses}>
79+
<div css={styles.container}>
7480
<EuiPopover
7581
data-test-subj={props['data-test-subj']}
7682
anchorPosition="leftCenter"

x-pack/platform/plugins/shared/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item/pipeline_processors_editor_item.scss

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)