feat: intent instance management 95/127895/1
authorliuwh7 <liuwh7@asiainfo.com>
Mon, 21 Mar 2022 06:11:42 +0000 (14:11 +0800)
committerliuwh7 <liuwh7@asiainfo.com>
Mon, 21 Mar 2022 06:11:57 +0000 (14:11 +0800)
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Change-Id: I7d8047e7ccc86617399ce57a5be62907d09292eb
Issue-ID: REQ-1075

13 files changed:
usecaseui-portal/src/app/app.module.ts
usecaseui-portal/src/app/core/services/intentBase.service.ts
usecaseui-portal/src/app/core/services/slicingTaskServices.ts
usecaseui-portal/src/app/views/fcaps/monitor-management-service/monitor-facps-service/monitor-facps-service.component.ts
usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.html
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/intent-based-services.component.html
usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html [new file with mode: 0644]
usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less [new file with mode: 0644]
usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts [new file with mode: 0644]
usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts
usecaseui-portal/src/assets/i18n/cn.json
usecaseui-portal/src/assets/i18n/en.json

index 1bf1b65..f9c7a6f 100644 (file)
@@ -75,6 +75,7 @@ import { CloudLeasedLineModalComponent } from './views/services/intent-based-ser
 import { CloudLeasedLineComponent } from './views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component';
 import { IntentBasedPredictComponent } from './views/services/intent-based-services/intent-based-predict/intent-based-predict.component';
 import { IntentBasedServicesComponent } from './views/services/intent-based-services/intent-based-services.component';
+import { IntentInstanceComponent } from './views/services/intent-based-services/intent-instance/intent-instance.component';
 import { SmartCloudLeasedModalComponent } from './views/services/intent-based-services/smart-cloud-leased-modal/smart-cloud-leased-modal.component';
 import { CcvpnCreationComponent } from "./views/services/services-list/ccvpn-creation/ccvpn-creation.component";
 import { CcvpnDetailComponent } from "./views/services/services-list/ccvpn-detail/ccvpn-detail.component";
@@ -177,6 +178,7 @@ registerLocaleData(en);
     MonitorFacpsServiceComponent,
     IntentBasedPredictComponent,
     IntentBasedServicesComponent,
+    IntentInstanceComponent,
     CloudLeasedLineComponent,
     CloudLeasedLineModalComponent,
     SmartCloudLeasedModalComponent,
index 7fb8104..5ee8424 100644 (file)
@@ -34,7 +34,10 @@ export class intentBaseService {
       invalidIntentInstance: this.baseUrl + "/intent/invalidIntentInstance",
       queryAccessNodeInfo: this.baseUrl + "/intent/queryAccessNodeInfo",
       intentInstancePredict: this.baseUrl + "/intent/predict",
-      intentBasedUnifyPredict: this.baseUrl + "/intent/unifyPredict"
+      intentBasedUnifyPredict: this.baseUrl + "/intent/unifyPredict",
+      getIntentInstanceList: this.baseUrl + "/intent/getIntentList",
+      delIntentInstance: this.baseUrl + "/intent/deleteIntent",
+      verifyIntentInstance: this.baseUrl + "/intent/verifyIntentInstance"
     };
 
     //The following APIs function are optimizable------------------------
@@ -88,4 +91,17 @@ export class intentBaseService {
     intentBasedUnifyPredict(requestBody) {
       return this.http.post<any>(this.url["intentBasedUnifyPredict"], requestBody);
     }
+
+    getIntentInstanceList(paramsObj) {
+      return this.http.post<any>(this.url["getIntentInstanceList"], paramsObj);
+    }
+
+    delIntentInstance(id) {
+      let params = new HttpParams({ fromObject: { "id": id } });
+      return this.http.delete<any>(this.url['delIntentInstance'], { params });
+    }
+
+    verifyIntentInstance(paramsObj) {
+      return this.http.post<any>(this.url['verifyIntentInstance'], paramsObj);
+    }
 }
index 362e9f6..292d9bd 100644 (file)
     See the License for the specific language governing permissions and\r
     limitations under the License.\r
 */\r
-import { Injectable } from "@angular/core";\r
 import {\r
-       HttpClient,\r
-       HttpHeaders,\r
-       HttpParams,\r
-       HttpResponse,\r
+  HttpClient\r
 } from "@angular/common/http";\r
