Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ yarn-error.log*
/dist/

# Composer
vendor/

composer.lock

# Environment files
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ To migrate from 1.x to 2.0.0:
- All code examples updated to use new function and filter names
- REST API namespace remains `redis-queue/v1` for API stability

### Post-release Adjustments (2.0.0)
These refinements were made after the initial 2.0.0 tag without changing the version number (non‑breaking / UI & internal only):

#### Added
- Noscript warning block on the Test Jobs admin page to inform users when JavaScript is disabled.

#### Changed
- Improved test job submission UX: enforce a short minimum "Processing…" state for better visual feedback.
- Replaced previous loading spinner with a subtle button fade animation (no color inversion, preserves native WP button styling).
- More resilient admin asset loading by switching from relative `../../assets/...` URLs to `plugins_url()` (avoids edge cases with path traversal or CDN rewriting).

#### Fixed
- Admin JS not reliably loading in some environments due to relative path (`../../`) usage from within namespaced class directory.
- Intermittent perception that form submission did "nothing" because the processing state was too brief—now perceptible.

#### Internal
- Minor housekeeping in admin UI scripts (added lightweight inline preload marker for debugging).

## [1.2.0] - 2025-10-10
### Removed
- Dropped all legacy global class aliases (previous `class_alias` guards) now that backward compatibility is not required.
Expand Down
72 changes: 16 additions & 56 deletions assets/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,26 @@
margin-top: 15px;
}

.health-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
background: #f9f9f9;
border-radius: 4px;
}

.health-item .label {
font-weight: 600;
/* Button loading state: subtle fade only (keep original colors) */
.button-primary.loading,
.button.loading {
position: relative;
pointer-events: none;
animation: rq-fade 0.9s ease-in-out infinite;
}

.health-item .value {
padding: 4px 8px;
border-radius: 3px;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
}
@keyframes rq-fade {
0% {
opacity: 1;
}

.health-item .value.connected,
.health-item .value.ok {
background-color: #d4edda;
color: #155724;
}
50% {
opacity: 0.45;
}

.health-item .value.disconnected,
.health-item .value.error {
background-color: #f8d7da;
color: #721c24;
100% {
opacity: 1;
}
}

/* Stats Boxes */
Expand Down Expand Up @@ -258,35 +247,6 @@
display: block;
}

/* Loading States */
.loading {
opacity: 0.6;
pointer-events: none;
}

.loading::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 20px;
height: 20px;
margin: -10px 0 0 -10px;
border: 2px solid #f3f3f3;
border-top: 2px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}

/* Responsive Design */
@media (max-width: 768px) {
Expand Down
18 changes: 15 additions & 3 deletions assets/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,18 @@
var $form = $(this);
var $submitButton = $form.find('button[type="submit"]');
var originalText = $submitButton.text();
var startTime = Date.now();
var MIN_PROCESSING_MS = 700; // ensure user perceives processing state

// Prevent double submission
if ($submitButton.prop('disabled')) {
console.log('Form submission already in progress, ignoring duplicate submit');
return;
}

$submitButton.prop('disabled', true).text(redisQueueAdmin.strings.processing);
$submitButton.prop('disabled', true).addClass('loading').text(redisQueueAdmin.strings.processing);
// Immediate user feedback line
RedisQueueAdmin.showTestResult('Submitting job request...', 'info');

// Get form data
var formData = {};
Expand Down Expand Up @@ -549,7 +553,15 @@
},
complete: function() {
console.log('Job creation request completed');
$submitButton.prop('disabled', false).text(originalText);
var elapsed = Date.now() - startTime;
var remaining = MIN_PROCESSING_MS - elapsed;
if (remaining > 0) {
setTimeout(function() {
$submitButton.prop('disabled', false).removeClass('loading').text(originalText);
}, remaining);
} else {
$submitButton.prop('disabled', false).removeClass('loading').text(originalText);
}
}
});
},
Expand Down Expand Up @@ -659,7 +671,7 @@
var $output = $('#test-output');

var timestamp = new Date().toLocaleTimeString();
var resultClass = type === 'success' ? 'success' : 'error';
var resultClass = (type === 'success') ? 'success' : (type === 'info' ? 'info' : 'error');

var resultHtml = '[' + timestamp + '] ' + message + '\n';

Expand Down
7 changes: 7 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ The plugin includes fallback mechanisms and graceful error handling. Jobs will f
* Complete documentation update to reflect new naming
* See CHANGELOG.md for detailed migration guide

* Post-release adjustments (still 2.0.0, non-breaking):
* Improved test job submission feedback: enforced brief minimum "Processing..." state so users perceive action.
* Reworked loading indicator: spinner removed; simple fade animation keeps original button colors.
* Fixed admin JS enqueue path (relative `../../` replaced with `plugins_url()` to avoid edge cases in some setups).
* Added a <noscript> warning on Test Jobs page for users with JavaScript disabled.
* Minor internal JS housekeeping (debug preload marker) to help diagnose asset loading.

