Skip to content
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

[BUG][Data Explorer][Discover] Automatically load solo added default index pattern #5171

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Oct 2, 2023

Description

This fix ensures that when add a default index pattern, Discover will automatically select and load its details.

  • before
before.mov
  • after
after.mov

Issues Resolved

closes #5128

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov
Copy link

codecov bot commented Oct 2, 2023

Codecov Report

Merging #5171 (0142d81) into main (cb6e0f0) will decrease coverage by 0.04%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #5171      +/-   ##
==========================================
- Coverage   66.76%   66.73%   -0.04%     
==========================================
  Files        3278     3278              
  Lines       62999    62999              
  Branches    10031    10031              
==========================================
- Hits        42061    42041      -20     
+ Misses      18552    18487      -65     
- Partials     2386     2471      +85     
Flag Coverage Δ
Linux_1 35.31% <ø> (ø)
Linux_2 55.24% <ø> (ø)
Linux_3 43.74% <ø> (-0.01%) ⬇️
Linux_4 35.42% <ø> (ø)
Windows_1 ?
Windows_2 55.20% <ø> (ø)
Windows_3 ?
Windows_4 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 24 files with indirect coverage changes

Comment on lines 36 to 59
const indexPatternMissingWarning = i18n.translate(
'discover.valueIsNotConfiguredIndexPatternIDWarningTitle',
{
defaultMessage: '{id} is not a configured index pattern ID',
values: {
id: `"${id}"`,
},
}
);

data.indexPatterns
.get(id)
.then((result) => {
if (isMounted) {
setIndexPattern(result);
}
})
.catch(() => {
if (isMounted) {
toastNotifications.addDanger({
title: indexPatternMissingWarning,
});
}
});
};
Copy link
Collaborator

@AMoo-Miki AMoo-Miki Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move indexPatternMissingWarning inside the catch, where it is being used.

Suggested change
const indexPatternMissingWarning = i18n.translate(
'discover.valueIsNotConfiguredIndexPatternIDWarningTitle',
{
defaultMessage: '{id} is not a configured index pattern ID',
values: {
id: `"${id}"`,
},
}
);
data.indexPatterns
.get(id)
.then((result) => {
if (isMounted) {
setIndexPattern(result);
}
})
.catch(() => {
if (isMounted) {
toastNotifications.addDanger({
title: indexPatternMissingWarning,
});
}
});
};
data.indexPatterns
.get(id)
.then((result) => {
if (isMounted) {
setIndexPattern(result);
}
})
.catch(() => {
if (isMounted) {
const indexPatternMissingWarning = i18n.translate(
'discover.valueIsNotConfiguredIndexPatternIDWarningTitle',
{
defaultMessage: '{id} is not a configured index pattern ID',
values: {
id: `"${id}"`,
},
}
);
toastNotifications.addDanger({
title: indexPatternMissingWarning,
});
}
});
};

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -71,7 +72,7 @@ export const DiscoverTable = ({ history }: Props) => {
);

const { rows } = fetchState || {};
const { savedSearch } = useSearch(services);
const { savedSearch } = useSearch(services, store);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont need to use useSearch here again. useDiscoverContext should have all the values you need i.e. savedSearch

} = useOpenSearchDashboards<DataExplorerServices>();

const searchParams = useSearch(services, store);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…index pattern

This fix ensures that when add a default index pattern, Discover will
automatically select and load its details.

Issue Resolve
opensearch-project#5128

