Update Active Directory sites page to display site details in a table

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 705f2157-ef97-4fbd-89e4-8c7f2ecaea90
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ed01c5f-a82d-405a-b728-b2e3d127c60c/0728d421-d119-4a15-876b-b3825b0e616d.jpg
This commit is contained in:
alphaeusmote
2025-04-10 00:05:41 +00:00
parent 56090d1a27
commit 8cbf4cf23e
+49 -41
View File
@@ -552,7 +552,7 @@ export default function SitesPage() {
<div>
<CardTitle>Active Directory Sites</CardTitle>
<CardDescription>
Manage physical locations in your Active Directory infrastructure.
View and manage sites in your Active Directory environment.
</CardDescription>
</div>
<div className="flex gap-2">
@@ -579,24 +579,6 @@ export default function SitesPage() {
</div>
</CardHeader>
<CardContent>
{!selectedConnection ? (
<div className="text-center py-10">
<p className="text-muted-foreground">Please select a connection to view sites.</p>
</div>
) : isLoadingSites ? (
<div className="space-y-3">
{[...Array(5)].map((_, i) => (
<div key={i} className="flex items-center space-x-4">
<Skeleton className="h-12 w-full" />
</div>
))}
</div>
) : sitesError ? (
<div className="text-center py-10">
<p className="text-destructive font-medium">Error loading sites</p>
<p className="text-muted-foreground">{sitesError.message || "Unknown error occurred"}</p>
</div>
) : (
<Table>
<TableHeader>
<TableRow>
@@ -608,7 +590,30 @@ export default function SitesPage() {
</TableRow>
</TableHeader>
<TableBody>
{sitesData?.data && sitesData.data.length > 0 ? (
{!selectedConnection ? (
<TableRow>
<TableCell colSpan={5} className="text-center py-6">
<p className="text-muted-foreground">Please select a connection to view sites.</p>
</TableCell>
</TableRow>
) : isLoadingSites ? (
<TableRow>
<TableCell colSpan={5} className="p-0 border-0">
<div className="space-y-3 p-4">
{[...Array(5)].map((_, i) => (
<Skeleton key={i} className="h-12 w-full" />
))}
</div>
</TableCell>
</TableRow>
) : sitesError ? (
<TableRow>
<TableCell colSpan={5} className="text-center py-6">
<p className="text-destructive font-medium">Error loading sites</p>
<p className="text-muted-foreground">{sitesError.message || "Unknown error occurred"}</p>
</TableCell>
</TableRow>
) : sitesData?.data && sitesData.data.length > 0 ? (
sitesData.data.map((site: AdSite) => (
<TableRow key={site.objectGUID}>
<TableCell className="font-medium">{site.name}</TableCell>
@@ -676,7 +681,6 @@ export default function SitesPage() {
)}
</TableBody>
</Table>
)}
{/* Pagination for sites */}
{sitesData?.data && sitesData.data.length > 0 && totalSitePages > 1 && (
@@ -840,24 +844,6 @@ export default function SitesPage() {
</div>
</CardHeader>
<CardContent>
{!selectedConnection ? (
<div className="text-center py-10">
<p className="text-muted-foreground">Please select a connection to view subnets.</p>
</div>
) : isLoadingSubnets ? (
<div className="space-y-3">
{[...Array(5)].map((_, i) => (
<div key={i} className="flex items-center space-x-4">
<Skeleton className="h-12 w-full" />
</div>
))}
</div>
) : subnetsError ? (
<div className="text-center py-10">
<p className="text-destructive font-medium">Error loading subnets</p>
<p className="text-muted-foreground">{subnetsError.message || "Unknown error occurred"}</p>
</div>
) : (
<Table>
<TableHeader>
<TableRow>
@@ -870,7 +856,30 @@ export default function SitesPage() {
</TableRow>
</TableHeader>
<TableBody>
{subnetsData?.data && subnetsData.data.length > 0 ? (
{!selectedConnection ? (
<TableRow>
<TableCell colSpan={6} className="text-center py-6">
<p className="text-muted-foreground">Please select a connection to view subnets.</p>
</TableCell>
</TableRow>
) : isLoadingSubnets ? (
<TableRow>
<TableCell colSpan={6} className="p-0 border-0">
<div className="space-y-3 p-4">
{[...Array(5)].map((_, i) => (
<Skeleton key={i} className="h-12 w-full" />
))}
</div>
</TableCell>
</TableRow>
) : subnetsError ? (
<TableRow>
<TableCell colSpan={6} className="text-center py-6">
<p className="text-destructive font-medium">Error loading subnets</p>
<p className="text-muted-foreground">{subnetsError.message || "Unknown error occurred"}</p>
</TableCell>
</TableRow>
) : subnetsData?.data && subnetsData.data.length > 0 ? (
subnetsData.data.map((subnet: AdSubnet) => (
<TableRow key={subnet.objectGUID}>
<TableCell className="font-medium">{subnet.name}</TableCell>
@@ -939,7 +948,6 @@ export default function SitesPage() {
)}
</TableBody>
</Table>
)}
{/* Pagination for subnets */}
{subnetsData?.data && subnetsData.data.length > 0 && totalSubnetPages > 1 && (