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

Use renderComplete handler in maps embeddable #144421

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions x-pack/performance/journeys/ecommerce_dashboard_map_only.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import { Journey } from '@kbn/journeys';
import { subj } from '@kbn/test-subj-selector';
import { waitForVisualizations } from '../utils';

export const journey = new Journey({
esArchives: ['x-pack/performance/es_archives/sample_data_ecommerce'],
Expand All @@ -18,9 +19,7 @@ export const journey = new Journey({
await page.waitForSelector('#dashboardListingHeading');
})

.step('Go to Ecommerce No Map Dashboard', async ({ page, kbnUrl }) => {
.step('Go to Ecommerce Map only Dashboard', async ({ page, log, kbnUrl }) => {
await page.click(subj('dashboardListingTitleLink-[eCommerce]-Map-Only'));
await page.waitForSelector(
'div[data-title="[eCommerce] Orders by Country"][data-render-complete="true"]'
);
await waitForVisualizations(page, log, 1);
});
9 changes: 9 additions & 0 deletions x-pack/plugins/maps/public/embeddable/map_embeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ export class MapEmbeddable
* @param {ContainerState} containerState
*/
render(domNode: HTMLElement) {
super.render(domNode);
this._domNode = domNode;
if (!this._isInitialized) {
return;
Expand Down Expand Up @@ -776,6 +777,14 @@ export class MapEmbeddable
* This means that the DASHBOARD_LOADED_EVENT event might be fired while a map is still rendering in some cases.
* For more details please contact the maps team.
*/
const isRendered = !isLoading && firstLayerWithError === undefined;
if (isLoading) {
this.renderComplete.dispatchInProgress();
} else if (firstLayerWithError) {
this.renderComplete.dispatchError();
} else if (!isLoading && isRendered) {
this.renderComplete.dispatchComplete();
}
this.updateOutput({
...output,
loading: isLoading,
Expand Down