fix: fix the bug of loading 99/119799/1
authorwangyuerg <wangyuerg@chinamobile.com>
Thu, 25 Mar 2021 09:26:37 +0000 (17:26 +0800)
committerwangyuerg <wangyuerg@chinamobile.com>
Thu, 25 Mar 2021 09:27:39 +0000 (17:27 +0800)
Signed-off-by: wangyuerg <wangyuerg@chinamobile.com>
Change-Id: Id63f6fbd3e831af9c9216d505f546436648e087a
Issue-ID: USECASEUI-527

usecaseui-portal/src/app/mock/json/tn_connectionLinkTable.json
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts

index dbb4637..9111606 100644 (file)
@@ -4,7 +4,7 @@
         "result_message": "5Gslicingorderqueryresult."
     },
     "result_body": {
-        "record_number": 2,
+        "record_number": 4,
         "connection_links_list": [{
                 "linkId": "233errt4545",
                 "anInfo": {
                     "maxBandwidth": "2002",
                     "resourceSharingLevel": "shared2"
                 }
+            },
+            {
+                "linkId": "233errt4547",
+                "anInfo": {
+                    "ipAddress": "2.2.2.2",
+                    "logicId": "dff344442",
+                    "nextHop": "sddsweedffsdsssss2"
+                },
+                "cnInfo": {
+                    "ipAddress": "1.1.1.12",
+                    "logicId": "dff344442",
+                    "nextHop": "sddsweedffsdsssss2"
+                },
+                "properties": {
+                    "latency": "202",
+                    "jitter": "dffd2",
+                    "maxBandwidth": "2002",
+                    "resourceSharingLevel": "shared2"
+                }
+            },
+            {
+                "linkId": "233errt4548",
+                "anInfo": {
+                    "ipAddress": "2.2.2.2",
+                    "logicId": "dff344442",
+                    "nextHop": "sddsweedffsdsssss2"
+                },
+                "cnInfo": {
+                    "ipAddress": "1.1.1.12",
+                    "logicId": "dff344442",
+                    "nextHop": "sddsweedffsdsssss2"
+                },
+                "properties": {
+                    "latency": "202",
+                    "jitter": "dffd2",
+                    "maxBandwidth": "2002",
+                    "resourceSharingLevel": "shared2"
+                }
             }
         ]
     }
index 711a135..224be55 100644 (file)
                                        </nz-input-group>
                                        <!-- connection links table -->
                                        <div *ngIf="item.type==='table-radio'">
-                                               <nz-table #basicTable [nzLoading]="loading" [nzData]="connectionLinkTable" nzShowPagination="true"
-                                                       [nzPageSize]="pageSize" (nzPageIndexChange)="pageIndexChange($event)"
-                                                       nzFrontPagination="false" [nzTotal]="recordNum">
+                                               <nz-table #basicTable [nzLoading]="loading" [nzLoadingDelay]="loadingDelay"
+                                                       [nzData]="connectionLinkTable" nzShowPagination="true" [nzPageSize]="pageSize"
+                                                       (nzPageIndexChange)="pageIndexChange($event)" nzFrontPagination="false"
+                                                       [nzTotal]="recordNum">
                                                        <thead>
                                                                <tr>
                                                                        <th *ngFor="let val of connectionTableHeader" class="subnet_td">{{val}}</th>
