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 setting user default filter in report results #1699

Merged
merged 2 commits into from
Oct 17, 2019
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 11 additions & 1 deletion gsa/src/web/pages/reports/detailspage.js
Original file line number Diff line number Diff line change
@@ -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,
};
};