Skip to content

Commit

Permalink
Merge pull request #1242 from dlabrecq/source-of-spend2
Browse files Browse the repository at this point in the history
Omit unsupported query param
  • Loading branch information
dlabrecq authored Sep 11, 2024
2 parents e11028d + b60ceab commit f83fc3a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/routes/details/DetailsHeaderToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const DetailsHeaderToolbar: React.FC<DetailsToolbarProps> = ({
const getSourceOfSpendOptions = () => {
const newOptions = cloneDeep(sourceOfSpendOptions);

if (options?.data?.source_of_spend) {
if (options?.data?.source_of_spend.length > 0) {
options.data.source_of_spend.forEach(item => {
switch (item.code.toLowerCase()) {
case SourceOfSpendType.aws:
Expand Down
10 changes: 9 additions & 1 deletion src/routes/details/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ export function getSourceOfSpendFilter(sourceOfSpendType): string {
return 'CCSP';
case SourceOfSpendType.consulting:
return 'Consulting';
case SourceOfSpendType.direct:
return 'Direct';
case SourceOfSpendType.gcp:
return 'Google Cloud Platform';
case SourceOfSpendType.indirect:
return 'Indirect';
case SourceOfSpendType.miscellaneous:
return 'Miscellaneous';
case SourceOfSpendType.oci:
Expand All @@ -100,7 +104,7 @@ export function getSourceOfSpendFilter(sourceOfSpendType): string {
return 'Yearly subscriptions';
case SourceOfSpendType.all:
default:
return 'All sources of spend';
return undefined;
}
}

Expand All @@ -114,8 +118,12 @@ export function getSourceOfSpendType(sourceOfSpendType: SourceOfSpendType): stri
return 'ccsp';
case SourceOfSpendType.consulting:
return 'consulting';
case SourceOfSpendType.direct:
return 'direct';
case SourceOfSpendType.gcp:
return 'gcp';
case SourceOfSpendType.indirect:
return 'indirect';
case SourceOfSpendType.miscellaneous:
return 'miscellaneous';
case SourceOfSpendType.oci:
Expand Down
1 change: 1 addition & 0 deletions src/routes/details/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const useDetailsMapToProps = ({
},
orderBy: query.orderBy,
...(startDate && endDate && { ...formatDate({ startDate, endDate }) }),
sourceOfSpend: undefined, // Not supported by API
};

// Add secondaryGroupBy for export API request
Expand Down

0 comments on commit f83fc3a

Please sign in to comment.