Signed-off-by: ananzh <[email protected]>
Signed-off-by: ananzh <[email protected]>
@ananzh ananzh merged commit 9601c6c into opensearch-project:main Oct 3, 2023
49 of 55 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 3, 2023
…index pattern (#5171)

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern

This fix ensures that when add a default index pattern, Discover will
automatically select and load its details.

Issue Resolve
#5128

---------

Signed-off-by: ananzh <[email protected]>
(cherry picked from commit 9601c6c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
ananzh pushed a commit that referenced this pull request Oct 3, 2023
…index pattern (#5171) (#5189)

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern

This fix ensures that when add a default index pattern, Discover will
automatically select and load its details.

Issue Resolve
#5128

---------

Signed-off-by: ananzh <[email protected]>
(cherry picked from commit 9601c6c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AMoo-Miki added a commit that referenced this pull request Oct 4, 2023
AMoo-Miki added a commit that referenced this pull request Oct 4, 2023
@AMoo-Miki
Copy link
Collaborator

The backport to 2.x was reverted to orchestrate the merging of all the 2.x PRs.

AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Oct 4, 2023
…index pattern (opensearch-project#5171)

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern

This fix ensures that when add a default index pattern, Discover will
automatically select and load its details.

Issue Resolve
opensearch-project#5128

---------

Signed-off-by: ananzh <[email protected]>

(cherry picked from commit 9601c6c)
Signed-off-by: Miki <[email protected]>
AMoo-Miki added a commit that referenced this pull request Oct 4, 2023
* [BUG][Discover] Add onQuerySubmit to top nav and allow force update to embeddable (#5160)

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
#5116
#5159

Signed-off-by: ananzh <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>

(cherry picked from commit 7d89cca)
Signed-off-by: Miki <[email protected]>

* [Discover] A bunch of navigation fixes (#5168)

* Discover: Fixes state persistence after nav
* Fixed breadcrumbs and navigation
* fixes mobile view

---------

Signed-off-by: Ashwin P Chandran <[email protected]>

(cherry picked from commit cb6e0f0)
Signed-off-by: Miki <[email protected]>

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern (#5171)

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern

This fix ensures that when add a default index pattern, Discover will
automatically select and load its details.

Issue Resolve
#5128

---------

Signed-off-by: ananzh <[email protected]>

(cherry picked from commit 9601c6c)
Signed-off-by: Miki <[email protected]>

* [BUG][Data Explorer][Discover] Allow data grid to auto adjust size based on fetched data count (#5191)

* This PR adds a new rows state to the DiscoverCanvas component and updated it whenever
the data$ observable emitted new row data.
* The DiscoverTable component was then refactored to accept rows as a prop, making it
dependent on the parent component to provide the correct set of data. This ensures that the table
renders correctly based on the current data and doesn't rely on its internal state,
which could be outdated.

Issue Resolve
#5181

Signed-off-by: ananzh <[email protected]>

(cherry picked from commit 677fdf5)
Signed-off-by: Miki <[email protected]>

* Fixes mobile layout (#5195)

Signed-off-by: Ashwin P Chandran <[email protected]>
(cherry picked from commit 0ffd2ab)

* [BUG][Data Explorer][Discover] Allow filter and query persist when refresh page or paste url to a new tab (#5206)

Issue Resolve
#5179
#5071

Signed-off-by: ananzh <[email protected]>

(cherry picked from commit 5623cef)
Signed-off-by: Miki <[email protected]>

* fixes DataTable rendering in doscover (#5207)

Signed-off-by: Ashwin P Chandran <[email protected]>
(cherry picked from commit c70125f)

---------

Signed-off-by: ananzh <[email protected]>
Signed-off-by: Miki <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>
Co-authored-by: Anan Zhuang <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>
willie-hung pushed a commit to willie-hung/OpenSearch-Dashboards that referenced this pull request Oct 5, 2023
…index pattern (opensearch-project#5171)

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern

This fix ensures that when add a default index pattern, Discover will
automatically select and load its details.

Issue Resolve
opensearch-project#5128

---------

Signed-off-by: ananzh <[email protected]>
Signed-off-by: Willie Hung <[email protected]>
SuZhou-Joe pushed a commit to SuZhou-Joe/OpenSearch-Dashboards that referenced this pull request Oct 7, 2023
…index pattern (opensearch-project#5171)

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern

This fix ensures that when add a default index pattern, Discover will
automatically select and load its details.

Issue Resolve
opensearch-project#5128

---------

Signed-off-by: ananzh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x bug Something isn't working data explorer Issues related to the Data Explorer project discover for discover reinvent distinguished-contributor v2.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG][Data Explorer][Discover] When there is only one index pattern, discover is not able to load it
3 participants