Check for empty costs array and allow title override

Signed-off-by: Jen Evans <jenevan@rei.com>
This commit is contained in:
Jen Evans
2023-02-07 16:58:16 -08:00
parent 3efd4da23c
commit 8c5abb388a
2 changed files with 3 additions and 2 deletions
@@ -37,6 +37,7 @@ type CostInsightsLayoutProps = {
};
export const CostInsightsLayout = ({
title = 'Cost Insights',
groups,
children,
}: PropsWithChildren<CostInsightsLayoutProps>) => {
@@ -46,7 +47,7 @@ export const CostInsightsLayout = ({
<Header
style={{ boxShadow: 'none' }}
title="Cost Insights"
pageTitleOverride="Cost Insights"
pageTitleOverride={title}
type="Tool"
/>
<div className={classes.root}>
@@ -120,7 +120,7 @@ export const EntityCostsCard = () => {
return <MaterialAlert severity="error">{error.message}</MaterialAlert>;
}
if (!dailyCost) {
if (!dailyCost || !dailyCost.aggregation.length) {
return <MaterialAlert severity="error">No daily costs</MaterialAlert>;
}