e2eService Scale finsh 37/71937/1
authorguochuyicmri <guochuyi@chinamobile.com>
Tue, 6 Nov 2018 11:21:32 +0000 (19:21 +0800)
committerguochuyicmri <guochuyi@chinamobile.com>
Tue, 6 Nov 2018 11:22:06 +0000 (19:22 +0800)
Change-Id: Ib7e5e792c6434a832bc120295888f78af555f4b6
Issue-ID: USECASEUI-163
Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
usecaseui-portal/src/app/myhttp.service.ts
usecaseui-portal/src/app/services/services-list/services-list.component.css
usecaseui-portal/src/app/services/services-list/services-list.component.html
usecaseui-portal/src/app/services/services-list/services-list.component.less
usecaseui-portal/src/app/services/services-list/services-list.component.ts

index b2ab91b..45cb895 100644 (file)
@@ -52,6 +52,8 @@ export class MyhttpService {
   //   vnfInfo: this.baseUrl + "/vnfInfo.json?",
   //   progress:this.baseUrl + "/progress.json?",
   //   nsProgress:this.baseUrl + "nsProgress.json?",
+  //   e2eScale:this.baseUrl + "/e2eScale.json?",
+  //   e2e_nsdata:this.baseUrl + "/e2e_nsdata.json?",
 
   //   allottedResource:this.baseUrl + "/allotted-resources2.json?",
   //   pnfDetail:this.baseUrl + "/pnfdetail-domain.json?",
@@ -89,6 +91,8 @@ export class MyhttpService {
     vnfInfo: this.baseUrl + "/uui-lcm/VnfInfo/",
     progress:this.baseUrl + "/uui-lcm/services/" + "*_*" + "/operations/",
     nsProgress:this.baseUrl + "/uui-lcm/jobs/getNsLcmJobStatus/"+ "*_*" + "?responseId=",
+    e2eScale: this.baseUrl + "/services/scaleServices/",
+    e2e_nsdata: this.baseUrl + "/getServiceInstanceById/customerId/",
 
     allottedResource:this.baseUrl + "/uui-sotn/getAllottedResources",
     pnfDetail:this.baseUrl + "/uui-sotn/getPnfInfo/",
@@ -219,6 +223,16 @@ export class MyhttpService {
     return this.http.post<any>(this.url.ns_healService + id,requestBody);
   }
 
+  // scale
+  scaleE2eService(id,requestBody){
+    // return this.http.get<any>(this.url.e2eScale + id);  
+    return this.http.post<any>(this.url.e2eScale + id,requestBody);
+  }
+  getE2e_nsData(paramsObj){
+    let params = new HttpParams({fromObject:paramsObj});
+    return this.http.get<any>(this.url.e2e_nsdata,{params});
+  }
+
   // Query progress interface
   getProgress(obj){
     let url = this.url.progress.replace("*_*",obj.serviceId) + obj.operationId;
index 1f9d051..1579383 100644 (file)
@@ -96,7 +96,7 @@ hr {
   font-size: 12px;
   color: green;
 }
-.list nz-table tbody td span.stopping {
+.list nz-table tbody td span.scaling {
   font-size: 12px;
   color: purple;
 }
index 616d5b3..fa875c0 100644 (file)
             <td>
               <span [ngClass]="{'active':data.status=='Active','closed':data.status=='Closed','onboarding':data.status=='Onboarding',
                     'updating':data.status=='Updating','deleting':data.status=='Deleting','creating':data.status=='Creating',
-                    'stopping':data.status=='Stopping','healing':data.status=='Healing'}">{{data.status || "Active"}}</span>
-              <nz-progress *ngIf="data.status == 'Creating' || data.status == 'Deleting' ||  data.status == 'Stopping' || data.status == 'Healing' " [nzPercent]="data.rate"></nz-progress>
+                    'scaling':data.status=='Scaling','healing':data.status=='Healing'}">{{data.status || "Active"}}</span>
+              <nz-progress *ngIf="data.status == 'Creating' || data.status == 'Deleting' ||  data.status == 'Scaling' || data.status == 'Healing' " [nzPercent]="data.rate"></nz-progress>
             </td>
             <td>
-              <i [ngClass]="{'cannotclick':data.status=='Deleting'||data.status=='Creating'||data.status=='Healing'}"
-                *ngIf="data.serviceDomain=='E2E Service'||data.serviceDomain=='Network Service' " class="anticon anticon-setting" (click)="scaleService(data)"></i>
+              <i [ngClass]="{'cannotclick':data.status=='Deleting'||data.status=='Creating'||data.status=='Scaling'}"
+                *ngIf="data.serviceDomain=='E2E Service' " class="anticon anticon-setting" (click)="scaleService(data)"></i>
               <!-- <i *ngIf="data.serviceDomain=='E2E Service'||data.serviceDomain=='Network Service' " class="anticon anticon-cloud-upload-o" (click)="updataService(data)"></i> -->
               <i [ngClass]="{'cannotclick':data.status=='Deleting'||data.status=='Creating'||data.status=='Healing'}" 
                 *ngIf="data.serviceDomain=='Network Service' " class="anticon anticon-reload" (click)="healService(data)"></i>
               <i *ngIf="data.serviceDomain=='SOTN'||data.serviceDomain=='CCVPN' " class="anticon anticon-ellipsis" (click)="serviceDetail(data)"></i>
-              <i [ngClass]="{'cannotclick':data.status=='Deleting'||data.status=='Creating'||data.status=='Healing'}"  class="anticon anticon-delete" (click)="deleteModel(data)"></i>
+              <i [ngClass]="{'cannotclick':data.status=='Deleting'||data.status=='Creating'||data.status=='Healing'||data.status=='Scaling'}"  class="anticon anticon-delete" (click)="deleteModel(data)"></i>
             </td>
           </tr>
           <tr class="childtr" [nzExpand]="data.expand" *ngFor="let item of data.childServiceInstances">
         </ng-template>
       </tbody>
     </nz-table>
+
+    <nz-modal [nzVisible]="scaleModelVisible" nzTitle="Scale" (nzOnCancel)="scaleCancel()" (nzOnOk)="scaleOk()">
+      <h3><i class="anticon anticon-question-circle" style="color:yellow;"></i>Are you sure heal this instance?</h3>
+      Instance ID: <b style="color:green"> {{ thisService["service-instance-id"] || thisService["nsInstanceId"] || thisService["vnfInstanceId"]}}</b>
+      <div *ngFor="let item of e2e_nsData">
+        <h3>{{ item.netWorkServiceName }}</h3><hr>
+        <span style="display:inline-block;width:50%;">Scale Type:</span>
+        <nz-select style="width: 165px;" [(ngModel)]="item.scaleType">
+          <nz-option nzValue="SCALE_NS" nzLabel="SCALE_NS"></nz-option>
+          <nz-option nzValue="SCALE_VNF" nzLabel="SCALE_VNF"></nz-option>
+        </nz-select>
+        <span style="display:inline-block;width:50%;">AspectId:</span>
+        <input style="width: 165px;" nz-input [(ngModel)]="item.aspectId" placeholder="string">
+        <span style="display:inline-block;width:50%;">Number Of Steps:</span>
+        <nz-input-number style="width: 165px;" [(ngModel)]="item.numberOfSteps" [nzMin]="1" [nzMax]="100" nzPrecision=0 [nzStep]="1" nzPlaceHolder="number"></nz-input-number>
+        <span style="display:inline-block;width:50%;">Scaling Direction:</span>
+        <nz-select style="width: 165px;" nzPlaceHolder="Chose" [(ngModel)]="item.scalingDirection">
+          <nz-option nzValue="SCALE_IN" nzLabel="SCALE_IN"></nz-option>
+          <nz-option nzValue="SCALE_OUT" nzLabel="SCALE_OUT"></nz-option>
+        </nz-select>
+      </div>
+    </nz-modal>
     <nz-modal [(nzVisible)]="deleteModelVisible" nzTitle="Delete" (nzOnCancel)="deleteCancel()" (nzOnOk)="deleteOk()">
       <h3><i class="anticon anticon-question-circle" style="color:yellow;"></i>Are you sure delete this instance?</h3>
       Instance ID: <b class="deleteModelContent"> {{ thisService["service-instance-id"] || thisService["nsInstanceId"] }}</b>
index 3d9962d..40c0023 100644 (file)
@@ -99,7 +99,7 @@ hr {
                     font-size: 12px;
                     color: green;
                 }
-                span.stopping {
+                span.scaling {
                     font-size: 12px;
                     color: purple;
                 }
index 9da7cf9..373583e 100644 (file)
@@ -167,9 +167,49 @@ export class ServicesListComponent implements OnInit {
   }
 
   thisService = {};  //The current service of the operation
-  scaleService(){
-    console.log("scaleService!");
+  e2e_nsData:Object[];
+  scaleModelVisible = false;
+  scaleService(service){
+    this.thisService = service;
+    this.scaleModelVisible = true;
+    let paramsObj = {
+      customerId:this.customerSelected.id,
+      serviceType:this.serviceTypeSelected.name,
+      serviceId:service["service-instance-id"]
+    }
+    this.myhttp.getE2e_nsData(paramsObj)
+      .subscribe((data)=>{
+        this.e2e_nsData = data;
+      })
+  }
+  scaleOk(){
+    this.scaleModelVisible = false;
+    let requestBody = {
+      "service": {
+        "serviceInstanceName": this.thisService["service-instance-name"],
+        "serviceType": this.serviceTypeSelected.name,
+        "globalSubscriberId": this.customerSelected.id,
+        "resources": this.e2e_nsData.map((item)=>{
+          return {
+            "resourceInstanceId": item["netWorkServiceId"],
+            "scaleType": item["scaleType"],
+            "scaleNsData": {
+              "scaleNsByStepsData": {
+                "aspectId": item["aspectId"],
+                "numberOfSteps": item["numberOfSteps"],
+                "scalingDirection": item["scalingDirection"]
+              }
+            }
+          }
+        })
+      }
+    }
+    this.scaleE2eService(this.thisService,requestBody);
   }
+  scaleCancel(){
+    this.scaleModelVisible = false;
+  }
+  
   updataService(){
     console.log("updataService!");
   }
@@ -511,6 +551,26 @@ export class ServicesListComponent implements OnInit {
     return mypromise;
   }
 
+  scaleE2eService(service,requestBody){
+    let id = service["service-instance-id"];
+    service.rate = 0;
+    service.status = "Scaling";
+    this.myhttp.scaleE2eService(id,requestBody)
+      .subscribe((data)=>{
+        let obj = {
+          serviceId:id,
+          operationId:data.operationId
+        }
+        let updata = (prodata)=>{
+          service.rate = prodata.progress;
+        }
+        this.queryProgress(obj,updata).then(()=>{
+          service.rate = 100;
+          service.status = "Active";
+        })
+      })
+  }
+
   healNsVnfService(service,requestBody){
     console.log(service);
     service.rate = 0;