feat:Optimize code for slice ordering and business code of csmf slicing 70/101670/1
authorcyuamber <xuranyjy@chinamobile.com>
Thu, 13 Feb 2020 12:44:33 +0000 (20:44 +0800)
committercyuamber <xuranyjy@chinamobile.com>
Thu, 13 Feb 2020 12:44:39 +0000 (20:44 +0800)
Change-Id: I62a00ed407796434239c2089788ac47330e1c0d8
Issue-ID: USECASEUI-368
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
15 files changed:
usecaseui-portal/src/app/core/services/slicingTaskServices.ts
usecaseui-portal/src/app/mock/json/csmf_slicing_businessData.json
usecaseui-portal/src/app/mock/routes.js
usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.html
usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.less
usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts
usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/csmf-slicing-business-management.component.html
usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/csmf-slicing-business-management.component.ts
usecaseui-portal/src/app/views/services/slicing-management/slicing-management.component.html
usecaseui-portal/src/app/views/services/slicing-management/slicing-management.component.ts
usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-table/nsi-table.component.ts
usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-table/nssi-table.component.ts
usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-table/slicing-business-table.component.html
usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-table/slicing-business-table.component.ts
usecaseui-portal/src/constants/constants.ts

index 5a1e911..3c55a0c 100644 (file)
@@ -48,12 +48,12 @@ export class SlicingTaskServices {
         slicingNssiQueryOfStatus: this.baseUrl + "/resource/nssi/instanceStatus/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}",\r
         slicingNssiDetail: this.baseUrl + "/resource/nssi/{nssiId}/details",\r
         //csmf\r
-        csmfSlicingBusinessList:"/api/uui-slicing/csmf/5gSlicing/orders/status/{status}/pageNo/{pageNo}/pageSize/{pageSize}",\r
+        csmfSlicingBusinessList:"/api/usecaseui-server/v1/uui-slicing/csmf/5gSlicing/orders/status/{status}/pageNo/{pageNo}/pageSize/{pageSize}",\r
         csmfActivate:"/api/usecaseui/csmf/5gSlicing/service/{serviceId}/activate",\r
         csmfDeactivate:"/api/usecaseui/csmf/5gSlicing/service/{serviceId}/deactivate",\r
         csmfTerminate:"/api/usecaseui/csmf/5gSlicing/service/{serviceId}",\r
         csmfGetProgress:"/api/usecaseui/csmf/5gSlicing/service/{serviceId}/progress",\r
-        csmfPurchase:"/api/uui-slicing/csmf/5gSlicing",\r
+        csmfPurchase:"/api/usecaseui-server/v1/uui-slicing/csmf/5gSlicing",\r
         //monitor 5G\r
         fetchTraffic: this.baseUrl + "/monitoring/queryTimestamp/{queryTimestamp}/trafficData",\r
         fetchOnlineusers: this.baseUrl + "/monitoring/queryTimestamp/{queryTimestamp}/onlineUsers",\r
index 15a0ee8..a47bbf3 100644 (file)
@@ -14,7 +14,7 @@
         "service_snssai": "01-010101",
         "order_status": "activated",
         "last_operation_type": "activation",
-        "last_operation_process": 100
+        "last_operation_progress": "100"
       },
       {
         "order_id": "8c681037-75c9-444c-a665-34a66372e13e",
@@ -22,9 +22,9 @@
         "order_creation_time":"1454171445000",
         "service_type": "embb",
         "service_snssai": "01-1370889D",
-        "order_status": "deactivated",
-        "last_operation_type": null,
-        "last_operation_process": null
+        "order_status": "activated",
+        "last_operation_type": "activated",
+        "last_operation_progress": "60"
       },
       {
         "order_id": "dfa76a2f-6416-4070-9024-355d0d210234",
@@ -34,7 +34,7 @@
         "service_snssai": "01-485C16B6",
         "order_status": "deactivated",
         "last_operation_type": "activation",
-        "last_operation_process": 0
+        "last_operation_progress": "0"
       },
       {
         "order_id": "1e6a6a4b-8efb-4211-b583-b2e8567c5950",
@@ -43,8 +43,8 @@
         "service_type": "embb",
         "service_snssai": "01-6C572676",
         "order_status": "deactivated",
-        "last_operation_type": null,
-        "last_operation_process": null
+        "last_operation_type": "deactivated",
+        "last_operation_progress": "100"
       },
       {
         "order_id": "9941305e-311f-4a88-bd9e-431252a46337",
@@ -53,8 +53,8 @@
         "service_type": "embb",
         "service_snssai": "01-D38E2F0",
         "order_status": "deactivated",
-        "last_operation_type": null,
-        "last_operation_process": null
+        "last_operation_type": "deactivated",
+        "last_operation_progress": "80"
       },
       {
         "order_id": "4876265d-e4bb-4240-bcda-7b4b00481e4a",
@@ -63,8 +63,8 @@
         "service_type": "embb",
         "service_snssai": "01-6A345C48",
         "order_status": "deactivated",
-        "last_operation_type": null,
-        "last_operation_process": null
+        "last_operation_type": "deactivated",
+        "last_operation_progress": "40"
       },
       {
         "order_id": "6c52086a-e9b6-4f31-bc7a-7b34d66c69c0",
@@ -73,8 +73,8 @@
         "service_type": "embb",
         "service_snssai": "01-774F54FC",
         "order_status": "deactivated",
-        "last_operation_type": null,
-        "last_operation_process": null
+        "last_operation_type": "deactivated",
+        "last_operation_progress": "100"
       },
       {
         "order_id": "1cab507a-3422-46f8-8520-9b46c95b7f9d",
@@ -82,9 +82,9 @@
         "order_creation_time":"1454171445000",
         "service_type": "embb",
         "service_snssai": "01-44AA4085",
-        "order_status": "deactivated",
+        "order_status": "DELETE",
         "last_operation_type": "DELETE",
-        "last_operation_process": 100
+        "last_operation_progress": "30"
       }
     ]
   }
