Skip to content

Commit

Permalink
chore: add IsAlphanumericExpectUnderscore to k8s modules and caprover, (
Browse files Browse the repository at this point in the history
  • Loading branch information
0oM4R authored Oct 28, 2024
1 parent c0d9939 commit a78daae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/grid_client/src/modules/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class MachinesModel {
}

class AddMachineModel extends MachineModel {
@Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) deployment_name: string;
@Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) deployment_name: string;
@Expose() @IsString() @IsOptional() myceliumNetworkSeed?: string;
}

Expand All @@ -167,7 +167,7 @@ class MachinesGetModel extends BaseGetDeleteModel {}
class MachinesDeleteModel extends BaseGetDeleteModel {}

class KubernetesNodeModel {
@Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string;
@Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) name: string;
@Expose() @IsInt() @Min(1) node_id: number;
@Expose() @IsInt() @Min(1) cpu: number;
@Expose() @Min(1024) memory: number; // in MB
Expand All @@ -187,7 +187,7 @@ class KubernetesNodeModel {
}

class K8SModel {
@Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string;
@Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) name: string;
@Expose() @IsString() @IsNotEmpty() secret: string;
@Expose() @Type(() => NetworkModel) @ValidateNested() network: NetworkModel;
@Expose() @Type(() => KubernetesNodeModel) @ValidateNested({ each: true }) masters: KubernetesNodeModel[];
Expand All @@ -202,13 +202,13 @@ class K8SGetModel extends BaseGetDeleteModel {}
class K8SDeleteModel extends BaseGetDeleteModel {}

class AddWorkerModel extends KubernetesNodeModel {
@Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) deployment_name: string;
@Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) deployment_name: string;
@Expose() @IsString() @IsOptional() myceliumNetworkSeed?: string;
}

class DeleteWorkerModel {
@Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) deployment_name: string;
@Expose() @IsString() @IsNotEmpty() @IsAlphanumeric() @MaxLength(NameLength) name: string;
@Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) deployment_name: string;
@Expose() @IsString() @IsNotEmpty() @IsAlphanumericExpectUnderscore() @MaxLength(NameLength) name: string;
}

class ZDBModel {
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/components/k8s_worker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
validators.required('Name is required.'),
validators.isLowercase('Name should consist of lowercase letters only.'),
(name: string) => validators.isAlpha('Name must start with an alphabetical character.')(name[0]),
validators.isAlphanumeric('Name should consist of alphabets & numbers only.'),
validators.IsAlphanumericExpectUnderscore('Name should consist of letters ,numbers and underscores only.'),
validators.minLength('Name minimum length is 2 chars.', 2),
validators.maxLength('Name max length is 50 chars.', 50),
]"
Expand Down

0 comments on commit a78daae

Please sign in to comment.