index 3db1933..2d2dd7f 100644 (file)
@@ -49,8 +49,9 @@ export class SubnetParamsModelComponent implements OnInit {
        connectionTableHeader: string[] = [];
        pageSize: number = 2;
        recordNum: number = 0;
-       hasPageNo: number[] = [];
+       // hasPageNo: number[] = [];
        loading = false;
+       loadingDelay = 100;
        objectKeys = Object.keys;
        //  Comment: Above code
 
@@ -129,14 +130,15 @@ export class SubnetParamsModelComponent implements OnInit {
        }
 
        addCheckStatus() {
-               if(this.connectionLinkTable && this.connectionLinkTable.length>0){
+               if (this.connectionLinkTable && this.connectionLinkTable.length > 0) {
                        this.connectionLinkTable.forEach((item) => {
                                if (
                                        item.hasOwnProperty("linkId") &&
                                        typeof this.formData["sliceProfile_TN_connection_links"] !==
                                                "undefined" &&
                                        this.formData["sliceProfile_TN_connection_links"] !== "" &&
-                                       this.formData["sliceProfile_TN_connection_links"] !== null &&
+                                       this.formData["sliceProfile_TN_connection_links"] !==
+                                               null &&
                                        item["linkId"] ===
                                                this.formData["sliceProfile_TN_connection_links"]
                                ) {
@@ -171,7 +173,7 @@ export class SubnetParamsModelComponent implements OnInit {
                        .then((res) => {
                                if (pageNo === 1) {
                                        // the first page
-                                       this.loading = false
+                                       this.loading = false;
                                        this.connectionLinkTable =
                                                res.result_body.connection_links_list;
                                        this.recordNum = res.result_body.record_number;
@@ -195,7 +197,7 @@ export class SubnetParamsModelComponent implements OnInit {
                                        //              this.connectionLinkTable.push(defaultItem);
                                        //      }
                                        // }
-                                       this.hasPageNo = [1];
+                                       // this.hasPageNo = [1];
                                } else if (pageNo > 1) {
                                        // delete the default page of the page and add the actual data of the page
                                        // const startIndex = pageSize * (pageNo - 1);
@@ -213,8 +215,9 @@ export class SubnetParamsModelComponent implements OnInit {
                                        this.connectionLinkTable =
                                                res.result_body.connection_links_list;
                                        this.recordNum = res.result_body.record_number;
+                                       this.loading = false;
                                }
-                               this.hasPageNo.push(pageNo);
+                               // this.hasPageNo.push(pageNo);
                                this.addCheckStatus(); // add init check status for connection link table
                                this.judgeTn(); // init judge
                                this.getTableHeader();
@@ -223,40 +226,40 @@ export class SubnetParamsModelComponent implements OnInit {
 
        getTableHeader(): void {
                // Find the common key of all data
-               if(this.connectionLinkTable && this.connectionLinkTable.length>0){
-               let keyList: any[] = this.connectionLinkTable.map((item) => {
-                       return Object.keys(item);
-               });
-               this.connectionTableHeader = this.Util.intersection(keyList).filter(
-                       (item) => {
-                               return item !== "checked";
-                       }
-               );
-               // Filter redundant items in table data
-               this.connectionLinkTable.forEach((item) => {
-                       for (let key in item) {
-                               if (
-                                       key !== "linkId" &&
-                                       key !== "checked" &&
-                                       this.connectionTableHeader.indexOf(key) === -1
-                               ) {
-                                       delete item[key];
-                               } else {
-                                       // Filter out the null values in each item
-                                       for (let i in item[key]) {
-                                               if (
-                                                       i === "jitter" &&
-                                                       (item[key][i] === "" ||
-                                                               item[key][i] === "null" ||
-                                                               item[key][i] === null)
-                                               ) {
-                                                       delete item[key][i];
+               if (this.connectionLinkTable && this.connectionLinkTable.length > 0) {
+                       let keyList: any[] = this.connectionLinkTable.map((item) => {
+                               return Object.keys(item);
+                       });
+                       this.connectionTableHeader = this.Util.intersection(keyList).filter(
+                               (item) => {
+                                       return item !== "checked";
+                               }
+                       );
+                       // Filter redundant items in table data
+                       this.connectionLinkTable.forEach((item) => {
+                               for (let key in item) {
+                                       if (
+                                               key !== "linkId" &&
+                                               key !== "checked" &&
+                                               this.connectionTableHeader.indexOf(key) === -1
+                                       ) {
+                                               delete item[key];
+                                       } else {
+                                               // Filter out the null values in each item
+                                               for (let i in item[key]) {
+                                                       if (
+                                                               i === "jitter" &&
+                                                               (item[key][i] === "" ||
+                                                                       item[key][i] === "null" ||
+                                                                       item[key][i] === null)
+                                                       ) {
+                                                               delete item[key][i];
+                                                       }
                                                }
                                        }
                                }
-                       }
-               });
-          }
+                       });
+               }
        }
 
        pageIndexChange(e) {
@@ -270,10 +273,11 @@ export class SubnetParamsModelComponent implements OnInit {
        }
 
        judgeTn(): void {
-               console.log('fprm',this.formData)
+               console.log("fprm", this.formData);
                if (
                        this.formData["sliceProfile_TN_resourceSharingLevel"] ===
-                       "non-shared" || this.formData["sliceProfile_TN_resourceSharingLevel"]==null
+                               "non-shared" ||
+                       this.formData["sliceProfile_TN_resourceSharingLevel"] == null
                ) {
                        //:todo clear??
                        // this.connectionLinkTable.forEach((item) => {