Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h3 class="modal-title">{{title}}</h3>
<form #ngForm="ngForm">
<section class="form-block">
<div class="form-group" style="padding-left: 135px;">
<label for="app_id" class="col-md-3 form-group-label-override required">应用</label>
<label for="app_id" class="col-md-3 form-group-label-override required">项目</label>
<div class="select form-control">
<select id="app_id" [(ngModel)]="configMap.appId" [disabled]="actionType==1" name="app_id">
<!--这是一个坑,如果使用value获取到的是string,使用ngValue获取到的是model本身类型-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h3 class="modal-title">{{title}}</h3>
<form #ngForm="ngForm">
<section class="form-block">
<div class="form-group" style="padding-left: 135px;">
<label for="app_id" class="col-md-3 form-group-label-override required">应用</label>
<label for="app_id" class="col-md-3 form-group-label-override required">项目</label>
<div class="select form-control">
<select id="app_id" [(ngModel)]="cronjob.appId" [disabled]="actionType==1" name="app_id">
<!--这是一个坑,如果使用value获取到的是string,使用ngValue获取到的是model本身类型-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h3 class="modal-title">{{title}}</h3>

<section class="form-block">
<div class="form-group" style="padding-left: 135px;">
<label for="app_id" class="col-md-3 form-group-label-override required">应用</label>
<label for="app_id" class="col-md-3 form-group-label-override required">项目</label>
<div class="select form-control">
<select id="app_id" [(ngModel)]="daemonset.appId" [disabled]="actionType==1" name="app_id">
<option *ngFor="let app of apps" [ngValue]="app.id" [selected]="app.id == daemonset.appId">{{app.name}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h3 class="modal-title">{{deploymentTitle}}</h3>

<section class="form-block">
<div class="form-group" style="padding-left: 135px;">
<label for="deployment_app_id" class="col-md-3 form-group-label-override required">应用</label>
<label for="deployment_app_id" class="col-md-3 form-group-label-override required">项目</label>
<div class="select form-control">
<select id="deployment_app_id" [(ngModel)]="deployment.appId" [disabled]="actionType==1" name="deployment_app_id">
<!--这是一个坑,如果使用value获取到的是string,使用ngValue获取到的是model本身类型-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h3 class="modal-title">{{title}}</h3>
<form #ngForm="ngForm">
<section class="form-block">
<div class="form-group" style="padding-left: 135px;">
<label for="app_id" class="col-md-3 form-group-label-override required">应用</label>
<label for="app_id" class="col-md-3 form-group-label-override required">项目</label>
<div class="select form-control">
<select id="app_id" [(ngModel)]="pvc.appId" [disabled]="actionType==1" name="app_id">
<!--这是一个坑,如果使用value获取到的是string,使用ngValue获取到的是model本身类型-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h3 class="modal-title">{{secretTitle}}</h3>
<form #secretForm="ngForm">
<section class="form-block">
<div class="form-group" style="padding-left: 135px;">
<label for="app_id" class="col-md-3 form-group-label-override required">应用</label>
<label for="app_id" class="col-md-3 form-group-label-override required">项目</label>
<div class="select form-control">
<select id="app_id" [(ngModel)]="secret.appId" [disabled]="actionType==1" name="app_id">
<option *ngFor="let app of apps" [ngValue]="app.id" [selected]="app.id == secret.appId">{{app.name}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h3 class="modal-title">{{title}}</h3>

<section class="form-block">
<div class="form-group" style="padding-left: 135px;">
<label for="app_id" class="col-md-3 form-group-label-override required">应用</label>
<label for="app_id" class="col-md-3 form-group-label-override required">项目</label>
<div class="select form-control">
<select id="app_id" [(ngModel)]="statefulset.appId" [disabled]="actionType==1" name="app_id">
<!--这是一个坑,如果使用value获取到的是string,使用ngValue获取到的是model本身类型-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h3 class="modal-title">{{userTitle}}</h3>
required
pattern="[a-z]([-a-z0-9]*[a-z0-9])?"
maxlength="24"
(keyup)='handleValidation()'>
(keyup)='handleNameValidation()'>
<span class="tooltip-content">
用户名称不符合规范,验证规则[a-z]([-a-z0-9]*[a-z0-9])?
</span>
Expand All @@ -20,11 +20,12 @@ <h3 class="modal-title">{{userTitle}}</h3>
</div>
<div class="form-group" style="padding-left: 135px;">
<label for="user_email" class="col-md-3 form-group-label-override required">邮箱</label>
<label for="user_email" aria-haspopup="true" role="tooltip" [class.invalid]="!isNameValid" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
<label for="user_email" aria-haspopup="true" role="tooltip" [class.invalid]="!isEmailValid" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
<input type="text" id="user_email" [(ngModel)]="user.email"
name="user_email" size="36"
required
maxlength="128"
pattern="^([A-Za-z0-9_\-\.\u4e00-\u9fa5])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,15})$"
maxlength="128" (keyup)='handleEmailValidation()'
>
<span class="tooltip-content">
用户邮箱不符合规范
Expand All @@ -34,11 +35,11 @@ <h3 class="modal-title">{{userTitle}}</h3>
</div>
<div class="form-group" style="padding-left: 135px;">
<label for="user_display" class="col-md-3 form-group-label-override required">展示</label>
<label for="user_display" aria-haspopup="true" role="tooltip" [class.invalid]="!isNameValid" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
<label for="user_display" aria-haspopup="true" role="tooltip" [class.invalid]="!isDisplayValid" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
<input type="text" id="user_display" [(ngModel)]="user.display"
name="user_display" size="36"
required
maxlength="128"
maxlength="128" (keyup)='isDisplayValid = user.display.trim().length>0'
>
<span class="tooltip-content">
用户展示不符合规范
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class CreateEditUserComponent {
checkOnGoing: boolean = false;
isSubmitOnGoing: boolean = false;
isNameValid: boolean = true;
isDisplayValid: boolean = true;
isEmailValid: boolean = true;

userTitle: string;
actionType: ActionType;
Expand Down Expand Up @@ -109,15 +111,21 @@ export class CreateEditUserComponent {
this.currentForm.valid &&
!this.isSubmitOnGoing &&
this.isNameValid &&
!this.checkOnGoing;
!this.checkOnGoing && this.isEmailValid && this.isDisplayValid;
}

// Handle the form validation
handleValidation(): void {
handleNameValidation(): void {
let cont = this.currentForm.controls['user_name'];
if (cont) {
this.isNameValid = cont.valid
}
}
handleEmailValidation(): void {
let cont = this.currentForm.controls['user_email'];
if (cont) {
this.isEmailValid = cont.valid
}
}
}