fix: Simplify Pagination 13/117613/1
authorwangyuerg <wangyuerg@chinamobile.com>
Mon, 8 Feb 2021 10:25:45 +0000 (18:25 +0800)
committerwangyuerg <wangyuerg@chinamobile.com>
Mon, 8 Feb 2021 10:27:06 +0000 (18:27 +0800)
Signed-off-by: wangyuerg <wangyuerg@chinamobile.com>
Change-Id: Ibb2619b2bf5bb801581bb2a2199af7d4ecfbc5c7
Issue-ID: USECASEUI-527

usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/constants.ts
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 5f8c384..0e0e550 100644 (file)
@@ -42,7 +42,7 @@ export const TRANSFRER_FORM_ITEMS = [
                title: "Resource Sharing Level", // select
                key: "sliceProfile_TN_resourceSharingLevel", // :new
                required: true,
-               disable: false,
+               disable: true,
                type: "radio",
                options: [
                        {
index 37e5db5..b496349 100644 (file)
@@ -12,7 +12,7 @@
                                        <input nz-input [(ngModel)]="formData[item.key]" [name]="item.key" [id]="item.key"
                                                [disabled]="item.disable" [placeholder]="inputHolder(item.title)" *ngIf="item.type==='input'" />
                                        <nz-radio-group [name]=" item.key" [(ngModel)]="formData[item.key]" *ngIf="item.type==='radio'"
-                                               (ngModelChange)="changeResourceShare()">
+                                               [disabled]="item.disable">
                                                <label nz-radio [nzValue]="option.key" *ngFor="let option of item.options">
                                                        {{ option.title }}
                                                </label>
@@ -58,7 +58,8 @@
                                        <!-- connection links table -->
                                        <div *ngIf="item.type==='table-radio'">
                                                <nz-table #basicTable [nzData]="connectionLinkTable" nzShowPagination="true"
-                                                       [nzPageSize]="pageSize" (nzPageIndexChange)="pageIndexChange($event)">
+                                                       [nzPageSize]="pageSize" (nzPageIndexChange)="pageIndexChange($event)"
+                                                       nzFrontPagination="false" [nzTotal]="recordNum">
                                                        <thead>
                                                                <tr>
                                                                        <th *ngFor="let val of connectionTableHeader" class="subnet_td">{{val}}</th>
index 636fd9e..c9836c9 100644 (file)
@@ -142,9 +142,9 @@ export class SubnetParamsModelComponent implements OnInit {
                });
        }
 
-       changeResourceShare() {
-               this.judgeTn();
-       }
+       // changeResourceShare() {
+       //      this.judgeTn();
+       // }
 
        isObject(val) {
                if (Object.prototype.toString.call(val) === "[object Object]") {
@@ -168,40 +168,43 @@ export class SubnetParamsModelComponent implements OnInit {
                                                res.result_body.connection_links_list;
                                        this.recordNum = res.result_body.record_number;
                                        // Use default value to occupy
-                                       let defaultItem: object = {};
-                                       if (this.connectionLinkTable.length !== 0) {
-                                               defaultItem = JSON.parse(
-                                                       JSON.stringify(this.connectionLinkTable[0])
-                                               );
-                                               for (let key in defaultItem) {
-                                                       if (!this.isObject(defaultItem[key])) {
-                                                               defaultItem[key] = "";
-                                                       }
-                                                       // else {
-                                                       //      for (let i in defaultItem[key]) {
-                                                       //              defaultItem[key][i] = "";
-                                                       //      }
-                                                       // }
-                                               }
-                                               for (let i = pageSize; i < this.recordNum; i++) {
-                                                       this.connectionLinkTable.push(defaultItem);
-                                               }
-                                       }
+                                       // let defaultItem: object = {};
+                                       // if (this.connectionLinkTable.length !== 0) {
+                                       //      defaultItem = JSON.parse(
+                                       //              JSON.stringify(this.connectionLinkTable[0])
+                                       //      );
+                                       //      for (let key in defaultItem) {
+                                       //              if (!this.isObject(defaultItem[key])) {
+                                       //                      defaultItem[key] = "";
+                                       //              }
+                                       //              // else {
+                                       //              //      for (let i in defaultItem[key]) {
+                                       //              //              defaultItem[key][i] = "";
+                                       //              //      }
+                                       //              // }
+                                       //      }
+                                       //      for (let i = pageSize; i < this.recordNum; i++) {
+                                       //              this.connectionLinkTable.push(defaultItem);
+                                       //      }
+                                       // }
                                        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);
-                                       const endIndex = startIndex + pageSize - 1;
-                                       this.connectionLinkTable.splice(startIndex, pageSize);
-                                       const frontArr = this.connectionLinkTable.slice(
-                                               0,
-                                               startIndex
-                                       );
-                                       const backArr = this.connectionLinkTable.slice(startIndex);
-                                       this.connectionLinkTable = frontArr.concat(
-                                               res.result_body.connection_links_list,
-                                               backArr
-                                       );
+                                       // const startIndex = pageSize * (pageNo - 1);
+                                       // const endIndex = startIndex + pageSize - 1;
+                                       // this.connectionLinkTable.splice(startIndex, pageSize);
+                                       // const frontArr = this.connectionLinkTable.slice(
+                                       //      0,
+                                       //      startIndex
+                                       // );
+                                       // const backArr = this.connectionLinkTable.slice(startIndex);
+                                       // this.connectionLinkTable = frontArr.concat(
+                                       //      res.result_body.connection_links_list,
+                                       //      backArr
+                                       // );
+                                       this.connectionLinkTable =
+                                               res.result_body.connection_links_list;
+                                       this.recordNum = res.result_body.record_number;
                                }
                                this.hasPageNo.push(pageNo);
                                this.addCheckStatus(); // add init check status for connection link table
@@ -248,9 +251,9 @@ export class SubnetParamsModelComponent implements OnInit {
 
        pageIndexChange(e) {
                // judge whether there is data of the page, if not, request it from the back end
-               if (this.hasPageNo.indexOf(e) === -1) {
-                       this.getConnectionLinkTable(e, this.pageSize);
-               }
+               // if (this.hasPageNo.indexOf(e) === -1) {
+               this.getConnectionLinkTable(e, this.pageSize);
+               // }
        }
        getConnetionFailed() {
                console.log("failed");
@@ -261,10 +264,11 @@ export class SubnetParamsModelComponent implements OnInit {
                        this.formData["sliceProfile_TN_resourceSharingLevel"] ===
                        "non-shared"
                ) {
-                       this.connectionLinkTable.forEach((item) => {
-                               item.checked = false;
-                       });
-                       this.formData["tn_connection_links"] = null;
+                       //:todo clear??
+                       // this.connectionLinkTable.forEach((item) => {
+                       //      item.checked = false;
+                       // });
+                       // this.formData["tn_connection_links"] = null;
                        this.notPassPara = ["tn_connection_links"];
                        this.transferFormItems.forEach((item) => {
                                if (item.title === "Connection Links") {