Revision 711cbdbe
Added by Liza Gilman over 5 years ago
webpack/assets/javascripts/react_app/components/common/charts/DonutChart/index.js | ||
---|---|---|
import React from 'react';
|
||
import { DonutChart as PfDonutChart } from 'patternfly-react';
|
||
import { getDonutChartConfig } from '../../../../../services/ChartService';
|
||
import { getDonutChartConfig } from '../../../../../services/charts/DonutChartService';
|
||
import MessageBox from '../../MessageBox';
|
||
import { translate as __ } from '../../../../../react_app/common/I18n';
|
||
|
||
... | ... | |
noDataMsg = __('No data available'),
|
||
title = { type: 'percent' },
|
||
unloadData = false,
|
||
|
||
}) => {
|
||
const chartConfig = getDonutChartConfig({ data, config, onclick });
|
||
|
||
if (chartConfig.data.columns.length > 0) {
|
||
return (
|
||
<PfDonutChart
|
||
{...chartConfig}
|
||
title={title}
|
||
unloadBeforeLoad = {unloadData}
|
||
/>
|
||
);
|
||
return <PfDonutChart {...chartConfig} title={title} unloadBeforeLoad={unloadData} />;
|
||
}
|
||
return <MessageBox msg={noDataMsg} icontype="info" />;
|
||
};
|
Also available in: Unified diff
Fixes #24011 - Add Patternfly bar chart support