clean build for version 1.4.5 with fixes of security funtionalities, logic branches, etc. Already tested and working fine
This commit is contained in:
@@ -31,6 +31,16 @@
|
||||
<small class="text-muted">Maximum records to display (performance limit)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-3"><label class="form-label fw-bold mb-0">Cache Control</label></div>
|
||||
<div class="col-9">
|
||||
<button type="button" class="btn btn-sm btn-outline-warning" id="clear-checker-cache" data-checker-id="<?= $post_id ?>">
|
||||
<i class="bi bi-arrow-clockwise"></i> Clear Cache & Refresh Data
|
||||
</button>
|
||||
<small class="text-muted d-block mt-1">Clear cached data to fetch fresh data from Google Sheet (cached for 5 minutes)</small>
|
||||
<div id="cache-clear-message" class="mt-2" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="has-link" style="display: none;">
|
||||
@@ -150,4 +160,49 @@
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
$('#clear-checker-cache').on('click', function() {
|
||||
var btn = $(this);
|
||||
var checkerId = btn.data('checkerId');
|
||||
var messageDiv = $('#cache-clear-message');
|
||||
|
||||
btn.prop('disabled', true).html('<i class="bi bi-arrow-clockwise spinner-border spinner-border-sm"></i> Clearing...');
|
||||
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'checker_clear_cache',
|
||||
checker_id: checkerId,
|
||||
security: '<?php echo wp_create_nonce("checker_ajax_nonce"); ?>'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
messageDiv.removeClass('alert-danger').addClass('alert alert-success')
|
||||
.html('<i class="bi bi-check-circle"></i> ' + response.data.message)
|
||||
.fadeIn();
|
||||
} else {
|
||||
messageDiv.removeClass('alert-success').addClass('alert alert-danger')
|
||||
.html('<i class="bi bi-exclamation-circle"></i> ' + response.data.message)
|
||||
.fadeIn();
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
messageDiv.fadeOut();
|
||||
}, 3000);
|
||||
},
|
||||
error: function() {
|
||||
messageDiv.removeClass('alert-success').addClass('alert alert-danger')
|
||||
.html('<i class="bi bi-exclamation-circle"></i> Failed to clear cache')
|
||||
.fadeIn();
|
||||
},
|
||||
complete: function() {
|
||||
btn.prop('disabled', false).html('<i class="bi bi-arrow-clockwise"></i> Clear Cache & Refresh Data');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user