PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.2
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | modules/api-backups/assets/js/module-api-backups-manager.js +231 -21 5.1 → 6.2.2 View file →
@@ -148,9 +148,9 @@
148 148 });
149 149
150 150 // Trigger action_delete_backup.
151 151 jQuery('#mainwp_3rd_party_api_linode_action_cancel_backups').on('click', function () {
152 - let confirmMsg = __('Are you sure you want to Disable and Delete all existing backups from this Linode?');
152 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Disable and Delete all existing backups from this Linode?');
153 153 mainwp_confirm(confirmMsg, function () {
154 154 linode_action_cancel_backups(this);
155 155 });
156 156 });
@@ -199,9 +199,9 @@
199 199 });
200 200
201 201 // Trigger action_restore_backup.
202 202 jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_backup', function () {
203 - let confirmMsg = __('Are you sure you want to Restore this backup?');
203 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?');
204 204 mainwp_confirm(confirmMsg, function () {
205 205 cPanel_action_restore_backup(this);
206 206 });
207 207 });
@@ -207,18 +207,17 @@
207 207 });
208 208
209 209 // Trigger action_restore_database_backup.
210 210 jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_database_backup', function () {
211 - let confirmMsg = __('Are you sure you want to Restore this backup?');
212 - let btObj = this;
213 - mainwp_confirm(confirmMsg, function () {
214 - cpanel_action_restore_database_backup(btObj);
211 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?');
212 + mainwp_confirm(confirmMsg, () => {
213 + cpanel_action_restore_database_backup(this);
215 214 });
216 215 });
217 216
218 217 // Trigger action_restore_manual_backup.
219 218 jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_manual_backup', function () {
220 - let confirmMsg = __('Are you sure you want to Restore this backup?');
219 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?');
221 220 mainwp_confirm(confirmMsg, function () {
222 221 cpanel_action_restore_manual_backup();
223 222 });
224 223 });
@@ -249,9 +248,9 @@
249 248 });
250 249
251 250 // Trigger action_restore_wptk_backup.
252 251 jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').on('click', function () {
253 - let confirmMsg = __('Are you sure you want to Restore this backup?');
252 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?');
254 253 mainwp_confirm(confirmMsg, function () {
255 254 cpanel_action_restore_wptk_backup(this);
256 255 });
257 256 });
@@ -257,9 +256,9 @@
257 256 });
258 257
259 258 // Trigger action_delete_wptk_backup.
260 259 jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').on('click', function () {
261 - let confirmMsg = __('Are you sure you want to Delete this backup?');
260 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Delete this backup?');
262 261 mainwp_confirm(confirmMsg, function () {
263 262 cpanel_action_delete_wptk_backup(this);
264 263 });
265 264 });
@@ -289,9 +288,9 @@
289 288 });
290 289
291 290 // Trigger action_restore_backup.
292 291 jQuery(document).on('click', '.mainwp_3rd_party_api_plesk_action_restore_backup', function () {
293 - let confirmMsg = __('Are you sure you want to Restore this backup?');
292 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?');
294 293 mainwp_confirm(confirmMsg, function () {
295 294 plesk_action_restore_backup();
296 295 });
297 296 });
@@ -297,14 +296,54 @@
297 296 });
298 297
299 298 // Trigger action_delete_backup.
300 299 jQuery(document).on('click', '.mainwp_3rd_party_api_plesk_action_delete_backup', function () {
301 - let confirmMsg = __('Are you sure you want to Delete this backup?');
300 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Delete this backup?');
302 301 mainwp_confirm(confirmMsg, function () {
303 302 plesk_action_delete_backup();
304 303 });
305 304 });
306 305
306 + /**
307 + * Kinsta Ajax Hooks
308 + */
309 + // Trigger action_refresh_available_backups.
310 + jQuery('#mainwp_3rd_party_api_kinsta_action_refresh_available_backups').on('click', function () {
311 + kinsta_action_refresh_available_backups(this);
312 + });
313 +
314 + //Trigger action_backup.
315 + jQuery('#mainwp_3rd_party_api_kinsta_action_individual_create_backup').on('click', function () {
316 + kinsta_action_create_backup(this);
317 + });
318 +
319 + // Trigger Bulk action_create_backup.
320 + jQuery('.mainwp_3rd_party_api_kinsta_action_backup').on('click', function () {
321 + kinsta_action_create_backup(this);
322 + });
323 +
324 + // Trigger action_delete_backup.
325 + jQuery('.mainwp_3rd_party_api_kinsta_action_delete_backup').on('click', function () {
326 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Delete this backup?');
327 + let backupId = jQuery(this).attr('backup_id');
328 + mainwp_confirm(confirmMsg, function () {
329 + kinsta_action_delete_backup(this, backupId);
330 + });
331 + });
332 +
333 + // Trigger action_restore_backup.
334 + jQuery('.mainwp_3rd_party_api_kinsta_action_restore_backup').on('click', function () {
335 + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?');
336 + let backupId = jQuery(this).attr('backup_id');
337 + mainwp_confirm(confirmMsg, function () {
338 + kinsta_action_restore_backup(this, backupId);
339 + });
340 + });
341 +
342 + /**
343 + * Global Bulk Action: backup selected sites.
344 + */
345 +
307 346 // Trigger action_backup_selected_sites.
308 347 jQuery('#action_backup_selected_sites').on('click', function () {
309 348 action_backup_selected_sites(this);
310 349 });
@@ -413,9 +452,9 @@
413 452 .html( 'A backup has been requested. Please allow some time for the backup to complete, then Refresh Available Backups.')
414 453 ;
415 454
416 455 setTimeout(function () {
417 - location.reload();
456 + mainwp_forceReload();
418 457 }, 5000);
419 458
420 459 } else {
421 460
@@ -425,9 +464,9 @@
425 464 .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.')
426 465 ;
427 466
428 467 setTimeout(function () {
429 - location.reload();
468 + mainwp_forceReload();
430 469 }, 5000);
431 470
432 471 }
433 472 });
@@ -678,9 +717,9 @@
678 717 jQuery('#mainwp-api-backups-message-zone').addClass('green').show();
679 718 jQuery('#mainwp-api-backups-message-zone .content .message')
680 719 .html('A backup has been requested.');
681 720 setTimeout(function () {
682 - location.reload();
721 + mainwp_forceReload();
683 722 }, 5000);
684 723
685 724 } else {
686 725 let err_message = '' !== response ? response : 'There was an issue while requesting your backup. Please check that your ID and API Key are correct.';
@@ -689,9 +728,9 @@
689 728 jQuery('#mainwp-api-backups-message-zone').addClass('red').show();
690 729 jQuery('#mainwp-api-backups-message-zone .content .message')
691 730 .html( err_message );
692 731 setTimeout(function () {
693 - location.reload();
732 + mainwp_forceReload();
694 733 }, 5000);
695 734
696 735 }
697 736 });
@@ -891,9 +930,9 @@
891 930 .html('A backup has been requested.')
892 931 ;
893 932
894 933 setTimeout(function () {
895 - location.reload();
934 + mainwp_forceReload();
896 935 }, 5000);
897 936
898 937 } else {
899 938
@@ -903,9 +942,9 @@
903 942 .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.' )
904 943 ;
905 944
906 945 setTimeout(function () {
907 - location.reload();
946 + mainwp_forceReload();
908 947 }, 5000);
909 948
910 949 }
911 950 });
@@ -1108,9 +1147,9 @@
1108 1147 .html('A backup has been requested.')
1109 1148 ;
1110 1149
1111 1150 setTimeout(function () {
1112 - location.reload();
1151 + mainwp_forceReload();
1113 1152 }, 5000);
1114 1153
1115 1154 } else {
1116 1155
@@ -1120,9 +1159,9 @@
1120 1159 .html('There was an issue while requesting your backup. Please check that your backups are enabled & ID\'s are correct.')
1121 1160 ;
1122 1161
1123 1162 setTimeout(function () {
1124 - location.reload();
1163 + mainwp_forceReload();
1125 1164 }, 5000);
1126 1165 }
1127 1166 });
1128 1167 };
@@ -1319,9 +1358,9 @@
1319 1358 .html('A backup has been requested.')
1320 1359 ;
1321 1360
1322 1361 setTimeout(function () {
1323 - location.reload();
1362 + mainwp_forceReload();
1324 1363 }, 5000);
1325 1364 } else {
1326 1365
1327 1366 // Show message.
@@ -1330,9 +1369,9 @@
1330 1369 .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.')
1331 1370 ;
1332 1371
1333 1372 setTimeout(function () {
1334 - location.reload();
1373 + mainwp_forceReload();
1335 1374 }, 5000);
1336 1375 }
1337 1376 });
1338 1377 };
@@ -2134,5 +2173,176 @@
2134 2173 }
2135 2174 });
2136 2175 };
2137 2176
2177 +/********************************************************
2178 + * Kinsta Functions.
2179 + */
2138 2180
2181 +// Refresh Available Backups.
2182 +let kinsta_action_refresh_available_backups = function (pObj) {
2183 +
2184 + let websiteId = jQuery(pObj).attr('website_id');
2185 +
2186 + let data = mainwp_secure_data({
2187 + action: 'kinsta_action_refresh_available_backups',
2188 + website_id: websiteId,
2189 + backup_api: 'Kinsta'
2190 + });
2191 +
2192 + // Start button animation.
2193 + jQuery(pObj).addClass('disabled loading');
2194 +
2195 + jQuery.post(ajaxurl, data, function (response) {
2196 + response = jQuery.trim(response);
2197 +
2198 + if (response === 'true') {
2199 +
2200 + // Show message.
2201 + jQuery('#mainwp-api-backups-message-zone').addClass('green').show();
2202 + jQuery('#mainwp-api-backups-message-zone .content .message')
2203 + .html('Available backups have been refreshed.')
2204 + ;
2205 +
2206 + // Stop button animation.
2207 + jQuery(pObj).removeClass('disabled loading');
2208 +
2209 + setInterval('location.reload()', 7000);// Using .reload() method.
2210 +
2211 + } else {
2212 +
2213 + // Show message.
2214 + jQuery('#mainwp-api-backups-message-zone').addClass('red').show();
2215 + jQuery('#mainwp-api-backups-message-zone .content .message')
2216 + .html('There was an issue while refreshing available backups.')
2217 + ;
2218 +
2219 + // Stop button animation.
2220 + jQuery(pObj).removeClass('disabled loading');
2221 +
2222 + }
2223 + });
2224 +};
2225 +
2226 +// Create Manual Backup.
2227 +let kinsta_action_create_backup = function (pObj) {
2228 +
2229 + let websiteId = jQuery(pObj).attr('website_id');
2230 +
2231 + let data = mainwp_secure_data({
2232 + action: 'kinsta_action_create_backup',
2233 + website_id: websiteId,
2234 + backup_api: 'kinsta'
2235 + });
2236 +
2237 + // Start button animation.
2238 + jQuery(pObj).addClass('disabled loading');
2239 +
2240 + jQuery.post(ajaxurl, data, function (response) {
2241 + response = jQuery.trim(response);
2242 +
2243 + if (response === 'true') {
2244 +
2245 + // Show message.
2246 + jQuery('#mainwp-api-backups-message-zone').addClass('green').show();
2247 + jQuery('#mainwp-api-backups-message-zone .content .message')
2248 + .html('A backup has been requested.')
2249 + ;
2250 +
2251 + // Stop button animation.
2252 + jQuery(pObj).removeClass('disabled loading');
2253 +
2254 + } else {
2255 +
2256 + // Show message.
2257 + jQuery('#mainwp-api-backups-message-zone').addClass('red').show();
2258 + jQuery('#mainwp-api-backups-message-zone .content .message')
2259 + .html( response )
2260 + ;
2261 +
2262 + // Stop button animation.
2263 + jQuery(pObj).removeClass('disabled loading');
2264 +
2265 + }
2266 + });
2267 +};
2268 +
2269 +// Delete Manual Backup.
2270 +let kinsta_action_delete_backup = function (pObj, backupId) {
2271 + let websiteId = jQuery('.mainwp_3rd_party_api_kinsta_action_delete_backup ').attr('website_id');
2272 + let data = mainwp_secure_data({
2273 + action: 'kinsta_action_delete_backup',
2274 + backup_id: backupId,
2275 + website_id: websiteId,
2276 + backup_api: 'kinsta'
2277 + });
2278 +
2279 + // Start button animation.
2280 + jQuery(pObj).addClass('disabled loading');
2281 +
2282 + jQuery.post(ajaxurl, data, function (response) {
2283 + response = jQuery.trim(response);
2284 + if (response === 'true') {
2285 +
2286 + // Show message.
2287 + jQuery('#mainwp-api-backups-message-zone').addClass('green').show();
2288 + jQuery('#mainwp-api-backups-message-zone .content .message')
2289 + .html('The selected backup has been deleted.')
2290 + ;
2291 +
2292 + setInterval('location.reload()', 5000); // Using .reload() method.
2293 +
2294 + } else {
2295 +
2296 + // Show message.
2297 + jQuery('#mainwp-api-backups-message-zone').addClass('red').show();
2298 + jQuery('#mainwp-api-backups-message-zone .content .message')
2299 + .html('There was an issue while deleting your backup.')
2300 + ;
2301 +
2302 + setInterval('location.reload()', 5000); // Using .reload() method.
2303 +
2304 + }
2305 + });
2306 +};
2307 +
2308 +// Delete Manual Backup.
2309 +let kinsta_action_restore_backup = function (pObj, backupId) {
2310 +
2311 + let websiteId = jQuery('.mainwp_3rd_party_api_kinsta_action_restore_backup').attr('website_id');
2312 +
2313 + let data = mainwp_secure_data({
2314 + action: 'kinsta_action_restore_backup',
2315 + backup_id: backupId,
2316 + backup_api: 'kinsta',
2317 + website_id: websiteId
2318 + });
2319 +
2320 + // Start button animation.
2321 + jQuery(pObj).addClass('disabled loading');
2322 +
2323 + jQuery.post(ajaxurl, data, function (response) {
2324 + response = jQuery.trim(response);
2325 + if (response === 'true') {
2326 +
2327 + // Show message.
2328 + jQuery('#mainwp-api-backups-message-zone').addClass('green').show();
2329 + jQuery('#mainwp-api-backups-message-zone .content .message')
2330 + .html('Your application is in the process of restoring. This will take a few minuets...')
2331 + ;
2332 +
2333 + // Stop button animation.
2334 + jQuery(button).removeClass('disabled loading');
2335 +
2336 + } else {
2337 +
2338 + // Show message.
2339 + jQuery('#mainwp-api-backups-message-zone').addClass('red').show();
2340 + jQuery('#mainwp-api-backups-message-zone .content .message')
2341 + .html('There was an issue while attempting to restore your application...')
2342 + ;
2343 +
2344 + // Stop button animation.
2345 + jQuery(button).removeClass('disabled loading');
2346 + }
2347 + });
2348 +};