fix(projects): client-side inline validation on project forms [MAPPS-176] #154

Merged
vas2000-work merged 2 commits from fix/MAPPS-176-project-form-validation into main 2026-06-15 18:55:34 +02:00
Owner

What

Client-side counterpart to PMS-324: the project create and edit forms in mokosh-apps did almost no inline validation, so over-long names and bad budgets were sent to the server and the resulting errors surfaced as a generic "request failed" (MAPPS-176).

Changes

  • Shared helpers validate_project_name (required, trimmed, <= 80 chars) and validate_budget (optional; non-negative number with at most 2 decimal places), mirroring the server rules from PMS-324.
  • Wired both the create form (ProjectNewPage) and the edit modal (on_save) to validate per field before submit, blocking submission and showing the message inline on the offending field via the existing Input { error } prop. Added per-field error signals for name / budget amount / budget hours in both forms.
  • The edit form now sends validated budget numbers (or explicit null) instead of silently coercing unparseable input to null.
  • Unit tests for both helpers.

Verification

  • cargo test --lib validation_tests (container): green.
  • cargo clippy --all-targets -- -D warnings, cargo fmt --all --check, cargo check --target wasm32-unknown-unknown: green.

Server-side validation (the actual 422/500 fixes) is in PMS-324 (linked).

#MAPPS-176

## What Client-side counterpart to PMS-324: the project create and edit forms in mokosh-apps did almost no inline validation, so over-long names and bad budgets were sent to the server and the resulting errors surfaced as a generic "request failed" (MAPPS-176). ## Changes - Shared helpers `validate_project_name` (required, trimmed, <= 80 chars) and `validate_budget` (optional; non-negative number with at most 2 decimal places), mirroring the server rules from PMS-324. - Wired both the create form (`ProjectNewPage`) and the edit modal (`on_save`) to validate per field before submit, blocking submission and showing the message inline on the offending field via the existing `Input { error }` prop. Added per-field error signals for name / budget amount / budget hours in both forms. - The edit form now sends validated budget numbers (or explicit null) instead of silently coercing unparseable input to null. - Unit tests for both helpers. ## Verification - `cargo test --lib validation_tests` (container): green. - `cargo clippy --all-targets -- -D warnings`, `cargo fmt --all --check`, `cargo check --target wasm32-unknown-unknown`: green. Server-side validation (the actual 422/500 fixes) is in PMS-324 (linked). #MAPPS-176
fix(projects): inline validation on project create and edit forms
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 56s
f2bfc41023
The project create and edit forms did almost no client-side validation, so over-long names and bad budgets were posted to the server and the resulting errors surfaced as a generic "request failed". This mirrors the server rules added in PMS-324 on the client for immediate, per-field feedback.

Add shared helpers validate_project_name (required, trimmed, at most 80 chars) and validate_budget (optional; non-negative number with at most 2 decimal places), and wire both the create page and the edit modal to validate per field before submit, showing the message inline on the offending field via the existing Input error prop. The edit form now sends validated budget numbers (or explicit null) instead of silently coercing unparseable input to null. Adds unit tests for both helpers.

#MAPPS-176

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merge branch 'main' into fix/MAPPS-176-project-form-validation
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 1m11s
302dfec62b
vas2000-work deleted branch fix/MAPPS-176-project-form-validation 2026-06-15 18:55:34 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!154
No description provided.