From 899598fbddc0e6e4546187bace5101e49bc360a5 Mon Sep 17 00:00:00 2001 From: Steffen Waterkamp <steffen.waterkamp@greenbone.net> Date: Thu, 17 Oct 2019 12:04:46 +0200 Subject: [PATCH 1/2] Fix setting defaultFilter for report results Clicking the "reset to default filter" button in the powerfilter of the report detailspage loads and sets the userSettingsDefaultFilter for results. If none is set, it falls back to the DEFAULT_FILTER set on the detailspage. --- gsa/src/web/pages/reports/detailspage.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gsa/src/web/pages/reports/detailspage.js b/gsa/src/web/pages/reports/detailspage.js index 0d730ffcd8..87d5e262b1 100644 --- a/gsa/src/web/pages/reports/detailspage.js +++ b/gsa/src/web/pages/reports/detailspage.js @@ -67,6 +67,8 @@ import { import {loadUserSettingDefaults} from 'web/store/usersettings/defaults/actions'; import {getUserSettingsDefaults} from 'web/store/usersettings/defaults/selectors'; +import {loadUserSettingsDefaultFilter} from 'web/store/usersettings/defaultfilters/actions'; +import {getUserSettingsDefaultFilter} from 'web/store/usersettings/defaultfilters/selectors'; import { getReportComposerDefaults, @@ -364,7 +366,7 @@ class ReportDetails extends React.Component { } handleFilterResetClick() { - this.handleFilterChange(Filter.fromString('')); + this.handleFilterChange(this.props.resultDefaultFilter); } handleActivateTab(index) { @@ -695,6 +697,7 @@ ReportDetails.propTypes = { reportFilter: PropTypes.filter, reportFormats: PropTypes.array, reportId: PropTypes.id, + resultDefaultFilter: PropTypes.filter, saveReportComposerDefaults: PropTypes.func.isRequired, showError: PropTypes.func.isRequired, showErrorMessage: PropTypes.func.isRequired, @@ -723,6 +726,8 @@ const mapDispatchToProps = (dispatch, {gmp}) => { : dispatch(loadReportEntityWithStoreIfNeeded(gmp)(id, filter)), loadReportComposerDefaults: () => dispatch(loadReportComposerDefaults(gmp)()), + loadUserSettingDefaultFilter: () => + dispatch(loadUserSettingsDefaultFilter(gmp)('result')), saveReportComposerDefaults: reportComposerDefaults => dispatch(saveReportComposerDefaults(gmp)(reportComposerDefaults)), }; @@ -735,6 +740,10 @@ const mapStateToProps = (rootState, {match}) => { const deltaSel = deltaSelector(rootState); const reportFormatsSel = reportFormatsSelector(rootState); const userDefaultsSelector = getUserSettingsDefaults(rootState); + const userDefaultFilterSel = getUserSettingsDefaultFilter( + rootState, + 'result', + ); const username = getUsername(rootState); let entity; @@ -761,6 +770,7 @@ const mapStateToProps = (rootState, {match}) => { reportFormats: reportFormatsSel.getAllEntities(REPORT_FORMATS_FILTER), reportId: id, reportComposerDefaults: getReportComposerDefaults(rootState), + resultDefaultFilter: userDefaultFilterSel.getFilter('result'), username, }; }; From a91e1818e0506c731ceea42d974c0e7732544b6c Mon Sep 17 00:00:00 2001 From: Steffen Waterkamp <steffen.waterkamp@greenbone.net> Date: Thu, 17 Oct 2019 12:07:45 +0200 Subject: [PATCH 2/2] Update Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c742ed2c3b..1da2250f66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). logged in [#1508](https://github.com/greenbone/gsa/pull/1508) ### Fixed +- Fix setting the user default filter in report results [#1699](https://github.com/greenbone/gsa/pull/1699) - Use new model construction in some commands [#1665](https://github.com/greenbone/gsa/pull/1665) - Fixed auth_method preselection for user dialog [#1661](https://github.com/greenbone/gsa/pull/1661) - Fixed userId, roleId and groupId not rendering in create entity permissions dialog [#1658](https://github.com/greenbone/gsa/pull/1658)