Skip to content

Share a composite modification nested in another composite - #4192

Open
flomillot wants to merge 1 commit into
mainfrom
feat/share-nested-composite-modification
Open

Share a composite modification nested in another composite#4192
flomillot wants to merge 1 commit into
mainfrom
feat/share-nested-composite-modification

Conversation

@flomillot

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 sharing logic moves out of the node editor into a dedicated SaveNetworkModificationsDialog wrapping ElementSaveDialog.

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

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: 09e3f0ec-7784-4353-b3ec-5636571ae9ac

📥 Commits

Reviewing files that changed from the base of the PR and between 8ef4c9b and 50d2136.

📒 Files selected for processing (3)
  • src/components/graph/menus/network-modifications/network-modification-node-editor.tsx
  • src/components/graph/menus/network-modifications/save-network-modifications-dialog.tsx
  • src/services/study/network-modifications.ts

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 checks sharing eligibility through a study-server query before enabling shared saving. The network modification editor passes selected modifications and save handlers to the new dialog.

Changes

Network modification sharing

Layer / File(s) Summary
Shared-modification query
src/services/study/network-modifications.ts
Adds containsSharedModification, which queries the study server for the selected composite modification UUID.
Sharing eligibility dialog
src/components/graph/menus/network-modifications/save-network-modifications-dialog.tsx
Adds a dedicated dialog that checks developer mode, selection shape, shared ancestry, and server-reported shared content before enabling shared saving.
Editor dialog integration
src/components/graph/menus/network-modifications/network-modification-node-editor.tsx
Replaces the generic save dialog with SaveNetworkModificationsDialog and passes the selected modifications and save handlers.

Suggested reviewers: dbraquart

Sequence Diagram(s)

sequenceDiagram
  participant NetworkModificationNodeEditor
  participant SaveNetworkModificationsDialog
  participant StudyNetworkModificationsService
  participant StudyServer
  NetworkModificationNodeEditor->>SaveNetworkModificationsDialog: open with selected modifications and handlers
  SaveNetworkModificationsDialog->>StudyNetworkModificationsService: check composite UUID
  StudyNetworkModificationsService->>StudyServer: GET contains-shared-modification
  StudyServer-->>StudyNetworkModificationsService: return boolean
  StudyNetworkModificationsService-->>SaveNetworkModificationsDialog: return sharing status
  SaveNetworkModificationsDialog-->>NetworkModificationNodeEditor: enable or disable shared save
Loading

Merge Risk: ⚪ Minimal · up to 50d21

This change enables nested composite sharing while keeping shared saving disabled when eligibility cannot be confirmed. The current implementation shows no concrete merge-blocking correctness or availability 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. 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 summarizes the primary change: enabling sharing of a composite modification nested within another composite.
Description check ✅ Passed The description accurately explains the sharing restrictions, developer-mode behavior, server validation, component extraction, and required 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.
  • 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.

@sonarqubecloud

Copy link
Copy Markdown

}
})
.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' });

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

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

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