Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/prod-beta' into prod-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
dlabrecq committed Oct 19, 2022
2 parents c3d7bc1 + 14109a2 commit 9f88f52
Show file tree
Hide file tree
Showing 3 changed files with 361 additions and 298 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@patternfly/react-styles": "4.91.6",
"@patternfly/react-table": "4.111.5",
"@patternfly/react-tokens": "4.93.6",
"@redhat-cloud-services/frontend-components": "^3.9.19",
"@redhat-cloud-services/frontend-components": "^3.9.20",
"@redhat-cloud-services/frontend-components-notifications": "^3.2.12",
"@redhat-cloud-services/frontend-components-translations": "^3.2.5",
"@redhat-cloud-services/frontend-components-utilities": "^3.3.1",
Expand Down Expand Up @@ -90,7 +90,7 @@
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-formatjs": "^4.3.4",
"eslint-plugin-jest-dom": "^4.0.2",
"eslint-plugin-jsdoc": "^39.3.13",
"eslint-plugin-jsdoc": "^39.3.14",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-patternfly-react": "^4.80.4",
"eslint-plugin-prettier": "^4.2.1",
Expand All @@ -104,8 +104,8 @@
"html-replace-webpack-plugin": "^2.6.0",
"html-webpack-plugin": "^5.5.0",
"inquirer": "^8.2.4",
"jest": "^29.2.0",
"jest-environment-jsdom": "^29.2.0",
"jest": "^29.2.1",
"jest-environment-jsdom": "^29.2.1",
"jest-mock-axios": "^4.7.0-beta",
"jws": "^4.0.0",
"mini-css-extract-plugin": "^2.6.1",
Expand Down
25 changes: 13 additions & 12 deletions src/routes/views/components/export/exportSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ const mapStateToProps = createMapStateToProps<ExportSubmitOwnProps, ExportSubmit
const { groupBy, isAllItems, items, query, reportPathsType, resolution, timeScope } = props;
let { end_date, start_date } = getDateRange(query.dateRange);

if (!query.dateRange) {
const isPrevious = timeScope === 'previous';
const today = getToday();

if (isPrevious) {
today.setMonth(today.getMonth() - 1);
}
end_date = format(isPrevious ? endOfMonth(today) : today, 'yyyy-MM-dd');
start_date = format(startOfMonth(today), 'yyyy-MM-dd');
}

// Todo: Add name and format type for "all exports" feature
const getQueryString = () => {
const newQuery: Query = {
Expand All @@ -157,14 +168,15 @@ const mapStateToProps = createMapStateToProps<ExportSubmitOwnProps, ExportSubmit
limit: undefined,
offset: undefined,
resolution: resolution ? resolution : undefined,
...(!(start_date && end_date) && { time_scope_value: timeScope === 'previous' ? -2 : -1 }),
},
filter_by: {},
limit: 0,
order_by: undefined,
perspective: undefined,
dateRange: undefined,
delta: undefined,
start_date,
end_date,
};

// Store filter_by as an array so we can add to it below
Expand Down Expand Up @@ -212,17 +224,6 @@ const mapStateToProps = createMapStateToProps<ExportSubmitOwnProps, ExportSubmit
const reportError = exportSelectors.selectExportError(state, reportPathsType, reportType, queryString);
const reportFetchStatus = exportSelectors.selectExportFetchStatus(state, reportPathsType, reportType, queryString);

if (!(start_date && end_date)) {
const isPrevious = timeScope === 'previous';
const today = getToday();

if (isPrevious) {
today.setMonth(today.getMonth() - 1);
}
end_date = format(isPrevious ? endOfMonth(today) : today, 'yyyy-MM-dd');
start_date = format(startOfMonth(today), 'yyyy-MM-dd');
}

return {
endDate: end_date,
isExportsFeatureEnabled: featureFlagsSelectors.selectIsExportsFeatureEnabled(state),
Expand Down
Loading

0 comments on commit 9f88f52

Please sign in to comment.