Skip to content

chore(TwoWindingsTransformerModification): use form from commons-UI - #953

Open
dbraquart wants to merge 13 commits into
mainfrom
dbraquart/use-2wt-modification-form-from-commons-UI
Open

chore(TwoWindingsTransformerModification): use form from commons-UI#953
dbraquart wants to merge 13 commits into
mainfrom
dbraquart/use-2wt-modification-form-from-commons-UI

Conversation

@dbraquart

Copy link
Copy Markdown
Contributor

PR Summary

TwoWindingsTransformerModification form is now supported in composite modifications dialog. Requires gridsuite/commons-ui#1291.

dbraquart and others added 5 commits August 3, 2026 13:22
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
…ation-form-from-commons-UI

# Conflicts:
#	src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aecc88af-eea4-437a-9929-0230b7398714

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 101ad3b8-f4e3-4aeb-a562-c93029c65497

📥 Commits

Reviewing files that changed from the base of the PR and between dcd4f26 and 5de63b7.

📒 Files selected for processing (1)
  • src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx

📝 Walkthrough

Walkthrough

Changes

The modification dialogs now accept configurable widths. The composite dialog registers two-windings transformer creation and modification with the required forms, converters, identifiers, mode settings, optional-field behavior, and xl widths.

Transformer dialog integration

Layer / File(s) Summary
Dialog width support
src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx, src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
ModificationDialog accepts an optional Breakpoint width and forwards it to CustomMuiDialog. The composite dialog exposes the same configuration.
Transformer modification registration
src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
The composite dialog registers two-windings transformer creation and modification with form schemas, DTO converters, identifiers, mode settings, optional-field behavior, and xl widths. The line conversion parameter name is clarified.

