Skip to content

Commit

Permalink
🐛 Fix risk filter in reports tab (#1854) (#1879)
Browse files Browse the repository at this point in the history
Solves [MTA-2652](https://issues.redhat.com/browse/MTA-2652)


[39263239-0a8e-4e33-85e2-3178fde2b0d9.webm](https://github.com/konveyor/tackle2-ui/assets/117646518/a499d388-a9a3-4780-a497-f21fb1ba85a9)

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>
Co-authored-by: Ian Bolton <ibolton@redhat.com>
Co-authored-by: Scott Dickerson <sdickers@redhat.com>
Signed-off-by: Cherry Picker <noreply@github.com>
  • Loading branch information
3 people committed Apr 22, 2024
1 parent aaacc9f commit 9914066
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ export const IdentifiedRisksTable: React.FC<IIdentifiedRisksTableProps> = ({
}) => {
const { t } = useTranslation();

const riskLevelLabelMapping = {
red: t("risks.high"),
yellow: t("risks.medium"),
green: t("risks.low"),
unknown: t("risks.unknown"),
};

const { assessmentsWithArchetypeApplications } =
useFetchAssessmentsWithArchetypeApplications();

Expand Down Expand Up @@ -242,15 +249,14 @@ export const IdentifiedRisksTable: React.FC<IIdentifiedRisksTableProps> = ({
getItemValue: (item: ITableRowData) => {
const riskKey = item.answer.risk;
const riskValue =
riskLevelMapping[riskKey as keyof typeof riskLevelMapping];
riskLevelLabelMapping[
riskKey as keyof typeof riskLevelLabelMapping
];
return riskValue.toString();
},
selectOptions: [
{ value: "3", label: "High" },
{ value: "2", label: "Medium" },
{ value: "1", label: "Low" },
{ value: "0", label: "Unknown" },
],
selectOptions: Object.values(riskLevelLabelMapping).map((riskName) => {
return { value: riskName, label: riskName };
}),
},
],
initialItemsPerPage: 10,
Expand Down

0 comments on commit 9914066

Please sign in to comment.