From 125fb9b3811f9f580997545f92c93e0a01271abe Mon Sep 17 00:00:00 2001 From: liuwh7 Date: Fri, 4 Mar 2022 14:13:19 +0800 Subject: feat:intentBasedService predict Signed-off-by: liuwh7 Change-Id: I08e0d7a5141325f830bf522b42894b399ea6e7af Issue-ID: REQ-1075 --- .../intent-based-predict.component.ts | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts (limited to 'usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts') diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts new file mode 100644 index 00000000..d88afa9c --- /dev/null +++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts @@ -0,0 +1,73 @@ +import { Component, OnInit } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd'; +import { intentBaseService } from '../../../../core/services/intentBase.service'; + +@Component({ + selector: 'app-intent-based-predict', + templateUrl: './intent-based-predict.component.html', + styleUrls: ['./intent-based-predict.component.less'] +}) +export class IntentBasedPredictComponent implements OnInit { + + constructor( + private myhttp: intentBaseService, + private msg: NzMessageService + ) {} + + // textarea input predict param + communicationMessage: String = ""; + // button loading + isConfirmCreating: boolean = false; + // modal param + modalParam: Object = {}; + // cloud modal show flag + cloudModalShowFlag: boolean = false; + // business modal show flag + businessModalShowFlag: boolean = false; + + ngOnInit() { + this.communicationMessage = ''; + } + + ngOnChange() {} + + submitFormMessage(): void { + this.isConfirmCreating = true; + this.myhttp.intentBasedUnifyPredict({ + "text": this.communicationMessage + }).subscribe( + (response) => { + this.isConfirmCreating = false; + const { code, message, data: { type, formData } } = response; + if (code !== 200) { + this.msg.error(message); + return; + } + + this.modalParam = { + ...formData, + intentContent: this.communicationMessage + }; + + if (type === 'ccvpn') { + this.cloudModalShowFlag = true; + } + + if (type === '5gs') { + this.businessModalShowFlag = true; + } + }, + (err) => { + this.isConfirmCreating = false; + console.log(err); + } + ) + } + + modalClose() { + this.cloudModalShowFlag = false; + this.businessModalShowFlag = false; + this.modalParam = {}; + this.communicationMessage = ''; + } +} -- cgit 1.2.3-korg