From 69d7e5fe7cd33f65e4ea0dceb4e456eb39351c41 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 7 Apr 2025 18:18:19 +0500 Subject: [PATCH] fetch search index change settings --- .../websiteFunctions/websiteFunctions.js | 46 ++++--------------- .../websiteFunctions/WPsiteHome.html | 4 +- 2 files changed, 11 insertions(+), 39 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 2e8a59d68..9ade37a93 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -595,12 +595,9 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo if (response.data.ret_data.debugging === 1) { $('#debugging').prop('checked', true); } - - // Set the search index state - $timeout(function() { - $scope.searchIndexEnabled = response.data.ret_data.searchIndex === 1; - }); - + if (response.data.ret_data.searchIndex === 1) { + $('#searchIndex').prop('checked', true); + } if (response.data.ret_data.maintenanceMode === 1) { $('#maintenanceMode').prop('checked', true); } @@ -646,12 +643,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo PPPassword: CheckBoxpasssword == 0 ? $scope.PPPassword : '' }; } else { - var settingValue = 0; - if (setting === 'searchIndex') { - settingValue = $scope.searchIndexEnabled ? 1 : 0; - } else if ($('#' + setting).is(":checked")) { - settingValue = 1; - } + var settingValue = $('#' + setting).is(":checked") ? 1 : 0; data = { WPid: $('#WPid').html(), setting: setting, @@ -4156,12 +4148,9 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo if (response.data.ret_data.debugging === 1) { $('#debugging').prop('checked', true); } - - // Set the search index state - $timeout(function() { - $scope.searchIndexEnabled = response.data.ret_data.searchIndex === 1; - }); - + if (response.data.ret_data.searchIndex === 1) { + $('#searchIndex').prop('checked', true); + } if (response.data.ret_data.maintenanceMode === 1) { $('#maintenanceMode').prop('checked', true); } @@ -4207,12 +4196,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo PPPassword: CheckBoxpasssword == 0 ? $scope.PPPassword : '' }; } else { - var settingValue = 0; - if (setting === 'searchIndex') { - settingValue = $scope.searchIndexEnabled ? 1 : 0; - } else if ($('#' + setting).is(":checked")) { - settingValue = 1; - } + var settingValue = $('#' + setting).is(":checked") ? 1 : 0; data = { WPid: $('#WPid').html(), setting: setting, @@ -4245,11 +4229,6 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo text: response.data.error_message, type: 'error' }); - if (setting === 'searchIndex') { - $timeout(function() { - $scope.searchIndexEnabled = !$scope.searchIndexEnabled; // Revert the change - }); - } if (setting === "PasswordProtection") { location.reload(); } @@ -4257,11 +4236,6 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo }, function(error) { $('#wordpresshomeloading').hide(); $scope.wordpresshomeloading = true; - if (setting === 'searchIndex') { - $timeout(function() { - $scope.searchIndexEnabled = !$scope.searchIndexEnabled; // Revert the change - }); - } console.error('Failed to update setting:', error); }); }; @@ -5922,8 +5896,8 @@ function website_create_checkbox_function() { app.controller('createWebsite', function ($scope, $http, $timeout, $window) { $scope.webSiteCreationLoading = true; - $scope.installationDetailsForm = false; - $scope.installationProgress = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; $scope.errorMessageBox = true; $scope.success = true; $scope.couldNotConnect = true; diff --git a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html index dd98997ad..c923b64f3 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html @@ -244,9 +244,7 @@ + ng-click="UpdateWPSettings('searchIndex')">