index 85cb6fd..e25beea 100644 (file)
@@ -20,8 +20,6 @@ module.exports =
         ///////<-------------api proxy--------->/////
         "/usecaseui-server/v1/*": "/$1",
         "/usecaseui-server/v1/*?:param": "/$1",
-        "/uui-slicing/csmf/*": "/$1",
-        "/uui-slicing/csmf/*?:param": "/$1",
         ///////////////
 
         //text interface
@@ -120,7 +118,7 @@ module.exports =
         "/uui-slicing/nsmf/resource/nssi/instanceStatus/:instanceStatus/instances/pageNo/:pageNo/pageSize/:pageSize": "/slicing_nssi_list_activated",
         "/uui-slicing/nsmf/resource/nssi/:nssiId/details":"/getSlicingNssiDetail",
         ///////<-------------CSMF slicing_business--------->/////
-        "/5gSlicing/orders/status/:status/pageNo/:pageNo/pageSize/:pageSize": "/csmf_slicing_businessData",
+        "/uui-slicing/csmf/5gSlicing/orders/status/:status/pageNo/:pageNo/pageSize/:pageSize": "/csmf_slicing_businessData",
         "/POST/uui-slicing/csmf/5gSlicing": "/csmf_slicing_purchase",
         "/PUT/usecaseui/csmf/5gSlicing/service/:serviceId/activate": "/csmfActivate",
         "/DELETE/usecaseui/csmf/5gSlicing/service/:serviceId": "/csmfTerminate",
index 0ad676a..7b31b07 100644 (file)
@@ -3,14 +3,14 @@
           (nzOnOk)="handleOk()"
           nzWidth="900px">
     <div class="subnet_params_container">
