Skip to content

Commit

Permalink
fix(quay): fix list page sorting of vulnerabilities based on severity
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitkrai03 committed Dec 21, 2023
1 parent 0679f44 commit 4b0243c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions plugins/quay/src/components/QuayTagDetails/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import LinkIcon from '@material-ui/icons/Link';
import WarningIcon from '@material-ui/icons/Warning';

import { SEVERITY_COLORS } from '../../lib/utils';
import { Layer, Vulnerability, VulnerabilityListItem } from '../../types';
import {
Layer,
Vulnerability,
VulnerabilityListItem,
VulnerabilityOrder,
} from '../../types';

type QuayTagDetailsProps = {
layer: Layer;
Expand Down Expand Up @@ -125,7 +130,13 @@ export const QuayTagDetails = ({
},
);
})
.flat();
.flat()
.sort((a, b) => {
const severityA = VulnerabilityOrder[a.Severity];
const severityB = VulnerabilityOrder[b.Severity];

return severityA - severityB;
});

return (
<TableContainer>
Expand Down

0 comments on commit 4b0243c

Please sign in to comment.