= 1.2.0 =
* Removed legacy global class aliases and all back-compat shims
* Deleted deprecated `includes/` directory (fully namespaced codebase)
Expand Down
9 changes: 7 additions & 2 deletions src/Admin/Admin_Interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ public function enqueue_admin_scripts( $hook_suffix ) {
if ( false === strpos( $hook_suffix, 'redis-queue' ) ) {
return;
}
\wp_enqueue_script( 'redis-queue-admin', \plugin_dir_url( __FILE__ ) . '../../assets/admin.js', [ 'jquery' ], REDIS_QUEUE_VERSION, true );
// Use plugins_url with main plugin file for predictable paths (avoid ../../ in URL which some setups may block).
$script_url = \plugins_url( 'assets/admin.js', REDIS_QUEUE_PLUGIN_FILE );
$style_url = \plugins_url( 'assets/admin.css', REDIS_QUEUE_PLUGIN_FILE );
\wp_enqueue_script( 'redis-queue-admin', $script_url, [ 'jquery' ], REDIS_QUEUE_VERSION, true );
// Add a small inline script early to help debug if main script fails to load (will be replaced by main script execution log if successful).
\wp_add_inline_script( 'redis-queue-admin', 'window.redisQueueAdminLoadedPre=Date.now();', 'before' );
\wp_localize_script( 'redis-queue-admin', 'redisQueueAdmin', [
'ajaxUrl' => \admin_url( 'admin-ajax.php' ),
'nonce' => \wp_create_nonce( 'redis_queue_admin' ),
Expand All @@ -62,7 +67,7 @@ public function enqueue_admin_scripts( $hook_suffix ) {
'queueCleared' => __( 'Queue cleared successfully', 'redis-queue' ),
],
] );
\wp_enqueue_style( 'redis-queue-admin', \plugin_dir_url( __FILE__ ) . '../../assets/admin.css', [], REDIS_QUEUE_VERSION );
\wp_enqueue_style( 'redis-queue-admin', $style_url, [], REDIS_QUEUE_VERSION );
}

// The following render methods replicate legacy output exactly.
Expand Down
18 changes: 12 additions & 6 deletions src/Admin/partials/test-inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<h1><?php esc_html_e( 'Test Jobs', 'redis-queue' ); ?></h1>
<p><?php esc_html_e( 'Create test jobs to verify the queue system is working correctly.', 'redis-queue' ); ?>
</p>
<noscript>
<div class="notice notice-error" style="padding:10px;">
<p><?php esc_html_e( 'JavaScript is disabled in your browser. Test job submission requires JavaScript.', 'redis-queue' ); ?>
</p>
</div>
</noscript>
<?php wp_nonce_field( 'wp_rest', '_wpnonce' ); ?>
<div class="redis-queue-test-forms">
<div class="test-form-section">
Expand Down Expand Up @@ -50,21 +56,20 @@ class="button button-primary"><?php esc_html_e( 'Queue Email Job', 'redis-queue'
<form id="test-image-job" class="test-job-form">
<table class="form-table">
<tr>
<th><label
for="image-operation"><?php esc_html_e( 'Operation:', 'redis-queue' ); ?></label>
<th><label for="image-operation"><?php esc_html_e( 'Operation:', 'redis-queue' ); ?></label>
</th>
<td><select id="image-operation" name="operation">
<option value="thumbnail">
<?php esc_html_e( 'Generate Thumbnails', 'redis-queue' ); ?></option>
<?php esc_html_e( 'Generate Thumbnails', 'redis-queue' ); ?>
</option>
<option value="optimize"><?php esc_html_e( 'Optimize Image', 'redis-queue' ); ?>
</option>
<option value="watermark"><?php esc_html_e( 'Add Watermark', 'redis-queue' ); ?>
</option>
</select></td>
</tr>
<tr>
<th><label
for="attachment-id"><?php esc_html_e( 'Attachment ID:', 'redis-queue' ); ?></label>
<th><label for="attachment-id"><?php esc_html_e( 'Attachment ID:', 'redis-queue' ); ?></label>
</th>
<td><input type="number" id="attachment-id" name="attachment_id" value="1" class="small-text">
<p class="description">
Expand All @@ -86,7 +91,8 @@ class="button button-primary"><?php esc_html_e( 'Queue Image Job', 'redis-queue'
</th>
<td><select id="api-operation" name="operation">
<option value="social_media_post">
<?php esc_html_e( 'Social Media Post', 'redis-queue' ); ?></option>
<?php esc_html_e( 'Social Media Post', 'redis-queue' ); ?>
</option>
<option value="crm_sync"><?php esc_html_e( 'CRM Sync', 'redis-queue' ); ?></option>
<option value="webhook"><?php esc_html_e( 'Webhook', 'redis-queue' ); ?></option>
</select></td>
Expand Down
25 changes: 25 additions & 0 deletions vendor/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit0cebc4f52f44ec387b055d34fdf9f29a::getLoader();
Loading