Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a custom validation for flexible VM naming #3057

Merged
merged 12 commits into from
Jul 8, 2024

Conversation

maayarosama
Copy link
Contributor

@maayarosama maayarosama commented Jun 30, 2024

Description

Added a custom validation decorator accepting alphanumeric values and underscores

Related Issues

Documentation PR

For UI changes, Please provide the Documetation PR on info_grid

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

@maayarosama maayarosama changed the title using any type instead of object Adding a custom validation for flexible VM naming Jul 1, 2024
@@ -31,4 +31,25 @@ function validateHexSeed(seed: string, length: number): boolean {
return true;
}

export { validateObject, validateInput, validateHexSeed };
function IsAlphanumericExceptUnderscore(validationOptions?: ValidationOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is underscore allowed or not? :D

@maayarosama maayarosama requested a review from 0oM4R July 2, 2024 07:12
Mahmoud-Emad
Mahmoud-Emad previously approved these changes Jul 2, 2024
Copy link
Contributor

@amiraabouhadid amiraabouhadid left a comment

Choose a reason for hiding this comment

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

it isnt accepting underscore
image

0oM4R
0oM4R previously requested changes Jul 2, 2024
Copy link
Contributor

@0oM4R 0oM4R left a comment

Choose a reason for hiding this comment

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

DeleteMachineModel need to be updated as well

Copy link
Contributor

@0oM4R 0oM4R left a comment

Choose a reason for hiding this comment

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

also BaseGetDeleteModel need to be updated
image

@maayarosama maayarosama marked this pull request as draft July 2, 2024 09:17
@maayarosama maayarosama marked this pull request as ready for review July 2, 2024 10:05
@maayarosama maayarosama dismissed Mahmoud-Emad’s stale review July 2, 2024 10:07

Applied new feature

Base automatically changed from development_2.6 to development July 2, 2024 12:42
@0oM4R
Copy link
Contributor

0oM4R commented Jul 2, 2024

should we sync the name validation on dashboard with the client, in client it accept upper case char,
but on dashboard:
Screenshot from 2024-07-02 16-19-08

Screenshot from 2024-07-02 16-32-32

@@ -4,10 +4,10 @@
:rules="[
validators.required('Name is required.'),
validators.isLowercase('Name should consist of lowercase letters only.'),
validators.isAlphanumeric('Name should consist of letters and numbers only.'),
validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and undersocres only.'),
Copy link
Contributor

Choose a reason for hiding this comment

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

please change typo to "underscores".

@@ -18,9 +18,9 @@
:value="threebotName"
:rules="[
validators.required('Name is required.'),
validators.isAlphanumeric('Name should consist of letters and numbers only.'),
validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and undersocres only.'),
Copy link
Contributor

@amiraabouhadid amiraabouhadid Jul 3, 2024

Choose a reason for hiding this comment

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

here too, there are 20 instances of the typo so please fix them all

@Mahmoud-Emad
Copy link
Contributor

Please fix the conflicts

Copy link
Contributor

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

I think the maxLength should be changed here:

@Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength + 20) name: string;

@Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength + 20) name: string;

@@ -29,11 +29,10 @@
:value="name"
:rules="[
validators.required('Name is required.'),
validators.isLowercase('Name should consist of lowercase letters only.'),
validators.isAlphanumeric('Name should consist of letters and numbers only.'),
Copy link
Contributor

Choose a reason for hiding this comment

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

should be IsAlphanumericExpectUnderscore.

@@ -17,11 +17,10 @@
:value="name"
:rules="[
validators.required('Name is required.'),
validators.isLowercase('Name should consist of lowercase letters only.'),
validators.isAlphanumeric('Name should consist of letters and numbers only.'),
Copy link
Contributor

Choose a reason for hiding this comment

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

here too.

@maayarosama maayarosama requested a review from zaelgohary July 7, 2024 11:35
@maayarosama maayarosama dismissed 0oM4R’s stale review July 8, 2024 08:25

not relevant

@maayarosama maayarosama merged commit d863879 into development Jul 8, 2024
4 checks passed
@maayarosama maayarosama deleted the development_2.6_flexible_vm_name branch July 8, 2024 08:25
@xmonader xmonader added this to the 2.6.0 milestone Sep 24, 2024
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.

6 participants