SimplyStaking/panic

Repository form validation for name field

itsciccio opened this issue · 0 comments

Technical Story

As the Repositories form, I want the name field to satisfy a specific format, so that it can be parsed as a namespace and name accordingly if needed.

Description

The legacy installer allows for repository name input validation, something not yet implemented in the new UI installer.

As-is there is no constraint on the name input within the Repositories modal.

A future UIKit upgrade will be adding the pattern and title attributes to svc-input, allowing us to add regex validation and display error messages accordingly.

We need to satisfy the following constraints:

For Dockerhub:

  • Must be either in the format namespace/name or name (1 / between 2 strings)
  • In the case that name is inputted (without the /), namespace defaults to library, so library/name
  • Use regex format: ^[a-z+-0-9]+\/[a-z+-0-9]+$|^[a-z+-0-9]+$ for the above constraints

For GitHub:

  • Since we do not include a namespace, any string is enough. No validation is needed

Requirements

  • Upgrade to have latest UIKit version to use pattern and title within svc-input.
  • Dockerhub validation with the provided regex.
  • Manually test that validation works as expected, as well as data is submitted to Mongo correctly.

Blocked by

#336

Acceptance criteria

Scenario: User inputs testnamespace/test to the Dockerhub form
When: The add/edit Repo form modal is present
Then: The form is allowed to be submitted.

Scenario: User inputs test to the Dockerhub form
When: The add/edit Repo form modal is present
Then: The form is allowed to be submitted, with namespace set to library and name set to test.

Scenario: User inputs testnamespace/ to the Dockerhub form
When: The add/edit Repo form modal is present
Then: The form is not allowed to be submitted, with an error message.

Scenario: User inputs testnamespace/test/test1 to the Dockerhub form
When: The add/edit Repo form modal is present
Then: The form is not allowed to be submitted, with an error message.