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

Add color formatter for string fields #8597

Merged
merged 10 commits into from
Oct 28, 2016
Merged

Conversation

marcelhallmann
Copy link
Contributor

@marcelhallmann marcelhallmann commented Oct 8, 2016

The pull request addresses the isse #6537 (#6537).
I think it would be nice to integrate the code also in the current 5.x version.

Content:
Now a string field can be colored depending on a specified regex.
Let me show the result using some screenshot:

At first you can see that it is possible now to choose the color-formatter on a string field:
color_in_string_field_1

Very similar to the already exisiting number coloring it is possible to define a condition:
color_in_string_field_2

In the Discover tab the result looks like:
color_in_string_field_3

And in a vizualization (data table) it looks like:
color_in_string_field_4
I also added the column "referer" to demonstrate that the exisiting string formatters / transformers like uppercase are still working.

Closes #6537

@elasticmachine
Copy link
Contributor

Can one of the admins verify this patch?

html(val, field) {

var color;
if (field.type === 'string' || field === 'string') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the logic for coloring numbers vs strings is pretty different (including completely different parameters), I think we should duplicate the existing formatter, and modify it to support strings instead of numbers.

Copy link
Contributor Author

@marcelhallmann marcelhallmann Oct 14, 2016

Choose a reason for hiding this comment

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

@spalger
Excuse the question, but are you going to move the code in a separate formatter, or do you want me to do this?

Copy link
Contributor

@spalger spalger Oct 17, 2016

Choose a reason for hiding this comment

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

I'd be happy to, didn't want to step on toes :)

Copy link
Contributor Author

@marcelhallmann marcelhallmann Oct 18, 2016

Choose a reason for hiding this comment

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

