-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Security Solution][Resolver] Pill numbers in compact notation #80038
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
Merged
bkimmel
merged 8 commits into
elastic:master
from
bkimmel:resolver/pills-compact-notation
Oct 8, 2020
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
773d592
Add compact notation to pills
bkimmel e2e420d
Add tests, put number in a Formatted entry
9a26b79
update comments
3ef426d
i18n number too
722321d
J Buttner review: use log10
b400f0a
add comment
9641856
revise comment
e067ca9
Merge branch 'master' into resolver/pills-compact-notation
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
x-pack/plugins/security_solution/public/resolver/view/submenu.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import { compactNotationParts } from './submenu'; | ||
|
|
||
| describe('The Resolver node pills number presentation', () => { | ||
| describe('When given a small number under 1000', () => { | ||
| it('does not change the presentation of small numbers', () => { | ||
| expect(compactNotationParts(1)).toEqual([1, '', '']); | ||
| expect(compactNotationParts(100)).toEqual([100, '', '']); | ||
| expect(compactNotationParts(999)).toEqual([999, '', '']); | ||
| }); | ||
| }); | ||
| describe('When given a number greater or equal to 1000 but less than 1000000', () => { | ||
| it('presents the number as untis of k', () => { | ||
| expect(compactNotationParts(1000)).toEqual([1, 'k', '']); | ||
| expect(compactNotationParts(1001)).toEqual([1, 'k', '+']); | ||
| expect(compactNotationParts(10000)).toEqual([10, 'k', '']); | ||
| expect(compactNotationParts(10001)).toEqual([10, 'k', '+']); | ||
| expect(compactNotationParts(999999)).toEqual([999, 'k', '+']); | ||
| }); | ||
| }); | ||
| describe('When given a number greater or equal to 1000000 but less than 1000000000', () => { | ||
| it('presents the number as untis of M', () => { | ||
| expect(compactNotationParts(1000000)).toEqual([1, 'M', '']); | ||
| expect(compactNotationParts(1000001)).toEqual([1, 'M', '+']); | ||
| expect(compactNotationParts(10000000)).toEqual([10, 'M', '']); | ||
| expect(compactNotationParts(10000001)).toEqual([10, 'M', '+']); | ||
| expect(compactNotationParts(999999999)).toEqual([999, 'M', '+']); | ||
| }); | ||
| }); | ||
| describe('When given a number greater or equal to 1000000000 but less than 1000000000000', () => { | ||
| it('presents the number as untis of B', () => { | ||
| expect(compactNotationParts(1000000000)).toEqual([1, 'B', '']); | ||
| expect(compactNotationParts(1000000001)).toEqual([1, 'B', '+']); | ||
| expect(compactNotationParts(10000000000)).toEqual([10, 'B', '']); | ||
| expect(compactNotationParts(10000000001)).toEqual([10, 'B', '+']); | ||
| expect(compactNotationParts(999999999999)).toEqual([999, 'B', '+']); | ||
| }); | ||
| }); | ||
| describe('When given a number greater or equal to 1000000000000', () => { | ||
| it('presents the number as untis of T', () => { | ||
| expect(compactNotationParts(1000000000000)).toEqual([1, 'T', '']); | ||
| expect(compactNotationParts(1000000000001)).toEqual([1, 'T', '+']); | ||
| expect(compactNotationParts(10000000000000)).toEqual([10, 'T', '']); | ||
| expect(compactNotationParts(10000000000001)).toEqual([10, 'T', '+']); | ||
| expect(compactNotationParts(999999999999999)).toEqual([999, 'T', '+']); | ||
| expect(compactNotationParts(9999999999999990)).toEqual([9999, 'T', '+']); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ℹ️ h/t @jonathan-buttner on the math
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.