-        <form nz-form>
-            <nz-form-item *ngFor="let item of comunicationFormItems">
+        <form nz-form >
+            <nz-form-item *ngFor="let item of comunicationFormItems; let i = index">
                 <nz-form-label [nzSpan]="6" nzRequired [nzFor]="item.key">
                     {{ item.title }}
                 </nz-form-label>
                 <nz-form-control [nzSpan]="15">
-                    <input nz-input [id]="item.key" [name]="item.key" [(ngModel)]="slicing_order_info[item.key]"
-                           *ngIf=" item.title !== 'Resource Sharing Level' && item.title !== 'Mobility' && item.title !== 'Area' "/>
+                    <input nz-input [id]="item.key" [name]="item.key" [(ngModel)]="slicing_order_info[item.key]" [ngClass]="{'error-input-border':validateRules[i] === true}"
+                           *ngIf=" item.title !== 'Resource Sharing Level' && item.title !== 'Mobility' && item.title !== 'Area' " (blur)="validator(item.key,slicing_order_info[item.key],i)"/>
                     <nz-radio-group [name]="item.key" [(ngModel)]="slicing_order_info[item.key]"
                                     *ngIf="item.title === 'Resource Sharing Level'">
                         <label nz-radio [nzValue]="option.key" *ngFor="let option of item.options">
@@ -22,6 +22,7 @@
                         <nz-option [nzValue]="option.key" [nzLabel]="option.title" *ngFor="let option of item.options">
                         </nz-option>
                     </nz-select>
+                    <nz-form-explain *ngIf=" item.title !== 'Resource Sharing Level' && item.title !== 'Mobility' && item.title !== 'Area' && validateRules[i]" class="validateRules">{{rulesText[i]}}</nz-form-explain>
                 </nz-form-control>
                 <div *ngIf="item.key === 'coverageArea'">
                     <div *ngFor="let area of areaList; let i = index">
index f31f4dd..7fc95e4 100644 (file)
@@ -2,7 +2,6 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
 import {COMMUNICATION_FORM_ITEMS, COMMUNICATION_FORM_ADDRESS} from "../../../../../../constants/constants";
 import {SlicingTaskServices} from "../../../../../core/services/slicingTaskServices";
 import {NzMessageService} from "ng-zorro-antd";
