-
+
{this.state.showDeleteModal && this.renderConfirmDeleteModal()}
- Dashboard
+ Dashboards
@@ -409,8 +441,31 @@ export class DashboardListing extends React.Component {
{this.renderSearchBar()}
- {this.renderTable()}
+
+ {this.renderTable()}
+
+ );
+ }
+
+ renderPageContent() {
+ if (!this.state.hasInitialFetchReturned) {
+ return;
+ }
+
+ return (
+
+ {this.renderListingOrEmptyState()}
+
+ );
+ }
+
+ render() {
+ return (
+
+
+ {this.renderPageContent()}
+
);
}
diff --git a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.test.js b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.test.js
index afb4c6a12c86..e1a95b65982a 100644
--- a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.test.js
+++ b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.test.js
@@ -57,7 +57,7 @@ const find = (num) => {
});
};
-test('renders table in loading state', () => {
+test('renders empty page in before initial fetch to avoid flickering', () => {
const component = shallow( {}}
@@ -67,18 +67,24 @@ test('renders table in loading state', () => {
expect(component).toMatchSnapshot();
});
-test('initialFilter', () => {
- const component = shallow( {}}
- listingLimit={1000}
- hideWriteControls={false}
- initialFilter="my dashboard"
- />);
- expect(component).toMatchSnapshot();
-});
-
describe('after fetch', () => {
+ test('initialFilter', async () => {
+ const component = shallow( {}}
+ listingLimit={1000}
+ hideWriteControls={false}
+ initialFilter="my dashboard"
+ />);
+
+ // Ensure all promises resolve
+ await new Promise(resolve => process.nextTick(resolve));
+ // Ensure the state changes are reflected
+ component.update();
+
+ expect(component).toMatchSnapshot();
+ });
+
test('renders table rows', async () => {
const component = shallow( {
+ const isNavVisible = await testSubjects.exists('top-nav');
+ const isLandingPageVisible = await testSubjects.exists('dashboardLandingPage');
+ if (!isNavVisible && !isLandingPageVisible) {
+ throw new Error('Dashboard application not loaded yet');
+ }
+ });
await this.awaitGlobalLoadingIndicatorHidden();
}