Skip to content

[OnWeek][FieldFormatters] Update styles for Color formatter to look like a badge#189391

Merged
jughosta merged 26 commits intoelastic:mainfrom
jughosta:upgrade-color-formatter
Apr 29, 2025
Merged

[OnWeek][FieldFormatters] Update styles for Color formatter to look like a badge#189391
jughosta merged 26 commits intoelastic:mainfrom
jughosta:upgrade-color-formatter

Conversation

@jughosta
Copy link
Contributor

@jughosta jughosta commented Jul 29, 2024

Summary

This PR updates the styles for Color formatter so it has EuiBadge look. EuiBadge is not used as it does not support multiline text. Ideally we could use a CSS class and move styles to it but since we are moving away from SCSS usage I haven't used it here. Also Emotion styles don't get applied when used inside the field formatter utils, so I went with a simpler solution which should work in any case and be relatively fast.

Before:
Screenshot 2025-02-27 at 16 05 42

After:
Screenshot 2025-02-27 at 16 04 31

Screenshot 2025-02-27 at 15 33 36

Checklist

@jughosta jughosta self-assigned this Jul 29, 2024
@github-actions
Copy link
Contributor

A documentation preview will be available soon.

Request a new doc build by commenting
  • Rebuild this PR: run docs-build
  • Rebuild this PR and all Elastic docs: run docs-build rebuild

run docs-build is much faster than run docs-build rebuild. A rebuild should only be needed in rare situations.

If your PR continues to fail for an unknown reason, the doc build pipeline may be broken. Elastic employees can check the pipeline status here.

@jughosta jughosta changed the title [Discover][FieldFormatters] Update color formatter. Use EuiBadge. Jul 29, 2024
@elastic elastic deleted a comment from github-actions bot Feb 27, 2025
@elastic elastic deleted a comment from github-actions bot Feb 27, 2025
@elastic elastic deleted a comment from github-actions bot Feb 27, 2025
@elastic elastic deleted a comment from github-actions bot Feb 27, 2025
@jughosta jughosta changed the title [Discover][FieldFormatters] Convert color formatter layout to EuiBadge Feb 27, 2025
@jughosta jughosta changed the title [OnWeek][Discover][FieldFormatters] Convert color formatter layout to EuiBadge Feb 27, 2025
@jughosta jughosta added Feature:Discover Discover Application Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Feature:FieldFormatters release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting and removed Feature:Discover Discover Application labels Feb 27, 2025
@jughosta jughosta added backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Mar 13, 2025
@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

/ci

@jughosta
Copy link
Contributor Author

/ci

@jughosta jughosta marked this pull request as ready for review April 23, 2025 10:02
@jughosta jughosta requested review from a team as code owners April 23, 2025 10:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

LGTM, as we aligned in our sync, this is just a visual change for the better, aligning it visually to how it looks like when contextual awareness in Discover is available. While it's true that the defined colors can collide with by value cell coloring in Lens, this is not introduced by this PR, which adds more padding and borderRadius. Tested it remotely (link) and works as expected. On top of that this PR saved a few lines of code by making the unit test better 👍 .

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

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

id before after diff
fieldFormats 61.8KB 61.9KB +78.0B

History

cc @jughosta