It's up to you :)
Just tell me if you are going to do it - or if I should (haven't started refactoring yet)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll take care of it, thanks!

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

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

nice & useful improvement!

@spalger spalger added the v6.0.0 label Oct 28, 2016
@spalger spalger merged commit 409a30b into elastic:master Oct 28, 2016
elastic-jasper added a commit that referenced this pull request Oct 28, 2016
---------

**Commit 1:**
#6537 add color formatting for string fields

* Original sha: ca87c48
* Authored by Marcel Hallmann <marcel.hallmann@six-group.com> on 2016-09-29T12:53:19Z

**Commit 2:**
#6537 adjust test

* Original sha: 23e2ce1
* Authored by marcelhallmann <marcelhallmann@gmx.ch> on 2016-10-05T08:21:24Z

**Commit 3:**
Merge remote-tracking branch 'upstream/master'

* Original sha: bdf66fb
* Authored by Marcel Hallmann <marcel.hallmann@six-group.com> on 2016-10-07T11:19:00Z

**Commit 4:**
#6537 adjust check

* Original sha: a4bf798
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T17:58:51Z

**Commit 5:**
#6537 add simple check to enable coloring in viz (data table), too

* Original sha: e67f6eb
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:01:12Z

**Commit 6:**
#6537 call the field formatter instead of the toString() function

* Original sha: 7dc7fd5
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:47:39Z

**Commit 7:**
#6537 add some tests for coloring string fields

* Original sha: 9733fe5
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:48:46Z

**Commit 8:**
#6537 better default value for regex field

* Original sha: fed9df2
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T19:13:40Z

**Commit 9:**
Merge branch 'master' of github.com:elastic/kibana into pr/8597

* Original sha: b583db7
* Authored by spalger <email@spalger.com> on 2016-10-27T19:31:25Z

**Commit 10:**
[stringify] track field type in params

* Original sha: c84a61b
* Authored by spalger <email@spalger.com> on 2016-10-27T21:04:19Z
spalger pushed a commit that referenced this pull request Oct 28, 2016
---------

**Commit 1:**
#6537 add color formatting for string fields

* Original sha: ca87c48
* Authored by Marcel Hallmann <marcel.hallmann@six-group.com> on 2016-09-29T12:53:19Z

**Commit 2:**
#6537 adjust test

* Original sha: 23e2ce1
* Authored by marcelhallmann <marcelhallmann@gmx.ch> on 2016-10-05T08:21:24Z

**Commit 3:**
Merge remote-tracking branch 'upstream/master'

* Original sha: bdf66fb
* Authored by Marcel Hallmann <marcel.hallmann@six-group.com> on 2016-10-07T11:19:00Z

**Commit 4:**
#6537 adjust check

* Original sha: a4bf798
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T17:58:51Z

**Commit 5:**
#6537 add simple check to enable coloring in viz (data table), too

* Original sha: e67f6eb
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:01:12Z

**Commit 6:**
#6537 call the field formatter instead of the toString() function

* Original sha: 7dc7fd5
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:47:39Z

**Commit 7:**
#6537 add some tests for coloring string fields

* Original sha: 9733fe5
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:48:46Z

**Commit 8:**
#6537 better default value for regex field

* Original sha: fed9df2
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T19:13:40Z

**Commit 9:**
Merge branch 'master' of github.com:elastic/kibana into pr/8597

* Original sha: b583db7
* Authored by spalger <email@spalger.com> on 2016-10-27T19:31:25Z

**Commit 10:**
[stringify] track field type in params

* Original sha: c84a61b
* Authored by spalger <email@spalger.com> on 2016-10-27T21:04:19Z
@epixa epixa changed the title Add coloring for string fields, closes #6537 Add color formatter for string fields Oct 31, 2016
nreese pushed a commit to nreese/kibana that referenced this pull request Nov 10, 2016
* elastic#6537 add color formatting for string fields

* elastic#6537 adjust test

* elastic#6537 adjust check

* elastic#6537 add simple check to enable coloring in viz (data table), too

* elastic#6537 call the field formatter instead of the toString() function

* elastic#6537 add some tests for coloring string fields

* elastic#6537 better default value for regex field

* [stringify] track field type in params
@epixa epixa added v5.1.1 and removed v5.1.0 labels Dec 8, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
---------

**Commit 1:**
elastic#6537 add color formatting for string fields

* Original sha: ca87c48
* Authored by Marcel Hallmann <marcel.hallmann@six-group.com> on 2016-09-29T12:53:19Z

**Commit 2:**
elastic#6537 adjust test

* Original sha: 23e2ce1
* Authored by marcelhallmann <marcelhallmann@gmx.ch> on 2016-10-05T08:21:24Z

**Commit 3:**
Merge remote-tracking branch 'upstream/master'

* Original sha: bdf66fb
* Authored by Marcel Hallmann <marcel.hallmann@six-group.com> on 2016-10-07T11:19:00Z

**Commit 4:**
elastic#6537 adjust check

* Original sha: a4bf798
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T17:58:51Z

**Commit 5:**
elastic#6537 add simple check to enable coloring in viz (data table), too

* Original sha: e67f6eb
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:01:12Z

**Commit 6:**
elastic#6537 call the field formatter instead of the toString() function

* Original sha: 7dc7fd5
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:47:39Z

**Commit 7:**
elastic#6537 add some tests for coloring string fields

* Original sha: 9733fe5
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T18:48:46Z

**Commit 8:**
elastic#6537 better default value for regex field

* Original sha: fed9df2
* Authored by Marcel Hallmann <marcelhallmann@gmx.ch> on 2016-10-08T19:13:40Z

**Commit 9:**
Merge branch 'master' of github.com:elastic/kibana into pr/8597

* Original sha: b583db7
* Authored by spalger <email@spalger.com> on 2016-10-27T19:31:25Z

**Commit 10:**
[stringify] track field type in params

* Original sha: c84a61b
* Authored by spalger <email@spalger.com> on 2016-10-27T21:04:19Z

Former-commit-id: f2e3528
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants