improved wp display

This commit is contained in:
usmannasir
2025-04-03 23:34:06 +05:00
parent bd920b691c
commit 4a45b10c05

View File

@@ -2662,34 +2662,51 @@ app.controller('listWebsites', function ($scope, $http) {
return str.join("&"); return str.join("&");
} }
}).then(function(response) { }).then(function(response) {
if (response.data.status === 1) { console.log('WP Details Response:', response); // Debug log
$scope.wp_sites = response.data.data.map(function(site) {
return { if (response.data && response.data.status === 1 && response.data.data) {
id: site.id, try {
title: site.title || site.domain, $scope.wp_sites = response.data.data.map(function(site) {
url: site.url, return {
version: site.version, id: site.id || '',
phpVersion: site.php_version, title: site.title || site.domain || $scope.selectedWebsite.domain,
theme: site.theme, url: site.url || 'http://' + $scope.selectedWebsite.domain,
activePlugins: site.active_plugins || 0, version: site.version || 'Unknown',
searchIndex: site.search_index === 'enabled', phpVersion: site.php_version || 'Unknown',
debugging: site.debugging === 'enabled', theme: site.theme || 'Unknown',
passwordProtection: site.password_protection === 'enabled', activePlugins: site.active_plugins || 0,
maintenanceMode: site.maintenance_mode === 'enabled' searchIndex: site.search_index === 'enabled',
}; debugging: site.debugging === 'enabled',
}); passwordProtection: site.password_protection === 'enabled',
$scope.web.showWPSites = true; maintenanceMode: site.maintenance_mode === 'enabled'
};
});
$scope.web.showWPSites = true;
} catch (e) {
console.error('Error processing WordPress data:', e);
new PNotify({
title: 'Error',
text: 'Failed to process WordPress site details: ' + e.message,
type: 'error'
});
}
} else { } else {
console.error('Invalid response format:', response); // Debug log
new PNotify({ new PNotify({
title: 'Error', title: 'Error',
text: 'Failed to fetch WordPress site details.', text: response.data && response.data.error_message ?
response.data.error_message :
'Failed to fetch WordPress site details. Invalid response format.',
type: 'error' type: 'error'
}); });
} }
}).catch(function(error) { }).catch(function(error) {
console.error('WP Details Error:', error); // Debug log
new PNotify({ new PNotify({
title: 'Error', title: 'Error',
text: 'Connection failed while fetching WordPress site details.', text: error.data && error.data.error_message ?
error.data.error_message :
'Connection failed while fetching WordPress site details.',
type: 'error' type: 'error'
}); });
}); });
@@ -6627,34 +6644,51 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind
return str.join("&"); return str.join("&");
} }
}).then(function(response) { }).then(function(response) {
if (response.data.status === 1) { console.log('WP Details Response:', response); // Debug log
$scope.wp_sites = response.data.data.map(function(site) {
return { if (response.data && response.data.status === 1 && response.data.data) {
id: site.id, try {
title: site.title || site.domain, $scope.wp_sites = response.data.data.map(function(site) {
url: site.url, return {
version: site.version, id: site.id || '',
phpVersion: site.php_version, title: site.title || site.domain || $scope.selectedWebsite.domain,
theme: site.theme, url: site.url || 'http://' + $scope.selectedWebsite.domain,
activePlugins: site.active_plugins || 0, version: site.version || 'Unknown',
searchIndex: site.search_index === 'enabled', phpVersion: site.php_version || 'Unknown',
debugging: site.debugging === 'enabled', theme: site.theme || 'Unknown',
passwordProtection: site.password_protection === 'enabled', activePlugins: site.active_plugins || 0,
maintenanceMode: site.maintenance_mode === 'enabled' searchIndex: site.search_index === 'enabled',
}; debugging: site.debugging === 'enabled',
}); passwordProtection: site.password_protection === 'enabled',
$scope.web.showWPSites = true; maintenanceMode: site.maintenance_mode === 'enabled'
};
});
$scope.web.showWPSites = true;
} catch (e) {
console.error('Error processing WordPress data:', e);
new PNotify({
title: 'Error',
text: 'Failed to process WordPress site details: ' + e.message,
type: 'error'
});
}
} else { } else {
console.error('Invalid response format:', response); // Debug log
new PNotify({ new PNotify({
title: 'Error', title: 'Error',
text: 'Failed to fetch WordPress site details.', text: response.data && response.data.error_message ?
response.data.error_message :
'Failed to fetch WordPress site details. Invalid response format.',
type: 'error' type: 'error'
}); });
} }
}).catch(function(error) { }).catch(function(error) {
console.error('WP Details Error:', error); // Debug log
new PNotify({ new PNotify({
title: 'Error', title: 'Error',
text: 'Connection failed while fetching WordPress site details.', text: error.data && error.data.error_message ?
error.data.error_message :
'Connection failed while fetching WordPress site details.',
type: 'error' type: 'error'
}); });
}); });