Skip to content

add erreur message in modal CI" - #1131

Merged
PascalSeniziRTE merged 2 commits into
devfrom
feat/800/ci-error-messages-not-exist
Aug 31, 2026
Merged

add erreur message in modal CI"#1131
PascalSeniziRTE merged 2 commits into
devfrom
feat/800/ci-error-messages-not-exist

Conversation

@Fred-RTE

Copy link
Copy Markdown
Contributor

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)

800

add message error on input in modal Initial Condition

Signed-off-by: Frédéric Madranges <frederic.madranges_externe@rte-france.com>
@Fred-RTE Fred-RTE self-assigned this Aug 28, 2026
Copilot AI lite review requested due to automatic review settings August 28, 2026 13:12
@Fred-RTE Fred-RTE added the bug Something isn't working label Aug 28, 2026

Copilot AI left a comment

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.

Pull request overview

This PR improves validation feedback in the Initial Condition modal by adding inline error messages (PrimeNG p-message) and wiring inputs to accessibility attributes (aria-invalid, aria-errormessage), with shared constraints/validators and i18n strings.

Changes:

  • Added shared helpers for integer validation and building aria-errormessage id lists.
  • Centralized min/max constraints and updated the modal form validators to reuse them.
  • Updated the modal template to display min/max/integer error messages and added new i18n key(s) for the integer requirement.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/app/shared/components/initial-condition-modal/initialConditionModal.helpers.ts Adds reusable validators/helpers (integerValidator, getErrorIds) to support error rendering + aria-errormessage.
src/app/shared/components/initial-condition-modal/initialConditionModal.helpers.spec.ts Adds unit tests for the new helper functions.
src/app/shared/components/initial-condition-modal/initialConditionModal.constantes.ts Introduces centralized min/max constraints for initial condition fields.
src/app/shared/components/initial-condition-modal/initialConditionModal.component.ts Reworks validators to use shared constraints and adds methods to expose aria-errormessage ids.
src/app/shared/components/initial-condition-modal/initialConditionModal.component.html Displays inline min/max/integer errors and connects inputs to aria-invalid/aria-errormessage.
public/i18n/en.json Adds English translation for the “whole number required” error.
public/i18n/fr.json Adds French translation for the “whole number required” error.
Suppressed comments (2)

src/app/shared/components/initial-condition-modal/initialConditionModal.component.ts:28

  • The validators constant is declared in the component file. In this repo, component files should only contain the Angular metadata + class; constants/helpers should be externalized into *.constantes.ts / *.helpers.ts for testability and to keep components slim.
/** Form validation rules for initial condition fields. */
const validators = {
  name: ['', [Validators.required, Validators.maxLength(40)]],
  base_parameters: [
    null,

src/app/shared/components/initial-condition-modal/initialConditionModal.helpers.spec.ts:49

  • This test says it covers “multiple errors” but the setup only triggers the integer error, so it never validates the space-joined id behavior. Either adjust the description or make the setup produce 2 active errors.
  it('should return several ids joined with a space when multiple errors are active', () => {
    const form = fb.group({ base_temperature: [15.5, [Validators.min(-50), integerValidator]] });
    expect(getErrorIds(form, 'base_temperature', ['min', 'integer'])).toBe('base_temperature-error-integer');
  });

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Signed-off-by: Frédéric Madranges <frederic.madranges_externe@rte-france.com>
@sonarqubecloud

Copy link
Copy Markdown

@PascalSeniziRTE
PascalSeniziRTE merged commit ff90d86 into dev Aug 31, 2026
6 checks passed
@PascalSeniziRTE
PascalSeniziRTE deleted the feat/800/ci-error-messages-not-exist branch August 31, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants