Skip to content

Commit

Permalink
Use common no data message
Browse files Browse the repository at this point in the history
  • Loading branch information
sulemanof committed Sep 22, 2020
1 parent d02577f commit fddf019
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/plugins/vis_type_tagcloud/public/tag_cloud_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,4 @@ export const tagCloudVisTypeDefinition = {
},
]),
},
useCustomNoDataScreen: true,
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import React, { lazy, Suspense } from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { EuiLoadingSpinner } from '@elastic/eui';
import { get } from 'lodash';

import { VisualizationContainer } from '../../visualizations/public';
import { ExpressionRenderDefinition } from '../../expressions/common/expression_renderers';
Expand All @@ -41,7 +42,7 @@ export const getTagCloudVisRenderer: (
});

render(
<VisualizationContainer>
<VisualizationContainer showNoResults={config.visData?.rows?.length === 0}>
<Suspense fallback={<EuiLoadingSpinner />}>
<TagCloudChart
{...config}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@
*/

import React, { ReactNode } from 'react';
import { VisualizationNoResults } from './visualization_noresults';

interface VisualizationContainerProps {
className?: string;
children: ReactNode;
showNoResults?: boolean;
}

export const VisualizationContainer = (props: VisualizationContainerProps) => {
const classes = `visualization ${props.className}`;
return <div className={classes}>{props.children}</div>;
export const VisualizationContainer = ({
className = '',
children,
showNoResults = false,
}: VisualizationContainerProps) => {
const classes = `visualization ${className}`;
return <div className={classes}>{showNoResults ? <VisualizationNoResults /> : children}</div>;
};

0 comments on commit fddf019

Please sign in to comment.