Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Remove scss from annotations plugin, visualization-ui-components and gauge expression #208891

Merged
merged 16 commits into from
Feb 18, 2025

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Jan 30, 2025

Summary

part of #208908

Replaces scss to css-in-js. I've tested all the changes.

@mbondyra mbondyra added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens v9.0.0 backport:version Backport to applied version labels v8.18.0 labels Jan 30, 2025
@mbondyra mbondyra requested review from a team as code owners January 30, 2025 09:34
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@mbondyra mbondyra added the release_note:skip Skip the PR/issue when compiling release notes label Jan 30, 2025
@mbondyra mbondyra changed the title [Lens] Remove scss from annotations plugin [Lens] Remove scss from annotations plugin nad visualization-ui-components Jan 30, 2025
@mbondyra mbondyra changed the title [Lens] Remove scss from annotations plugin nad visualization-ui-components [Lens] Remove scss from annotations plugin, visualization-ui-components and gauge expression Jan 30, 2025
Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @mbondyra. I've left two small comments/question regarding whether we can reduce some style repetition/redundancy, but this looks good to me otherwise. Assuming you're able to address those, I'll approve now so I don't hold you up.

Comment on lines 370 to 374
css={css`
& + .lnsRowCompressedMargin {
margin-top: ${euiThemeVars.euiSizeS};
}
`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This same style is used multiple times throughout this PR. To keep things DRY, would it be better to store this style in a separate .style.ts file and reference that one style in all locations, rather than repeating the style?

Comment on lines 65 to 68
css: {
color: !fieldOption.compatible ? euiThemeVars.euiColorLightShade : undefined,
backgroundColor: !fieldOptionExists ? euiThemeVars.euiColorLightestShade : undefined,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here as previous. Is there anything that can be done here to avoid repeating the same styles?

} from '@elastic/eui';
import type { DataViewBase, Query } from '@kbn/es-query';
import { css } from '@emotion/react';
import { euiThemeVars } from '@kbn/ui-theme';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the EUI team is asking people to move away from using euiThemeVars and instead using the useEuiTheme hook. See #199715 and search for euiThemeVars.

Before:

import { EuiIcon, EuiCode, EuiText, useEuiTheme } from '@elastic/eui';
height: ${euiThemeVars.euiSizeXS} / 2;

After:

import { useEuiTheme } from '@elastic/eui'
const { euiTheme } = useEuiTheme();
height: ${euiTheme.size.xs} / 2;

@mbondyra mbondyra force-pushed the lens/scss-js branch 2 times, most recently from 2aa224f to 6e1fc08 Compare February 5, 2025 13:37
@mbondyra mbondyra requested a review from a team as a code owner February 17, 2025 10:18
@mbondyra mbondyra marked this pull request as draft February 17, 2025 11:07
@mbondyra mbondyra force-pushed the lens/scss-js branch 2 times, most recently from e895517 to 9e73246 Compare February 17, 2025 11:17
@elastic elastic deleted a comment from elasticmachine Feb 17, 2025
@elastic elastic deleted a comment from elasticmachine Feb 17, 2025
@mbondyra mbondyra removed the request for review from a team February 17, 2025 12:16
Comment on lines -6 to -8
"sideEffects": [
"*.scss"
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should change this to sideEffects: false to avoid a different treeshake in the bundle.
sideEffects is by default true

@@ -2,8 +2,5 @@
"name": "@kbn/event-annotation-components",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
"sideEffects": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep sideEffects: false

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
eventAnnotationListing 746 710 -36
expressionGauge 95 69 -26
lens 1820 1784 -36
observability 1440 1404 -36
total -134

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
eventAnnotationListing 233.7KB 218.6KB -15.1KB
expressionGauge 19.5KB 9.9KB -9.6KB
lens 1.6MB 1.6MB -11.9KB
total -36.5KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
expressionGauge 13.7KB 13.7KB -1.0B

History

@mbondyra mbondyra merged commit 91a19c0 into elastic:main Feb 18, 2025
9 checks passed
@mbondyra mbondyra deleted the lens/scss-js branch February 18, 2025 12:31
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.18, 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/13390605630

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 18, 2025
…ts and gauge expression (elastic#208891)

## Summary

part of elastic#208908

Replaces scss to css-in-js. I've tested all the changes.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 91a19c0)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 18, 2025
…ts and gauge expression (elastic#208891)

## Summary

part of elastic#208908

Replaces scss to css-in-js. I've tested all the changes.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 91a19c0)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 18, 2025
…ts and gauge expression (elastic#208891)

## Summary

part of elastic#208908

Replaces scss to css-in-js. I've tested all the changes.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 91a19c0)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.18
8.x
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Feb 18, 2025
…mponents and gauge expression (#208891) (#211567)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Lens] Remove scss from annotations plugin,
visualization-ui-components and gauge expression
(#208891)](#208891)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"4283304+mbondyra@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-02-18T12:31:09Z","message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge
expression","number":208891,"url":"https://github.com/elastic/kibana/pull/208891","mergeCommit":{"message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208891","number":208891,"mergeCommit":{"message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Feb 18, 2025
…omponents and gauge expression (#208891) (#211565)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Lens] Remove scss from annotations plugin,
visualization-ui-components and gauge expression
(#208891)](#208891)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"4283304+mbondyra@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-02-18T12:31:09Z","message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge
expression","number":208891,"url":"https://github.com/elastic/kibana/pull/208891","mergeCommit":{"message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208891","number":208891,"mergeCommit":{"message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Feb 18, 2025
…mponents and gauge expression (#208891) (#211566)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Lens] Remove scss from annotations plugin,
visualization-ui-components and gauge expression
(#208891)](#208891)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"4283304+mbondyra@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-02-18T12:31:09Z","message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge
expression","number":208891,"url":"https://github.com/elastic/kibana/pull/208891","mergeCommit":{"message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208891","number":208891,"mergeCommit":{"message":"[Lens]
Remove scss from annotations plugin, visualization-ui-components and
gauge expression (#208891)\n\n## Summary\r\n\r\npart of
https://github.com/elastic/kibana/issues/208908\r\n\r\nReplaces scss to
css-in-js. I've tested all the
changes.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"91a19c0969bc140ad4c16e69eb23f424b0ecae4f"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.18.0 v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants