Service instance topology front-end development 02/89002/1
authorguochuyicmri <guochuyi@chinamobile.com>
Fri, 31 May 2019 07:50:46 +0000 (15:50 +0800)
committerguochuyicmri <guochuyi@chinamobile.com>
Fri, 31 May 2019 07:50:53 +0000 (15:50 +0800)
Change-Id: I6b42ffa8dbaf3dd41a0543c35597dd52f1338e81
Issue-ID: USECASEUI-224
Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.html
usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts
usecaseui-portal/src/app/services/services-list/services-list.component.ts

index 8a3a73a..b8d0ce3 100644 (file)
@@ -30,7 +30,7 @@
     <div id="detailChart">
       <svg width="100%" height="100%" style="position: relative">
         <!--local domain-->
-        <g class="clouds">
+        <g class="clouds" *ngIf="vpns[0].domain!=''">
           <image xlink:href="./assets/images/domain1.png"
                  id="domain1"
                  width="14%"
@@ -51,7 +51,7 @@
           </text>
         </g>
         <!--domain1 tp-->
-        <g class="clouds">
+        <g class="clouds" *ngIf="vpns[0].sitetpname!=''">
           <image xlink:href="./assets/images/tp.png"
                  class="tp"
                  id="tp1"
@@ -62,7 +62,7 @@
             {{vpns[0].sitetpname}}
           </text>
         </g>
-        <g class="clouds">
+        <g class="clouds" *ngIf="vpns[0].othertpname!=''">
           <image xlink:href="./assets/images/tp.png"
                  class="tp"
                  id="tp2"
           </text>
         </g>
         <!--local site-->
-        <g class="clouds">
+        <g class="clouds" *ngIf="localSite.length>0">
           <image xlink:href="./assets/images/site.png"
                  id="site1"
                  height="59" width="100"
             {{localSite[0] && localSite[0]["service-instance-name"]}}
           </text>
         </g>
-        <g *ngIf="!detailSites" class="clouds">
+        <g *ngIf="!detailSites && localSite.length>0" class="clouds">
           <image xlink:href="./assets/images/site.png"
                  id="site2"
                  height="59" width="100"
           </text>
         </g>
         <!--cloud site-->
-        <g *ngIf="!detailSites" class="clouds">
+        <g *ngIf="!detailSites && outerSite.length>0" class="clouds">
           <image xlink:href="./assets/images/site.png"
                  id="site3"
                  height="59" width="100"
                  x="89%" y="10%"
           ></image>
           <text dx="90%" dy="7%" style="font-size: 14px; fill: #666;width: 20px;">
-            {{outerSite[1]["service-instance-name"]}}
+            {{outerSite[1] && outerSite[1]["service-instance-name"]}}
           </text>
         </g>
-        <g class="clouds">
+        <g class="clouds" *ngIf="outerSite.length>0">
           <image xlink:href="./assets/images/site.png"
                  id="site4"
                  height="59" width="100"
                  x="89%" y="40%"
           ></image>
           <text dx="90%" dy="37%" style="font-size: 14px; fill: #666;width: 20px;">
-            {{outerSite[0]["service-instance-name"]}}
+            {{outerSite[0] && outerSite[0]["service-instance-name"]}}
           </text>
         </g>
         <!--tp,site,domain---line -->
index c11b159..d0ef7d1 100644 (file)
@@ -87,7 +87,11 @@ export class CcvpnDetailComponent implements OnInit {
         console.log(this.detailParams)
         console.log(this.upDateShow)
         // this.input_parameters = JSON.stringify(this.detailParams['input-parameters'])
-        this.input_parameters = JSON.parse(this.detailParams['input-parameters']);
+        if(this.detailParams['input-parameters']){
+            this.input_parameters = JSON.parse(this.detailParams['input-parameters']);
+        }else {
+            return false;
+        }
         console.log(this.input_parameters);
         this.templateParameters.service = {
             name:  this.input_parameters.service.name,
@@ -557,6 +561,8 @@ export class CcvpnDetailComponent implements OnInit {
             console.log(this.localSite);
             console.log(this.outerSite);
 
+           if(this.localSite.length>0){
+               this.detailLines = [].concat(this.detailLiness);
             this.localSite.forEach((site)=>{
                 let obj = {
                     customerId: this.detailParams.customer.id,
@@ -571,6 +577,10 @@ export class CcvpnDetailComponent implements OnInit {
                         res("sites-domain");
                     })
             })
+           }else {
+               console.log("localSite []");
+               return false;
+           }
         })
     }
 
@@ -707,7 +717,8 @@ export class CcvpnDetailComponent implements OnInit {
     }
 
     detailSites = false;
