-
Notifications
You must be signed in to change notification settings - Fork 919
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
[Discover] Add long numerals support #5592
[Discover] Add long numerals support #5592
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #5592 +/- ##
=======================================
Coverage 67.02% 67.02%
=======================================
Files 3294 3294
Lines 63307 63318 +11
Branches 10071 10083 +12
=======================================
+ Hits 42432 42440 +8
- Misses 18430 18432 +2
- Partials 2445 2446 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3c19a84
to
58f0a07
Compare
@@ -58,12 +59,12 @@ export const fetchTableDataCell = ( | |||
return <span>-</span>; | |||
} | |||
|
|||
if (!fieldInfo?.type && flattenedRow && typeof flattenedRow[columnId] === 'object') { | |||
if (!fieldInfo?.type && typeof flattenedRow?.[columnId] === 'object') { |
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.
does javascript end up equating this as undefined and null but then typeof of null equating to an object? idk if it can ever be null though.
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.
flattenedRow?.[columnId]
would be undefined
if flattenedRow
was null
, undefined
, Boolean(false)
, Number(0)
, or ""
. For the last 3, the prototype props and functions can be named in columnId
but then, they could be called with any Boolean
, Number
, or String
and if we wanted to block those from being used, we would need to handle them for all of those types and not just for the falsy ones.
58f0a07
to
3be6090
Compare
3590bed
to
fead6fb
Compare
return type === 'number' && typeof value !== 'bigint' | ||
? isFinite(value) && (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER) | ||
? BigInt(value) | ||
: parseFloat(value) | ||
: value; |
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.
nit: I prefer if-else over complex ternaries for readability
fead6fb
to
d635d24
Compare
d635d24
to
b5df33e
Compare
Signed-off-by: Miki <miki@amazon.com>
* Add long numerals support to Discover tabular view, document view, inspector, hash-url, and share * Use a fork of `numeral-js` that supports long numerals * Patch `rison` to correctly serialize BigInts * Replace the uses of `withLongNumerals` with `withLongNumeralsSupport` to match the rest of the codebase and mark `withLongNumerals` for deprecation * Add `withLongNumeralsSupport` as an option to `code/public/http/fetch` * Add long numerals support to `UiSettingsClient` * Add long numerals support to `core/server/http/router` response handler * Add long numerals support to `RangeFilter` and `FilterBar` * Add long numerals support to `kuery/ast` * Introduce `OPENSEARCH_SEARCH_WITH_LONG_NUMERALS_STRATEGY` in `core/plugins/data/search` * Remove `ng-non-bindable` leftovers Signed-off-by: Miki <miki@amazon.com>
b5df33e
to
6b8498a
Compare
Signed-off-by: Miki <miki@amazon.com>
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5592-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 10ae4eeceba9251bc88ad33affa8bd6d595b5206
# Push it to GitHub
git push --set-upstream origin backport/backport-5592-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
* Fix the usage of `pegjs` in tasks Signed-off-by: Miki <miki@amazon.com> * [Discover] Add long numerals support * Add long numerals support to Discover tabular view, document view, inspector, hash-url, and share * Use a fork of `numeral-js` that supports long numerals * Patch `rison` to correctly serialize BigInts * Replace the uses of `withLongNumerals` with `withLongNumeralsSupport` to match the rest of the codebase and mark `withLongNumerals` for deprecation * Add `withLongNumeralsSupport` as an option to `code/public/http/fetch` * Add long numerals support to `UiSettingsClient` * Add long numerals support to `core/server/http/router` response handler * Add long numerals support to `RangeFilter` and `FilterBar` * Add long numerals support to `kuery/ast` * Introduce `OPENSEARCH_SEARCH_WITH_LONG_NUMERALS_STRATEGY` in `core/plugins/data/search` * Remove `ng-non-bindable` leftovers Signed-off-by: Miki <miki@amazon.com> --------- Signed-off-by: Miki <miki@amazon.com> (cherry picked from commit 10ae4ee) Signed-off-by: Miki <miki@amazon.com>
* Fix the usage of `pegjs` in tasks Signed-off-by: Miki <miki@amazon.com> * [Discover] Add long numerals support * Add long numerals support to Discover tabular view, document view, inspector, hash-url, and share * Use a fork of `numeral-js` that supports long numerals * Patch `rison` to correctly serialize BigInts * Replace the uses of `withLongNumerals` with `withLongNumeralsSupport` to match the rest of the codebase and mark `withLongNumerals` for deprecation * Add `withLongNumeralsSupport` as an option to `code/public/http/fetch` * Add long numerals support to `UiSettingsClient` * Add long numerals support to `core/server/http/router` response handler * Add long numerals support to `RangeFilter` and `FilterBar` * Add long numerals support to `kuery/ast` * Introduce `OPENSEARCH_SEARCH_WITH_LONG_NUMERALS_STRATEGY` in `core/plugins/data/search` * Remove `ng-non-bindable` leftovers Signed-off-by: Miki <miki@amazon.com> --------- Signed-off-by: Miki <miki@amazon.com> Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
* Fix the usage of `pegjs` in tasks * [Discover] Add long numerals support * Add long numerals support to Discover tabular view, document view, inspector, hash-url, and share * Use a fork of `numeral-js` that supports long numerals * Patch `rison` to correctly serialize BigInts * Replace the uses of `withLongNumerals` with `withLongNumeralsSupport` to match the rest of the codebase and mark `withLongNumerals` for deprecation * Add `withLongNumeralsSupport` as an option to `code/public/http/fetch` * Add long numerals support to `UiSettingsClient` * Add long numerals support to `core/server/http/router` response handler * Add long numerals support to `RangeFilter` and `FilterBar` * Add long numerals support to `kuery/ast` * Introduce `OPENSEARCH_SEARCH_WITH_LONG_NUMERALS_STRATEGY` in `core/plugins/data/search` * Remove `ng-non-bindable` leftovers --------- (cherry picked from commit 10ae4ee) Signed-off-by: Miki <miki@amazon.com> Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
Description
numeral-js
that supports long numeralsrison
to correctly serialize BigIntsReplace the uses of
withLongNumerals
withwithLongNumeralsSupport
to match the rest of the codebase and markwithLongNumerals
for deprecationwithLongNumeralsSupport
as an option tocode/public/http/fetch
UiSettingsClient
core/server/http/router
response handlerRangeFilter
andFilterBar
kuery/ast
OPENSEARCH_SEARCH_WITH_LONG_NUMERALS_STRATEGY
incore/plugins/data/search
Screenshot
Check List
yarn test:jest
yarn test:jest_integration