Suggested reviewers: kolomenek

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly identifies the main change: using the commons-ui form for TwoWindingsTransformerModification.
Description check ✅ Passed The description directly explains the form update and composite modifications dialog support.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch dbraquart/use-2wt-modification-form-from-commons-UI

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx`:
- Around line 100-103: Update the `@gridsuite/commons-ui` dependency to a release
that exports TwoWindingsTransformerForm,
twoWindingsTransformerCreationFormSchema,
twoWindingsTransformerCreationDtoToForm, and
twoWindingsTransformerCreationFormToDto and declares dialogWidth in
CustomMuiDialogProps. Apply this dependency update for the transformer imports
in composite-modification-dialog.tsx and the dialogWidth usage in
ModificationDialog.tsx.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 79b05318-86b1-4c2c-bcec-d11b0c47386a

📥 Commits

Reviewing files that changed from the base of the PR and between f0a2d28 and dcd4f26.

📒 Files selected for processing (2)
  • src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
  • src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx

Comment on lines +100 to +103
TwoWindingsTransformerForm,
twoWindingsTransformerCreationFormSchema,
twoWindingsTransformerCreationDtoToForm,
twoWindingsTransformerCreationFormToDto,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- package manifests and lockfiles ---'
git ls-files | grep -E '(^|/)(package\.json|yarn\.lock|package-lock\.json|pnpm-lock\.yaml|\.yarnrc|\.npmrc)$' || true

printf '%s\n' '--- target files ---'
for f in \
  src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx \
  src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx
do
  if [ -f "$f" ]; then
    printf '\n--- %s ---\n' "$f"
    sed -n '80,120p' "$f"
  fi
done

printf '%s\n' '--- commons-ui references and API names ---'
rg -n --hidden \
  -g '!node_modules' \
  -g '!dist' \
  -g '!build' \
  '(`@gridsuite/commons-ui`|TwoWindingsTransformerForm|twoWindingsTransformerCreationFormSchema|twoWindingsTransformerCreationDtoToForm|twoWindingsTransformerCreationFormToDto|dialogWidth|interface CustomMuiDialogProps|type CustomMuiDialogProps)' \
  . | head -300

Repository: gridsuite/gridexplore-app

Length of output: 15374


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- package declarations ---'
sed -n '1,55p' package.json
sed -n '1,35p' package-lock.json
sed -n '3318,3340p' package-lock.json

printf '%s\n' '--- local dialog type/import context ---'
sed -n '1,125p' src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx
sed -n '90,135p' src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx

printf '%s\n' '--- published commons-ui 0.267.0 metadata ---'
python3 - <<'PY'
import json, urllib.request
url = 'https://registry.npmjs.org/@gridsuite%2fcommons-ui/0.267.0'
with urllib.request.urlopen(url, timeout=20) as response:
    data = json.load(response)
print(json.dumps({
    'version': data.get('version'),
    'dist': data.get('dist'),
    'types': data.get('types'),
    'files': data.get('files'),
}, indent=2))
PY

printf '%s\n' '--- available published commons-ui versions near 0.267 ---'
python3 - <<'PY'
import json, urllib.request
with urllib.request.urlopen('https://registry.npmjs.org/@gridsuite%2fcommons-ui', timeout=20) as response:
    data = json.load(response)
versions = list(data.get('versions', {}))
for v in versions:
    if v.startswith('0.26'):
        print(v)
PY

Repository: gridsuite/gridexplore-app

Length of output: 12564


🏁 Script executed:

#!/bin/bash
set -eu
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

printf '%s\n' '--- npm metadata for `@gridsuite/commons-ui` 0.267.0 ---'
curl -fsSLk 'https://registry.npmjs.org/@gridsuite%2fcommons-ui/0.267.0' \
  | tee "$tmpdir/metadata.json" \
  | jq '{version, dist, types, main, module, files}'

tarball="$(jq -r '.dist.tarball' "$tmpdir/metadata.json")"
curl -fsSLk "$tarball" -o "$tmpdir/commons-ui.tgz"
mkdir "$tmpdir/pkg"
tar -xzf "$tmpdir/commons-ui.tgz" -C "$tmpdir/pkg"

printf '%s\n' '--- package files related to the disputed APIs ---'
find "$tmpdir/pkg" -type f \( -name '*.d.ts' -o -name '*.js' -o -name '*.json' \) -print0 \
  | xargs -0 grep -nE \
    'TwoWindingsTransformerForm|twoWindingsTransformerCreation(FormSchema|DtoToForm|FormToDto)|CustomMuiDialogProps|dialogWidth' \
  | head -200 || true

printf '%s\n' '--- package entrypoint exports ---'
entry="$(jq -r '.main // .module // .types // empty' "$tmpdir/pkg/package/package.json")"
printf 'entrypoint: %s\n' "$entry"
if [ -n "$entry" ] && [ -f "$tmpdir/pkg/package/$entry" ]; then
  grep -nE 'TwoWindingsTransformerForm|twoWindingsTransformerCreation(FormSchema|DtoToForm|FormToDto)|CustomMuiDialogProps' \
    "$tmpdir/pkg/package/$entry" || true
fi

printf '%s\n' '--- commons-ui PR `#1291` ---'
curl -fsSLk 'https://api.github.com/repos/gridsuite/commons-ui/pulls/1291' \
  | jq '{html_url, state, title, base: .base.ref, head: .head.ref, merge_commit_sha, merged_at}' || true

Repository: gridsuite/gridexplore-app

Length of output: 447


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
import io
import json
import ssl
import tarfile
import urllib.request

ctx = ssl._create_unverified_context()

def get(url):
    req = urllib.request.Request(url, headers={'User-Agent': 'review-contract-check'})
    with urllib.request.urlopen(req, context=ctx, timeout=30) as r:
        return r.read()

metadata = json.loads(get('https://registry.npmjs.org/@gridsuite%2fcommons-ui/0.267.0'))
print('--- npm metadata ---')
print(json.dumps({
    'version': metadata.get('version'),
    'dist': metadata.get('dist'),
    'types': metadata.get('types'),
    'main': metadata.get('main'),
    'module': metadata.get('module'),
}, indent=2))

