From 4434642f44dd4fcfdf2b377dec3010f708dd8a1d Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Wed, 9 Apr 2025 23:53:29 +0000 Subject: [PATCH] Fix: Improved sites and subnets display for better user experience. No longer shows continual loading, instead displays default headers and "no results" message when appropriate. 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/5e8d7bb0-ab4a-4d9f-a7d5-5f2fd4e43809.jpg --- client/src/pages/sites-page.tsx | 262 +++++++++++++++++--------------- 1 file changed, 139 insertions(+), 123 deletions(-) diff --git a/client/src/pages/sites-page.tsx b/client/src/pages/sites-page.tsx index 59075b7..0426f7f 100644 --- a/client/src/pages/sites-page.tsx +++ b/client/src/pages/sites-page.tsx @@ -579,7 +579,11 @@ export default function SitesPage() { - {isLoadingSites || !selectedConnection ? ( + {!selectedConnection ? ( +
+

Please select a connection to view sites.

+
+ ) : isLoadingSites ? (
{[...Array(5)].map((_, i) => (
@@ -592,7 +596,7 @@ export default function SitesPage() {

Error loading sites

{sitesError.message || "Unknown error occurred"}

- ) : sitesData?.data && sitesData.data.length > 0 ? ( + ) : ( @@ -604,70 +608,74 @@ export default function SitesPage() { - {sitesData?.data?.map((site: AdSite) => ( - - {site.name} - {site.description || '—'} - {site.location || '—'} - - {site.subnets && site.subnets.length > 0 - ? site.subnets.map((subnet, idx) => ( - - {subnet.split(',')[0].replace('CN=', '')} - - )) - : '—'} - - -
- - - - - - - - - Are you sure you want to delete this site? - - - This action cannot be undone. This will permanently delete the - site "{site.name}" and all of its data from the server. - - - - Cancel - deleteSiteMutation.mutate(site.objectGUID)} - className="bg-destructive text-destructive-foreground" + {sitesData?.data && sitesData.data.length > 0 ? ( + sitesData.data.map((site: AdSite) => ( + + {site.name} + {site.description || '—'} + {site.location || '—'} + + {site.subnets && site.subnets.length > 0 + ? site.subnets.map((subnet, idx) => ( + + {subnet.split(',')[0].replace('CN=', '')} + + )) + : '—'} + + +
+ + + +
+ + + + + + + Are you sure you want to delete this site? + + + This action cannot be undone. This will permanently delete the + site "{site.name}" and all of its data from the server. + + + + Cancel + deleteSiteMutation.mutate(site.objectGUID)} + className="bg-destructive text-destructive-foreground" + > + Delete + + + +
+
+
+
+ )) + ) : ( + + +

No sites found for this connection.

- ))} + )}
- ) : ( -
-

No sites found for this connection.

-
)} {/* Pagination for sites */} @@ -832,7 +840,11 @@ export default function SitesPage() {
- {isLoadingSubnets || !selectedConnection ? ( + {!selectedConnection ? ( +
+

Please select a connection to view subnets.

+
+ ) : isLoadingSubnets ? (
{[...Array(5)].map((_, i) => (
@@ -845,7 +857,7 @@ export default function SitesPage() {

Error loading subnets

{subnetsError.message || "Unknown error occurred"}

- ) : subnetsData?.data && subnetsData.data.length > 0 ? ( + ) : ( @@ -858,71 +870,75 @@ export default function SitesPage() { - {subnetsData?.data?.map((subnet: AdSubnet) => ( - - {subnet.name} - {subnet.cidr || '—'} - {subnet.description || '—'} - {subnet.location || '—'} - - {subnet.siteObject ? ( - - {subnet.siteObject.split(',')[0].replace('CN=', '')} - - ) : ( - '—' - )} - - -
- - - - - - - - - Are you sure you want to delete this subnet? - - - This action cannot be undone. This will permanently delete the - subnet "{subnet.name}" and all of its data from the server. - - - - Cancel - deleteSubnetMutation.mutate(subnet.objectGUID)} - className="bg-destructive text-destructive-foreground" + {subnetsData?.data && subnetsData.data.length > 0 ? ( + subnetsData.data.map((subnet: AdSubnet) => ( + + {subnet.name} + {subnet.cidr || '—'} + {subnet.description || '—'} + {subnet.location || '—'} + + {subnet.siteObject ? ( + + {subnet.siteObject.split(',')[0].replace('CN=', '')} + + ) : ( + '—' + )} + + +
+ + + +
+ + + + + + + Are you sure you want to delete this subnet? + + + This action cannot be undone. This will permanently delete the + subnet "{subnet.name}" and all of its data from the server. + + + + Cancel + deleteSubnetMutation.mutate(subnet.objectGUID)} + className="bg-destructive text-destructive-foreground" + > + Delete + + + +
+
+
+
+ )) + ) : ( + + +

No subnets found for this connection.

- ))} + )}
- ) : ( -
-

No subnets found for this connection.

-
)} {/* Pagination for subnets */}