@jughosta jughosta merged commit 87da92b into elastic:main Apr 29, 2025
9 checks passed
@jughosta jughosta deleted the upgrade-color-formatter branch April 29, 2025 18:34
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

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

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.19:
- [ResponseOps] ES|QL rule type improvements - adding grouping per row (#212135)
- [Security Solution] Fix rule import error message display (#218701)
- 790 deployment environment discrepancy (#217899)
- [Oblt Onboarding] Remove Custom Logs flow (#216053)

Manual backport

To create the backport manually run:

node scripts/backport --pr 189391

Questions ?

Please refer to the Backport tool documentation

akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Apr 30, 2025
…ike a badge (elastic#189391)

## Summary

This PR updates the styles for Color formatter so it has `EuiBadge`
look. `EuiBadge` is not used as it does not support multiline text.
Ideally we could use a CSS class and move styles to it but since we are
moving away from SCSS usage I haven't used it here. Also Emotion styles
don't get applied when used inside the field formatter utils, so I went
with a simpler solution which should work in any case and be relatively
fast.

Before:
<img width="1744" alt="Screenshot 2025-02-27 at 16 05 42"
src="https://github.com/user-attachments/assets/355c7a23-f6a4-406d-b2a2-f6aaa50d4648"
/>

After:
<img width="1743" alt="Screenshot 2025-02-27 at 16 04 31"
src="https://github.com/user-attachments/assets/3263e145-5387-4bd8-b7d8-54dd2ae7db24"
/>

<img width="1084" alt="Screenshot 2025-02-27 at 15 33 36"
src="https://github.com/user-attachments/assets/12f3a197-24d2-4156-910d-ce02428643b1"
/>


### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
@jughosta
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.19

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

Questions ?

Please refer to the Backport tool documentation

jughosta added a commit to jughosta/kibana that referenced this pull request Apr 30, 2025
…ike a badge (elastic#189391)

## Summary

This PR updates the styles for Color formatter so it has `EuiBadge`
look. `EuiBadge` is not used as it does not support multiline text.
Ideally we could use a CSS class and move styles to it but since we are
moving away from SCSS usage I haven't used it here. Also Emotion styles
don't get applied when used inside the field formatter utils, so I went
with a simpler solution which should work in any case and be relatively
fast.

Before:
<img width="1744" alt="Screenshot 2025-02-27 at 16 05 42"
src="https://github.com/user-attachments/assets/355c7a23-f6a4-406d-b2a2-f6aaa50d4648"
/>

After:
<img width="1743" alt="Screenshot 2025-02-27 at 16 04 31"
src="https://github.com/user-attachments/assets/3263e145-5387-4bd8-b7d8-54dd2ae7db24"
/>

<img width="1084" alt="Screenshot 2025-02-27 at 15 33 36"
src="https://github.com/user-attachments/assets/12f3a197-24d2-4156-910d-ce02428643b1"
/>

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 87da92b)

# Conflicts:
#	x-pack/platform/plugins/private/translations/translations/fr-FR.json
#	x-pack/platform/plugins/private/translations/translations/ja-JP.json
#	x-pack/platform/plugins/private/translations/translations/zh-CN.json
jughosta added a commit that referenced this pull request Apr 30, 2025
… look like a badge (#189391) (#219762)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[OnWeek][FieldFormatters] Update styles for Color formatter to look
like a badge (#189391)](#189391)

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

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

<!--BACKPORT [{"author":{"name":"Julia
Rechkunova","email":"julia.rechkunova@elastic.co"},"sourceCommit":{"committedDate":"2025-04-29T18:34:07Z","message":"[OnWeek][FieldFormatters]
Update styles for Color formatter to look like a badge (#189391)\n\n##
Summary\n\nThis PR updates the styles for Color formatter so it has
`EuiBadge`\nlook. `EuiBadge` is not used as it does not support
multiline text.\nIdeally we could use a CSS class and move styles to it
but since we are\nmoving away from SCSS usage I haven't used it here.
Also Emotion styles\ndon't get applied when used inside the field
formatter utils, so I went\nwith a simpler solution which should work in
any case and be relatively\nfast.\n\nBefore:\n<img width=\"1744\"
alt=\"Screenshot 2025-02-27 at 16 05
42\"\nsrc=\"https://github.com/user-attachments/assets/355c7a23-f6a4-406d-b2a2-f6aaa50d4648\"\n/>\n\nAfter:\n<img
width=\"1743\" alt=\"Screenshot 2025-02-27 at 16 04
31\"\nsrc=\"https://github.com/user-attachments/assets/3263e145-5387-4bd8-b7d8-54dd2ae7db24\"\n/>\n\n<img
width=\"1084\" alt=\"Screenshot 2025-02-27 at 15 33
36\"\nsrc=\"https://github.com/user-attachments/assets/12f3a197-24d2-4156-910d-ce02428643b1\"\n/>\n\n\n###
Checklist\n\n- [x] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"87da92bf3da6382271c0421b0117320744fbb54c","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Feature:FieldFormatters","Team:DataDiscovery","backport:version","v9.1.0","v8.19.0"],"title":"[OnWeek][FieldFormatters]
Update styles for Color formatter to look like a
badge","number":189391,"url":"https://github.com/elastic/kibana/pull/189391","mergeCommit":{"message":"[OnWeek][FieldFormatters]
Update styles for Color formatter to look like a badge (#189391)\n\n##
Summary\n\nThis PR updates the styles for Color formatter so it has
`EuiBadge`\nlook. `EuiBadge` is not used as it does not support
multiline text.\nIdeally we could use a CSS class and move styles to it
but since we are\nmoving away from SCSS usage I haven't used it here.
Also Emotion styles\ndon't get applied when used inside the field
formatter utils, so I went\nwith a simpler solution which should work in
any case and be relatively\nfast.\n\nBefore:\n<img width=\"1744\"
alt=\"Screenshot 2025-02-27 at 16 05
42\"\nsrc=\"https://github.com/user-attachments/assets/355c7a23-f6a4-406d-b2a2-f6aaa50d4648\"\n/>\n\nAfter:\n<img
width=\"1743\" alt=\"Screenshot 2025-02-27 at 16 04
31\"\nsrc=\"https://github.com/user-attachments/assets/3263e145-5387-4bd8-b7d8-54dd2ae7db24\"\n/>\n\n<img
width=\"1084\" alt=\"Screenshot 2025-02-27 at 15 33
36\"\nsrc=\"https://github.com/user-attachments/assets/12f3a197-24d2-4156-910d-ce02428643b1\"\n/>\n\n\n###
Checklist\n\n- [x] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"87da92bf3da6382271c0421b0117320744fbb54c"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/189391","number":189391,"mergeCommit":{"message":"[OnWeek][FieldFormatters]
Update styles for Color formatter to look like a badge (#189391)\n\n##
Summary\n\nThis PR updates the styles for Color formatter so it has
`EuiBadge`\nlook. `EuiBadge` is not used as it does not support
multiline text.\nIdeally we could use a CSS class and move styles to it
but since we are\nmoving away from SCSS usage I haven't used it here.
Also Emotion styles\ndon't get applied when used inside the field
formatter utils, so I went\nwith a simpler solution which should work in
any case and be relatively\nfast.\n\nBefore:\n<img width=\"1744\"
alt=\"Screenshot 2025-02-27 at 16 05
42\"\nsrc=\"https://github.com/user-attachments/assets/355c7a23-f6a4-406d-b2a2-f6aaa50d4648\"\n/>\n\nAfter:\n<img
width=\"1743\" alt=\"Screenshot 2025-02-27 at 16 04
31\"\nsrc=\"https://github.com/user-attachments/assets/3263e145-5387-4bd8-b7d8-54dd2ae7db24\"\n/>\n\n<img
width=\"1084\" alt=\"Screenshot 2025-02-27 at 15 33
36\"\nsrc=\"https://github.com/user-attachments/assets/12f3a197-24d2-4156-910d-ce02428643b1\"\n/>\n\n\n###
Checklist\n\n- [x] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"87da92bf3da6382271c0421b0117320744fbb54c"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…ike a badge (elastic#189391)

## Summary

This PR updates the styles for Color formatter so it has `EuiBadge`
look. `EuiBadge` is not used as it does not support multiline text.
Ideally we could use a CSS class and move styles to it but since we are
moving away from SCSS usage I haven't used it here. Also Emotion styles
don't get applied when used inside the field formatter utils, so I went
with a simpler solution which should work in any case and be relatively
fast.

Before:
<img width="1744" alt="Screenshot 2025-02-27 at 16 05 42"
src="https://github.com/user-attachments/assets/355c7a23-f6a4-406d-b2a2-f6aaa50d4648"
/>

After:
<img width="1743" alt="Screenshot 2025-02-27 at 16 04 31"
src="https://github.com/user-attachments/assets/3263e145-5387-4bd8-b7d8-54dd2ae7db24"
/>

<img width="1084" alt="Screenshot 2025-02-27 at 15 33 36"
src="https://github.com/user-attachments/assets/12f3a197-24d2-4156-910d-ce02428643b1"
/>


### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
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:FieldFormatters release_note:enhancement Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v8.19.0 v9.1.0

5 participants