Skip to content

Upd. React. Refactoring #16. - #726

Open
Glomberg wants to merge 26 commits into
Upd-Scanner-Frontend-controller-removed-VIfrom
Upd-React-Refactoring-#16-VI
Open

Upd. React. Refactoring #16.#726
Glomberg wants to merge 26 commits into
Upd-Scanner-Frontend-controller-removed-VIfrom
Upd-React-Refactoring-#16-VI

Conversation

@Glomberg

@Glomberg Glomberg commented Sep 3, 2026

Copy link
Copy Markdown
Member

…removed-VI' into Upd-React-Refactoring-#16-VI

# Conflicts:
#	inc/spbc-admin.php
…removed-VI' into Upd-React-Refactoring-#16-VI

# Conflicts:
#	inc/spbc-admin.php
…act-Refactoring-#16-VI

# Conflicts:
#	js/public/spbct-react-bundle.js
…act-Refactoring-#16-VI

# Conflicts:
#	js/src/react/components/TabContent/TabScanner/TabScanner.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new React Scanner UI introduces hardcoded environment-specific URLs and some missing localization/fallback handling that can break production behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors the Scanner tab to move “last/next scan info” and scan progress UI responsibilities into React, while introducing a backend view layer and AJAX endpoint that provide raw scan metadata to the frontend.

Changes:

  • Added backend Scanner\View\View to provide React tab data and raw last/next scan info data via AJAX.
  • Updated scanner status endpoint to include per-stage total and percent progress details for React rendering.
  • Removed legacy PHP-rendered Scanner header/progress markup and legacy JS “reload scan info” hook in favor of the new React components.
File summaries
File Description
lib/CleantalkSP/SpbctWP/SpbcEnqueue.php Removes a localized string no longer used by legacy scan-info refresh logic.
lib/CleantalkSP/SpbctWP/Scanner/View/View.php New backend view that returns Scanner React data and raw last/next scan info payload.
lib/CleantalkSP/SpbctWP/Scanner/View/index.php Adds directory index guard.
lib/CleantalkSP/SpbctWP/Scanner/ScannerAjaxEndpoints.php Adds AJAX handler to return raw last/next scan info data for React.
lib/CleantalkSP/SpbctWP/RemoteCalls.php Minor formatting/indentation adjustment in background scan remote call response.
js/src/spbc-settings.js Removes legacy spbcScannerReloadScanInfo() implementation.
js/src/spbc-scanner-plugin.js Removes legacy call to reload last-scan info after accordion reload.
js/src/react/components/TabContent/TabScanner/TabScanner.js Adds React polling/progress state and integrates new ScannerInfo block plus live log refresh.
js/src/react/components/TabContent/TabScanner/styles.css Adds indeterminate progress-bar styling for stages without a computable percent.
js/src/react/components/TabContent/TabScanner/ScannerInfo/ScannerInfo.js New React UI for scanner header/actions and last/next scan sentence built from raw backend data.
js/src/react/components/TabContent/TabScanner/ScannerInfo/ScanButton.js New React scan button with “starting” state and spinner.
js/src/react/components/TabContent/TabContent.js Stops using legacy HTML fetch path for the scanner tab (now served by React data endpoint).
js/public/spbct-react-bundle.js Rebuilt bundle reflecting the new React scanner implementation.
inc/spbc-settings.php Removes legacy PHP-rendered Scanner header/progress markup and removes obsolete AJAX string-returning helper.
inc/spbc-scanner.php Adds AJAX wrapper for starting scan and extends status payload with per-stage progress metrics.
inc/spbc-admin.php Wires new AJAX handlers and returns new Scanner React data via spbct_get_tab_data.
Review details

Suppressed comments (1)

js/src/react/components/TabContent/TabScanner/ScannerInfo/ScannerInfo.js:289

  • This warning text is now hardcoded in English; previously it was localized in PHP. Wrap it with __() so it remains translatable.
            <p className='spbc_hint spbc_hint_warning spbc_hint_warning__outdated' style={{display: 'none', textAlign: 'center', marginTop: '5px'}}>
                Found outdated plugins or themes. Please, update to latest versions.
            </p>
  • Files reviewed: 14/16 changed files
  • Comments generated: 6
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

{buttonText}
</button>
{(isStarting || scannerStatus === 'in_progress') && (
<img className='spbc_preloader' src='http://wordpress-security.test/wp-content/plugins/security-malware-firewall/images/preloader.gif' style={{display: 'inline-block'}}/>
Comment on lines +264 to +266
<a target='blank' href={logsLinkUrl}>
{__('View all scan results for this website', 'security-malware-firewall')}<i className='spbc-icon-link-ext'></i>
</a>,
</>
)}
&nbsp;
<a href='http://wordpress-security.test/wp-admin/options-general.php?page=spbc&amp;spbc_tab=backups'>
Comment on lines +146 to 149
} catch (error) {
console.error('Error fetching content:', error);
setSectionDataLegacyFetched(true);
}
//flags
$data['flags'] = [];
//objects
$data['objects']['scanner']['last_scan'] = $spbc->data['scanner']['last_scan'];
Comment on lines +284 to +286
<p className='spbc_hint spbc_hint_warning spbc_hint_warning__long_scan' style={{display: 'none', textAlign: 'center', marginTop: '5px'}}>
A lot of files were found, so it will take time to scan
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants