Skip to content

[Closed] Auto-remove leading/trailing spaces from user-entered payloads#2532

Closed
zackcl wants to merge 3 commits intodevfrom
feature/2531-trim-payloads
Closed

[Closed] Auto-remove leading/trailing spaces from user-entered payloads#2532
zackcl wants to merge 3 commits intodevfrom
feature/2531-trim-payloads

Conversation

@zackcl
Copy link
Copy Markdown
Collaborator

@zackcl zackcl commented Jun 10, 2025

Resolves #2531

Description:

This PR fixes issue #2531 where payloads with leading/trailing whitespace characters were causing users to not get assigned the appropriate experiment variants.

Changes Made:

  • Created TrimInputDirective: A reusable Angular directive that automatically trims leading/trailing whitespace from form control values when users finish editing (on blur)
  • Applied directive to payload inputs: Added appTrimInput directive to payload input fields in:
    • Simple Experiment payloads (payloads-table.component.html)
    • Factorial Experiment condition payloads (conditions-table.component.html)
    • Factorial Experiment level payloads (factorial-experiment-design.component.html)
  • Added to SharedModule: Made the directive available across the entire application for consistent payload sanitization

Testing:

  • Enter payloads with leading/trailing spaces
  • Confirm the spaces are automatically removed when editing is completed
  • Verify trimmed payloads are properly stored and sent to the backend
  • Verify the payloads stored in the condition_payload table are properly trimmed

@zackcl zackcl requested review from bcb37, Copilot and danoswaltCL June 10, 2025 17:33
@zackcl zackcl self-assigned this Jun 10, 2025

This comment was marked as outdated.

@zackcl zackcl requested a review from amurphy-cl June 10, 2025 17:37
@zackcl zackcl changed the title Auto-remove leading/trailing spaces from user-entered payloads [WIP] Auto-remove leading/trailing spaces from user-entered payloads Jun 10, 2025
@zackcl zackcl marked this pull request as draft June 10, 2025 18:15
@zackcl
Copy link
Copy Markdown
Collaborator Author

zackcl commented Jun 10, 2025

Just realized I need to apply the same for the factorial payloads.

@zackcl zackcl removed the request for review from amurphy-cl June 11, 2025 11:29
@zackcl zackcl changed the title [WIP] Auto-remove leading/trailing spaces from user-entered payloads Auto-remove leading/trailing spaces from user-entered payloads Jun 11, 2025
@zackcl zackcl marked this pull request as ready for review June 11, 2025 13:19
@zackcl zackcl requested a review from Copilot June 11, 2025 13:19
Copy link
Copy Markdown
Contributor

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 introduces a new Angular directive, TrimInputDirective, to automatically remove leading and trailing whitespace from user-entered payloads and applies it to relevant input fields.

  • Introduced TrimInputDirective to trim inputs on blur
  • Updated SharedModule to include the new directive
  • Applied the directive to payload inputs in multiple components

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/projects/upgrade/src/app/shared/shared.module.ts Added import and declaration for TrimInputDirective in module arrays
frontend/projects/upgrade/src/app/shared/directives/trim-input.directive.ts Implemented a new directive that trims whitespace on blur
frontend/projects/upgrade/src/app/features/dashboard/home/components/factorial-experiment-design/factorial-experiment-design.component.html Applied appTrimInput to payload input
frontend/projects/upgrade/src/app/features/dashboard/home/components/factorial-experiment-design/conditions-table/conditions-table.component.html Applied appTrimInput to condition payload input
frontend/projects/upgrade/src/app/features/dashboard/home/components/experiment-design/payloads-table/payloads-table.component.ts Removed unused Output and EventEmitter imports
frontend/projects/upgrade/src/app/features/dashboard/home/components/experiment-design/payloads-table/payloads-table.component.html Applied appTrimInput to payload input

@zackcl zackcl changed the base branch from dev to release/6.1 June 11, 2025 14:06
@zackcl zackcl changed the base branch from release/6.1 to dev June 11, 2025 14:07
@zackcl zackcl marked this pull request as draft June 11, 2025 14:28
@zackcl
Copy link
Copy Markdown
Collaborator Author

zackcl commented Jun 11, 2025

Closing due to opening another hotfix PR: #2534

@zackcl zackcl closed this Jun 11, 2025
@zackcl zackcl changed the title Auto-remove leading/trailing spaces from user-entered payloads [Closed] Auto-remove leading/trailing spaces from user-entered payloads Jun 11, 2025
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.

Auto-remove leading/trailing spaces from payloads

2 participants