Skip to content

specific composite functions#3810

Open
Mathieu-Deharbe wants to merge 4 commits intomainfrom
specific-composite-functions
Open

specific composite functions#3810
Mathieu-Deharbe wants to merge 4 commits intomainfrom
specific-composite-functions

Conversation

@Mathieu-Deharbe
Copy link
Contributor

Separates the netmod move/copy functions from the composite insert functions.

Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
@Mathieu-Deharbe Mathieu-Deharbe self-assigned this Mar 17, 2026
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
return backendFetchJson(url);
}

export function insertCompositeModifications(
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor tidbit, but since "insert" is one the two actions carried on by this function (insert and split) maybe the naming should also reflect that with a more englobing prefix ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Like this ? : bd42f65

Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

The changes refactor composite modification handling by introducing a dedicated executeCompositeModificationAction function to replace composite-specific logic in copyOrMoveModifications. A new CompositeModificationAction enum separates composite operations from general copy/move types, and payload structures are updated to include modification names alongside IDs.

Changes

Cohort / File(s) Summary
Type Definitions
src/components/graph/menus/network-modifications/network-modification-menu.type.ts
Removed SPLIT_COMPOSITE and INSERT_COMPOSITE members from NetworkModificationCopyType enum. Added new CompositeModificationAction enum with SPLIT and INSERT values to separate composite operation semantics from general copy/move types.
Service Layer
src/services/study/index.ts
Added new executeCompositeModificationAction() function that sends a PUT request with composite modifications and an action query parameter. Updated copyOrMoveModifications() to send the modification UUID list directly without intermediate object mapping.
Dialog Component
src/components/dialogs/import-modification-dialog.tsx
Replaced copyOrMoveModifications() call with executeCompositeModificationAction(). Changed payload from UUID list to array of objects containing UUID and name pairs. Updated imports to use new CompositeModificationAction enum instead of composite copy types.
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'specific composite functions' is vague and generic, using non-descriptive language that doesn't clearly convey what composite functions were separated or how. Use a more specific title that describes the actual separation, such as 'Separate composite modification actions from move/copy functions' or 'Refactor composite modifications to use dedicated action function'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly relates to the changeset by explaining the separation of move/copy functions from composite insert functions, which aligns with the actual code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@sonarqubecloud
Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/services/study/index.ts (1)

22-25: Decouple service-layer types from component-layer modules.

src/services/study/index.ts importing from components/graph/.../network-modification-menu.type creates an inverted dependency. Consider moving shared enums/interfaces (CompositeModificationAction, NetworkModificationCopyInfos) to a neutral shared/domain types module consumed by both layers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/services/study/index.ts` around lines 22 - 25, The service layer is
importing UI component types (CompositeModificationAction,
NetworkModificationCopyInfos) which inverts dependencies; extract those shared
enums/interfaces into a neutral shared/domain types module (e.g., a new
shared-types or domain/types file), move the definitions of
CompositeModificationAction and NetworkModificationCopyInfos there, update the
import in the service module (src/services/study/index.ts) to import from the
new shared module, and update the component that originally owned them to import
from the same shared module so both layers depend on the neutral types instead
of components.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/services/study/index.ts`:
- Around line 22-25: The service layer is importing UI component types
(CompositeModificationAction, NetworkModificationCopyInfos) which inverts
dependencies; extract those shared enums/interfaces into a neutral shared/domain
types module (e.g., a new shared-types or domain/types file), move the
definitions of CompositeModificationAction and NetworkModificationCopyInfos
there, update the import in the service module (src/services/study/index.ts) to
import from the new shared module, and update the component that originally
owned them to import from the same shared module so both layers depend on the
neutral types instead of components.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bd0a139b-b59a-43ca-8ba9-637cbe71bd9a

📥 Commits

Reviewing files that changed from the base of the PR and between 7271e1d and bd42f65.

📒 Files selected for processing (3)
  • src/components/dialogs/import-modification-dialog.tsx
  • src/components/graph/menus/network-modifications/network-modification-menu.type.ts
  • src/services/study/index.ts

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