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

Add type column to scan config to allow filter and sort by type #1331

Merged
merged 3 commits into from
Apr 29, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [8.0.1] - (unreleased)

### Added
- Add type column to scan configs to allow filter and sort by scan config type [#1331](https://github.com/greenbone/gsa/pull/1331)
- Add new DefaultFilterSettings to UserSettings [#1326](https://github.com/greenbone/gsa/pull/1326)
- Add warning for IE11 [#1322](https://github.com/greenbone/gsa/pull/1322)
- Add tests for label and img [#1313](https://github.com/greenbone/gsa/pull/1313)
Expand Down
8 changes: 8 additions & 0 deletions gsa/src/gmp/models/scanconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,21 @@ import {parseInt} from '../parser';

import Model from '../model';

import _ from '../locale';

export const EMPTY_SCAN_CONFIG_ID = '085569ce-73ed-11df-83c3-002264764cea';
export const FULL_AND_FAST_SCAN_CONFIG_ID =
'daba56c8-73ec-11df-a475-002264764cea';

export const OSP_SCAN_CONFIG_TYPE = 1;
export const OPENVAS_SCAN_CONFIG_TYPE = 0;

export const getTranslatedType = config => {
return config.scan_config_type === OSP_SCAN_CONFIG_TYPE
? _('OSP')
: _('OpenVAS');
};

export const parse_count = count => {
return !isEmpty(count) && count !== '-1' ? parseInt(count) : undefined;
};
Expand Down
10 changes: 10 additions & 0 deletions gsa/src/web/pages/scanconfigs/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ const Header = ({
>
{_('Name')}
</TableHead>
<TableHead
width="5%"
rowSpan="2"
currentSortDir={currentSortDir}
currentSortBy={currentSortBy}
sortBy={sort ? 'type' : false}
onSortChange={onSortChange}
>
{_('Type')}
</TableHead>
<TableHead width="10%" colSpan="2">
{_('Family')}
</TableHead>
Expand Down
2 changes: 2 additions & 0 deletions gsa/src/web/pages/scanconfigs/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import PropTypes from 'web/utils/proptypes';
import {na} from 'web/utils/render';

import Trend from './trend';
import {getTranslatedType} from 'gmp/models/scanconfig';

const ScanConfigActions = withEntitiesActions(
({
Expand Down Expand Up @@ -100,6 +101,7 @@ const ScanConfigRow = ({
displayName={_('Scan Config')}
onToggleDetailsClick={onToggleDetailsClick}
/>
<TableData>{getTranslatedType(entity.scan_config_type)}</TableData>
<TableData>{na(entity.families.count)}</TableData>
<TableData>
<Trend
Expand Down
4 changes: 4 additions & 0 deletions gsa/src/web/pages/scanconfigs/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export const SORT_FIELDS = [
name: 'name',
displayName: _l('Name'),
},
{
name: 'type',
displayName: _l('Type'),
},
{
name: 'families_total',
displayName: _l('Families: Total'),
Expand Down