From 02f3e571ade91ce49aca0def49df3b70e5b3a2d7 Mon Sep 17 00:00:00 2001 From: Brenda Sukh Date: Tue, 3 Nov 2020 13:52:57 -0500 Subject: [PATCH] Make lastBillingDate a param for product insights --- plugins/cost-insights/src/api/CostInsightsApi.ts | 2 ++ plugins/cost-insights/src/client.ts | 3 ++- .../src/components/ProductInsightsCard/ProductInsightsCard.tsx | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/cost-insights/src/api/CostInsightsApi.ts b/plugins/cost-insights/src/api/CostInsightsApi.ts index be5cd54fdb..a9048dedb8 100644 --- a/plugins/cost-insights/src/api/CostInsightsApi.ts +++ b/plugins/cost-insights/src/api/CostInsightsApi.ts @@ -112,12 +112,14 @@ export type CostInsightsApi = { * @param group * @param duration A time duration, such as P1M. See the Duration type for a detailed explanation * of how the durations are interpreted in Cost Insights. + * @param lastBillingDate The most current date for which billing data is complete, in YYYY-MM-DD format. * @param project (optional) The project id from getGroupProjects or query parameters */ getProductInsights( product: string, group: string, duration: Duration, + lastBillingDate: string, project: Maybe, ): Promise; diff --git a/plugins/cost-insights/src/client.ts b/plugins/cost-insights/src/client.ts index f7671bcce0..69822d7a63 100644 --- a/plugins/cost-insights/src/client.ts +++ b/plugins/cost-insights/src/client.ts @@ -197,10 +197,11 @@ export class ExampleCostInsightsClient implements CostInsightsApi { product: string, group: string, duration: Duration, + lastBillingDate: string, project: Maybe, ): Promise { const projectProductInsights = await this.request( - { product, group, duration, project }, + { product, group, duration, lastBillingDate, project }, { aggregation: [80_000, 110_000], change: { diff --git a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.tsx b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.tsx index 840c99522a..abf56d91db 100644 --- a/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.tsx +++ b/plugins/cost-insights/src/components/ProductInsightsCard/ProductInsightsCard.tsx @@ -86,6 +86,7 @@ export const ProductInsightsCard = ({ product }: ProductInsightsCardProps) => { product.kind, group!, productFilter!.duration, + lastCompleteBillingDate, project, ); setResource(p); @@ -107,6 +108,7 @@ export const ProductInsightsCard = ({ product }: ProductInsightsCardProps) => { group, product.kind, project, + lastCompleteBillingDate, ]); const onPeriodSelect = (duration: Duration) => {