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

modified filterdialogs for reports and vulnerabilities #1503

Merged
merged 6 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
Expand Up @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[#1466](https://github.com/greenbone/gsa/pull/1466) [#1467](https://github.com/greenbone/gsa/pull/1467)

### Changed
- modified filterdialogs for reports and vulnerabilities [#1503](https://github.com/greenbone/gsa/pull/1503)
- Changed filterdialog for tickets page [#1489](https://github.com/greenbone/gsa/pull/1489)
- Restructured menu categories [#1481](https://github.com/greenbone/gsa/pull/1481)
- Logout and usersettings link got a menu [#1481](https://github.com/greenbone/gsa/pull/1481)
Expand Down
31 changes: 31 additions & 0 deletions gsa/src/web/pages/reports/detailsfilterdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ 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 SeverityValuesGroup from 'web/components/powerfilter/severityvaluesgroup';
import CreateNamedFilterGroup from 'web/components/powerfilter/createnamedfiltergroup';
import FilterSearchGroup from 'web/components/powerfilter/filtersearchgroup';

/* eslint-enable */

Expand All @@ -53,6 +55,7 @@ const FilterDialog = ({
filterstring,
onFilterStringChange,
onFilterValueChange,
onSearchTermChange,
capabilities,
filterName,
saveNamedFilter,
Expand Down Expand Up @@ -101,8 +104,36 @@ const FilterDialog = ({

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

<SeverityValuesGroup
name="severity"
title={_('Severity')}
filter={filter}
onChange={onFilterValueChange}
/>

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

<FilterSearchGroup
name="vulnerability"
filter={filter}
title={_('Vulnerability')}
onChange={onSearchTermChange}
/>

<FilterSearchGroup
name="host"
filter={filter}
title={_('Host (IP)')}
onChange={onSearchTermChange}
/>

<FilterSearchGroup
name="location"
filter={filter}
title={_('Location (eg. port/protocol)')}
onChange={onSearchTermChange}
/>

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

<ResultsPerPageGroup filter={filter} onChange={onFilterValueChange} />
Expand Down
17 changes: 17 additions & 0 deletions gsa/src/web/pages/reports/filterdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import ResultsPerPageGroup from 'web/components/powerfilter/resultsperpagegroup'
import SortByGroup from 'web/components/powerfilter/sortbygroup';
import withFilterDialog from 'web/components/powerfilter/withFilterDialog';
import FilterDialogPropTypes from 'web/components/powerfilter/dialogproptypes';
import SeverityValuesGroup from 'web/components/powerfilter/severityvaluesgroup';
import FilterSearchGroup from 'web/components/powerfilter/filtersearchgroup';

/* eslint-enable */

Expand Down Expand Up @@ -87,6 +89,7 @@ const ReportFilterDialogComponent = ({
saveNamedFilter,
onFilterStringChange,
onFilterValueChange,
onSearchTermChange,
onSortByChange,
onSortOrderChange,
onValueChange,
Expand All @@ -110,12 +113,26 @@ const ReportFilterDialogComponent = ({
onChange={onFilterValueChange}
/>

<SeverityValuesGroup
name="severity"
title={_('Highest Severity from Results')}
filter={filter}
onChange={onFilterValueChange}
/>

<MinQodGroup
name="min_qod"
filter={filter}
onChange={onFilterValueChange}
/>

<FilterSearchGroup
name="task"
title={_('From Task (name)')}
filter={filter}
onChange={onSearchTermChange}
/>

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

<ResultsPerPageGroup filter={filter} onChange={onFilterValueChange} />
Expand Down
96 changes: 91 additions & 5 deletions gsa/src/web/pages/vulns/filterdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,28 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import {_l} from 'gmp/locale/lang';
import React from 'react';

import {createFilterDialog} from '../../components/powerfilter/dialog.js';
import {_l, _} from 'gmp/locale/lang';

import Layout from 'web/components/layout/layout';

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

/* eslint-disable max-len */

import CreateNamedFilterGroup from 'web/components/powerfilter/createnamedfiltergroup';
import FilterDialogPropTypes from 'web/components/powerfilter/dialogproptypes';
import withFilterDialog from 'web/components/powerfilter/withFilterDialog';

import FilterStringGroup from 'web/components/powerfilter/filterstringgroup';
import FirstResultGroup from 'web/components/powerfilter/firstresultgroup';
import ResultsPerPageGroup from 'web/components/powerfilter/resultsperpagegroup';
import SortByGroup from 'web/components/powerfilter/sortbygroup';
import FilterSearchGroup from 'web/components/powerfilter/filtersearchgroup';
import SeverityValuesGroup from 'web/components/powerfilter/severityvaluesgroup';
import MinQodGroup from 'web/components/powerfilter/minqodgroup';

const SORT_FIELDS = [
{
Expand Down Expand Up @@ -51,8 +70,75 @@ const SORT_FIELDS = [
},
];

export default createFilterDialog({
sortFields: SORT_FIELDS,
});
const VulnsFilterDialogComponent = ({
capabilities,
filter,
filterName,
filterNameValid,
filterstring,
saveNamedFilter,
onFilterChange,
onFilterStringChange,
onFilterValueChange,
onSearchTermChange,
onSortByChange,
onSortOrderChange,
onValueChange,
}) => (
<Layout flex="column">
<FilterStringGroup
name="filterstring"
filter={filterstring}
onChange={onFilterStringChange}
/>

<SeverityValuesGroup
name="severity"
title={_('Severity')}
filter={filter}
onChange={onFilterValueChange}
/>

<MinQodGroup
name="min_qod"
filter={filter}
onChange={onFilterValueChange}
/>

<FilterSearchGroup
name="name"
title={_('Name')}
filter={filter}
onChange={onSearchTermChange}
/>

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

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

<SortByGroup
filter={filter}
fields={SORT_FIELDS}
onSortOrderChange={onSortOrderChange}
onSortByChange={onSortByChange}
/>

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

VulnsFilterDialogComponent.propTypes = FilterDialogPropTypes;

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

// vim: set ts=2 sw=2 tw=80: