From b3584d0044fb7e2c7c24240a88448a4855c95708 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 9 Apr 2025 13:36:45 +0500 Subject: [PATCH] add loader --- .../websiteFunctions/websiteFunctions.js | 360 ------------------ 1 file changed, 360 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index c141546a1..ef7003317 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -2684,10 +2684,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { wp.loadingTheme = false; }); $("#listFail").hide(); - // Fetch details for each WordPress site - site.wp_sites.forEach(function(wp) { - fetchWPSiteData(wp); - }); } else { $("#listFail").fadeIn(); site.showWPSites = false; @@ -2716,92 +2712,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { }); }; - function fetchWPSiteData(wp) { - wp.loading = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - // Fetch site data - $http.post('/websites/FetchWPdata', data, config) - .then(function(response) { - if (response.data.status === 1) { - var data = response.data.ret_data; - wp.version = data.version; - wp.phpVersion = data.phpVersion || 'PHP 7.4'; - wp.searchIndex = data.searchIndex === 1; - wp.debugging = data.debugging === 1; - wp.passwordProtection = data.passwordprotection === 1; - wp.maintenanceMode = data.maintenanceMode === 1; - fetchPluginData(wp); - fetchThemeData(wp); - } - }) - .finally(function() { - wp.loading = false; - }); - } - - function fetchPluginData(wp) { - wp.loadingPlugins = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - $http.post('/websites/GetCurrentPlugins', data, config) - .then(function(response) { - if (response.data.status === 1) { - var plugins = JSON.parse(response.data.plugins); - wp.activePlugins = plugins.filter(function(p) { return p.status === 'active'; }).length; - wp.totalPlugins = plugins.length; - } - }) - .finally(function() { - wp.loadingPlugins = false; - }); - } - - function fetchThemeData(wp) { - wp.loadingTheme = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - $http.post('/websites/GetCurrentTheme', data, config) - .then(function(response) { - if (response.data.status === 1) { - wp.theme = response.data.theme; - } - }) - .finally(function() { - wp.loadingTheme = false; - }); - } - $scope.visitSite = function(wp) { var url = wp.url || wp.domain; if (!url) return; @@ -5913,10 +5823,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { wp.loadingTheme = false; }); $("#listFail").hide(); - // Fetch details for each WordPress site - site.wp_sites.forEach(function(wp) { - fetchWPSiteData(wp); - }); } else { $("#listFail").fadeIn(); site.showWPSites = false; @@ -5945,92 +5851,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { }); }; - function fetchWPSiteData(wp) { - wp.loading = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - // Fetch site data - $http.post('/websites/FetchWPdata', data, config) - .then(function(response) { - if (response.data.status === 1) { - var data = response.data.ret_data; - wp.version = data.version; - wp.phpVersion = data.phpVersion || 'PHP 7.4'; - wp.searchIndex = data.searchIndex === 1; - wp.debugging = data.debugging === 1; - wp.passwordProtection = data.passwordprotection === 1; - wp.maintenanceMode = data.maintenanceMode === 1; - fetchPluginData(wp); - fetchThemeData(wp); - } - }) - .finally(function() { - wp.loading = false; - }); - } - - function fetchPluginData(wp) { - wp.loadingPlugins = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - $http.post('/websites/GetCurrentPlugins', data, config) - .then(function(response) { - if (response.data.status === 1) { - var plugins = JSON.parse(response.data.plugins); - wp.activePlugins = plugins.filter(function(p) { return p.status === 'active'; }).length; - wp.totalPlugins = plugins.length; - } - }) - .finally(function() { - wp.loadingPlugins = false; - }); - } - - function fetchThemeData(wp) { - wp.loadingTheme = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - $http.post('/websites/GetCurrentTheme', data, config) - .then(function(response) { - if (response.data.status === 1) { - wp.theme = response.data.theme; - } - }) - .finally(function() { - wp.loadingTheme = false; - }); - } - $scope.visitSite = function(wp) { var url = wp.url || wp.domain; if (!url) return; @@ -9716,10 +9536,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { wp.loadingTheme = false; }); $("#listFail").hide(); - // Fetch details for each WordPress site - site.wp_sites.forEach(function(wp) { - fetchWPSiteData(wp); - }); } else { $("#listFail").fadeIn(); site.showWPSites = false; @@ -9748,92 +9564,6 @@ app.controller('listWebsites', function ($scope, $http, $window) { }); }; - function fetchWPSiteData(wp) { - wp.loading = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - // Fetch site data - $http.post('/websites/FetchWPdata', data, config) - .then(function(response) { - if (response.data.status === 1) { - var data = response.data.ret_data; - wp.version = data.version; - wp.phpVersion = data.phpVersion || 'PHP 7.4'; - wp.searchIndex = data.searchIndex === 1; - wp.debugging = data.debugging === 1; - wp.passwordProtection = data.passwordprotection === 1; - wp.maintenanceMode = data.maintenanceMode === 1; - fetchPluginData(wp); - fetchThemeData(wp); - } - }) - .finally(function() { - wp.loading = false; - }); - } - - function fetchPluginData(wp) { - wp.loadingPlugins = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - $http.post('/websites/GetCurrentPlugins', data, config) - .then(function(response) { - if (response.data.status === 1) { - var plugins = JSON.parse(response.data.plugins); - wp.activePlugins = plugins.filter(function(p) { return p.status === 'active'; }).length; - wp.totalPlugins = plugins.length; - } - }) - .finally(function() { - wp.loadingPlugins = false; - }); - } - - function fetchThemeData(wp) { - wp.loadingTheme = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - $http.post('/websites/GetCurrentTheme', data, config) - .then(function(response) { - if (response.data.status === 1) { - wp.theme = response.data.theme; - } - }) - .finally(function() { - wp.loadingTheme = false; - }); - } - $scope.visitSite = function(wp) { var url = wp.url || wp.domain; if (!url) return; @@ -13884,10 +13614,6 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind wp.loadingTheme = false; }); $("#listFail").hide(); - // Fetch details for each WordPress site - site.wp_sites.forEach(function(wp) { - fetchWPSiteData(wp); - }); } else { $("#listFail").fadeIn(); site.showWPSites = false; @@ -13916,92 +13642,6 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind }); }; - function fetchWPSiteData(wp) { - wp.loading = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - // Fetch site data - $http.post('/websites/FetchWPdata', data, config) - .then(function(response) { - if (response.data.status === 1) { - var data = response.data.ret_data; - wp.version = data.version; - wp.phpVersion = data.phpVersion || 'PHP 7.4'; - wp.searchIndex = data.searchIndex === 1; - wp.debugging = data.debugging === 1; - wp.passwordProtection = data.passwordprotection === 1; - wp.maintenanceMode = data.maintenanceMode === 1; - fetchPluginData(wp); - fetchThemeData(wp); - } - }) - .finally(function() { - wp.loading = false; - }); - } - - function fetchPluginData(wp) { - wp.loadingPlugins = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - $http.post('/websites/GetCurrentPlugins', data, config) - .then(function(response) { - if (response.data.status === 1) { - var plugins = JSON.parse(response.data.plugins); - wp.activePlugins = plugins.filter(function(p) { return p.status === 'active'; }).length; - wp.totalPlugins = plugins.length; - } - }) - .finally(function() { - wp.loadingPlugins = false; - }); - } - - function fetchThemeData(wp) { - wp.loadingTheme = true; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = $.param({ - WPid: wp.id - }); - - $http.post('/websites/GetCurrentTheme', data, config) - .then(function(response) { - if (response.data.status === 1) { - wp.theme = response.data.theme; - } - }) - .finally(function() { - wp.loadingTheme = false; - }); - } - $scope.updateSetting = function(wp, setting) { var settingMap = { 'search-indexing': 'searchIndex',