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 filter in Report Results view cannot be saved #1303

Merged
merged 5 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Cleanup get_report function in gsad [#1263](https://github.com/greenbone/gsa/pull/1263)

### Fixed

- Fix filter in Report Results view cannot be saved & Fix error for create filter with no available results [#1303](https://github.com/greenbone/gsa/pull/1303)
- Fix creating permissions via the create multiple permissions dialog [#1302](https://github.com/greenbone/gsa/pull/1302)
- Fix showing host in Scanner dialog [#1301](https://github.com/greenbone/gsa/pull/1301)
- Fix detailslinks in AllSecInfo [#1299](https://github.com/greenbone/gsa/pull/1299)
Expand Down
14 changes: 14 additions & 0 deletions gsa/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"baseUrl": "src",
"paths": {
"gmp/*": ["./gmp/*"],
"web/*": ["./web/*"]
}
},
"exclude": ["build", "coverage", "node_modules"],
"typeAcquisition": {
"enable": true,
"include": ["jest"]
}
}
2 changes: 1 addition & 1 deletion gsa/src/web/entities/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ class EntitiesContainer extends React.Component {
<React.Fragment>
{children({
...other,
createFilterType: entitiesType,
createFilterType: this.props.gmpname,
entities,
entitiesCounts,
entitiesSelected: selected,
Expand Down
22 changes: 21 additions & 1 deletion gsa/src/web/pages/reports/detailsfilterdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,25 @@ import SolutionTypeGroup from 'web/components/powerfilter/solutiontypegroup';
import withFilterDialog from 'web/components/powerfilter/withFilterDialog';
import FilterDialogPropTypes from 'web/components/powerfilter/dialogproptypes';
import SeverityLevelsGroup from 'web/components/powerfilter/severitylevelsgroup';
import CreateNamedFilterGroup from 'web/components/powerfilter/createnamedfiltergroup';

/* eslint-enable */

import DeltaResultsFilterGroup from './deltaresultsfiltergroup';

import compose from 'web/utils/compose';
import withCapabilities from 'web/utils/withCapabilities';

const FilterDialog = ({
delta = false,
filter,
filterstring,
onFilterStringChange,
onFilterValueChange,
capabilities,
filterName,
saveNamedFilter,
onValueChange,
}) => {
const result_hosts_only = filter.get('result_hosts_only');
return (
Expand Down Expand Up @@ -93,12 +101,24 @@ const FilterDialog = ({
<FirstResultGroup filter={filter} onChange={onFilterValueChange} />

<ResultsPerPageGroup filter={filter} onChange={onFilterValueChange} />

{capabilities.mayCreate('filter') && (
<CreateNamedFilterGroup
filter={filter}
filterName={filterName}
saveNamedFilter={saveNamedFilter}
onValueChange={onValueChange}
/>
)}
</Layout>
);
};

FilterDialog.propTypes = FilterDialogPropTypes;

export default withFilterDialog()(FilterDialog);
export default compose(
withCapabilities,
withFilterDialog(),
)(FilterDialog);

// vim: set ts=2 sw=2 tw=80:
3 changes: 2 additions & 1 deletion gsa/src/web/pages/reports/detailspage.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ class ReportDetails extends React.Component {

handleFilterCreated(filter) {
this.handleInteraction();

this.load(filter);
this.props.loadFilters();
}
Expand Down Expand Up @@ -607,6 +606,8 @@ class ReportDetails extends React.Component {
delta={isDefined(report) && report.isDeltaReport()}
onFilterChanged={this.handleFilterChange}
onCloseClick={this.handleFilterDialogClose}
createFilterType="result"
onFilterCreated={this.handleFilterCreated}
/>
)}
{showDownloadReportDialog && (
Expand Down