diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 68c8b171a..f84242c13 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -2367,16 +2367,34 @@ app.controller('listWebsites', function ($scope, $http, $window) { $scope.web = {}; $scope.WebSitesList = []; $scope.loading = true; // Add loading state + $scope.expandedSites = {}; // Track which sites are expanded $scope.currentPage = 1; $scope.recordsToShow = 10; - $scope.expandedSites = {}; + // Function to toggle site expansion $scope.toggleSite = function(site) { - $scope.expandedSites[site.domain] = !$scope.expandedSites[site.domain]; + if (!$scope.expandedSites[site.domain]) { + $scope.expandedSites[site.domain] = true; + site.loading = true; + // You can add any data fetching logic here if needed + setTimeout(function() { + site.loading = false; + $scope.$apply(); + }, 500); + } else { + $scope.expandedSites[site.domain] = false; + } }; - $scope.isExpanded = function(domain) { - return !!$scope.expandedSites[domain]; + + // 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; }; // Initial fetch of websites @@ -2400,11 +2418,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { $scope.WebSitesList = JSON.parse(response.data.data); $scope.pagination = response.data.pagination; $("#listFail").hide(); - // Expand the first website by default - if ($scope.WebSitesList.length > 0) { - $scope.expandedSites = {}; - $scope.expandedSites[$scope.WebSitesList[0].domain] = true; - } } else { $("#listFail").fadeIn(); $scope.errorMessage = response.data.error_message; @@ -2519,6 +2532,12 @@ app.controller('listWebsites', function ($scope, $http, $window) { window.location.href = '/websites/WPHome?ID=' + wpId; }; + $scope.deleteWPSite = function(wp) { + if (confirm('Are you sure you want to delete this WordPress site? This action cannot be undone.')) { + window.location.href = '/websites/ListWPSites?DeleteID=' + wp.id; + } + }; + $scope.getFullUrl = function(url) { console.log('getFullUrl called with:', url); if (!url) { @@ -5519,16 +5538,34 @@ app.controller('listWebsites', function ($scope, $http, $window) { $scope.web = {}; $scope.WebSitesList = []; $scope.loading = true; // Add loading state + $scope.expandedSites = {}; // Track which sites are expanded $scope.currentPage = 1; $scope.recordsToShow = 10; - $scope.expandedSites = {}; + // Function to toggle site expansion $scope.toggleSite = function(site) { - $scope.expandedSites[site.domain] = !$scope.expandedSites[site.domain]; + if (!$scope.expandedSites[site.domain]) { + $scope.expandedSites[site.domain] = true; + site.loading = true; + // You can add any data fetching logic here if needed + setTimeout(function() { + site.loading = false; + $scope.$apply(); + }, 500); + } else { + $scope.expandedSites[site.domain] = false; + } }; - $scope.isExpanded = function(domain) { - return !!$scope.expandedSites[domain]; + + // 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; }; // Initial fetch of websites @@ -5552,11 +5589,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { $scope.WebSitesList = JSON.parse(response.data.data); $scope.pagination = response.data.pagination; $("#listFail").hide(); - // Expand the first website by default - if ($scope.WebSitesList.length > 0) { - $scope.expandedSites = {}; - $scope.expandedSites[$scope.WebSitesList[0].domain] = true; - } } else { $("#listFail").fadeIn(); $scope.errorMessage = response.data.error_message; @@ -5668,7 +5700,13 @@ app.controller('listWebsites', function ($scope, $http, $window) { }; $scope.manageWP = function(wpId) { - window.location.href = '/websites/listWPsites?wpID=' + wpId; + window.location.href = '/websites/WPHome?ID=' + wpId; + }; + + $scope.deleteWPSite = function(wp) { + if (confirm('Are you sure you want to delete this WordPress site? This action cannot be undone.')) { + window.location.href = '/websites/ListWPSites?DeleteID=' + wp.id; + } }; $scope.getFullUrl = function(url) { @@ -9018,16 +9056,34 @@ app.controller('listWebsites', function ($scope, $http, $window) { $scope.web = {}; $scope.WebSitesList = []; $scope.loading = true; // Add loading state + $scope.expandedSites = {}; // Track which sites are expanded $scope.currentPage = 1; $scope.recordsToShow = 10; - $scope.expandedSites = {}; + // Function to toggle site expansion $scope.toggleSite = function(site) { - $scope.expandedSites[site.domain] = !$scope.expandedSites[site.domain]; + if (!$scope.expandedSites[site.domain]) { + $scope.expandedSites[site.domain] = true; + site.loading = true; + // You can add any data fetching logic here if needed + setTimeout(function() { + site.loading = false; + $scope.$apply(); + }, 500); + } else { + $scope.expandedSites[site.domain] = false; + } }; - $scope.isExpanded = function(domain) { - return !!$scope.expandedSites[domain]; + + // 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; }; // Initial fetch of websites @@ -9051,11 +9107,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { $scope.WebSitesList = JSON.parse(response.data.data); $scope.pagination = response.data.pagination; $("#listFail").hide(); - // Expand the first website by default - if ($scope.WebSitesList.length > 0) { - $scope.expandedSites = {}; - $scope.expandedSites[$scope.WebSitesList[0].domain] = true; - } } else { $("#listFail").fadeIn(); $scope.errorMessage = response.data.error_message; diff --git a/websiteFunctions/templates/websiteFunctions/listWebsites.html b/websiteFunctions/templates/websiteFunctions/listWebsites.html index 793b5d4ca..bce128bf9 100755 --- a/websiteFunctions/templates/websiteFunctions/listWebsites.html +++ b/websiteFunctions/templates/websiteFunctions/listWebsites.html @@ -81,178 +81,235 @@ -
-
-
- -
-
-

- - {$ web.domain $} -

-
- -
-
-
-
- - -
-
- - -
- -
- -
-
- - -
-
+ +
+
+
+ +
-
-
-
-
-

- - {$ wp.title $} - - - -

+
+

+ + + {$ web.domain $} + + + + +

+
+ +
+
+ + +
+
+ + + + +
+
+
+
+ + {$ web.state $}
-
- - +
+
+
+ + {$ web.ipAddress $} +
+
+
+
+ + {$ web.phpVersion $} +
+
+
+
+ + {$ web.diskUsed $}
-
-
-
- {$ wp.title $} -
- - Visit Site - - - WP Login - +
+
+
+ + {$ web.package $} +
+
+
+
+ + {$ web.admin $} +
+
+
+
+ +
+ {$ (web.wp_sites && web.wp_sites.length) || 0 $} sites +
-
-
-
-
- - {$ wp.version || 'Loading...' $} - +
+
+ + +
+
+ WordPress Sites ({$ web.wp_sites.length $}) +
+
+
+
+
+
+
+

+ + {$ wp.title $} + + + +

+
+
+ + +
-
-
- - {$ wp.phpVersion || 'Loading...' $} - -
-
-
-
- - {$ wp.theme || 'Loading...' $} - -
-
-
-
- - {$ wp.activePlugins || '0' $} active - -
-
-
-
-
-
- -
-
- -
-
-
-
- -
-
- +
+
+ +
+
+
+
+ + {$ wp.version || 'Loading...' $} + +
+
+
+
+ + {$ wp.phpVersion || 'Loading...' $} + +
+
+
+
+ + {$ wp.theme || 'Loading...' $} + +
+
+
+
+ + {$ wp.activePlugins || '0' $} active + +
+
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
@@ -263,11 +320,15 @@
-
-

{% trans "Cannot list websites. Error message:" %} {$ errorMessage $}

-
+ + + + +
@@ -281,61 +342,111 @@
-
+
+ {% endblock %}