Skip to content

feat(map): expose resource fill color in editor#247

Open
vuntz wants to merge 2 commits into
devfrom
MON-199583-map-resource-fill-color
Open

feat(map): expose resource fill color in editor#247
vuntz wants to merge 2 commits into
devfrom
MON-199583-map-resource-fill-color

Conversation

@vuntz
Copy link
Copy Markdown
Member

@vuntz vuntz commented May 22, 2026

Description

Fixes: MON-199583

⚠️ Companion PR in centreon-modules: centreon/centreon-modules#8190. This drawio PR must merge first so the @centreon/drawio dependency in modules4 can be bumped to a commit including these changes.

Expose the existing fillColor setting for Centreon RESOURCE and CONTAINER cells in the editor's Format panel, and preserve it across style changes. The map viewer already honors fillColor when "Apply status color to background" is disabled, but the editor previously hid the picker for these cell types — making the value unreachable, especially on maps migrated from the legacy map software.

Changes

  • Format.js — show the fill picker for RESOURCE/CONTAINER cells when useBackgroundStatusColor is false and the cell's style is not GEOMETRIC (GEOMETRIC always paints the status color and ignores the user fill).
  • Graph.js — in handleCentreonStyleChange, save the current imageBackground onto fillColor when switching to GEOMETRIC, then clear imageBackground so drawio stops painting it. Restore on the way back.
  • EditorUi.js — fix a latent bug in the setStyleProperties handler: re-read cellStyle from the model after handleCentreonStyleChange, since the latter now writes through setCellStyles. Without the re-read, the final setStyle() would clobber those changes.

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

Target serie

  • 23.10.x
  • 24.04.x
  • 24.10.x
  • 25.10.x
  • master

How this pull request can be tested ?

  1. Open the MAP editor; the modules4 companion PR must be deployed too.
  2. Select a host with style ICON or WEATHER and `useBackgroundStatusColor=false`. Confirm the "Fill" color picker is visible in the Format panel and shows the current fill (mirrored from `fillColor`).
  3. Pick a new color. Confirm the cell renders the picked color in the editor.
  4. Save the map and reload; the picked color is persisted and re-rendered.
  5. Toggle "Apply status color to background" on in the resource wizard. Confirm the fill picker disappears.
  6. Switch the style to GEOMETRIC. Confirm the picker disappears and the picked fill is not lost.
  7. Switch back to ICON. Confirm the previously picked fill is restored.

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially new classes, functions or any legacy code modified.
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (master, maintenance).

vuntz added 2 commits May 22, 2026 13:23
Previously the Format panel always hid the fill picker for
RESOURCE and CONTAINER cells. Match the existing WIDGET OUTPUT
behavior: hide it only when useBackgroundStatusColor is true,
since the status color would otherwise override the picked fill.

The stroke panel continues to hide for all RESOURCE and
CONTAINER cells.

Assisted-by: Claude Code (claude-opus-4-7)
GEOMETRIC resources always render the status color and ignore
the user's fill. Hide the fill picker for GEOMETRIC cells in
the Format panel. In handleCentreonStyleChange, save the
current imageBackground onto fillColor when switching to
GEOMETRIC, then clear imageBackground; on the way back,
restore imageBackground from the saved fillColor.

Also fix the setStyleProperties handler to re-read the cell's
style after handleCentreonStyleChange, since the latter writes
through setCellStyles. Without the re-read, the final
setStyle() call clobbers those changes. The Resource wizard
hit this; the ResourcesAndContainer path already used
setCellStyles per key and was unaffected.

Assisted-by: Claude Code (claude-opus-4-7)
@vuntz vuntz requested a review from a team as a code owner May 22, 2026 16:42
@vuntz vuntz requested review from Med1233 and Thebarda May 22, 2026 16:42
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.

1 participant