-
Notifications
You must be signed in to change notification settings - Fork 839
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
[EuiSelectableSitewideTemplate][Fix] Do not show noMatchesMessage if one is provided by consumer #7758
Closed
Closed
[EuiSelectableSitewideTemplate][Fix] Do not show noMatchesMessage if one is provided by consumer #7758
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
eb8e8da
do not show noMatchesMessage if one is provided by consumer
rshen91 f7e32ad
changelog message for PR
rshen91 7b68459
show loading message for custom no matches message
rshen91 6f78520
wip
rshen91 5965891
fix and add test
rshen91 da1f5a0
Delete tsconfig.json
rshen91 d7da129
Merge branch 'main' into fix-show-empty-results
rshen91 58b0c80
Merge branch 'main' into fix-show-empty-results
rshen91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
**Bug fixes** | ||
|
||
- Fixed an issue with <SelectableTemplateSitewide>. If a consumer passes in a custom noMatchesMessage, then EUI should not pass the default empty message. On slow networks, this causes two no matches messages to appear to the end user. | ||
|
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,3 @@ | ||
**Bug fixes** | ||
|
||
- Fixed an issue with <SelectableTemplateSitewide>. If a consumer passes in a custom noMatchesMessage, then EUI should not pass the default empty message. On slow networks, this causes two no matches messages to appear to the end user. The user will see loading results message and then their custom noMatchesMessage. |
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
88 changes: 88 additions & 0 deletions
88
.../eui/src/components/selectable/selectable_templates/selectable_template_sitewide.spec.tsx
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,88 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/// <reference types="cypress" /> | ||
/// <reference types="cypress-real-events" /> | ||
/// <reference types="../../../../cypress/support" /> | ||
|
||
import React from 'react'; | ||
import { EuiSelectableTemplateSitewide } from './selectable_template_sitewide'; | ||
|
||
describe('SelectableTemplateSitewide', () => { | ||
beforeEach(() => { | ||
cy.viewport(500, 300); | ||
}); | ||
const props = { | ||
options: [ | ||
{ | ||
label: 'Basic data application', | ||
avatar: { | ||
name: 'Default Space', | ||
}, | ||
meta: [ | ||
{ | ||
text: 'Application', | ||
type: 'application', | ||
}, | ||
], | ||
url: 'welcome-dashboards', | ||
'data-test-subj': 'test-this', | ||
}, | ||
{ | ||
label: 'Platform with deployment highlighted', | ||
icon: { | ||
type: 'user', | ||
}, | ||
meta: [ | ||
{ | ||
text: 'Account', | ||
type: 'platform', | ||
}, | ||
{ | ||
text: 'personal-databoard', | ||
type: 'deployment', | ||
highlightSearchString: true, | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'Other metas', | ||
searchableLabel: 'Totally custom with pink metadata', | ||
icon: { | ||
type: 'warning', | ||
color: 'accent', | ||
}, | ||
meta: [ | ||
{ | ||
text: 'Meta 1', | ||
type: 'meta', | ||
}, | ||
{ | ||
text: 'Meta 2', | ||
type: 'meta', | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
it('uses a custom no match message if provided', () => { | ||
cy.realMount( | ||
<EuiSelectableTemplateSitewide | ||
options={props.options} | ||
noMatchesMessage={<span>THIS IS A CUSTOM MESSAGE</span>} | ||
/> | ||
); | ||
cy.get('[data-test-subj="nav-search-input"]').realClick(); | ||
cy.realType('adsdfadvs'); | ||
cy.wait(500); // need the popover to generate the message | ||
cy.get('[data-test-subj="nav-search-popover"]').contains( | ||
'THIS IS A CUSTOM MESSAGE' | ||
); | ||
}); | ||
}); |
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.
@cee-chen I think this is the part that's causing the issue in elastic/kibana#151199 since selectable_template_sitewide isn't registering the noMatchesMessage intially? Lmk what you think, I definitely concede I could be misunderstanding.
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.
It is registering it via
...rest
. Anything that comes in from that spread overrides the preceding props, which in production includesnoMatchesMessage
.