Skip to content

Commit

Permalink
Fix: Fix filters for severity "N/A" and "1" in "CVES by CVSS" diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
a-h-abdelsalam authored and timopollmeier committed Nov 29, 2023
1 parent b092d56 commit b3e5606
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
9 changes: 3 additions & 6 deletions src/web/components/dashboard/display/cvss/cvssdisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import FilterTerm from 'gmp/models/filter/filterterm';
import Filter from 'gmp/models/filter';

import PropTypes from 'web/utils/proptypes';
import {NA_VALUE} from 'web/utils/severity';

import BarChart from 'web/components/chart/bar';

Expand Down Expand Up @@ -69,11 +68,9 @@ class CvssDisplay extends React.Component {
let statusTerm;

if (isDefined(start)) {
if (start === NA_VALUE) {
statusTerm = FilterTerm.fromString('severity=""');
} else {
statusTerm = FilterTerm.fromString(`severity=${start}`);
}
statusTerm = FilterTerm.fromString(`severity=${start}`);
} else {
statusTerm = FilterTerm.fromString('severity=""');
}

if (isDefined(filter) && filter.hasTerm(statusTerm)) {
Expand Down
2 changes: 1 addition & 1 deletion src/web/components/dashboard/display/cvss/cvsstransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const transformCvssData = (data = {}) => {
start: value,
};
toolTip = `10.0 (${label}): ${perc}% (${count})`;
} else if (value > 1) {
} else if (value >= 1) {
filterValue = {
start: format(value - 0.1),
end: format(value + 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import {isDefined} from 'gmp/utils/identity';
import FilterTerm from 'gmp/models/filter/filterterm';
import Filter from 'gmp/models/filter';

import {NA_VALUE} from 'web/utils/severity';

import PropTypes from 'web/utils/proptypes';

import DonutChart from 'web/components/chart/donut';
Expand Down Expand Up @@ -67,8 +65,6 @@ class SeverityClassDisplay extends React.Component {
let severityTerm;
if (start > 0) {
severityTerm = FilterTerm.fromString(`severity>${start}`);
} else if (start === NA_VALUE) {
severityTerm = FilterTerm.fromString('severity=""');
} else {
severityTerm = FilterTerm.fromString(`severity=${start}`);
}
Expand Down

0 comments on commit b3e5606

Please sign in to comment.