-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Conversation
Can one of the admins verify this patch? |
html(val, field) { | ||
|
||
var color; | ||
if (field.type === 'string' || field === 'string') { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice & useful improvement!
--------- **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
--------- **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
* 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
--------- **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
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:
Very similar to the already exisiting number coloring it is possible to define a condition:
In the Discover tab the result looks like:
And in a vizualization (data table) it looks like:
I also added the column "referer" to demonstrate that the exisiting string formatters / transformers like uppercase are still working.
Closes #6537