mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
chore: rendering real data for Providers and relocate action folder
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export * from "./providers";
|
||||
@@ -0,0 +1,20 @@
|
||||
import "server-only";
|
||||
|
||||
import { parseStringify } from "@/lib";
|
||||
|
||||
export const getProvider = async () => {
|
||||
const keyServer = process.env.LOCAL_SERVER_URL;
|
||||
|
||||
try {
|
||||
const providers = await fetch(`${keyServer}/providers`, {
|
||||
headers: {
|
||||
"X-Tenant-ID": "12646005-9067-4d2a-a098-8bb378604362",
|
||||
},
|
||||
});
|
||||
|
||||
const data = await providers.json();
|
||||
return parseStringify(data);
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Spacer } from "@nextui-org/react";
|
||||
import React, { Suspense } from "react";
|
||||
|
||||
import { getProvider } from "@/actions";
|
||||
import {
|
||||
ColumnsProviders,
|
||||
DataTable,
|
||||
@@ -8,7 +9,6 @@ import {
|
||||
ModalWrap,
|
||||
SkeletonTableProvider,
|
||||
} from "@/components";
|
||||
import { getProvider } from "@/lib/actions";
|
||||
|
||||
export default async function Providers() {
|
||||
const onSave = async () => {
|
||||
@@ -44,10 +44,5 @@ export default async function Providers() {
|
||||
const SSRDataTable = async () => {
|
||||
const providersData = await getProvider();
|
||||
const [providers] = await Promise.all([providersData]);
|
||||
return (
|
||||
<DataTable
|
||||
columns={ColumnsProviders}
|
||||
data={providers?.providers?.data ?? []}
|
||||
/>
|
||||
);
|
||||
return <DataTable columns={ColumnsProviders} data={providers?.data ?? []} />;
|
||||
};
|
||||
|
||||
@@ -45,9 +45,9 @@ export const ColumnsProviders: ColumnDef<ProviderProps>[] = [
|
||||
{
|
||||
accessorKey: "status",
|
||||
header: "Scan Status",
|
||||
cell: ({ row }) => {
|
||||
const { status } = getProviderAttributes(row);
|
||||
return <StatusBadge status={status} />;
|
||||
cell: () => {
|
||||
// Temporarily overwriting the value until the API is functional.
|
||||
return <StatusBadge status={"completed"} />;
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -72,9 +72,9 @@ export const ColumnsProviders: ColumnDef<ProviderProps>[] = [
|
||||
{
|
||||
accessorKey: "resources",
|
||||
header: "Resources",
|
||||
cell: ({ row }) => {
|
||||
const { resources } = getProviderAttributes(row);
|
||||
return <p className="font-medium">{resources}</p>;
|
||||
cell: () => {
|
||||
// Temporarily overwriting the value until the API is functional.
|
||||
return <p className="font-medium">{288}</p>;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from "./provider.actions";
|
||||
@@ -1,19 +0,0 @@
|
||||
import "server-only";
|
||||
|
||||
import { parseStringify } from "../utils";
|
||||
|
||||
export const getProvider = async () => {
|
||||
const key = process.env.LOCAL_SITE_URL;
|
||||
|
||||
if (!key) return undefined;
|
||||
|
||||
try {
|
||||
const providers = await fetch(`${key}/api/providers`);
|
||||
|
||||
const data = await providers.json();
|
||||
|
||||
return parseStringify(data);
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user