Skip to content

Truncate long field names in filter editor#13379

Merged
lukasolson merged 2 commits intoelastic:masterfrom
lukasolson:long_fields
Aug 9, 2017
Merged

Truncate long field names in filter editor#13379
lukasolson merged 2 commits intoelastic:masterfrom
lukasolson:long_fields

Conversation

@lukasolson
Copy link
Copy Markdown
Contributor

Fixes #13365.

This PR adds an additional class to the field selector in the filter editor that properly truncates (with an ellipsis) it when it is too long.

Before:

image

After:

image

@lukasolson lukasolson added Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. :Discovery Feature:Filters review v5.6.0 v6.0.0 v6.1.0 v7.0.0 labels Aug 7, 2017
@lukasolson lukasolson self-assigned this Aug 7, 2017
@lukasolson
Copy link
Copy Markdown
Contributor Author

@cjcenizal It looks like, although this fixes the error, we now don't have the benefit of having the params field/text input expanding to fill up space unused by the field select. Can you think of some way to get the best of both worlds?

@cjcenizal
Copy link
Copy Markdown
Contributor

@lukasolson What's the params field/text input? What do you mean by "space unused by the field select"?

@lukasolson
Copy link
Copy Markdown
Contributor Author

@cjcenizal Sorry for the confusion. Looking at the screenshots in the description, there are three inputs. From left to right, they are the "field" input, "operator" input, and "params" input.

I'm not sure if you remember, but you suggested that we add some styles so that the params input could expand to fill up any extra space that wasn't being used by the field and operator inputs.

The problem now is that if the value for the field input is really big, the operator and params inputs flow outside the container.

This PR updates these styles such that, even if the field input is really big, they don't overflow off outside the container. However, it has the downside that both the field input and params input have the kuiFieldGroupSection--wide class applied, so they both try to take up as much space as they can... which means that in cases that the field name isn't very long, it will take up more space than it needs.

Here are some screenshots of what I'm talking about...

Before this PR:

image

After this PR:

image

I'm wondering if there is some way we can get the best of both worlds, where we wouldn't expect to see any overflow (even if both the field and params input were extremely long) but such that the params inputs get as much space as possible. Thoughts?

@cjcenizal
Copy link
Copy Markdown
Contributor

cjcenizal commented Aug 8, 2017

@lukasolson Ahhh, I see! I think you can solve this problem by removing kuiFieldGroupSection--wide from the "field" input and creating a custom class for it instead:

.filterEditorFieldInput {
  flex: 0 1 auto;
}

This will cause it to shrink and expand to fit its content, instead of expanding to try to take up as much space as possible.

image

image

On a separate note, I found a weird bug when the "operator" input is set to "is one of", where the "params" input gets squished:

image

You can solve this with another custom class:

.fieldEditorOperatorInput {
  min-width: 100px;
}

You might need to remove .filterEditor__wideField from this element to avoid conflicts. The end result should be this:

image

@lukasolson lukasolson removed the review label Aug 8, 2017
@lukasolson
Copy link
Copy Markdown
Contributor Author

@cjcenizal Thanks! I've made the updates.

Copy link
Copy Markdown
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

⛸ LGTM!

Copy link
Copy Markdown

@stacey-gammon stacey-gammon left a comment

Choose a reason for hiding this comment

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

LGTM!

@lukasolson lukasolson merged commit e545b12 into elastic:master Aug 9, 2017
lukasolson added a commit to lukasolson/kibana that referenced this pull request Aug 9, 2017
* Truncate long field names in filter editor

* Update filter editor styles
lukasolson added a commit to lukasolson/kibana that referenced this pull request Aug 9, 2017
* Truncate long field names in filter editor

* Update filter editor styles
lukasolson added a commit to lukasolson/kibana that referenced this pull request Aug 9, 2017
* Truncate long field names in filter editor

* Update filter editor styles
lukasolson added a commit to lukasolson/kibana that referenced this pull request Aug 9, 2017
* Truncate long field names in filter editor

* Update filter editor styles
@lukasolson
Copy link
Copy Markdown
Contributor Author

6.x (6.1.0): b677bea
6.0 (6.0.0): b6e7604
5.6 (5.6.0): 2d10c2b
5.5 (5.5.2): b86f7a9

@lukasolson lukasolson deleted the long_fields branch March 27, 2018 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Filters review Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. v5.5.2 v5.6.0 v6.0.0 v6.1.0 v7.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants