From e4fa26df5dafe2ddf2d91c87057660f1c1277696 Mon Sep 17 00:00:00 2001 From: Sarah Diedrich Date: Wed, 24 Apr 2019 12:25:10 +0200 Subject: [PATCH 1/3] Fix filter in Report Results view cannot be saved --- gsa/jsconfig.json | 14 ++++++++++++ .../web/pages/reports/detailsfilterdialog.js | 22 ++++++++++++++++++- gsa/src/web/pages/reports/detailspage.js | 3 ++- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 gsa/jsconfig.json diff --git a/gsa/jsconfig.json b/gsa/jsconfig.json new file mode 100644 index 0000000000..fcc56d69c0 --- /dev/null +++ b/gsa/jsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "baseUrl": "src", + "paths": { + "gmp/*": ["./gmp/*"], + "web/*": ["./web/*"] + } + }, + "exclude": ["build", "coverage", "node_modules"], + "typeAcquisition": { + "enable": true, + "include": ["jest"] + } +} diff --git a/gsa/src/web/pages/reports/detailsfilterdialog.js b/gsa/src/web/pages/reports/detailsfilterdialog.js index d146bd3808..d261021854 100644 --- a/gsa/src/web/pages/reports/detailsfilterdialog.js +++ b/gsa/src/web/pages/reports/detailsfilterdialog.js @@ -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 ( @@ -93,12 +101,24 @@ const FilterDialog = ({ + + {capabilities.mayCreate('filter') && ( + + )} ); }; FilterDialog.propTypes = FilterDialogPropTypes; -export default withFilterDialog()(FilterDialog); +export default compose( + withCapabilities, + withFilterDialog(), +)(FilterDialog); // vim: set ts=2 sw=2 tw=80: diff --git a/gsa/src/web/pages/reports/detailspage.js b/gsa/src/web/pages/reports/detailspage.js index a2bb6c73f9..e95fb1a5ab 100644 --- a/gsa/src/web/pages/reports/detailspage.js +++ b/gsa/src/web/pages/reports/detailspage.js @@ -458,7 +458,6 @@ class ReportDetails extends React.Component { handleFilterCreated(filter) { this.handleInteraction(); - this.load(filter); this.props.loadFilters(); } @@ -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 && ( From 2dd4363e60784536492c67d654b8d5d678703f16 Mon Sep 17 00:00:00 2001 From: Sarah Diedrich Date: Wed, 24 Apr 2019 12:29:25 +0200 Subject: [PATCH 2/3] Fix error for create filter with no available results --- gsa/src/web/entities/container.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsa/src/web/entities/container.js b/gsa/src/web/entities/container.js index acde669618..a565a209da 100644 --- a/gsa/src/web/entities/container.js +++ b/gsa/src/web/entities/container.js @@ -595,7 +595,7 @@ class EntitiesContainer extends React.Component { {children({ ...other, - createFilterType: entitiesType, + createFilterType: this.props.gmpname, entities, entitiesCounts, entitiesSelected: selected, From 71d10727d98bed016cb12d7d97e93f06b4fe2da5 Mon Sep 17 00:00:00 2001 From: Sarah Diedrich Date: Wed, 24 Apr 2019 12:34:26 +0200 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6edf6491e4..da7ad74455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ 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 detailslinks in AllSecInfo [#1299](https://github.com/greenbone/gsa/pull/1299) - Only run libmicrohttp in debug mode if gsad build type is debug [#1295](https://github.com/greenbone/gsa/pull/1295) - Fix dialog can be moved outside browser frame [#1294](https://github.com/greenbone/gsa/pull/1294)