Skip to content

Commit

Permalink
feat: implement new functionality with inserted_at__gte in overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
paabloLC committed Feb 7, 2025
1 parent 1f309b9 commit 04f5953
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 15 additions & 4 deletions ui/app/(prowler)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Spacer } from "@nextui-org/react";
import { format, subDays } from "date-fns";
import { Suspense } from "react";

import { getFindings } from "@/actions/findings/findings";
Expand Down Expand Up @@ -131,9 +132,12 @@ const SSRDataNewFindingsTable = async () => {
const page = 1;
const sort = "severity,-inserted_at";

const twoDaysAgo = format(subDays(new Date(), 2), "yyyy-MM-dd");

const defaultFilters = {
"filter[status__in]": "FAIL",
"filter[delta__in]": "new",
"filter[inserted_at__gte]": twoDaysAgo,
};

const findingsData = await getFindings({
Expand Down Expand Up @@ -172,14 +176,21 @@ const SSRDataNewFindingsTable = async () => {

return (
<>
<div className="relative flex items-start justify-between">
<h3 className="mb-4 w-full text-sm font-bold uppercase">
Latest 10 failing findings to date by Severity
</h3>
<div className="relative flex w-full">
<div className="flex w-full items-center gap-2">
<h3 className="text-sm font-bold uppercase">
Latest 10 failing findings to date by Severity
</h3>
<p className="text-xs text-gray-500">
Showing the latest 10 failing findings by severity from the last 2
days.
</p>
</div>
<div className="absolute -top-6 right-0">
<LinkToFindings />
</div>
</div>
<Spacer y={4} />
<DataTable
columns={ColumnNewFindingsToDate}
data={expandedResponse?.data || []}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const LinkToFindings = () => {
return (
<div className="mt-4 flex w-full items-center justify-end">
<CustomButton
asLink="/findings?sort=severity,-updated_at&filter[status__in]=FAIL"
asLink="/findings?sort=severity,-inserted_at&filter[status__in]=FAIL&filter[delta__in]=new"
ariaLabel="Go to Findings page"
variant="solid"
color="action"
Expand Down

0 comments on commit 04f5953

Please sign in to comment.