-
 @Component({
   selector: 'app-business-order',
   templateUrl: './business-order.component.html',
@@ -31,12 +30,14 @@ export class BusinessOrderComponent implements OnInit {
         latency: null,
         expDataRateUL: null,
         resourceSharingLevel: "shared",
-        uEMobilityLevel: null,
+        uEMobilityLevel: "stationary",
         useInterval: null,
         coverageArea: ''
     };
     areaList: any[] = [];
     isSpinning: boolean = false;
+    validateRules: any[] = [];
+    rulesText: any[] = [];
     AreaFormatting() {
         let areaList = ['Beijing;Beijing;Haidian District;Wanshoulu Street'];
         this.areaList = areaList.map((item: any) => {
@@ -148,7 +149,68 @@ export class BusinessOrderComponent implements OnInit {
         this.cancel.emit(this.showModel)
     }
 
+    getRulesText = (words,title,val,index) => {
+        return this.rulesText[index] = words + title
+    };
+
+    validator(key,val,i){
+        if(val === null || val.replace(/\s*/g,'').length<=0){
+            this.validateRules[i] = true;
+            this.getRulesText('Please enter',key,val,i);
+            return false
+        }else {
+            this.validateRules[i] = false;
+        }if(key === 'maxNumberofUEs' && !/^([1-9]\d{0,4}|100000)$/.test(val) && isNaN(val)){
+            this.validateRules[i] = true;
+            this.getRulesText('Only numbers can be entered','','',i);
+            return false
+        }else if(key === 'maxNumberofUEs' && !/^([1-9]\d{0,4}|100000)$/.test(val) && !isNaN(val)){
+            console.log("-----maxNumberofUEs")
+            this.validateRules[i] = true;
+            this.getRulesText('Scope: 1-100000','','',i);
+            return false
+        }else {
+            this.validateRules[i] = false;
+        }if((key === 'expDataRateDL' || key === 'expDataRateUL') && !/^([1-9]\d{2}|[1-3]\d{3}|3000)$/.test(val) && isNaN(val)){
+            this.validateRules[i] = true;
+            this.getRulesText('Only numbers can be entered','','',i);
+            return false
+        }else if((key === 'expDataRateDL' || key === 'expDataRateUL') && !/^([1-9]\d{2}|[1-3]\d{3}|3000)$/.test(val) && !isNaN(val)){
+            this.validateRules[i] = true;
+            this.getRulesText('Scope: 100-3000','','',i);
+            return false
+        }else {
+            this.validateRules[i] = false;
+        }if(key === 'latency' && !/^1[0-9]$|^[2-9]\d$|^1\d{2}$|^200$/.test(val) && isNaN(val)){
+            this.validateRules[i] = true;
+            this.getRulesText('Only numbers can be entered','','',i);
+            return false
+        }else if(key === 'latency' && !/^1[0-9]$|^[2-9]\d$|^1\d{2}$|^200$/.test(val) && !isNaN(val)){
+            this.validateRules[i] = true;
+            this.getRulesText('Scope: 10-200','','',i);
+            return false
+        }else {
+            this.validateRules[i] = false;
+        }if(key === 'useInterval' && !/^[1-9]\d*$/.test(val) && isNaN(val)){
+            this.validateRules[i] = true;
+            this.getRulesText('Only numbers can be entered','','',i);
+            return false
+        }else if(key === 'useInterval' && !/^[1-9]\d*$/.test(val) && !isNaN(val)){
+            this.validateRules[i] = true;
+            this.getRulesText('Scope: >=1','','',i);
+            return false
+        }else {
+            this.validateRules[i] = false;
+        }
+    }
+
     handleOk(): void {
+        Object.keys(this.slicing_order_info).forEach((item,index)=>{
+            this.validator(item,this.slicing_order_info[item],index)
+        });
+        if(this.validateRules.indexOf(true)>-1){
+            return
+        };
             const coverage_list: string[] = [];
             this.areaList.forEach( item => {
                 let str: string = '';
index 9c039c6..8d7e13b 100644 (file)
@@ -57,9 +57,9 @@
             <div class="action-icon">
               <i [ngClass]="{'cannotclick': data.last_operation_type && data.last_operation_progress && data.last_operation_progress !== '100' && (data.last_operation_type !== 'DELETE' || data.order_status==='activated')}"
                  nz-icon nzType="poweroff" nzTheme="outline" class="anticon anticon-poweroff"
-                 (click)="terminate(data)"></i>
+                 (click)="terminate(data,i)"></i>
               <nz-progress
-                      *ngIf="data.last_operation_type && data.last_operation_progress && data.last_operation_progress !== '100' && terminateStart"
+                      *ngIf="data.last_operation_type && data.last_operation_progress && data.last_operation_progress !== '100' && terminateStart[i]"
                       [nzPercent]="data.last_operation_progress" [nzShowInfo]="false" nzStatus="active">
               </nz-progress>
             </div>
index 76f0bcd..766f9ed 100644 (file)
@@ -36,14 +36,14 @@ export class CsmfSlicingBusinessManagementComponent implements OnInit {
     statusOptions: any[] = BUSINESS_STATUS;
     // isSelect: boolean = false;
     progressingTimer: any[] = [];
-    terminateStart: boolean = false;
+    terminateStart:  any[] = [];
     businessOrderShow: boolean = false;
     getCSMFBusinessList() {
         this.loading = true;
         // this.isSelect = false;
         this.listOfData = [];
         let paramsObj = {
-            status: this.selectedValue,
+            status: this.selectedValue.toLocaleLowerCase(),
             pageNo: this.pageIndex,
             pageSize: this.pageSize
         };
@@ -66,7 +66,8 @@ export class CsmfSlicingBusinessManagementComponent implements OnInit {
                             let obj = {
                                 serviceId: item.order_id
                             };
-                            if (item.last_operation_type === 'DELETE') this.terminateStart = true;
+                            if (item.last_operation_type === 'DELETE') this.terminateStart[index] = true
+                            else this.terminateStart[index] = false;
                             this.queryProgress(obj, index, updata).then((res) => {
                                 item.last_operation_progress = '100';
                                 this.getCSMFBusinessList();
@@ -143,14 +144,14 @@ export class CsmfSlicingBusinessManagementComponent implements OnInit {
         })
     }
 
-    terminate(slicing) {
+    terminate(slicing,index) {
         console.log(slicing, "slicing");
         this.modalService.confirm({
             nzTitle: 'Are you sure you want to terminate this task?',
             nzContent: '<b>Name:&nbsp;</b>' + slicing.order_name,
             nzOnOk: () => {
                 let paramsObj = { serviceId: slicing.order_id };
-                this.terminateStart = true;
+                this.terminateStart[index] = true;
                 this.loading = true;
                 this.myhttp.terminateSlicingService(paramsObj).subscribe(res => {
                     const { result_header: { result_code, result_message }, result_body: { operation_id } } = res;
@@ -158,11 +159,11 @@ export class CsmfSlicingBusinessManagementComponent implements OnInit {
                     if (+result_code === 200) {
                         this.getCSMFBusinessList();
                     } else {
-                        this.terminateStart = false;
+                        this.terminateStart[index] = false;
                     }
                 }, () => {
                     this.loading = false;
-                    this.terminateStart = false;
+                    this.terminateStart[index] = false;
                 })
             },
             nzCancelText: 'No',
index 1de1378..6d55ea1 100644 (file)
@@ -1,7 +1,7 @@
 <nz-tabset (nzSelectChange)="handleTabChange($event)" class="slicing">
-    <nz-tab nzTitle="communication Service">
+    <nz-tab nzTitle="Communication Service">
         <app-csmf-slicing-business-management
-                *ngIf="currentTab ==='communication Service'"
+                *ngIf="currentTab ==='Communication Service'"
         ></app-csmf-slicing-business-management>
     </nz-tab>
   <nz-tab nzTitle="Slicing Task Management">
index 597e4ee..0520824 100644 (file)
@@ -15,7 +15,7 @@ export class SlicingManagementComponent implements OnInit {
 
   ngOnInit() {
   }
-    currentTab = 'communication Service';
+    currentTab = 'Communication Service';
     handleTabChange($event): void {
         console.log($event,"$event");
         this.currentTab = $event.tab._title;
index 203df8a..6ac2941 100644 (file)
@@ -37,7 +37,7 @@ export class NsiTableComponent implements OnInit {
             pageSize: this.pageSize
         };
         if(this.selectedValue !== BUSINESS_STATUS[0]){
-            paramsObj["instanceStatus"] = this.selectedValue;
+            paramsObj["instanceStatus"] = this.selectedValue.toLocaleLowerCase();
             this.isSelect = true;
         }
         this.myhttp.getSlicingNsiList(paramsObj,this.isSelect).subscribe (res => {
index a6e00b4..5e90bce 100644 (file)
@@ -37,7 +37,7 @@ export class NssiTableComponent implements OnInit {
             pageSize: this.pageSize
         };
         if(this.selectedValue !== BUSINESS_STATUS[0]){
-            paramsObj["instanceStatus"] = this.selectedValue;
+            paramsObj["instanceStatus"] = this.selectedValue.toLocaleLowerCase();
             this.isSelect = true;
         }
         this.myhttp.getSlicingNssiList(paramsObj,this.isSelect).subscribe (res => {
index 8bce1cd..14c51f1 100644 (file)
@@ -53,7 +53,7 @@
                             <div class="action-icon">
                                 <i [ngClass]="{'cannotclick': data.last_operation_type && data.last_operation_progress && data.last_operation_progress !== '100' && (data.last_operation_type !== 'DELETE' || data.orchestration_status==='activated')}"
                                     nz-icon nzType="poweroff" nzTheme="outline" class="anticon anticon-poweroff"
-                                    (click)="terminate(data)"></i>
+                                    (click)="terminate(data,i)"></i>
                                 <nz-progress
                                     *ngIf="data.last_operation_type && data.last_operation_progress && data.last_operation_progress !== '100' && terminateStart"
                                     [nzPercent]="data.last_operation_progress" [nzShowInfo]="false" nzStatus="active">
index 23b8360..fc07efc 100644 (file)
@@ -35,7 +35,7 @@ export class SlicingBusinessTableComponent implements OnInit {
     isSelect: boolean = false;
     statusOptions: any[] = BUSINESS_STATUS;
     progressingTimer: any[] = [];
-    terminateStart: boolean = false;
+    terminateStart: any[] = [];
     @ViewChild('notification') notification1: any;
 
     getBusinessList(): void {
@@ -47,7 +47,7 @@ export class SlicingBusinessTableComponent implements OnInit {
             pageSize: this.pageSize
         };
         if (this.selectedValue !== BUSINESS_STATUS[0]) {
-            paramsObj["businessStatus"] = this.selectedValue;
+            paramsObj["businessStatus"] = this.selectedValue.toLocaleLowerCase();
             this.isSelect = true;
         }
         this.myhttp.getSlicingBusinessList(paramsObj, this.isSelect).subscribe(res => {
@@ -64,7 +64,8 @@ export class SlicingBusinessTableComponent implements OnInit {
                             let obj = {
                                 serviceId: item.service_instance_id
                             };
-                            if (item.last_operation_type === 'DELETE') this.terminateStart = true;
+                            if (item.last_operation_type === 'DELETE') this.terminateStart[index] = true
+                            else this.terminateStart[index] = false;
                             this.queryProgress(obj, item.orchestration_status, index, updata).then((res) => {
                                 item.last_operation_progress = '100';
                                 this.getBusinessList();
@@ -140,14 +141,14 @@ export class SlicingBusinessTableComponent implements OnInit {
             this.getBusinessList();
         })
     }
-    terminate(slicing) {
+    terminate(slicing,index) {
         this.modalService.confirm({
             nzTitle: 'Do you Want to terminate slicing business?',
             nzContent: '<b>Name:&nbsp;</b>' + slicing.service_instance_name,
             nzOnOk: () => {
                 this.notification1.notificationStart('slicing business', 'terminate', slicing.service_instance_id);
                 let paramsObj = { serviceId: slicing.service_instance_id };
-                this.terminateStart = true;
+                this.terminateStart[index] = true;
                 this.loading = true;
                 this.myhttp.terminateSlicingService(paramsObj).subscribe(res => {
                     const { result_header: { result_code, result_message }, result_body: { operation_id } } = res;
@@ -157,12 +158,12 @@ export class SlicingBusinessTableComponent implements OnInit {
                         this.getBusinessList();
                     } else {
                         this.notification1.notificationFailed('slicing business', 'terminate', slicing.service_instance_id);
-                        this.terminateStart = false;
+                        this.terminateStart[index] = false;
                     }
                 }, () => {
                     this.loading = false;
                     this.notification1.notificationFailed('slicing business', 'terminate', slicing.service_instance_id);
-                    this.terminateStart = false;
+                    this.terminateStart[index] = false;
                 })
             },
             nzCancelText: 'No',
index 8973f18..b7842f4 100644 (file)
@@ -243,7 +243,7 @@ export const ADDRESS = [
        }\r
 ]\r
 export const BUSINESS_STATUS = [\r
-       "All", "activated", "deactivated"\r
+       "All", "Activated", "Deactivated"\r
 ]\r
 \r
 export const COMMUNICATION_FORM_ITEMS = [\r