Skip to content

Conversation

lucasgoral
Copy link
Contributor

@lucasgoral lucasgoral commented Jul 16, 2025

What this PR does / why we need it:
Added logic to handle input of charging target and charging target type properly. And added validation.

Fixes openmcp-project/backlog#163

@lucasgoral lucasgoral changed the title Feat/add charging target inputs improvements Feat: charging target inputs improvements and validation Jul 16, 2025
@lucasgoral lucasgoral marked this pull request as ready for review July 17, 2025 07:51
@andreaskienle andreaskienle requested a review from Copilot July 17, 2025 10:22
Copy link
Contributor

@Copilot Copilot AI left a comment

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 enhances how the chargingTarget and chargingTargetType inputs are handled and validated across the project.

  • Adds schema-level validation (format and presence) for chargingTarget when a type is selected
  • Updates form components to disable/mark fields based on selected type and surfaces validation messages
  • Passes getValues through dialog/container components to drive dynamic form behavior

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/lib/api/validations/schemas.ts Imported btpChargingTargetRegex and added superRefine checks
src/components/Wizards/CreateManagedControlPlaneWizardContainer.tsx Flattened props/callbacks, no functional change
src/components/Dialogs/MetadataForm.tsx Added getValues, dynamic disabling/valueState on charging inputs
src/components/Dialogs/CreateWorkspaceDialogContainer.tsx Passed getValues to CreateProjectWorkspaceDialog
src/components/Dialogs/CreateProjectWorkspaceDialog.tsx Added getValues prop and inline formatting updates
src/components/Dialogs/CreateProjectDialogContainer.tsx Passed getValues to workspace dialog
src/components/Dialogs/CreateProjectDialog.cy.tsx Updated default values and flattened test selectors
public/locales/en.json Added new validation message key notValidChargingTargetFormat
Comments suppressed due to low confidence (1)

src/components/Dialogs/CreateProjectDialog.cy.tsx:33

  • New validation for chargingTarget format and required presence when a type is selected isn’t covered by existing tests. Add scenarios that try invalid formats and missing targets for btp type to ensure the error messages surface correctly.
      chargingTargetType: 'btp',

@andreaskienle andreaskienle self-assigned this Jul 17, 2025
Copy link
Contributor

@andreaskienle andreaskienle left a comment

Choose a reason for hiding this comment

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

👍

@andreaskienle andreaskienle merged commit 929dc93 into main Jul 22, 2025
5 checks passed
@andreaskienle andreaskienle deleted the feat/add-charging-target-inputs-improvements branch July 22, 2025 06:18
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.

Task: Fix charging-target-type not optional

2 participants