-    detailLines = [ //Details of the topology map connection coordinates
+    detailLines = [];
+    detailLiness = [ //Details of the topology map connection coordinates
         {
             "x1": "9%", "y1": "40%", "x2": "21%", "y2": "40%"//site1--tp1
         },
index 959df39..5856442 100644 (file)
@@ -91,6 +91,7 @@ export class ServicesListComponent implements OnInit {
     }
   getallCustomers(){
     console.log(this.listSortMasters);
+    console.log(this.language,"this.language");
     this.myhttp.getAllCustomers()
       .subscribe((data)=>{
         this.customerList = data.map((item)=>{return {name:item["subscriber-name"],id:item["global-customer-id"]}});
@@ -613,6 +614,7 @@ export class ServicesListComponent implements OnInit {
   }
 deleteOk(templatedeletestarting,templateDeleteSuccessFaild) {
         this.deleteModelVisible = false;
+        this.loadingAnimateShow = true;
         if (this.thisService["serviceDomain"] == "Network Service") {
             this.deleteNsService(this.thisService,templateDeleteSuccessFaild);
         } else {
@@ -657,6 +659,7 @@ deleteOk(templatedeletestarting,templateDeleteSuccessFaild) {
     }
     this.createshow = false;
         this.listDisplay = false;
+      this.loadingAnimateShow = true;
     console.log(obj);
     let newData; //Newly created service data for the main table
 
@@ -664,7 +667,8 @@ deleteOk(templatedeletestarting,templateDeleteSuccessFaild) {
             "&serviceType=" + this.serviceTypeSelected2.name +
             "&serviceDomain=" + this.templateTypeSelected;
         this.createService(obj, createParams,templateCreatestarting,templateCreateSuccessFaild).then((data) => {
-            console.log(data)
+            console.log(data);
+            this.loadingAnimateShow = false;
             newData = {  //Newly created service data in the main form
                 'service-instance-id': data["serviceId"],
                 'service-instance-name': obj.service.name,
@@ -721,6 +725,7 @@ e2eCloseCreate(obj,templateCreatestarting,templateCreateSuccessFaild) {
     }
     this.createshow2 = false; //
     this.listDisplay = false; //
+    this.loadingAnimateShow = true;
     console.log(obj);
     let newData; //
     let   createParams = "?customerId="+this.customerSelected.id +
@@ -731,6 +736,7 @@ e2eCloseCreate(obj,templateCreatestarting,templateCreateSuccessFaild) {
                         "&invariantUuuid="+obj.service.serviceInvariantUuid;
         this.createService(obj, createParams,templateCreatestarting,templateCreateSuccessFaild).then((data) => {
       console.log(data);
+        this.loadingAnimateShow = false;
       newData = {  //
         'service-instance-id':data["serviceId"],
         'service-instance-name':obj.service.name,
@@ -786,12 +792,14 @@ e2eCloseCreate(obj,templateCreatestarting,templateCreateSuccessFaild) {
     }
     this.createshow2 = false; //
     this.listDisplay = false; //
+    this.loadingAnimateShow = true;
     console.log(obj);
     let newData; //
     // step1
     this.myhttp.nsCreateInstance(obj.step1)
     .subscribe((data)=>{
       // console.log(data);
+        this.loadingAnimateShow = false;
       newData = {  //
         'service-instance-id':data.nsInstanceId,
         'service-instance-name':obj.step1.nsName,
@@ -873,6 +881,7 @@ e2eCloseCreate(obj,templateCreatestarting,templateCreateSuccessFaild) {
       this.myhttp.createInstance(requestBody,createParams)
         .subscribe((data)=>{
           if(data.status == "FAILED"){
+            this.loadingAnimateShow = false;
             res("Failed");
             console.log("create e2e service Failed :" + JSON.stringify(data));
             return false;
@@ -887,6 +896,7 @@ e2eCloseCreate(obj,templateCreatestarting,templateCreateSuccessFaild) {
       this.myhttp.nsCreateInstance2(id,obj)
         .subscribe((data)=>{
           if(data.status == "FAILED"){
+              this.loadingAnimateShow = false;
             console.log("instantiate ns service Failed :" + JSON.stringify(data));
             res("Failed");
             return false;
@@ -1075,6 +1085,7 @@ e2eCloseCreate(obj,templateCreatestarting,templateCreateSuccessFaild) {
       return new Promise((res,rej)=>{
         this.myhttp.deleteInstance(params)
         .subscribe((data)=>{
+            this.loadingAnimateShow = false;
           if(data.status == "FAILED"){
             console.log("delete service Failed :" + JSON.stringify(data));
             service.status = "Failed";
@@ -1186,6 +1197,7 @@ e2eCloseCreate(obj,templateCreatestarting,templateCreateSuccessFaild) {
     let mypromise = new Promise((res,rej)=>{
       this.myhttp.stopNsService(id,obj)
         .subscribe((data)=>{
+            this.loadingAnimateShow = false;
           if(data.status == "FAILED"){
             console.log("stop ns service Failed :" + JSON.stringify(data));
             res("Failed");