tarball = get(metadata['dist']['tarball'])
with tarfile.open(fileobj=io.BytesIO(tarball), mode='r:gz') as archive:
    print('--- matching package contents ---')
    matches = []
    for member in archive.getmembers():
        if member.isfile() and member.name.endswith(('.d.ts', '.js', '.json')):
            content = archive.extractfile(member).read().decode('utf-8', errors='replace')
            if any(token in content for token in (
                'TwoWindingsTransformerForm',
                'twoWindingsTransformerCreationFormSchema',
                'twoWindingsTransformerCreationDtoToForm',
                'twoWindingsTransformerCreationFormToDto',
                'CustomMuiDialogProps',
                'dialogWidth',
            )):
                matches.append((member.name, content))
    for name, content in matches:
        print(f'--- {name} ---')
        for i, line in enumerate(content.splitlines(), 1):
            if any(token in line for token in (
                'TwoWindingsTransformerForm',
                'twoWindingsTransformerCreationFormSchema',
                'twoWindingsTransformerCreationDtoToForm',
                'twoWindingsTransformerCreationFormToDto',
                'CustomMuiDialogProps',
                'dialogWidth',
            )):
                print(f'{i}:{line}')

print('--- commons-ui PR `#1291` ---')
try:
    pr = json.loads(get('https://api.github.com/repos/gridsuite/commons-ui/pulls/1291'))
    print(json.dumps({
        'html_url': pr.get('html_url'),
        'state': pr.get('state'),
        'title': pr.get('title'),
        'base': (pr.get('base') or {}).get('ref'),
        'head': (pr.get('head') or {}).get('ref'),
        'merge_commit_sha': pr.get('merge_commit_sha'),
        'merged_at': pr.get('merged_at'),
    }, indent=2))
except Exception as e:
    print(f'GitHub query failed: {e}')
PY

Repository: gridsuite/gridexplore-app

Length of output: 1980


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
import io
import json
import ssl
import tarfile
import urllib.request

ctx = ssl._create_unverified_context()

def get(url):
    req = urllib.request.Request(url, headers={'User-Agent': 'review-contract-check'})
    with urllib.request.urlopen(req, context=ctx, timeout=30) as r:
        return r.read()

def package_files(version):
    metadata = json.loads(get(f'https://registry.npmjs.org/@gridsuite%2fcommons-ui/{version}'))
    archive = tarfile.open(fileobj=io.BytesIO(get(metadata['dist']['tarball'])), mode='r:gz')
    files = {}
    for member in archive.getmembers():
        if member.isfile() and member.name.endswith(('.d.ts', '.js')):
            files[member.name] = archive.extractfile(member).read().decode('utf-8', errors='replace')
    return metadata, files

metadata, files = package_files('0.267.0')
print('--- CustomMuiDialogProps declaration ---')
for name, content in files.items():
    if name.endswith('CustomMuiDialog.d.ts'):
        print(name)
        print('\n'.join(f'{i}:{line}' for i, line in enumerate(content.splitlines(), 1)))
        break

print('--- package entrypoint references ---')
for name, content in files.items():
    if name.endswith('/index.d.ts') and ('dist/index.d.ts' in name or name == 'package/dist/index.d.ts'):
        for i, line in enumerate(content.splitlines(), 1):
            if any(x in line for x in (
                'TwoWindingsTransformerForm',
                'twoWindingsTransformerCreation',
                'CustomMuiDialog',
            )):
                print(f'{name}:{i}:{line}')

print('--- versions containing all requested symbols ---')
registry = json.loads(get('https://registry.npmjs.org/@gridsuite%2fcommons-ui'))
versions = list(registry.get('versions', {}))
candidates = []
for version in versions:
    try:
        _, candidate_files = package_files(version)
    except Exception:
        continue
    text = '\n'.join(candidate_files.values())
    required = [
        'TwoWindingsTransformerForm',
        'twoWindingsTransformerCreationFormSchema',
        'twoWindingsTransformerCreationDtoToForm',
        'twoWindingsTransformerCreationFormToDto',
        'dialogWidth',
    ]
    if all(symbol in text for symbol in required):
        candidates.append(version)
print(candidates[-20:])
PY

Repository: gridsuite/gridexplore-app

Length of output: 155


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
import io
import json
import ssl
import tarfile
import urllib.request

ctx = ssl._create_unverified_context()

def get(url):
    req = urllib.request.Request(url, headers={'User-Agent': 'review-contract-check'})
    with urllib.request.urlopen(req, context=ctx, timeout=30) as r:
        return r.read()

metadata = json.loads(get('https://registry.npmjs.org/@gridsuite%2fcommons-ui/0.267.0'))
archive = tarfile.open(fileobj=io.BytesIO(get(metadata['dist']['tarball'])), mode='r:gz')

