-
Notifications
You must be signed in to change notification settings - Fork 918
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
[Data Explorer][Discover 2.0] Fix display for index pattern without a default time field #4821
[Data Explorer][Discover 2.0] Fix display for index pattern without a default time field #4821
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4821 +/- ##
==========================================
+ Coverage 66.39% 66.43% +0.03%
==========================================
Files 3397 3398 +1
Lines 64805 64893 +88
Branches 10359 10359
==========================================
+ Hits 43028 43110 +82
- Misses 19218 19304 +86
+ Partials 2559 2479 -80
Flags with carried forward coverage won't be shown. Click here to find out more. |
92207a1
to
b6c449f
Compare
cb95e58
to
99d7b03
Compare
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.
You accidentally removed a flag that allows the search bar queries to be saved. the rest of the PR looks good :)
return ( | ||
<TopNavMenu | ||
appName={PLUGIN_ID} | ||
config={topNavLinks} | ||
showSearchBar | ||
showSaveQuery | ||
showDatePicker={showDatePicker} |
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.
showDatePicker={showDatePicker} | |
showDatePicker={showDatePicker} | |
showSaveQuery |
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.
will add
@@ -100,7 +105,7 @@ export function ContextApp({ | |||
onSort={() => {}} | |||
sort={sort} | |||
rows={rows} | |||
displayTimeColumn={true} | |||
displayTimeColumn={displayTimeColumn || true} |
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 displayTimeColumn
is boolean too, this will be true
always. I don't think that was your intention.
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.
The displayTimeColumn
constant could technically be undefined if indexPattern is undefined or if uiSettings.get(DOC_HIDE_TIME_COLUMN_SETTING, false) returns a falsy value and indexPattern?.isTimeBased() is undefined.
I have updated it to be
const displayTimeColumn = useMemo(
() => !!(!uiSettings.get(DOC_HIDE_TIME_COLUMN_SETTING, false) && indexPattern?.isTimeBased()),
[indexPattern, uiSettings]
);
to convert the value of the expression to a boolean, turning undefined or any other falsy values to false. And I changed this line to displayTimeColumn={displayTimeColumn
.
if (!hits || !bucketInterval || !chartData) { | ||
// TODO: handle better | ||
return null; | ||
} |
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.
Just double checking. We are good with not having bucketInterval
or chartData
?
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.
hits itself is enough. hits = 0 will always has no chartData or bucketInterval.
@@ -93,7 +103,7 @@ export const DiscoverTable = ({ history }: Props) => { | |||
onSort={onSetSort} | |||
sort={sort} | |||
rows={rows} | |||
displayTimeColumn={true} | |||
displayTimeColumn={displayTimeColumn || true} |
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.
Doesn't seem right.
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.
same as above.
d17d9bf
to
df20e7c
Compare
…ield Issue Resolve opensearch-project#4820 Signed-off-by: ananzh <[email protected]>
df20e7c
to
c9073dd
Compare
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-4821-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 83cd7f629c3211a9d5d216b80cc5c3db40adefbc
# Push it to GitHub
git push --set-upstream origin backport/backport-4821-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 |
…ield (#4821) Issue Resolve #4820 Signed-off-by: ananzh <[email protected]> (cherry picked from commit 83cd7f6) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…ield (#4821) (#4901) Issue Resolve #4820 (cherry picked from commit 83cd7f6) Signed-off-by: ananzh <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
This PR is blocked by #4816
Please see the 2nd commit. Need to rebase after #4816 is merged.
no date picker in the top nav
only show hits if index pattern has no time field
Issues Resolved
#4820
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr