feat: modify intent based service 71/124871/1
authorliuwh7 <liuwh7@asiainfo.com>
Wed, 13 Oct 2021 03:19:07 +0000 (11:19 +0800)
committerliuwh7 <liuwh7@asiainfo.com>
Wed, 13 Oct 2021 03:19:25 +0000 (11:19 +0800)
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Change-Id: I9974fb12163823288292cfc9ded92fefec3767eb
Issue-ID: USECASEUI-605

usecaseui-portal/src/app/core/services/intentBase.service.ts
usecaseui-portal/src/app/views/fcaps/monitor-management-service/monitor-facps-service/monitor-facps-service.component.ts
usecaseui-portal/src/app/views/onboard-vnf-vm/nlp-upload-dialog/nlp-upload-dialog.component.html
usecaseui-portal/src/app/views/onboard-vnf-vm/onboard-vnf-vm.component.ts
usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html
usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts
usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts
usecaseui-portal/src/app/views/services/intent-based-services/smart-cloud-leased-modal/smart-cloud-leased-modal.component.ts
usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts

index b8ead33..eaa67b9 100644 (file)
@@ -26,13 +26,14 @@ export class intentBaseService {
       getInstanceId: this.baseUrl + "/intent/getInstanceId",
       createIntentInstance: this.baseUrl + "/intent/createIntentInstance",
       getInstanceList: this.baseUrl + "/intent/getInstanceList",
+      getInstanceStatus: this.baseUrl + "/intent/getInstanceStatus",
       queryInstancePerformanceData: this.baseUrl + "/intent/queryInstancePerformanceData",
       getFinishedInstanceInfo: this.baseUrl + "/intent/getFinishedInstanceInfo",
       deleteIntentInstance: this.baseUrl + "/intent/deleteIntentInstance",
       activeIntentInstance: this.baseUrl + "/intent/activeIntentInstance",
       invalidIntentInstance: this.baseUrl + "/intent/invalidIntentInstance",
       queryAccessNodeInfo: this.baseUrl + "/intent/queryAccessNodeInfo",
-      intentInstancePredict: this.baseUrl + "/intent/intentInstancePredict"
+      intentInstancePredict: this.baseUrl + "/intent/predict"
     };
 
     //The following APIs function are optimizable------------------------
@@ -50,6 +51,10 @@ export class intentBaseService {
       return this.http.post<any>(this.url["getInstanceList"], requestBody);
     }
     
+    getInstanceStatus(requestBody) {
+      return this.http.post<any>(this.url["getInstanceStatus"], requestBody);
+    }
+
     queryInstancePerformanceData(requestBody) {
         return this.http.post<any>(this.url["queryInstancePerformanceData"], requestBody);
     }
