Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Allow applying report configs to delta reports. #4082

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions src/web/pages/reports/deltadetailspage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

import logger from 'gmp/log';

import Filter, {RESET_FILTER, RESULTS_FILTER_FILTER} from 'gmp/models/filter';
import Filter, {
ALL_FILTER,
RESET_FILTER,
RESULTS_FILTER_FILTER} from 'gmp/models/filter';
import {isActive} from 'gmp/models/task';

import {first} from 'gmp/utils/array';
Expand All @@ -34,6 +37,11 @@
selector as filterSelector,
} from 'web/store/entities/filters';

import {
loadAllEntities as loadReportConfigs,
selector as reportConfigsSelector,
} from 'web/store/entities/reportconfigs';

import {
loadAllEntities as loadReportFormats,
selector as reportFormatsSelector,
Expand Down Expand Up @@ -168,6 +176,7 @@
componentDidMount() {
this.props.loadSettings();
this.props.loadFilters();
this.props.loadReportConfigs();

Check warning on line 179 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L179

Added line #L179 was not covered by tests
this.props.loadReportFormats();
this.props.loadReportComposerDefaults();
}
Expand Down Expand Up @@ -307,8 +316,13 @@
username,
onDownload,
} = this.props;
const {includeNotes, includeOverrides, reportFormatId, storeAsDefault} =
state;
const {
includeNotes,
includeOverrides,
reportConfigId,
reportFormatId,
storeAsDefault
} = state;

Check warning on line 325 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L319-L325

Added lines #L319 - L325 were not covered by tests

const newFilter = reportFilter.copy();
newFilter.set('notes', includeNotes);
Expand All @@ -317,6 +331,7 @@
if (storeAsDefault) {
const defaults = {
...reportComposerDefaults,
defaultReportConfigId: reportConfigId,

Check warning on line 334 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L334

Added line #L334 was not covered by tests
defaultReportFormatId: reportFormatId,
includeNotes,
includeOverrides,
Expand All @@ -336,6 +351,7 @@

return gmp.report
.download(entity, {
reportConfigId,

Check warning on line 354 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L354

Added line #L354 was not covered by tests
reportFormatId,
deltaReportId,
filter: newFilter,
Expand Down Expand Up @@ -457,6 +473,7 @@
isLoading,
reportFilter,
reportFormats,
reportConfigs,

Check warning on line 476 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L476

Added line #L476 was not covered by tests
reportId,
onInteraction,
reportComposerDefaults,
Expand Down Expand Up @@ -530,11 +547,13 @@
)}
{showDownloadReportDialog && (
<DownloadReportDialog
defaultReportConfigId={reportComposerDefaults.defaultReportConfigId}

Check warning on line 550 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L550

Added line #L550 was not covered by tests
defaultReportFormatId={reportComposerDefaults.defaultReportFormatId}
filter={reportFilter}
includeNotes={reportComposerDefaults.includeNotes}
includeOverrides={reportComposerDefaults.includeOverrides}
reportFormats={reportFormats}
reportConfigs={reportConfigs}

Check warning on line 556 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L556

Added line #L556 was not covered by tests
storeAsDefault={storeAsDefault}
onClose={this.handleCloseDownloadReportDialog}
onSave={this.handleReportDownload}
Expand All @@ -556,6 +575,7 @@
loadFilters: PropTypes.func.isRequired,
loadReport: PropTypes.func.isRequired,
loadReportComposerDefaults: PropTypes.func.isRequired,
loadReportConfigs: PropTypes.func.isRequired,
loadReportFormats: PropTypes.func.isRequired,
loadReportIfNeeded: PropTypes.func.isRequired,
loadSettings: PropTypes.func.isRequired,
Expand All @@ -567,6 +587,7 @@
reportExportFileName: PropTypes.string,
reportFilter: PropTypes.filter,
reportFormats: PropTypes.array,
reportConfigs: PropTypes.array,
reportId: PropTypes.id,
resultDefaultFilter: PropTypes.filter,
saveReportComposerDefaults: PropTypes.func.isRequired,
Expand All @@ -585,6 +606,7 @@
loadFilters: () => dispatch(loadFilters(gmp)(RESULTS_FILTER_FILTER)),
loadSettings: () => dispatch(loadUserSettingDefaults(gmp)()),
loadTarget: targetId => gmp.target.get({id: targetId}),
loadReportConfigs: () => dispatch(loadReportConfigs(gmp)(ALL_FILTER)),

Check warning on line 609 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L609

Added line #L609 was not covered by tests
loadReportFormats: () =>
dispatch(loadReportFormats(gmp)(REPORT_FORMATS_FILTER)),
loadReport: (id, deltaId, filter) =>
Expand All @@ -605,6 +627,7 @@
const filterSel = filterSelector(rootState);
const deltaSel = deltaReportSelector(rootState);
const reportFormatsSel = reportFormatsSelector(rootState);
const reportConfigsSel = reportConfigsSelector(rootState);

Check warning on line 630 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L630

Added line #L630 was not covered by tests
const userDefaultsSelector = getUserSettingsDefaults(rootState);
const userDefaultFilterSel = getUserSettingsDefaultFilter(
rootState,
Expand All @@ -624,6 +647,7 @@
'reportexportfilename',
),
reportFilter: getFilter(entity),
reportConfigs: reportConfigsSel.getAllEntities(ALL_FILTER),

Check warning on line 650 in src/web/pages/reports/deltadetailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/reports/deltadetailspage.jsx#L650

Added line #L650 was not covered by tests
reportFormats: reportFormatsSel.getAllEntities(REPORT_FORMATS_FILTER),
reportId: id,
reportComposerDefaults: getReportComposerDefaults(rootState),
Expand Down
Loading