Skip to content

Share a composite modification nested in another composite - #4192

Merged
flomillot merged 5 commits into
mainfrom
feat/share-nested-composite-modification
Sep 16, 2026
Merged

flomillot merged 5 commits into
mainfrom
feat/share-nested-composite-modification

Conversation

@flomillot

@flomillot flomillot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Follow-up of #4157.

The "New (shared)" option of the dialog saving modifications into GridExplore is now only enabled in developer mode — it stays visible but greyed out otherwise.

A composite modification nested in another composite of the node can now be shared, as long as it is not contained by an already shared composite. The option is also greyed out when the selected composite contains a shared modification, at any depth: since the table only loads the content of a composite as it is unfolded, the server is asked, once the dialog is open.

The saving logic moves out of the node editor into a dedicated SaveNetworkModificationsDialog wrapping ElementSaveDialog. A single server call there both warns that shared modifications are saved as a copy and greys out the sharing.

Requires gridsuite/study-server#1089 and gridsuite/commons-ui#1336.

The shared option of the save dialog is only enabled in developer mode, and stays disabled when the selected composite contains a shared modification, which the server is asked once the dialog is open.

Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: af5730b8-adfa-4eb4-86df-61baff25ad34

📥 Commits

Reviewing files that changed from the base of the PR and between 18f91d2 and 134607e.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The composite modification save flow now uses a dedicated dialog. The dialog validates sharing eligibility, checks nested shared references when needed, reports query errors, and passes save actions through the network modification editor.

Changes

Network modification sharing

Layer / File(s) Summary
Sharing eligibility dialog
src/components/graph/menus/network-modifications/save-network-modifications-dialog.tsx
Adds a dedicated dialog that derives selection state, queries nested shared references when open, reports failures, and configures shared-save availability and alerts.
Editor dialog integration
src/components/graph/menus/network-modifications/network-modification-node-editor.tsx, package.json
Removes editor-level sharing validation, uses SaveNetworkModificationsDialog with the selected modifications and save handlers, and updates @gridsuite/commons-ui to 0.292.0.

Sequence Diagram(s)

sequenceDiagram
  participant NetworkModificationEditor
  participant SaveNetworkModificationsDialog
  participant hasModificationReferences
  participant StudyServer
  NetworkModificationEditor->>SaveNetworkModificationsDialog: open with selected modifications
  SaveNetworkModificationsDialog->>hasModificationReferences: query composite UUIDs
  hasModificationReferences->>StudyServer: check nested shared references
  StudyServer-->>hasModificationReferences: return shared-content result
  hasModificationReferences-->>SaveNetworkModificationsDialog: set sharing eligibility
Loading

Suggested reviewers: ghazwarhili, dbraquart

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 13460

The reviewed sharing-flow changes have no confirmed merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: enabling sharing for a composite modification nested in another composite.
Description check ✅ Passed The description accurately explains the sharing rules, dialog changes, server check, and related dependencies.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

}
})
.catch((error) => {
console.error(

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.

snackWithFallback(snackError, error, { headerId: 'errContainsSharedModificationMsg' });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

const url = `${PREFIX_STUDY_QUERIES}/v1/network-composite-modifications/${safeEncodeURIComponent(
compositeModificationUuid
)}/contains-shared-modification`;
console.debug(url);

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.

console.debug(url); to be cleaned up maybe

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Its just how its done everywhere

onSave={onSave}
onSaveShared={onSaveShared}
createSharedDisabled={!isSharingAvailable}
OnUpdate={onUpdate}

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.

It would be better to use onUpdate instead of OnUpdate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup but not my code

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
It brings the message of the modification.containsShared business error.

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
@sonarqubecloud

Copy link
Copy Markdown

@flomillot
flomillot merged commit 826c0ed into main Sep 16, 2026
6 checks passed
@flomillot
flomillot deleted the feat/share-nested-composite-modification branch September 16, 2026 10:59
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