[Dashboard] Await new services in exported listing table (#195277)

Closes https://github.com/elastic/kibana/issues/194733

## Summary

In https://github.com/elastic/kibana/pull/193644, I forgot to remove
references to the old `servicesReady` promise - this caused an issue
where it never resolved `true`, so anywhere that depended on this would
be stuck in a loading state. This PR fixes this by replacing all
instances of `servicesReady` with the new
`untilPluginStartServicesReady` promise.

Specifically, this fixes the exported `DashboardListingTable` that the
Security page uses:

- **Before:**


https://github.com/user-attachments/assets/78fc8ad8-7bff-43bf-95ec-d52f4da91371

- **After:**



https://github.com/user-attachments/assets/af1be9d3-9af5-4a30-9b5d-bc4352214a97


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Hannah Mudge 2024-10-07 11:36:27 -06:00 committed by GitHub
parent 5d7de2f6c2
commit 10271a2e1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -7,10 +7,10 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import React, { Suspense } from 'react';
import { EuiEmptyPrompt, EuiLoadingSpinner } from '@elastic/eui';
import React, { Suspense } from 'react';
import { servicesReady } from '../plugin';
import { untilPluginStartServicesReady } from '../services/kibana_services';
import { DashboardListingProps } from './types';
const ListingTableLoadingIndicator = () => {
@ -20,7 +20,7 @@ const ListingTableLoadingIndicator = () => {
const LazyDashboardListing = React.lazy(() =>
(async () => {
const modulePromise = import('./dashboard_listing_table');
const [module] = await Promise.all([modulePromise, servicesReady]);
const [module] = await Promise.all([modulePromise, untilPluginStartServicesReady()]);
return {
default: module.DashboardListingTable,

View file

@ -138,7 +138,6 @@ export interface DashboardStart {
}
export let resolveServicesReady: () => void;
export const servicesReady = new Promise<void>((resolve) => (resolveServicesReady = resolve));
export class DashboardPlugin
implements