needles = (
    'TwoWindingsTransformerForm',
    'twoWindingsTransformerCreationFormSchema',
    'twoWindingsTransformerCreationDtoToForm',
    'twoWindingsTransformerCreationFormToDto',
    'CustomMuiDialogProps',
    'dialogWidth',
)
for member in archive.getmembers():
    if member.isfile() and member.name.endswith('.d.ts'):
        content = archive.extractfile(member).read().decode('utf-8', errors='replace')
        if member.name.endswith('CustomMuiDialog.d.ts') or member.name.endswith('dist/index.d.ts'):
            print(f'--- {member.name} ---')
            for i, line in enumerate(content.splitlines(), 1):
                if member.name.endswith('CustomMuiDialog.d.ts') or any(n in line for n in needles):
                    print(f'{i}:{line}')
PY

Repository: gridsuite/gridexplore-app

Length of output: 2471


🌐 Web query:

"gridsuite/commons-ui" "1291"

💡 Result:

The term "1291" in the context of the GitHub repository gridsuite/commons-ui refers to a specific Pull Request (PR) or issue identifier within that project [1]. As of August 12, 2026, the gridsuite/commons-ui repository is an active project that hosts common React components for GridSuite applications [1][2]. The repository utilizes a standard GitHub issue and PR tracking system, where numbers such as 1291 are assigned sequentially to track development tasks, bug fixes, or feature requests [1][2]. Other recent examples include PR #1241 regarding an MUI v7 upgrade and PR #1246 regarding ElementAttributes [3][4]. If you are looking for specific information regarding a change or discussion associated with #1291, you can access it directly by appending the number to the repository's pull request URL: gridsuite/commons-ui#1291.

Citations:


Update @gridsuite/commons-ui to a release that provides the required APIs.

Version 0.267.0 exports none of the four transformer symbols and does not declare dialogWidth in CustomMuiDialogProps. The TypeScript build fails at both usage sites.

🧰 Tools
🪛 GitHub Actions: CI / 0_build _ build.txt

[error] 100-100: TypeScript type-check failed: Module '@gridsuite/commons-ui' has no exported member 'TwoWindingsTransformerForm'.

🪛 GitHub Actions: CI / build _ build

[error] 100-5: TypeScript type-check failed: Module "@gridsuite/commons-ui" has no exported member "TwoWindingsTransformerForm".

🪛 GitHub Check: build / build

[failure] 103-103:
Module '"@gridsuite/commons-ui"' has no exported member 'twoWindingsTransformerCreationFormToDto'.


[failure] 102-102:
Module '"@gridsuite/commons-ui"' has no exported member 'twoWindingsTransformerCreationDtoToForm'.


[failure] 101-101:
Module '"@gridsuite/commons-ui"' has no exported member 'twoWindingsTransformerCreationFormSchema'.


[failure] 100-100:
Module '"@gridsuite/commons-ui"' has no exported member 'TwoWindingsTransformerForm'.

📍 Affects 2 files
  • src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx#L100-L103 (this comment)
  • src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx#L107-L107
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx`
around lines 100 - 103, Update the `@gridsuite/commons-ui` dependency to a release
that exports TwoWindingsTransformerForm,
twoWindingsTransformerCreationFormSchema,
twoWindingsTransformerCreationDtoToForm, and
twoWindingsTransformerCreationFormToDto and declares dialogWidth in
CustomMuiDialogProps. Apply this dependency update for the transformer imports
in composite-modification-dialog.tsx and the dialogWidth usage in
ModificationDialog.tsx.

Source: Linters/SAST tools

Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
@dbraquart
dbraquart changed the base branch from main to dbraquart/use-2wt-creation-form-from-commons-UI August 13, 2026 18:18
dbraquart and others added 6 commits August 13, 2026 20:44
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
…ation-form-from-commons-UI

# Conflicts:
#	src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
#	src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx
…braquart/use-2wt-modification-form-from-commons-UI

# Conflicts:
#	src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
…braquart/use-2wt-modification-form-from-commons-UI
Base automatically changed from dbraquart/use-2wt-creation-form-from-commons-UI to main August 20, 2026 08:35
…ification-form-from-commons-UI

# Conflicts:
#	src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
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