mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
chore: remove NextUI boilerplate code
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
export default function AboutLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
|
||||
<div className="inline-block max-w-lg text-center justify-center">
|
||||
{children}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { title } from "@/components/primitives";
|
||||
|
||||
export default function AboutPage() {
|
||||
return (
|
||||
<div>
|
||||
<h1 className={title()}>About</h1>
|
||||
<p className="mt-24">This is a page with no components on it</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
export default function BlogLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
|
||||
<div className="inline-block max-w-lg text-center justify-center">
|
||||
{children}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { title } from "@/components/primitives";
|
||||
|
||||
export default function BlogPage() {
|
||||
return (
|
||||
<div>
|
||||
<h1 className={title()}>Blog</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
export default function CloudsLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
|
||||
<div className="inline-block text-center justify-center">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
"use client";
|
||||
|
||||
// import { PencilSquareIcon } from "@heroicons/react/24/solid";
|
||||
// import { TrashIcon } from "@heroicons/react/24/solid";
|
||||
// import { EyeIcon } from "@heroicons/react/24/solid";
|
||||
import {
|
||||
// Chip,
|
||||
// getKeyValue,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableColumn,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
// Tooltip,
|
||||
// User,
|
||||
} from "@nextui-org/react";
|
||||
import React from "react";
|
||||
import useSWR from "swr";
|
||||
|
||||
import { title } from "@/components/primitives";
|
||||
import { fetcher } from "@/utils/fetcher";
|
||||
|
||||
export default function CloudsPage() {
|
||||
const getAccounts = useSWR(
|
||||
"http://localhost:8080/api/v1/providers/aws/accounts",
|
||||
fetcher,
|
||||
);
|
||||
|
||||
const getAudits = useSWR(
|
||||
"http://localhost:8080/api/v1/providers/aws/audits",
|
||||
fetcher,
|
||||
);
|
||||
|
||||
// TODO FIX TYPE CHECKING
|
||||
const getScanDetails = (account_id: number, detail: string) => {
|
||||
const scan =
|
||||
getAudits.data &&
|
||||
getAudits.data.find((audit: any) => audit.account_id === account_id);
|
||||
|
||||
if (detail === "status") {
|
||||
return scan?.audit_complete && "Completed";
|
||||
}
|
||||
|
||||
if (detail === "duration") {
|
||||
return scan?.audit_duration;
|
||||
}
|
||||
|
||||
if (detail === "added") {
|
||||
return new Date(scan?.inserted_at).toDateString();
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
// console.log("### getAccounts data", getAccounts.data);
|
||||
// console.log("### getAudits data", getAudits.data);
|
||||
|
||||
// TODO FIX TYPE CHECKING
|
||||
const rowItems = getAccounts.data?.map((row: any) => (
|
||||
<TableRow key={row.id}>
|
||||
<TableCell>{row.aws_account_id}</TableCell>
|
||||
<TableCell>{row.provider_id}</TableCell>
|
||||
<TableCell>{row.alias}</TableCell>
|
||||
<TableCell>{row.connected && "Connected"}</TableCell>
|
||||
<TableCell>{row.groups.map(String).join(", ")}</TableCell>
|
||||
<TableCell>{getScanDetails(row.account_id, "status")}</TableCell>
|
||||
<TableCell>{getScanDetails(row.account_id, "duration")}</TableCell>
|
||||
<TableCell>TBD</TableCell>
|
||||
<TableCell>{row.resources}</TableCell>
|
||||
<TableCell>{getScanDetails(row.account_id, "added")}</TableCell>
|
||||
</TableRow>
|
||||
));
|
||||
|
||||
// TODO IMPLEMENT NEXT UI SPECIFIC TABLE COMPONENT WITH VARIED RENDERING
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1 className={title()}>Cloud Accounts</h1>
|
||||
<p className="mt-10 text-left">
|
||||
{getAccounts.error && (
|
||||
<span className="text-red-400">Failed to load</span>
|
||||
)}
|
||||
{getAccounts.isLoading && (
|
||||
<span className="text-yellow-400">Loading</span>
|
||||
)}
|
||||
</p>
|
||||
{getAccounts.data && (
|
||||
<Table aria-label="cloud accounts table" className="text-left mt-10">
|
||||
<TableHeader>
|
||||
<TableColumn>ACCOUNT ID</TableColumn>
|
||||
<TableColumn>PROVIDER ID</TableColumn>
|
||||
<TableColumn>ALIAS</TableColumn>
|
||||
<TableColumn>CONNECTED</TableColumn>
|
||||
<TableColumn>GROUP(S)</TableColumn>
|
||||
<TableColumn>SCAN STATUS</TableColumn>
|
||||
<TableColumn>LAST SCAN</TableColumn>
|
||||
<TableColumn>NEXT SCAN</TableColumn>
|
||||
<TableColumn>RESOURCES</TableColumn>
|
||||
<TableColumn>ADDED</TableColumn>
|
||||
</TableHeader>
|
||||
<TableBody>{rowItems}</TableBody>
|
||||
</Table>
|
||||
)}
|
||||
<p className="mt-24">This is a page with "use client", useSWR</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
export default function DocsLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
|
||||
<div className="inline-block max-w-lg text-center justify-center">
|
||||
{children}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { title } from "@/components/primitives";
|
||||
|
||||
export default function DocsPage() {
|
||||
return (
|
||||
<div>
|
||||
<h1 className={title()}>Docs</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
export default function LoginLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
|
||||
<div className="inline-block max-w-lg text-center justify-center">
|
||||
{children}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { EyeIcon } from "@heroicons/react/24/solid";
|
||||
import { EyeSlashIcon } from "@heroicons/react/24/solid";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
CardBody,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
Input,
|
||||
Link,
|
||||
} from "@nextui-org/react";
|
||||
import React from "react";
|
||||
|
||||
export default function LoginPage() {
|
||||
const [isVisible, setIsVisible] = React.useState(false);
|
||||
|
||||
const toggleVisibility = () => setIsVisible(!isVisible);
|
||||
|
||||
return (
|
||||
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
|
||||
<div className="inline-block max-w-lg text-center justify-center">
|
||||
<Card>
|
||||
<CardHeader className="pb-0">
|
||||
<h1 className="pl-1">Login</h1>
|
||||
</CardHeader>
|
||||
<CardBody className="w-72 pb-0">
|
||||
<Input
|
||||
label="Email"
|
||||
variant="bordered"
|
||||
placeholder="Enter your email"
|
||||
className="mb-2"
|
||||
/>
|
||||
<Input
|
||||
label="Password"
|
||||
variant="bordered"
|
||||
placeholder="Enter your password"
|
||||
endContent={
|
||||
<button
|
||||
className="focus:outline-none"
|
||||
type="button"
|
||||
onClick={toggleVisibility}
|
||||
>
|
||||
{isVisible ? (
|
||||
<EyeSlashIcon className="text-2xl text-default-400 pointer-events-none w-5 h-5" />
|
||||
) : (
|
||||
<EyeIcon className="text-2xl text-default-400 pointer-events-none w-5 h-5" />
|
||||
)}
|
||||
</button>
|
||||
}
|
||||
type={isVisible ? "text" : "password"}
|
||||
className="max-w-xs"
|
||||
/>
|
||||
</CardBody>
|
||||
<CardFooter>
|
||||
<Button href="/clouds" as={Link} color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
<p className="mt-24">This is a page with "use client", useState</p>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
export default function PricingLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
|
||||
<div className="inline-block max-w-lg text-center justify-center">
|
||||
{children}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { title } from "@/components/primitives";
|
||||
|
||||
export default function PricingPage() {
|
||||
return (
|
||||
<div>
|
||||
<h1 className={title()}>Pricing</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user