index 8da138b..1c5017c 100644 (file)
@@ -19,62 +19,7 @@ export class MonitorFacpsServiceComponent implements OnInit {
        selectedSubscriptionType: string = "";
        selectedServiceInstance: string = "";
        selectedTopology: string = "";
-        instanceId: string = "";
-  chartData: any = {
-    xAxis: {
-      data: [
-        "2018-09-10 ",
-        "2018-09-11",
-        "2018-09-12",
-        "2018-09-13",
-        "2018-09-14",
-        "2018-09-15",
-        "2018-09-16",
-        "2018-09-17",
-        "2018-09-18",
-        "2018-09-19",
-        "2018-09-20",
-        "2018-09-21",
-        "2018-09-22"
-      ]
-    },
-    series: [
-      {
-        data: [
-          30,
-          45,
-          34,
-          35,
-          43,
-          56,
-          36,
-          53,
-          42,
-          45,
-          44,
-          35,
-          32
-        ] 
-      },
-      {
-        data: [
-          60,
-          60,
-          60,
-          60,
-          60,
-          60,
-          60,
-          60,
-          60,
-          60,
-          60,
-          60,
-          60
-        ]
-      }
-    ]
-  };
+  instanceId: string = "";
        initData: any = {
                height: 320,
                option: {
@@ -106,6 +51,7 @@ export class MonitorFacpsServiceComponent implements OnInit {
        updateOption: any;
 
        instanceLists: any[] = [];
+  progressSetTimeOut: any;
 
   ngOnInit() {
     this.getFinishedInstanceInfo();
@@ -179,21 +125,31 @@ export class MonitorFacpsServiceComponent implements OnInit {
   }
 
        queryInstancePerformance(instanceId) {
-    this.myHttp.queryInstancePerformanceData({ instanceId}).subscribe(
-      (response) => {
-        const { code, message, data } = response;
-        if (code !== 200) {
-          this.nzMessage.error(message);
-          return;
-        }
-        if(this.chartIntance){
-          this.updateOption = data;
+    const requery = () => {
+      this.myHttp.queryInstancePerformanceData({ instanceId}).subscribe(
+        (response) => {
+          const { code, message, data } = response;
+          if (code !== 200) {
+            this.nzMessage.error(message);
+          } else {
+            if(this.chartIntance) {
+              this.updateOption = data;
+            }
+          }
+
+          if (this.progressSetTimeOut) {
+            clearInterval(this.progressSetTimeOut);
+          }
+          
+          this.progressSetTimeOut = setTimeout(() => {
+            requery();
+          }, 5000);
+        },
+        (err) => {
+          console.log(err);
         }
-      },
-      (err) => {
-        console.log(err);
-      }
-    )
+      )
+    }
+    requery();
   }
-
 }
index 9e7f669..d2c8910 100644 (file)
@@ -20,8 +20,8 @@
             [name]="nlpType"
             [(ngModel)]="nlpType"
           >
-            <nz-option nzValue="nlp" nzLabel="nlp"></nz-option>
-            <nz-option nzValue="intent" nzLabel="intent"></nz-option>
+            <nz-option nzValue="ccvpn" nzLabel="ccvpn"></nz-option>
+            <nz-option nzValue="5gs" nzLabel="5gs"></nz-option>
           </nz-select>
         </nz-form-control>
       </nz-form-item>
index ccdebc3..dfe82bd 100644 (file)
@@ -183,6 +183,7 @@ export class OnboardVnfVmComponent implements OnInit {
     // tslint:disable-next-line:no-any
     this.fileList.forEach((file: any) => {
       formData.set('file', file);
+      formData.set('modelType', this.nlpType);
     });
     this.uploading = true;
     this.file = {
@@ -298,7 +299,8 @@ export class OnboardVnfVmComponent implements OnInit {
                     return nsvfc.id == nssdc.uuid
                   })
                 });
-                this.nsTableData = this.nsTableData.concat(sameData);
+                console.log(sameData);
+                this.nsTableData = [...this.nsTableData, ...sameData];
               },
               (err) => {
                 this.msg.error(err);
index 9bb9ffa..64924b9 100644 (file)
@@ -40,8 +40,8 @@
                 *ngIf="item.type === 'select'"
               >
                 <nz-option
-                  [nzValue]="option.key"
-                  [nzLabel]="option.title"
+                  [nzValue]="option"
+                  [nzLabel]="option"
                   *ngFor="let option of cloudPointOptions"
                 >
                 </nz-option>
@@ -67,8 +67,8 @@
                     [(ngModel)]="cloud_leased_line_info[item.key].name"
                   >
                     <nz-option
-                      [nzValue]="option.key"
-                      [nzLabel]="option.title"
+                      [nzValue]="option"
+                      [nzLabel]="option"
                       *ngFor="let option of nodeLists"
                     >
                     </nz-option>
index 0f0afc7..90bcf9b 100644 (file)
@@ -51,7 +51,12 @@ export class CloudLeasedLineModalComponent implements OnInit {
   queryAccessNodeInfo() {
     this.myHttp.queryAccessNodeInfo().subscribe(
       (response) => {
-        console.log(response);
+        const { code, data } = response;
+        if (code !== 200) {
+          return;
+        }
+        this.cloudPointOptions = [...data.cloudAccessNodeList];
+        this.nodeLists = [...data.accessNodeList];
       },
       (err) => {
         console.log(err);
index bf04654..28e312a 100644 (file)
@@ -32,17 +32,22 @@ export class CloudLeasedLineComponent implements OnInit {
     2: 'Deleted',
     3: 'Inactive'
   }
-  // 列表数据源
+  // table lists
        listOfData: any[] = [];
-  // 分页信息及总数
+  // pageSize or pageNum
        pageIndex: number = 1;
        pageSize: number = 10;
        total: number = 0;
        loading = false;
-  // 控制弹窗展示变量
+  // cantrol dialog show or hidden
   cloudLeasedLineShowFlag: boolean = false;
   smartCloudLeasedLineShowFlag: boolean = false;
-  // 初始化查询数据源
+  // resolve to dialog
+  resolveResult: any = null;
+  intervalTime: number = 5000;
+  progressingTimer: any[] = [];
+  
+  // init source data
        getCloudLeasedLineList(): void {
     this.myHttp.getInstanceList({
       currentPage: this.pageIndex,
@@ -54,39 +59,85 @@ export class CloudLeasedLineComponent implements OnInit {
                                return;
       }
       this.total = data.totalRecords;
-      this.listOfData = [...data.list];
+      if (data.list === 0) {
+        return;
+      }
+      
+      this.listOfData = data.list.map((item, index) => {
+        if (item.status === 'Incomplete') {
+          const updateStatus = (prodata) => {
+            item.status = prodata.status || item.status;
+          };
+          
+          const obj = { serviceId: item.id };
+          this.queryStatus(obj, index, updateStatus).then(() => {
+            item.status = "Completed";
+            this.getCloudLeasedLineList();
+          });
+        } 
+        return item;
+      });
     }, (err) => {
       console.log(err);
     });
   }
-  // 分页信息变更查询数据
+
+  queryStatus(obj: any, index: number, callback: any) {
+    return new Promise((res) => {
+                       const requery = () => {
+        const param = [obj.id];
+                               this.myHttp.getInstanceStatus(param).subscribe((response) => {
+                                               if (
+                                                       response.data.status && response.data.status === 'Incomplete') {
+                                                       callback(response.data);
+                                                       let progressSetTimeOut = setTimeout(() => {
+                                                               requery();
+                                                       }, this.intervalTime);
+                                                       this.progressingTimer.push({
+                                                               id: obj.id,
+                                                               timer: progressSetTimeOut,
+                                                       });
+                                               } else {
+                                                       this.progressingTimer.forEach((item) => {
+                                                               if (item.serviceId === obj.serviceId) {
+                                                                       clearInterval(item.timer);
+                                                               }
+                                                       });
+                                                       res(response.data);
+                                               }
+                                       });
+                       };
+                       requery();
+               });
+  }
+
+  // change page message
   searchData(): void {
     this.getCloudLeasedLineList();
   }
-  // 解析结果传递到create弹窗
-  resolveResult: any;
-  // 弹窗加载
+  
+  // dialog show
        cloudLeasedLineShow(): void {
          this.cloudLeasedLineShowFlag = true;
        }
-  // 弹窗关闭
+  // dialog close
        cloudLeasedLineClose(): void {
     this.cloudLeasedLineShowFlag = false;
     this.pageIndex = 1;
     this.pageSize = 10;
     this.getCloudLeasedLineList();
   }
-  // smart 弹窗加载
+  // smart dialog show
        smartCloudLeasedLineShow(): void {
          this.smartCloudLeasedLineShowFlag = true;
        }
-  // smart 弹窗关闭
+  // smart dialog close
        smartCloudLeasedLineClose(data): void {
     this.smartCloudLeasedLineShowFlag = false;
     if (data.cancel) {
       return;
     }
-    this.cloudLeasedLineShowFlag = true;
+
     this.resolveResult = {
       name: 'test',
       instanceId: '123456',
@@ -96,8 +147,10 @@ export class CloudLeasedLineComponent implements OnInit {
       },
       cloudPointName: 'aaa',
     };
+
+    this.cloudLeasedLineShowFlag = true;
   }
-  // 跳转监控管理页面
+  // to monitor page
   goMonitorService(): void {
     this.router.navigateByUrl('/fcaps/monitor_service');
   }
index 014a1c4..16a3843 100644 (file)
@@ -58,6 +58,7 @@ export class SmartCloudLeasedModalComponent implements OnInit {
   submitFormMessage(): void {
     let params = {
       "title": "predict",
+      "modelType": 'ccvpn',
       "text": this.communicationMessage
     };
     this.myhttp.intentInstancePredict(params).subscribe(
index 94bccfe..e64f687 100644 (file)
@@ -1,8 +1,8 @@
-import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
 import { NzMessageService } from 'ng-zorro-antd';
-import { Util } from '../../../../../shared/utils/utils';
 import { onboardService } from '../../../../../core/services/onboard.service';
 import { Recorder } from '../../../../../shared/utils/recorder';
+import { Util } from '../../../../../shared/utils/utils';
 
 @Component({
   selector: 'app-input-business-order',
@@ -74,8 +74,9 @@ export class InputBusinessOrderComponent implements OnInit {
       return
     }
     let params = {
-          "title": "predict",
-          "text": this.communicationMessage
+      "title": "predict",
+      "modelType": '5gs',
+      "text": this.communicationMessage
     };
     this.myhttp["analysisInputText"](params)
       .subscribe((data) => {