From 8072bc85c35a3d46b39f1cb85cb3ad473d31cfc4 Mon Sep 17 00:00:00 2001 From: Brenda Sukh Date: Mon, 23 Nov 2020 18:45:02 -0500 Subject: [PATCH] Update daily cost data to return groupedCosts --- plugins/cost-insights/src/client.ts | 6 ++++-- plugins/cost-insights/src/types/Cost.ts | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/cost-insights/src/client.ts b/plugins/cost-insights/src/client.ts index 2180385424..c78a3dc2dc 100644 --- a/plugins/cost-insights/src/client.ts +++ b/plugins/cost-insights/src/client.ts @@ -35,7 +35,7 @@ import { UnlabeledDataflowAlert, } from '../src/utils/alerts'; import { inclusiveStartDateOf } from '../src/utils/duration'; -import { trendlineOf, changeOf } from './utils/mockData'; +import { trendlineOf, changeOf, getGroupedProducts } from './utils/mockData'; type IntervalFields = { duration: Duration; @@ -56,7 +56,7 @@ function parseIntervals(intervals: string): IntervalFields { }; } -function aggregationFor( +export function aggregationFor( intervals: string, baseline: number, ): DateAggregation[] { @@ -140,6 +140,7 @@ export class ExampleCostInsightsClient implements CostInsightsApi { aggregation: aggregation, change: changeOf(aggregation), trendline: trendlineOf(aggregation), + groupedCosts: getGroupedProducts(intervals), }, ); @@ -155,6 +156,7 @@ export class ExampleCostInsightsClient implements CostInsightsApi { aggregation: aggregation, change: changeOf(aggregation), trendline: trendlineOf(aggregation), + groupedCosts: getGroupedProducts(intervals), }, ); diff --git a/plugins/cost-insights/src/types/Cost.ts b/plugins/cost-insights/src/types/Cost.ts index 84a8bfae51..dd28bba6b0 100644 --- a/plugins/cost-insights/src/types/Cost.ts +++ b/plugins/cost-insights/src/types/Cost.ts @@ -21,6 +21,7 @@ import { Trendline } from './Trendline'; export interface Cost { id: string; aggregation: DateAggregation[]; - change: ChangeStatistic; - trendline: Trendline; + change?: ChangeStatistic; + trendline?: Trendline; + groupedCosts?: Cost[]; }