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

add IsAlphanumericExpectUnderscore to k8s modules and caprover, #3552

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading