summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/intent-management/input-intent-expectation/input-intent-expectation.component.ts
diff options
context:
space:
mode:
authorzoulingli128 <zll_1208@126.com>2022-09-08 15:32:27 +0800
committerzoulingli128 <zll_1208@126.com>2022-09-08 15:32:27 +0800
commit7bdeb7cc89a8d60e4c3199f1922a6bf73a9d83c1 (patch)
treebfa45c3c2e02f3f07d760065654d5c3af7ae52c2 /usecaseui-portal/src/app/views/intent-management/input-intent-expectation/input-intent-expectation.component.ts
parenta6d5ef22e8874a33fbee58ec6813be4299b04d67 (diff)
Intent analysis frontend
Issue-ID: USECASEUI-711 Signed-off-by: zoulingli128 <zll_1208@126.com> Change-Id: I8f8636f6b47c5ba25e6f342c484fd8ffb5ed1d6d
Diffstat (limited to 'usecaseui-portal/src/app/views/intent-management/input-intent-expectation/input-intent-expectation.component.ts')
-rw-r--r--usecaseui-portal/src/app/views/intent-management/input-intent-expectation/input-intent-expectation.component.ts109
1 files changed, 109 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/views/intent-management/input-intent-expectation/input-intent-expectation.component.ts b/usecaseui-portal/src/app/views/intent-management/input-intent-expectation/input-intent-expectation.component.ts
new file mode 100644
index 00000000..3848ffbb
--- /dev/null
+++ b/usecaseui-portal/src/app/views/intent-management/input-intent-expectation/input-intent-expectation.component.ts
@@ -0,0 +1,109 @@
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { Util } from '../../../shared/utils/utils';
+
+@Component({
+ selector: 'app-input-intent-expectation',
+ templateUrl: './input-intent-expectation.component.html',
+ styleUrls: ['../intent-management.component.less']
+})
+export class InputIntentExpectationComponent implements OnInit {
+
+ constructor(
+ private Util: Util
+ ) { }
+
+ @Input() showModel: boolean;
+ @Output() modalOpreation = new EventEmitter();
+ @Input() editExpectationTableData;
+
+ defaultParams:Object={
+ expectationId:'',
+ expectationName:'',
+ expectationType:'DELIVERY',
+ expectationObject:{
+ objectType:'CLL_VPN',
+ objectInstance:'',
+ },
+ expectationTargets:[]
+ };
+ currentIndex:number = -1;
+
+ listOfData: any[] = [];
+
+ intentTargetShow: boolean = false;
+ editTargetTableList: Object={};
+
+ expectationTypeList: any[] = [];
+ expectationObjectTypeList: any[] = [];
+
+ ngOnInit() {
+ this.expectationTypeList = [
+ { label:'DELIVERY', value:'DELIVERY' },
+ { label:'ASSURANCE', value:'ASSURANCE' }
+ ]
+ this.expectationObjectTypeList = [
+ { label:'CLL_VPN', value:'CLL_VPN' }
+ ]
+ }
+
+ ngOnChanges() {
+ if (this.showModel) {
+ if (JSON.stringify(this.editExpectationTableData)!=='{}') {
+ this.defaultParams=this.editExpectationTableData
+ this.listOfData=this.defaultParams['expectationTargets']
+ }
+ }
+ }
+
+ handleCancel(): void {
+ this.modalOpreation.emit({ "cancel": true });
+ this.clearExpectationData()
+ }
+ handleOk(): void {
+ if(JSON.stringify(this.editExpectationTableData)==='{}'){
+ this.defaultParams['expectationId']=this.Util.getUuid()
+ }
+ this.modalOpreation.emit({ "cancel": false, "param": this.defaultParams });
+ this.clearExpectationData()
+ }
+ editTargetList(data,i): void {
+ this.editTargetTableList=JSON.parse(JSON.stringify(data))
+ this.currentIndex=i
+ this.intentTargetShow = true
+ }
+ deleteTargetList(i): void{
+ this.listOfData.splice(i,1)
+ }
+ clearExpectationData(): void{
+ this.showModel = false;
+ this.defaultParams = {
+ expectationId:'',
+ expectationName:'',
+ expectationType:'DELIVERY',
+ expectationObject:{
+ objectType:'CLL_VPN',
+ objectInstance:'',
+ },
+ expectationTargets:[]
+ };
+ this.listOfData=[]
+ }
+ inputIntentTargetShow(): void {
+ this.intentTargetShow = true;
+ }
+ inputIntentStateClose($event: any): void {
+ this.intentTargetShow = false;
+ this.editTargetTableList={}
+ if ($event.cancel) {
+ return;
+ }
+ if(this.currentIndex>-1){
+ this.listOfData[this.currentIndex]=$event.param
+ this.currentIndex=-1
+ }else{
+ this.listOfData.push($event.param)
+ }
+ this.defaultParams['expectationTargets']=this.listOfData
+ }
+
+}