Skip to content

Commit

Permalink
[MAN-9036] fix RiskTag risk low to crit
Browse files Browse the repository at this point in the history
  • Loading branch information
thelasttoto committed Apr 8, 2022
1 parent 3e17243 commit 6fc3a3c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
6 changes: 5 additions & 1 deletion ui/src/components/RiskTag/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import './risk-tag.scss';

const ALERT_RISKS = {
INFO: {value: "INFO", label: "Info"},
WARN: {value: "WARN", label: "Warn"}
WARN: {value: "WARN", label: "Warn"},
LOW: {value: "LOW", label: "Low"},
MEDIUM: {value: "MEDIUM", label: "Medium"},
HIGH: {value: "HIGH", label: "High"},
CRITICAL: {value: "CRITICAL", label: "Critical"}
}

const RiskTag = ({risk, label}) => {
Expand Down
16 changes: 16 additions & 0 deletions ui/src/components/RiskTag/risk-tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,20 @@
background-color: $color-risk-unknown;
color: white;
}
&.low {
background-color: $color-risk-low;
color: white;
}
&.medium {
background-color: $color-risk-medium;
color: white;
}
&.high {
background-color: $color-risk-high;
color: white;
}
&.critical {
background-color: $color-risk-critical;
color: white;
}
}
14 changes: 5 additions & 9 deletions ui/src/modules/fuzzer/TestOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import VulnerabilityCounts from './VulnerabilityCounts';

const TestOverview = ({backUrl}) => {
const {startTime, inventoryId} = useParams();
const specUrl = `modules/fuzzer/tests/${inventoryId}`;
const specUrl = `modules/fuzzer/report/${inventoryId}/${startTime}`;
const [report, setReport] = useState();
const [{loading, data}] = useFetch(specUrl);
const [testDetails, setTestDetails] = useState();
Expand All @@ -24,14 +24,10 @@ const TestOverview = ({backUrl}) => {

useEffect(() => {
if (data) {
const {items} = data || {};
const test = items.filter((r) => r.starttime === parseInt(startTime));
if (test) {
const {report: topLevelReport} = test[0] || {};
const {report} = topLevelReport || {report:[]};
const formattedReport = Object.keys(report).map((k) => report[k]);
setReport({ items: formattedReport });
}
const {report: topLevelReport} = data || {};
const {report} = topLevelReport || {report:[]};
const formattedReport = Object.keys(report).map((k) => report[k]);
setReport({ items: formattedReport });
}
},[data, startTime]);

Expand Down
1 change: 0 additions & 1 deletion ui/src/modules/fuzzer/TestsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { isNull } from 'lodash';
import Icon, { ICON_NAMES } from 'components/Icon';
import Modal from 'components/Modal';
import Table from 'components/Table';
import VulnerabilityIcon from 'components/VulnerabilityIcon';
import Button from 'components/Button';
import LineLoader from 'components/LineLoader';
import DownloadJsonButton from 'components/DownloadJsonButton';
Expand Down
6 changes: 6 additions & 0 deletions ui/src/utils/scss_variables.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ $color-status-violet: #721BD5;
$color-status-blue: #30749E;

//risk colors:
$color-risk-critical: $color-error-dark;
$color-risk-high: $color-error;
$color-risk-medium: $color-warning-dark;
$color-risk-low: $color-warning;
$color-risk-unknown: $color-status-blue;

:export {
Expand All @@ -57,6 +60,9 @@ $color-risk-unknown: $color-status-blue;
color-warning-dark: $color-warning-dark;
color-success: $color-success;

color-risk-critical: $color-risk-critical;
color-risk-high: $color-risk-high;
color-risk-medium: $color-risk-medium;
color-risk-low: $color-risk-low;
color-risk-unknown: $color-risk-unknown;
}

0 comments on commit 6fc3a3c

Please sign in to comment.