Skip to content

Merge alive-dev into main: chartHeight control, Format migration & block editor fixes#142

Open
sdimunzio wants to merge 9 commits into
mainfrom
alive-dev
Open

Merge alive-dev into main: chartHeight control, Format migration & block editor fixes#142
sdimunzio wants to merge 9 commits into
mainfrom
alive-dev

Conversation

@sdimunzio

@sdimunzio sdimunzio commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Incorporates the work accumulated in alive-dev (8 commits) into main.

Main Changes

  • chartHeight: New optional attribute + UI control to decouple the chart area from the container height.

  • Format: Migration of the Format component to @devgateway/dvz-wp-commons and support for percentChangeFormat in the big-number-trend block.

  • Block Editor: Isolated styles to the enqueue_block_editor_assets hook; default block labels to generic values.

  • Fixes: HTTP status check before displaying cache-clear success; use of createRef from @wordpress/element; removal of unnecessary status checks in BlockEdit.

🤖 Generated with Claude Code

sdimunzio and others added 8 commits March 31, 2026 13:12
…ssage

The cache-eviction requests now properly validate that each fetch response
has response.ok === true before indicating success to the user. Previously,
the code would show 'Cache cleared successfully!' even when the server
returned 4xx or 5xx error responses, since fetch() only rejects on network
errors, not HTTP error status codes.

Now if any cache eviction request fails with a non-2xx status, an error is
thrown with details (app name, status code, and status text) which is caught
by the existing error handler.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…eact.createRef

Blocks.jsx was using React.createRef() without importing React, which would
cause a ReferenceError at runtime in bundler/module environments that don't
provide a global React variable.

Fixed by:
1. Importing createRef from @wordpress/element (WordPress recommendation)
2. Replacing React.createRef() with createRef()

This follows WordPress best practices for ref creation in components.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…add percentChangeFormat support to big-number-trend block
# Conflicts:
#	plugins/wp-react-blocks-plugin/blocks/filter/BlockEdit.js
Copilot AI review requested due to automatic review settings June 18, 2026 20:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR merges accumulated work from alive-dev into main, focusing on improving block-editor behavior, consolidating shared UI components (Format) into @devgateway/dvz-wp-commons, and adding new formatting/size controls for visualization blocks.

Changes:

  • Added an optional chartHeight attribute + editor control to decouple chart-area height from the resizable container height.
  • Migrated Format usage to @devgateway/dvz-wp-commons, added optional Prefix/Suffix UI via showPrefixSuffix, and introduced a deprecated local charts/Format.jsx shim.
  • Block editor/admin fixes: scope editor CSS to enqueue_block_editor_assets, improve Superset cache-evict success handling, and add percentChangeFormat to Big Number Trend.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
wp-theme/_settings.php Adds HTTP status checking for Superset cache eviction requests before reporting success.
wp-theme/_admin_styles.php Splits admin vs block-editor stylesheet loading (but currently still enqueues Semantic UI in the block editor via admin_enqueue_scripts).
plugins/wp-react-blocks-plugin/blocks/pdf-button/index.js Updates default button label to a more generic value and normalizes import formatting.
plugins/wp-react-blocks-plugin/blocks/measures/BlockEdit.js Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/map/README.md Updates documented default dataSourceText.
plugins/wp-react-blocks-plugin/blocks/map/index.js Updates defaults/formatting for map block attributes (including generic source label).
plugins/wp-react-blocks-plugin/blocks/grouped-bars/BlockEdit.js Switches to commons Format and enables Prefix/Suffix UI via showPrefixSuffix.
plugins/wp-react-blocks-plugin/blocks/data-paragraph/BlockEdit.js Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/utils/MapMeasures.jsx Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/Flow.jsx Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/Data.jsx Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/charts/README.md Updates documented default data source value.
plugins/wp-react-blocks-plugin/blocks/charts/Radar.jsx Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/charts/Line.jsx Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/charts/Info.jsx Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/charts/index.js Adds chartHeight attribute; updates default data source value and normalizes formatting.
plugins/wp-react-blocks-plugin/blocks/charts/GroupTotalSetting.jsx Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/charts/Format.jsx Replaces legacy implementation with a deprecated shim that logs an error and forwards to commons (needs fix to render as a component).
plugins/wp-react-blocks-plugin/blocks/charts/BlockSave.js Persists chartHeight via data-chart-height.
plugins/wp-react-blocks-plugin/blocks/charts/BlockEdit.js Adds editor UI control (RangeControl) for chartHeight.
plugins/wp-react-blocks-plugin/blocks/big-number/BlockEdit.js Switches Format import to the shared commons package.
plugins/wp-react-blocks-plugin/blocks/big-number-trend/index.js Adds new percentChangeFormat attribute.
plugins/wp-react-blocks-plugin/blocks/big-number-trend/BlockSave.js Serializes percentChangeFormat via data-percent-change-format and cleans up saved attributes.
plugins/wp-react-blocks-plugin/blocks/big-number-trend/BlockEdit.js Adds Percent Change format panel and fixes MediaUpload value binding (button label logic still references the wrong variable).
packages/commons/src/Format.jsx Adds showPrefixSuffix prop to optionally render Prefix/Suffix fields.
packages/commons/src/Blocks.jsx Replaces React.createRef() usage with createRef from @wordpress/element.
Comments suppressed due to low confidence (2)

plugins/wp-react-blocks-plugin/blocks/big-number-trend/BlockEdit.js:273

  • The Icon Up MediaUpload button label currently checks iconImage (main image) instead of iconUp, so it can show “Change Icon” even when the Up icon is empty (and vice-versa).
                                value={iconUp}
                                render={({ open }) => (
                                    <button onClick={open} className="components-button is-secondary">
                                        {iconImage
                                            ? __("Change Icon")

plugins/wp-react-blocks-plugin/blocks/big-number-trend/BlockEdit.js:303

  • The Icon Down MediaUpload button label currently checks iconImage (main image) instead of iconDown, so it can show “Change Icon” even when the Down icon is empty (and vice-versa).
                                value={iconDown}
                                render={({ open }) => (
                                    <button onClick={open} className="components-button is-secondary">
                                        {iconImage
                                            ? __("Change Icon")

Comment on lines 4 to +10
function admin_style()
{

// Load semantic-ui only on admin pages that need it (not the block editor canvas).
wp_enqueue_style('semantic-styles', 'https://cdn.jsdelivr.net/npm/semantic-ui-css@2.5.0/semantic.min.css');
wp_enqueue_style('react-styles_common', '/../scss/themes/common.css');
}
add_action('admin_enqueue_scripts', 'admin_style');
Comment thread plugins/wp-react-blocks-plugin/blocks/charts/Format.jsx
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

3 participants