v1.2.0
This commit is contained in:
parent
6708bbb67f
commit
650e69349f
2 changed files with 2919 additions and 268 deletions
|
|
@ -218,6 +218,99 @@
|
|||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
Tools & Status page
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
/* Status table */
|
||||
.mra-status-table td.mra-status-dot-col {
|
||||
width: 24px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.mra-status-table th {
|
||||
white-space: nowrap;
|
||||
width: 180px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.mra-status-table td.mra-status-hint {
|
||||
color: #50575e;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Status indicator dots */
|
||||
.mra-dot {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.mra-dot-ok { background: #00a32a; }
|
||||
.mra-dot-warn { background: #dba617; }
|
||||
.mra-dot-error { background: #d63638; }
|
||||
|
||||
/* Job status labels in the scheduled-jobs row */
|
||||
.mra-job-label {
|
||||
display: inline-block;
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
/* WP-CLI hint below status table */
|
||||
.mra-cli-hint {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.mra-cli-hint code {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
/* Operations section */
|
||||
.mra-ops-heading {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.mra-destructive-heading {
|
||||
margin-top: 1.5em;
|
||||
color: #b32d2e;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.mra-ops-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
margin: 12px 0 20px;
|
||||
}
|
||||
|
||||
.mra-op-card {
|
||||
background: #fff;
|
||||
border: 1px solid #dcdcde;
|
||||
border-radius: 4px;
|
||||
padding: 16px 20px;
|
||||
width: 280px;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.mra-op-card-title {
|
||||
margin: 0 0 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
.mra-op-card-desc {
|
||||
flex: 1;
|
||||
margin-bottom: 12px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Pricing reference table (settings page) */
|
||||
.mra-pricing-table {
|
||||
margin-top: 8px;
|
||||
|
|
@ -238,6 +331,44 @@
|
|||
border-bottom: 1px solid #dcdcde;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
Direct scan runner
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
.mra-runner-progress {
|
||||
margin: 8px 0 10px;
|
||||
}
|
||||
|
||||
.mra-runner-bar {
|
||||
height: 8px;
|
||||
background: #dcdcde;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.mra-runner-bar-fill {
|
||||
height: 100%;
|
||||
width: 0;
|
||||
background: #2271b1;
|
||||
border-radius: 4px;
|
||||
transition: width 0.25s ease;
|
||||
}
|
||||
|
||||
.mra-runner-label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #50575e;
|
||||
min-height: 1.4em;
|
||||
}
|
||||
|
||||
.mra-runner-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/* Consensus block */
|
||||
.mra-consensus {
|
||||
background: #f0f8e8;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,86 @@
|
|||
/* global mraAdmin */
|
||||
/* global mraAdmin, mraTools */
|
||||
( function ( $ ) {
|
||||
'use strict';
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Batch runner — Tools page
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
function initRunner( type ) {
|
||||
var running = false;
|
||||
var stopReq = false;
|
||||
|
||||
var $card = $( '#mra-runner-' + type );
|
||||
var $start = $card.find( '.mra-runner-start' );
|
||||
var $stop = $card.find( '.mra-runner-stop' );
|
||||
var $prog = $card.find( '.mra-runner-progress' );
|
||||
var $fill = $card.find( '.mra-runner-bar-fill' );
|
||||
var $label = $card.find( '.mra-runner-label' );
|
||||
|
||||
$start.on( 'click', function () {
|
||||
if ( running ) { return; }
|
||||
running = true;
|
||||
stopReq = false;
|
||||
$start.prop( 'disabled', true );
|
||||
$stop.prop( 'hidden', false );
|
||||
$prog.prop( 'hidden', false );
|
||||
$fill.css( 'width', '0%' );
|
||||
$label.text( '' );
|
||||
runBatch();
|
||||
} );
|
||||
|
||||
$stop.on( 'click', function () {
|
||||
stopReq = true;
|
||||
$( this ).prop( 'disabled', true );
|
||||
} );
|
||||
|
||||
function runBatch() {
|
||||
if ( stopReq ) {
|
||||
finish( mraTools.i18n.stopped );
|
||||
return;
|
||||
}
|
||||
$.ajax( {
|
||||
url: mraTools.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'mra_run_batch',
|
||||
type: type,
|
||||
nonce: mraTools.nonce
|
||||
},
|
||||
success: function ( res ) {
|
||||
if ( ! res.success ) {
|
||||
finish( mraTools.i18n.error );
|
||||
return;
|
||||
}
|
||||
var d = res.data;
|
||||
var pct = d.total > 0 ? Math.round( ( d.done / d.total ) * 100 ) : 100;
|
||||
$fill.css( 'width', pct + '%' );
|
||||
$label.text( d.done + ' / ' + d.total );
|
||||
if ( d.remaining > 0 ) {
|
||||
setTimeout( runBatch, 300 );
|
||||
} else {
|
||||
$fill.css( 'width', '100%' );
|
||||
finish( mraTools.i18n.done );
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
finish( mraTools.i18n.error );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
function finish( msg ) {
|
||||
running = false;
|
||||
$start.prop( 'disabled', false );
|
||||
$stop.prop( 'hidden', true ).prop( 'disabled', false );
|
||||
$label.text( msg );
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Modal — Audit page
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
var $overlay, $modalTitle, $modalBody;
|
||||
|
||||
function openModal( attachmentId ) {
|
||||
|
|
@ -37,6 +116,11 @@
|
|||
}
|
||||
|
||||
$( function () {
|
||||
// Initialize batch runners if mraTools is available (Tools page only).
|
||||
if ( typeof mraTools !== 'undefined' ) {
|
||||
[ 'index', 'usage', 'external' ].forEach( initRunner );
|
||||
}
|
||||
|
||||
$overlay = $( '#mra-modal-overlay' );
|
||||
$modalTitle = $overlay.find( '.mra-modal-title' );
|
||||
$modalBody = $overlay.find( '.mra-modal-body' );
|
||||
|
|
|
|||
Loading…
Reference in a new issue