A dynamic Gutenberg block for Liaison Site Prober that fetches and displays real-time
system logs via the REST API. Engineered for performance and security,
it provides a seamless way to visualize site activity without compromising page speed.
Plugin structure:
liaison-site-prober-viewer/
├── src/
│ ├── edit.js # Block editor UI
│ └── editor.scss # Block editor styles
├── build/
│ └── index.js # Compiled block code
├── tests/ # Jest unit tests
├── liaison-site-prober-viewer.php # Plugin bootstrap
└── package.json / node_modules # JS dependencies
Architecture Diagram (textual):
[Database: liaison-site-prober activity table]
|
v
[WordPress REST API endpoint: wp-json/site-prober/v1/logs]
|
v
[Gutenberg dynamic block: liaison-site-prober-viewer]
|
v
[Editor/UI: renders logs in a table inside the block]
wp-json/site-prober/v1/logs) exposes logs in JSON format.Edit component) calls apiFetch({ path: '/site-prober/v1/logs' }).loading shows Spinnererror shows Noticelogs renders table rowspermission_callback to restrict access.esc_html() to prevent XSS.liaison-site-prober is installed and meets minimum version.wp_die() for activation errors, preventing unsafe state.Pros:
Cons:
Block uses Jest with @wordpress/scripts preset.
REST API calls are mocked; tests cover loading, empty, and error states.