mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Return no metrics immediately if chartData.datasets are missing (#2082)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
b514e5c833
commit
e6c90c28cc
@ -50,6 +50,10 @@ export class BarChart extends React.Component<Props> {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (chartData.datasets.length == 0) {
|
||||||
|
return <NoMetrics/>;
|
||||||
|
}
|
||||||
|
|
||||||
const formatTimeLabels = (timestamp: string, index: number) => {
|
const formatTimeLabels = (timestamp: string, index: number) => {
|
||||||
const label = moment(parseInt(timestamp)).format("HH:mm");
|
const label = moment(parseInt(timestamp)).format("HH:mm");
|
||||||
const offset = " ";
|
const offset = " ";
|
||||||
@ -143,10 +147,6 @@ export class BarChart extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
const options = merge(barOptions, customOptions);
|
const options = merge(barOptions, customOptions);
|
||||||
|
|
||||||
if (chartData.datasets.length == 0) {
|
|
||||||
return <NoMetrics/>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Chart
|
<Chart
|
||||||
className={cssNames("BarChart flex box grow column", className)}
|
className={cssNames("BarChart flex box grow column", className)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user