+import { Injectable } from "@angular/core";\r
 import { Http } from "../../shared/utils/http";\r
 @Injectable()\r
 export class SlicingTaskServices {\r
@@ -85,6 +82,7 @@ export class SlicingTaskServices {
                csmfGetProgress:\r
                        "/api/usecaseui/csmf/5gSlicing/service/{serviceId}/progress",\r
                csmfPurchase: "/api/usecaseui-server/v1/uui-slicing/csmf/5gSlicing",\r
+    csmfPurchaseWithContent: '/api/usecaseui-server/v1/intent/csmf/5gSlicing',\r
                //monitor 5G\r
                fetchTraffic:\r
                        this.baseUrl +\r
@@ -294,7 +292,10 @@ export class SlicingTaskServices {
                let url = this.url.csmfPurchase;\r
                return this.Http.httpAxios("post", url, paramsObj, failedCallback);\r
        }\r
-\r
+  csmfSlicingPurchaseWithContent(paramsObj: any, failedCallback?: any) {\r
+               let url = this.url.csmfPurchaseWithContent;\r
+               return this.Http.httpAxios("post", url, paramsObj, failedCallback);\r
+       }\r
        //monitor 5G\r
        getFetchTraffic(service_list, time, failedCallback?: any) {\r
                let url = this.url.fetchTraffic.replace("{queryTimestamp}", time);\r
index f86f02c..858bfac 100644 (file)
@@ -1,5 +1,6 @@
 import { HttpClient } from "@angular/common/http";
 import { Component, OnInit } from "@angular/core";
+import { ActivatedRoute } from '@angular/router';
 import { NzMessageService } from "ng-zorro-antd";
 import { intentBaseService } from "../../../../core/services/intentBase.service";
 
@@ -13,7 +14,8 @@ export class MonitorFacpsServiceComponent implements OnInit {
   constructor(
     private nzMessage: NzMessageService,
     private myHttp: intentBaseService,
-    private http: HttpClient
+    private http: HttpClient,
+    private route: ActivatedRoute
   ) {}
   
        selectedSubscriptionType: string = "";
@@ -57,6 +59,14 @@ export class MonitorFacpsServiceComponent implements OnInit {
   progressSetTimeOut: any;
 
   ngOnInit() {
+    this.route.queryParams.subscribe(
+      params => {
+        this.instanceId= params['instanceId'];
+        if (this.instanceId) {
+          this.queryInstancePerformance(this.instanceId);
+        }
+      }
+    );
     this.getFinishedInstanceInfo();
                this.initOpts = {
                        renderer: "canvas",
index f4dd029..ae733c5 100644 (file)
@@ -51,7 +51,7 @@
                 nz-button
                 nzType="primary"
                 class="buy-button"
-                (click)="goMonitorService()"
+                (click)="goMonitorService(data)"
               >
                 Intent Monitor
               </button>
index 7b39f1a..a9d239d 100644 (file)
@@ -147,8 +147,14 @@ export class CloudLeasedLineComponent implements OnInit {
     this.cloudLeasedLineShowFlag = true;
   }
   // to monitor page
-  goMonitorService(): void {
-    this.router.navigateByUrl('/fcaps/monitor_service');
+  goMonitorService(data): void {
+    // this.router.navigateByUrl('/fcaps/monitor_service');navigate
+    this.router.navigate(['/fcaps/monitor_service'], {
+      queryParams: {
+        instanceId: data.instanceId
+      },
+      skipLocationChange: true
+    });
   }
 
   activeCloudLeasedLine(row): void {
index e426285..52f7098 100644 (file)
@@ -9,4 +9,9 @@
       *ngIf="selectedIndex === 1"
     ></app-cloud-leased-line>
   </nz-tab>
+  <nz-tab [nzTitle]="'i18nTextDefine_intentInstance' | translate">
+    <app-intent-instance
+      *ngIf="selectedIndex === 2"
+    ></app-intent-instance>
+  </nz-tab>
 </nz-tabset>
\ No newline at end of file
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html
new file mode 100644 (file)
index 0000000..ee71be0
--- /dev/null
@@ -0,0 +1,64 @@
+<div class="intent-resource_tab">
+  <div class="intent-resource-table-list">
+    <nz-table
+      #basicTable [nzData]="listOfData"
+      [nzFrontPagination]="false"
+      nzShowSizeChanger
+      [nzPageSizeOptions]="[5,10,15,20]"
+      [nzTotal]='total'
+      [(nzPageSize)]="pageSize"
+      [(nzPageIndex)]='pageIndex'
+      [nzLoading]="loading"
+      (nzPageIndexChange)="searchData()"
+      (nzPageSizeChange)="searchData()"
+      [nzScroll]="{ x: '1500px' }"
+      nzTableLayout="fixed"
+    >
+      <thead>
+        <tr>
+          <th [nzLeft]="true">No</th>
+          <th>Intent Name</th>
+          <th>Intent Source</th>
+          <th>Customer</th>
+          <th nzEllipsis>Intent Content</th>
+          <th>Intent Config</th>
+          <th>Business Instance</th>
+          <th [nzRight]="true" [nzWidth]="300"></th>
+        </tr>
+      </thead>
+      <tbody>
+        <ng-template ngFor let-data [ngForOf]="basicTable.data" let-i="index">
+          <tr>
+            <td [nzLeft]="true">{{i+1}}</td>
+            <td>{{ data.intentName }}</td>
+            <td>{{ data.intentSource }}</td>
+            <td>{{ data.customer }}</td>
+            <td [title]="data.intentContent" nzEllipsis>
+              {{ data.intentContent }}
+            </td>
+            <td>{{ data.intentConfig }}</td>
+            <td>{{ data.businessInstance }}</td>
+            <td [nzRight]="true">
+              <button
+                nz-button
+                nzType="primary"
+                class="buy-button"
+                (click)="verificationIntentionInstance(data)"
+              >
+                check
+              </button>
+              <button
+                nz-button
+                nzType="primary"
+                class="buy-button"
+                (click)="deleteIntentionInstance(data)"
+              >
+                Delete
+              </button>
+            </td>
+          </tr>
+        </ng-template>
+      </tbody>
+    </nz-table>
+  </div>
+</div>
\ No newline at end of file
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less
new file mode 100644 (file)
index 0000000..f665fdb
--- /dev/null
@@ -0,0 +1,87 @@
+.intent-resource_tab {
+  width: 103%;
+  margin-left: 60px!important;
+  margin-top: -35px!important;
+  .ant-tabs-content.ant-tabs-content-animated{
+    padding:  20px 0!important;
+  }
+}
+.slicing-resource-table{
+  padding: 20px!important;
+}
+.intent-resource-table-list{
+  padding: 20px!important;
+  nz-table{
+    .ant-table-wrapper{
+      .ant-table-body{
+        th,td{
+          word-break: break-word!important;
+        }
+      }
+    }
+  }
+}
+nz-select {
+  width: 200px;
+}
+
+.task_status {
+  margin-bottom: 20px;
+
+  span {
+    margin-right: 5%;
+  }
+}
+
+.action-icon {
+  display: inline-block;
+  vertical-align: top;
+}
+
+i.anticon {
+  cursor: pointer;
+  font-size: 18px;
+  padding: 2px 15px;
+  vertical-align: inherit !important;
+
+  &:hover {
+    color: #147dc2;
+  }
+}
+
+.cannotclick {
+  pointer-events: none;
+  color: #aaa;
+  opacity: 0.6;
+}
+
+.buy-button {
+  float: right;
+  margin-right: 2%;
+}
+::ng-deep .ant-table-row .buy-button {
+  float: left;
+}
+
+::ng-deep .ant-table-th-right-sticky {
+  width: 200px;
+}
+.ant-table-th-right-sticky, .ant-table-td-right-sticky {
+  position: -webkit-sticky;
+  position: sticky;
+  z-index: 1;
+  right: 0;
+}
+.ant-table-th-left-sticky, .ant-table-td-left-sticky {
+  position: -webkit-sticky;
+  position: sticky;
+  z-index: 1;
+  left: 0;
+}
+.ellipsisClass{
+  display: inline-block;
+  max-width: 150px;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  overflow: hidden;
+}
\ No newline at end of file
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts
new file mode 100644 (file)
index 0000000..d13b9d7
--- /dev/null
@@ -0,0 +1,96 @@
+import { Component, OnInit } from "@angular/core";
+import { Router } from "@angular/router";
+import { NzMessageService } from "ng-zorro-antd";
+import { intentBaseService } from "../../../../core/services/intentBase.service";
+
+@Component({
+  selector: 'app-intent-instance',
+  templateUrl: './intent-instance.component.html',
+  styleUrls: ['./intent-instance.component.less']
+})
+export class IntentInstanceComponent implements OnInit {
+
+  constructor(
+    private router:Router,
+    private myHttp: intentBaseService,
+    private nzMessage: NzMessageService 
+  ) {}
+
+       ngOnChanges() {}
+
+       ngOnInit() {
+    this.pageIndex = 1;
+    this.pageSize = 10;
+    this.getIntentionInstanceList();
+  }
+
+       ngOnDestroy() {}
+
+  // table lists
+       listOfData: any[] = [];
+  // pageSize or pageNum
+       pageIndex: number = 1;
+       pageSize: number = 10;
+       total: number = 0;
+       loading = false;
+  
+  // init source data
+       getIntentionInstanceList(): void {
+    this.myHttp.getIntentInstanceList({
+      currentPage: this.pageIndex,
+      pageSize: this.pageSize
+    }).subscribe((response) => {
+      const { code, message, data:{ totalRecords, list } } = response;
+      if (code !== 200) {
+        this.nzMessage.error(message);
+                               return;
+      }
+      
+      this.total = totalRecords;
+      this.listOfData = list;
+    }, (err) => {
+      console.log(err);
+    });
+  }
+
+  // change page message
+  searchData(): void {
+    this.getIntentionInstanceList();
+  }
+
+  verificationIntentionInstance(row): void {
+    this.myHttp.verifyIntentInstance({
+      id: row.id
+    }).subscribe((response) => {
+      const { code, message, data } = response;
+      if (code !== 200) {
+        this.nzMessage.error(message);
+                               return;
+      }
+      this.nzMessage.success(data);
+      this.resetParam2Query();
+    }, (err) => {
+      console.log(err);
+    });
+  }
+
+  deleteIntentionInstance(row): void {
+    this.myHttp.delIntentInstance(row.id).subscribe((response) => {
+      const { code, message } = response;
+      if (code !== 200) {
+        this.nzMessage.error(message);
+                               return;
+      }
+      this.nzMessage.success('Delete IntentionInstance Success');
+      this.resetParam2Query();
+    }, (err) => {
+      console.log(err);
+    });
+  }
+
+  resetParam2Query() {
+    this.pageIndex = 1;
+    this.pageSize = 10;
+    this.getIntentionInstanceList();
+  }
+}
\ No newline at end of file
index aa5a5db..70ef4ef 100644 (file)
@@ -51,6 +51,7 @@ export class BusinessOrderComponent implements OnInit {
                uEMobilityLevel: "stationary",
                coverageArea: "",
                coverageAreaNumber: null,
+    intentContent: '',
        };
        areaList: any[] = [];
        validateRulesShow: any[] = [];
@@ -95,6 +96,7 @@ export class BusinessOrderComponent implements OnInit {
                        uEMobilityLevel: "stationary",
                        coverageArea: "",
                        coverageAreaNumber: null,
+      intentContent: ''
                };
                this.validateRulesShow = [];
        }
@@ -152,7 +154,18 @@ export class BusinessOrderComponent implements OnInit {
                        this.handleCancel();
                };
                this.loading = true;
-               this.myhttp
+
+    // csmfSlicingPurchaseWithContent
+    const { intentContent } = this.slicing_order_info;
+    if (intentContent) {
+      this.csmfSlicingPurchaseWithContent(paramsObj, csmfSlicingPurchaseFailedCallback);
+      return;
+    }
+    this.csmfSlicingPurchase(paramsObj, csmfSlicingPurchaseFailedCallback);
+       }
+
+  csmfSlicingPurchase(paramsObj, csmfSlicingPurchaseFailedCallback): void {
+    this.myhttp
                        .csmfSlicingPurchase(paramsObj, csmfSlicingPurchaseFailedCallback)
                        .then((res) => {
                                const result = res.result_header;
@@ -168,5 +181,24 @@ export class BusinessOrderComponent implements OnInit {
                                this.loading = false;
                                this.handleCancel();
                        });
-       }
+  }
+
+  csmfSlicingPurchaseWithContent(paramsObj, csmfSlicingPurchaseFailedCallback): void {
+    this.myhttp
+                       .csmfSlicingPurchaseWithContent(paramsObj, csmfSlicingPurchaseFailedCallback)
+                       .then((res) => {
+                               const result = res.result_header;
+                               if (
+                                       result &&
+                                       result.result_code &&
+                                       +result.result_code === 200
+                               ) {
+                                       console.log(res);
+                               } else {
+                                       this.message.create("error", "Network error");
+                               }
+                               this.loading = false;
+                               this.handleCancel();
+                       });
+  }
 }
index ad9d855..e2eab0b 100644 (file)
   "i18nTextDefine_manageService":"管理服务",
   "i18nTextDefine_cloudLeasedLine":"Cloud Leased Line",
   "i18nTextDefine_intentBaseService":"Intent Based Services",
-
+  "i18nTextDefine_intentInstance":"Intent Instance Management",
        
   "mdons-network-component":"--:",
   "i18nTextDefine_InterDomainTitle": "域间链接",
index 034262b..f47d7b9 100644 (file)
   "i18nTextDefine_manageService":"Manage Service",
   "i18nTextDefine_cloudLeasedLine":"Cloud Leased Line",
   "i18nTextDefine_intentBaseService":"Intent Based Services",
-
+  "i18nTextDefine_intentInstance":"Intent Instance Management",
 
   "mdons-network-component":"--:",
   "i18nTextDefine_InterDomainTitle": "Inter-domain link",