-
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
[Reporting/Config] allow string representations of duration settings #74202
Merged
tsullivan
merged 41 commits into
elastic:master
from
tsullivan:reporting/config-use-duration
Sep 17, 2020
Merged
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
6ecd79f
[Reporting/Config] use better schema methods
tsullivan 0472d45
add createMockConfig
tsullivan a432276
update documentation
tsullivan ff00738
fix observable.test
tsullivan ce6eccb
Merge branch 'master' into reporting/config-use-duration
elasticmachine a40626b
add docs links to common options page
tsullivan 88af5e2
make the schema match the docs
tsullivan 2fd26c5
Merge branch 'master' into reporting/config-use-duration
tsullivan 4273afc
Merge branch 'master' into reporting/config-use-duration
elasticmachine 2157889
Merge branch 'master' into reporting/config-use-duration
elasticmachine f35ce37
Merge branch 'master' into reporting/config-use-duration
elasticmachine 43f5ce0
Merge branch 'master' into reporting/config-use-duration
elasticmachine 477ce75
Merge branch 'master' into reporting/config-use-duration
elasticmachine 618ae45
Merge branch 'master' into reporting/config-use-duration
elasticmachine 7aecbdc
Merge branch 'master' into reporting/config-use-duration
tsullivan 7b221f5
wording edits per feedback
tsullivan 7afa565
self edits
tsullivan 1d6f4f9
Merge branch 'master' into reporting/config-use-duration
elasticmachine 05debe2
todo comment
tsullivan 2bb2566
Merge branch 'master' into reporting/config-use-duration
tsullivan 556c71c
Merge commit '2bb25663528' into reporting/config-use-duration
tsullivan 0d0f298
Merge branch 'master' into reporting/config-use-duration
tsullivan a2fab88
fix tests
tsullivan 7515e09
Merge branch 'master' into reporting/config-use-duration
tsullivan bfcf1d8
Merge branch 'master' into reporting/config-use-duration
tsullivan 5319844
feedback change 1
tsullivan 2fdaf88
schema utils
tsullivan d9bed34
fix goof
tsullivan 89c0b89
use objects for the defaults when available
tsullivan d06391e
fix pollInterval
tsullivan 5bc26d9
fix snapshots
tsullivan 79aef77
Update report_listing.tsx
tsullivan 5fdcdea
Merge branch 'master' into reporting/config-use-duration
tsullivan e5f6a51
call new ByteSizeValue on server side only
tsullivan 729d1e7
revert xpack.reporting.poll
tsullivan a5138e4
Merge branch 'master' into reporting/config-use-duration
tsullivan 494fd05
Merge branch 'master' into reporting/config-use-duration
tsullivan 3134289
fix ts
tsullivan a09f956
fix snapshot
tsullivan e78fae2
use correct input for duration
tsullivan 7956662
revert reorganize imports
tsullivan 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
This file contains 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
This file contains 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,28 @@ | ||
/* | ||
tsullivan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* 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 { ByteSizeValue } from '@kbn/config-schema'; | ||
import moment from 'moment'; | ||
|
||
/* | ||
* For cleaner code: use these functions when a config schema value could be | ||
* one type or another. This allows you to treat the value as one type. | ||
*/ | ||
|
||
export const durationToNumber = (value: number | moment.Duration): number => { | ||
if (typeof value === 'number') { | ||
return value; | ||
} | ||
return value.asMilliseconds(); | ||
}; | ||
|
||
export const byteSizeValueToNumber = (value: number | ByteSizeValue) => { | ||
if (typeof value === 'number') { | ||
return value; | ||
} | ||
|
||
return value.getValueInBytes(); | ||
}; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
Might be nice to give a brief description on the order of these timeouts, so folks know what to expect with regards to the lifecycle of how these timeouts.