Merge pull request #16239 from jen13501/check_cost_insights_array_length

Check cost insights array length
This commit is contained in:
Fredrik Adelöw
2023-02-08 09:20:09 +01:00
committed by GitHub
3 changed files with 8 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': patch
---
Fix bug in EntityCostsCard if cost aggregation array is empty. Allow title override on the Cost Insights Page
@@ -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>;
}