diff options
author | liuwh7 <liuwh7@asiainfo.com> | 2021-10-22 15:21:16 +0800 |
---|---|---|
committer | liuwh7 <liuwh7@asiainfo.com> | 2021-10-22 15:22:55 +0800 |
commit | f1168a9fad8244d9a4ae5f21efb48bb9c14a2a4c (patch) | |
tree | c5fe713ec2f126645b78fece08c6585dff4a3cbb /usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal | |
parent | 4190f0efa75b358c3e1edda1381c7a7712b72e3e (diff) |
feat: modify intent based service
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Change-Id: I8efc89b26a1d51eddfdfdab53c3ad6e2136e1440
Issue-ID: USECASEUI-605
Diffstat (limited to 'usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal')
2 files changed, 25 insertions, 6 deletions
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html index 64924b9f..2fe58cfc 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html @@ -29,9 +29,7 @@ [name]="item.key" *ngIf="item.type === 'input'" [(ngModel)]="cloud_leased_line_info[item.key]" - [ngClass]="{'error-input-border' : validateRulesShow[i] === true}" [placeholder]="item.placeholder ? item.placeholder : ''" - (blur)="item.required ? this.Util.validator(item.title,item.key,cloud_leased_line_info[item.key],i,rulesText,validateRulesShow) : this.Util.validator()" /> </nz-tooltip> <nz-select @@ -55,9 +53,7 @@ [id]="item.key" [name]="item.key" [(ngModel)]="cloud_leased_line_info[item.key].bandwidth" - [ngClass]="{'error-input-border' : validateRulesShow[i] === true}" [placeholder]="item.placeholder ? item.placeholder : ''" - (blur)="item.required ? this.Util.validator(item.title,item.key,cloud_leased_line_info[item.key],i,rulesText,validateRulesShow) : this.Util.validator()" /> </div> <div> diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts index 90bcf9b0..a8c617ae 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts @@ -21,7 +21,6 @@ export class CloudLeasedLineModalComponent implements OnInit { @Input() cloudLeasedLineShowFlag: boolean; @Output() cancelEmitter = new EventEmitter<boolean>(); comunicationFormItems = COMMUNICATION_FORM_ITEMS; - validateRulesShow: any[] = []; isLoadingOne = false; nodeLists: any[] = []; cloudPointOptions: any[] = []; @@ -81,11 +80,31 @@ export class CloudLeasedLineModalComponent implements OnInit { } submit(): void { + const paramOnj = { ...this.cloud_leased_line_info }; + for (const iterator in paramOnj) { + if (this.isString(paramOnj[iterator]) && !paramOnj[iterator]) { + this.nzMessage.error(`Please enter ${iterator}`); + return; + } + if (!this.isString(paramOnj[iterator])) { + const { name, bandwidth} = paramOnj[iterator]; + if (!name) { + this.nzMessage.error(`Please enter accessPointOne Name`); + return; + } + + if (bandwidth !== 0 && !/^\+?[1-9][0-9]*$/.test(bandwidth)) { + this.nzMessage.error(`Please enter a positive integer accessPointOne bandwidth`); + return; + } + } + } + this.myHttp.createIntentInstance({ ...this.cloud_leased_line_info }).subscribe( (data) => { - console.log(data); + this.nzMessage.success('Create IntentInstance Success!'); this.cancel(); }, (err) => { @@ -107,4 +126,8 @@ export class CloudLeasedLineModalComponent implements OnInit { }; this.cancelEmitter.emit(); } + + isString(val) { + return Object.prototype.toString.call(val) === '[object String]'; + } }
\ No newline at end of file |