-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Add loader for kibana overview while checking for user data view #118881
Add loader for kibana overview while checking for user data view #118881
Conversation
{i18n.translate('kibana-react.kbnOverviewPageHeader.addIntegrationsButtonLabel', { | ||
defaultMessage: 'Add integrations', |
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.
This component is only used by kibana_overview
, but overview_page_footer
, in the same parent folder, is also used by other apps, so in doubt, I kept this component in kibana_react
.
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.
I hoped we can move it to overview
, but looks like I missed that overview_page_footer
is used in other apps :( #114990
afterAll(() => jest.clearAllMocks()); | ||
|
||
test('render', async () => { | ||
const component = mountWithIntl( |
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.
I had to switch from shallow
to mount
because enzyme does not support useEffect
with shallow rendering, so all snapshots were in the loading
state this PR adds. The snapshots are ugly, but correct.
const updateComponent = async (component: ReactWrapper) => { | ||
await act(async () => { | ||
await flushPromises(); | ||
component.update(); |
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.
Need to use that for the indexPatternService.hasUserDataView
promise to resolve.
Pinging @elastic/kibana-core (Team:Core) |
}), | ||
RedirectAppLinks: jest.fn((element: JSX.Element) => element), | ||
overviewPageActions: jest.fn().mockReturnValue([]), | ||
OverviewPageFooter: jest.fn().mockReturnValue(<></>), |
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.
optional: IMO React.createElement(React.Fragment..)
is more explicit in this case (and allows removing *.tsx
extension)
@@ -148,27 +124,94 @@ const mockFeatures = [ | |||
}, | |||
]; | |||
|
|||
const flushPromises = async () => { | |||
await new Promise<void>(async (resolve, reject) => { |
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.
optional
import { setTimeout: setTimeoutP } from 'timers/promises';
const flushPromises = async () => await setTimeoutP(10);
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
…stic#118881) * add loader on overview page * use KibanaThemeProvider for kibanaOverview * change add data label to integrations * adapt tests * update snapshots, remove i18n keys * review comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…stic#118881) * add loader on overview page * use KibanaThemeProvider for kibanaOverview * change add data label to integrations * adapt tests * update snapshots, remove i18n keys * review comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
#118881) (#119221) * Add loader for kibana overview while checking for user data view (#118881) * add loader on overview page * use KibanaThemeProvider for kibanaOverview * change add data label to integrations * adapt tests * update snapshots, remove i18n keys * review comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> * remove theme provider usage Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…ew (#118881) (#119222) * Add loader for kibana overview while checking for user data view (#118881) * add loader on overview page * use KibanaThemeProvider for kibanaOverview * change add data label to integrations * adapt tests * update snapshots, remove i18n keys * review comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> * remove theme provider usage Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…stic#118881) * add loader on overview page * use KibanaThemeProvider for kibanaOverview * change add data label to integrations * adapt tests * update snapshots, remove i18n keys * review comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…8881) * add loader on overview page * use KibanaThemeProvider for kibanaOverview * change add data label to integrations * adapt tests * update snapshots, remove i18n keys * review comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…stic#118881) * add loader on overview page * use KibanaThemeProvider for kibanaOverview * change add data label to integrations * adapt tests * update snapshots, remove i18n keys * review comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
Fix #116411
Part of #118866
indexPatternService.hasUserDataView
to avoid a blink effect between the data/noData version of the pageKibanaThemeProvider
for thekibanaOverview
application (will be removed from8.0
and7.16
backports)Checklist
Delete any items that are not applicable to this PR.