mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
Display Networks on Sites
This commit is contained in:
parent
fd4b8feaaf
commit
c01458e394
@ -30,6 +30,9 @@ export async function GET(request: NextRequest) {
|
|||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
include: {
|
||||||
|
networks: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const total = await prisma.site.count({
|
const total = await prisma.site.count({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
@ -24,6 +24,7 @@ export default function SitesPage({ username, name }: SitesPageProps) {
|
|||||||
setItemPerPage,
|
setItemPerPage,
|
||||||
loadSites
|
loadSites
|
||||||
} = useSites();
|
} = useSites();
|
||||||
|
console.log(sites);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sidebar
|
<Sidebar
|
||||||
|
|||||||
@ -5,7 +5,15 @@ interface SitesProps {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
networks: string[];
|
networks: Network[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Network {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
ipv4Subnet?: string;
|
||||||
|
ipv6Subnet?: string;
|
||||||
|
gateway?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Sites({ id, name, description, networks }: SitesProps) {
|
export default function Sites({ id, name, description, networks }: SitesProps) {
|
||||||
@ -16,7 +24,7 @@ export default function Sites({ id, name, description, networks }: SitesProps) {
|
|||||||
<h2 className="card-title">{name}</h2>
|
<h2 className="card-title">{name}</h2>
|
||||||
<p>{description}</p>
|
<p>{description}</p>
|
||||||
{ networks && networks.length > 0 && (
|
{ networks && networks.length > 0 && (
|
||||||
<p>Networks: {networks.join(', ')}</p>
|
<p>Networks: {networks.map((network) => network.name).join(", ")}</p>
|
||||||
)}
|
)}
|
||||||
<div className="card-actions justify-end">
|
<div className="card-actions justify-end">
|
||||||
<button className="btn btn-secondary btn-sm btn-outline" onClick={() => router.push(`/dashboard/sites/${id}`)}>View</button>
|
<button className="btn btn-secondary btn-sm btn-outline" onClick={() => router.push(`/dashboard/sites/${id}`)}>View</button>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user