Skip to content

Commit 5a58daa

Browse files
mendaomnmtfranchetto
authored andcommitted
Add filters to View in CostExplorer link
1 parent 1b4c3df commit 5a58daa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

frontend/src/old-pages/Clusters/Costs/CostData.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ const months = [
8383
i18next.t('costMonitoring.costData.chart.months.dec'),
8484
]
8585

86+
function buildCostExplorerLink(domain: string, clusterName: string) {
87+
const uri = `${domain}/cost-management/home#/cost-explorer?granularity=Monthly&historicalRelativeRange=LAST_12_MONTHS&groupBy=[]&filter=[{"dimension":{"id":"TagKey","displayValue":"Tag"},"operator":"INCLUDES","values":[{"value":"${clusterName}"}],"growableValue":{"value":"parallelcluster:cluster-name","displayValue":"parallelcluster:cluster-name"}}]`
88+
89+
return encodeURI(uri)
90+
}
91+
8692
export function CostData({clusterName}: Props) {
8793
const {t} = useTranslation()
8894
const defaultRegion = useState(['aws', 'region'])
@@ -112,7 +118,8 @@ export function CostData({clusterName}: Props) {
112118
)
113119

114120
const domain = consoleDomain(region)
115-
const costExplorerHref = `${domain}/cost-management/home#/cost-explorer`
121+
const costExplorerHref = buildCostExplorerLink(domain, clusterName)
122+
116123
const budgetsHref = `${domain}/billing/home#/budgets`
117124

118125
const i18nStrings: BarChartProps<XAxisValueType>['i18nStrings'] = useMemo(

0 commit comments

Comments
 (0)