diff --git a/websiteFunctions/templates/websiteFunctions/WPsitesList.html b/websiteFunctions/templates/websiteFunctions/WPsitesList.html index 2f71d8eac..5cf4babb3 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsitesList.html +++ b/websiteFunctions/templates/websiteFunctions/WPsitesList.html @@ -23,6 +23,27 @@ $scope.wpSitesCount = $scope.debug.wp_sites_count; $scope.currentPage = 1; $scope.recordsToShow = 10; + $scope.expandedSites = {}; // Track which sites are expanded + + // Function to toggle site expansion + $scope.toggleSite = function(site) { + if (!$scope.expandedSites[site.id]) { + $scope.expandedSites[site.id] = true; + fetchSiteData(site); + } else { + $scope.expandedSites[site.id] = false; + } + }; + + // Function to check if site is expanded + $scope.isExpanded = function(siteId) { + return $scope.expandedSites[siteId]; + }; + + // Function to check if site data is loaded + $scope.isDataLoaded = function(site) { + return site.version !== undefined; + }; $scope.updatePagination = function() { var filteredSites = $scope.wpSites; @@ -181,8 +202,10 @@ ); } - if ($scope.wpSites) { - $scope.wpSites.forEach(fetchSiteData); + if ($scope.wpSites && $scope.wpSites.length > 0) { + // Load data for first site by default + $scope.expandedSites[$scope.wpSites[0].id] = true; + fetchSiteData($scope.wpSites[0]); } }); @@ -244,7 +267,13 @@