Skip to content

Commit fb0cd66

Browse files
committed
Release 5.3.0
1 parent eafa87c commit fb0cd66

File tree

182 files changed

+13783
-1451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+13783
-1451
lines changed

assets/css/backwpup-admin.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,10 @@ select {
919919
z-index: 10;
920920
}
921921

922+
.z-50 {
923+
z-index: 50;
924+
}
925+
922926
.z-\[100000\] {
923927
z-index: 100000;
924928
}
@@ -1332,6 +1336,10 @@ select {
13321336
text-wrap: nowrap;
13331337
}
13341338

1339+
.break-all {
1340+
word-break: break-all;
1341+
}
1342+
13351343
.rounded {
13361344
border-radius: 0.25rem;
13371345
}
@@ -1651,8 +1659,8 @@ select {
16511659
line-height: 2.25rem;
16521660
}
16531661

1654-
.text-\[1\.21rem\] {
1655-
font-size: 1.21rem;
1662+
.text-\[1\.1rem\] {
1663+
font-size: 1.1rem;
16561664
}
16571665

16581666
.text-base {

assets/js/backwpup-admin.js

Lines changed: 105 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let requestWPApi;
1+
let requestWPApi, loadBackupsListingAndPagination, getUrlParameter, backwpupDisplaySettingsToast;
22
jQuery(document).ready(function ($) {
33
const $document = $(document); // Cache document lookup
44

@@ -80,7 +80,7 @@ jQuery(document).ready(function ($) {
8080
}
8181
}
8282
// Function to get URL parameter.
83-
function getUrlParameter(name, defaultValue="") {
83+
getUrlParameter = function getUrlParameter(name, defaultValue="") {
8484
let searchParams = new URLSearchParams(window.location.search)
8585
if (searchParams.has(name)) {
8686
return searchParams.get(name);
@@ -89,6 +89,54 @@ jQuery(document).ready(function ($) {
8989
}
9090
}
9191

92+
/**
93+
* Display a toast notification in the settings page.
94+
* @param type disable auto-remove if type is not 'success'.
95+
* @param message
96+
* @param duration - The duration in milliseconds to display the toast. Default is 5000ms. Set to -1 to disable auto-remove.
97+
*/
98+
backwpupDisplaySettingsToast = function backwpupDisplaySettingsToast(type = 'info', message = '', duration = 5000) {
99+
if(!message) {
100+
return;
101+
}
102+
requestWPApi(
103+
backwpupApi.getblock,
104+
{
105+
'block_name': 'alerts/info',
106+
'block_type': 'component',
107+
'block_data': {
108+
'type': type,
109+
'font': 'small',
110+
'dismiss_icon': true,
111+
'content': message
112+
},
113+
},
114+
function(response) {
115+
const toast = jQuery('<div class="transform translate-y-2 transition-all duration-300"></div>').html(response);
116+
$('#bwp-settings-toast').html('');
117+
$('#bwp-settings-toast').append(toast);
118+
// Animate in
119+
setTimeout(() => {
120+
toast.addClass('opacity-100 translate-y-0');
121+
}, 10);
122+
123+
// Auto-remove after duration
124+
if (duration !== -1 || type !== 'success') {
125+
setTimeout(() => {
126+
toast.removeClass('opacity-100 translate-y-0').addClass('opacity-0 translate-y-2');
127+
setTimeout(() => {
128+
toast.remove();
129+
}, 300);
130+
}, duration);
131+
}
132+
},
133+
'POST',
134+
function(request, error) {
135+
console.log(error,request);
136+
}
137+
);
138+
}
139+
92140
// Function to be sure the value on this class is an integer.
93141
$(".js-backwpup-intonly").on('keydown', function(event) {
94142
return ['Backspace','Delete','ArrowLeft','ArrowRight'].includes(event.code) ? true : !isNaN(Number(event.key)) && event.code!=='Space';
@@ -167,10 +215,11 @@ jQuery(document).ready(function ($) {
167215
}
168216

169217
//Refresh the dropbox authentification block.
170-
window.dropbox_refresh_authentification = function() {
218+
window.dropbox_refresh_authentification = function(job_id) {
171219
requestWPApi(
172220
backwpupApi.cloud_is_authenticated,
173221
{
222+
'job_id' : job_id,
174223
'cloud_name': 'dropbox',
175224
},
176225
function(response) {
@@ -375,7 +424,8 @@ jQuery(document).ready(function ($) {
375424

376425
// Set default block data payload.
377426
let block_data = {
378-
'job_id': job_id
427+
'job_id': job_id,
428+
'job_type': that.data("job-type")
379429
};
380430

381431
// Define basic frequency settings selectors on the onboarding screen.
@@ -387,8 +437,8 @@ jQuery(document).ready(function ($) {
387437
// Check that we are requesting frequency settings and basic frequency settings are present.
388438
if ('frequency' === panel && basic_frequency_selectors.files.is(':visible') && basic_frequency_selectors.database.is(':visible')) {
389439
let basic_frequency_data = {
390-
job_1: basic_frequency_selectors.files.val(),
391-
job_2: basic_frequency_selectors.database.val()
440+
job_2: basic_frequency_selectors.files.val(),
441+
job_3: basic_frequency_selectors.database.val()
392442
}
393443

394444
// Update block data payload with basic frequency data.
@@ -529,7 +579,7 @@ jQuery(document).ready(function ($) {
529579
);
530580
}
531581

532-
$document.on('click', '.backwpup-btn-select-files, .onboarding-advanced-files-settings ', function () {
582+
$document.on('click', '.js-data-settings-files, .onboarding-advanced-files-settings ', function () {
533583
let that = $(this);
534584
let job_id = that.data("job-id");
535585
let panels = ['exclude-files-core', 'exclude-files-plugins', 'exclude-files-root', 'exclude-files-themes', 'exclude-files-uploads', 'exclude-files-wp-content'];
@@ -571,6 +621,19 @@ jQuery(document).ready(function ($) {
571621

572622
//Refresh the SugarSync root folders.
573623
window.refreshSugarSyncRootFolders = function(job_id) {
624+
const $overlayTemplate = $('#backwpup-loading-overlay-template').children().first();
625+
const $sugarsyncSidebar = $('#sidebar-storage-SUGARSYNC');
626+
627+
let $overlay;
628+
629+
if ($sugarsyncSidebar.length) {
630+
// Add overlay to the sidebar.
631+
$overlay = $overlayTemplate.clone();
632+
$overlay.find('svg').addClass('animate-spin');
633+
$sugarsyncSidebar.find('.backwpup-loading-overlay').remove();
634+
$sugarsyncSidebar.append($overlay);
635+
}
636+
574637
// Reload the root folder list.
575638
requestWPApi(
576639
backwpupApi.getblock,
@@ -583,10 +646,12 @@ jQuery(document).ready(function ($) {
583646
},
584647
function(response) {
585648
$('#sugarsyncroot').html(response);
649+
$overlay?.remove();
586650
},
587651
'POST',
588652
function (request, error) {
589653
$('#sugarsyncroot').html(request.responseText);
654+
$overlay?.remove();
590655
}
591656
);
592657
}
@@ -723,7 +788,7 @@ jQuery(document).ready(function ($) {
723788
data,
724789
function (response) {
725790
refresh_storage_destinations(job_id, 'DROPBOX', response.connected);
726-
dropbox_refresh_authentification();
791+
dropbox_refresh_authentification(job_id);
727792
closeSidebar();
728793
},
729794
"POST",
@@ -754,7 +819,7 @@ jQuery(document).ready(function ($) {
754819
data,
755820
function (response) {
756821
refresh_storage_destinations(job_id, 'DROPBOX', response.connected);
757-
dropbox_refresh_authentification();
822+
dropbox_refresh_authentification(job_id);
758823
closeSidebar();
759824
},
760825
"POST",
@@ -880,7 +945,7 @@ jQuery(document).ready(function ($) {
880945
* Load the backups listing and the pagination from the api
881946
* @param page
882947
*/
883-
function loadBackupsListingAndPagination(page) {
948+
loadBackupsListingAndPagination = function loadBackupsListingAndPagination(page) {
884949
requestWPApi(backwpupApi.backupslistings, {page: page, length: backwpupApi.backupslistingslength}, refreshBackupTable, 'POST');
885950
}
886951

@@ -992,6 +1057,13 @@ jQuery(document).ready(function ($) {
9921057
$("#backwup-next-scheduled-backups").on('change', '.js-backwpup-toggle-job', function () {
9931058
const checked = $(this).prop("checked");
9941059
let job_id = $(this).data("job-id");
1060+
let tooltip_text = 'Disable';
1061+
if(!checked) {
1062+
tooltip_text = 'Enable'
1063+
}
1064+
const $tooltip = $(`#backwpup-${job_id}-options div`).find('[data-tooltip-position]:eq(2)');
1065+
const spanHTML = $tooltip.find('span').prop('outerHTML');
1066+
9951067
$(`#backwpup-${job_id}-options`).find("button:not(.always-enabled)").prop("disabled", !checked);
9961068
requestWPApi(
9971069
backwpupApi.updatejob,
@@ -1000,7 +1072,8 @@ jQuery(document).ready(function ($) {
10001072
'activ': checked
10011073
},
10021074
function (response) {
1003-
$(`#backwpup-${job_id}-options div span.label-scheduled`).html(response.message);
1075+
$(`#backwpup-${job_id}-options div span.label-scheduled`).html(response.message);
1076+
$tooltip.html(tooltip_text + ' ' + spanHTML);
10041077
},
10051078
"POST"
10061079
);
@@ -1033,13 +1106,19 @@ jQuery(document).ready(function ($) {
10331106
});
10341107

10351108
$("#backwup-next-scheduled-backups").on('change', '.backwpup-dynamic-backup-type', function() {
1036-
// Remove classes from all labels and child divs
1037-
$('.backwpup-dynamic-input label').removeClass('bg-secondary-lighter border-secondary-base');
1038-
$('.backwpup-dynamic-input label > div').removeClass('border-secondary-base');
1039-
1040-
// Add classes to the selected label and its child div
1041-
$(this).closest('label').addClass('bg-secondary-lighter border-secondary-base');
1042-
$(this).closest('label').find('div').addClass('border-secondary-base');
1109+
if (0 === $('#js-backwpup-add-new-backup-form').find('input[name="type"]:checked').length) {
1110+
$( this ).prop( "checked", true );
1111+
return; // Do not allow empty selection.
1112+
}
1113+
if (!$(this).is(':checked')) {
1114+
// Remove classes from the selected label and its child divs
1115+
$(this).closest('label').removeClass('bg-secondary-lighter border-secondary-base');
1116+
$(this).closest('label').find('div').removeClass('border-secondary-base');
1117+
} else {
1118+
// Add classes to the selected label and its child div
1119+
$(this).closest('label').addClass('bg-secondary-lighter border-secondary-base');
1120+
$(this).closest('label').find('div').addClass('border-secondary-base');
1121+
}
10431122
});
10441123

10451124
const $target_dynamic_card = '.backwpup-dynamic-backup-card';
@@ -1073,23 +1152,24 @@ jQuery(document).ready(function ($) {
10731152
}
10741153
}
10751154

1076-
// Show dynamic backup card when button is clicked.
1077-
$("#backwup-next-scheduled-backups").on('click', '#js_backwpup_add_new_backup', function () {
1078-
toggleDynamicCardDisplay($target_dynamic_card, 'visible');
1079-
});
10801155

10811156
$("#backwup-next-scheduled-backups").on('click', '#js_backwpup_close_dynamic_backup_card', function () {
10821157
toggleDynamicCardDisplay($target_dynamic_card);
10831158
});
10841159

1160+
//Deprecated since 5.3
10851161
$("#backwup-next-scheduled-backups").on('click', "#js-backwpup-add-new-backup", function (e) {
10861162
e.preventDefault();
10871163
$(this).prop('disabled', true);
10881164
let that = $(this);
1165+
let type = $('#js-backwpup-add-new-backup-form').find('input[name="type"]:checked').val();
1166+
if (2 === $('#js-backwpup-add-new-backup-form').find('input[name="type"]:checked').length) {
1167+
type = 'mixed';
1168+
}
10891169
requestWPApi(
10901170
backwpupApi.addjob,
10911171
{
1092-
type: $('#js-backwpup-add-new-backup-form').find('input[name="type"]:checked').val(),
1172+
type: type,
10931173
},
10941174
function (response) {
10951175
if ( response.success == true ) {
@@ -2053,9 +2133,9 @@ jQuery(document).ready(function ($) {
20532133
} else if ( 301 === response.status ) {
20542134
window.location = response.url;
20552135
}
2056-
},
2057-
'POST');
2136+
}, 'POST');
20582137
}
2138+
20592139
}
20602140

20612141
// Replace the 'Buy Pro' menu item with the correct link.
@@ -2093,51 +2173,6 @@ jQuery(document).ready(function ($) {
20932173
});
20942174
} );
20952175

2096-
/**
2097-
* Display a toast notification in the settings page.
2098-
* @param type disable auto-remove if type is not 'success'.
2099-
* @param message
2100-
* @param duration - The duration in milliseconds to display the toast. Default is 5000ms. Set to -1 to disable auto-remove.
2101-
*/
2102-
function backwpupDisplaySettingsToast(type = 'info', message = '', duration = 5000) {
2103-
requestWPApi(
2104-
backwpupApi.getblock,
2105-
{
2106-
'block_name': 'alerts/info',
2107-
'block_type': 'component',
2108-
'block_data': {
2109-
'type': type,
2110-
'font': 'small',
2111-
'dismiss_icon': true,
2112-
'content': message
2113-
},
2114-
},
2115-
function(response) {
2116-
const toast = jQuery('<div class="transform translate-y-2 transition-all duration-300"></div>').html(response);
2117-
$('#bwp-settings-toast').html('');
2118-
$('#bwp-settings-toast').append(toast);
2119-
// Animate in
2120-
setTimeout(() => {
2121-
toast.addClass('opacity-100 translate-y-0');
2122-
}, 10);
2123-
2124-
// Auto-remove after duration
2125-
if (duration !== -1 || type !== 'success') {
2126-
setTimeout(() => {
2127-
toast.removeClass('opacity-100 translate-y-0').addClass('opacity-0 translate-y-2');
2128-
setTimeout(() => {
2129-
toast.remove();
2130-
}, 300);
2131-
}, duration);
2132-
}
2133-
},
2134-
'POST',
2135-
function(request, error) {
2136-
console.log(error,request);
2137-
}
2138-
);
2139-
}
2140-
21412176
// hide toast on click.
21422177
$(document).on('click', '#bwp-settings-toast #dismiss-icon', function() {
21432178
const toastElements = $('#bwp-settings-toast').children();

assets/js/backwpup-admin.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/backwpup-generate.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)