Skip to content

Commit

Permalink
Billing enhancements: storage layers (#3080) - export layers, backpor…
Browse files Browse the repository at this point in the history
…ted to stage/0.16/uat
  • Loading branch information
rodichenko committed Mar 20, 2023
1 parent 6829fc8 commit 4c2bb78
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
9 changes: 9 additions & 0 deletions client/src/components/billing/navigation/aggregate.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ export function getStorageClassName (storageClass) {
}
}

export function getAllStorageClasses () {
return [
'DEEP_ARCHIVE',
'GLACIER',
'GLACIER_IR',
'STANDARD'
];
}

export function getStorageClassByAggregate (aggregate) {
return getBillingGroupingOrderAggregate(aggregate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class ExportConsumer extends React.Component {
user,
group,
types: typesPayload = [],
filters: extraFilters = {}
filters: extraFilters = {},
properties: extraProperties
} = exportConfiguration;
const {
start,
Expand Down Expand Up @@ -88,7 +89,8 @@ class ExportConsumer extends React.Component {
types,
from: start.format('YYYY-MM-DD'),
to: end.format('YYYY-MM-DD'),
filters
filters,
properties: extraProperties
};
return new Promise((resolve, reject) => {
const request = new XMLHttpRequest();
Expand Down
28 changes: 26 additions & 2 deletions client/src/components/billing/reports/storage-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ import {
parseStorageAggregate,
StorageAggregate,
DEFAULT_STORAGE_CLASS_ORDER,
getStorageClassByAggregate
getStorageClassByAggregate,
getAllStorageClasses
} from '../navigation/aggregate';
import {
getDetailsDatasetsByStorageClassAndMetrics,
Expand Down Expand Up @@ -389,6 +390,28 @@ class StorageReports extends React.Component {
return (dataItem) => getItemDetailsByMetrics(dataItem, metrics);
}

@computed
get getExportProperties () {
const {
type,
filters = {}
} = this.props;
const {
storageAggregate
} = filters;
if (!/^object$/i.test(type)) {
return () => undefined;
}
const total = !storageAggregate || storageAggregate === StorageAggregate.default;
const storageClass = total
? getAllStorageClasses()
: [getStorageClassByAggregate(storageAggregate)];
return {
includeStorageOldVersions: true,
includeStorageClasses: storageClass
};
}

renderSelectedLayerButton = () => {
const {filters} = this.props;
const {storageAggregate} = filters;
Expand Down Expand Up @@ -460,7 +483,8 @@ class StorageReports extends React.Component {
cloudRegionId.length > 0
? cloudRegionId
: undefined
}
},
properties: this.getExportProperties
}}
>
<Layout
Expand Down

0 comments on commit 4c2bb78

Please sign in to comment.