Skip to content

Commit

Permalink
fix(findings): order findings by inserted_at DESC (#6783)
Browse files Browse the repository at this point in the history
Co-authored-by: Pablo Lara <[email protected]>
  • Loading branch information
prowler-bot and paabloLC authored Feb 3, 2025
1 parent 37d912e commit c60f13f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions ui/app/(prowler)/findings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ export default async function Findings({
searchParams: SearchParamsProps;
}) {
const searchParamsKey = JSON.stringify(searchParams || {});
const defaultSort = "severity,status";
const sort = searchParams.sort?.toString() || defaultSort;
const sort = searchParams.sort?.toString();

// Make sure the sort is correctly encoded
const encodedSort = sort.replace(/^\+/, "");
const encodedSort = sort?.replace(/^\+/, "");

// Extract all filter parameters and combine with default filters
const defaultFilters = {
Expand Down Expand Up @@ -137,7 +136,7 @@ const SSRDataTable = async ({
searchParams: SearchParamsProps;
}) => {
const page = parseInt(searchParams.page?.toString() || "1", 10);
const defaultSort = "severity,status";
const defaultSort = "severity,status,-inserted_at";
const sort = searchParams.sort?.toString() || defaultSort;

// Make sure the sort is correctly encoded
Expand Down
2 changes: 1 addition & 1 deletion ui/app/(prowler)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const SSRFindingsBySeverity = async ({

const SSRDataNewFindingsTable = async () => {
const page = 1;
const sort = "severity,updated_at";
const sort = "severity,-inserted_at";

const defaultFilters = {
"filter[status__in]": "FAIL",
Expand Down

0 comments on commit c60f13f

Please sign in to comment.