From 0d9c465fa7053a26c3daeeb841057d571ce2b587 Mon Sep 17 00:00:00 2001 From: wangyuerg Date: Thu, 3 Sep 2020 18:48:10 +0800 Subject: fix: change parameters of subnet, change the selection box of nexthop to an input box; method abstraction and extration; set placeholder for all input box; cancel required fields for jitter Change-Id: If7efba49d01d870414146eea3359491b3e2cd5c0 Signed-off-by: wangyuerg Issue-ID: USECASEUI-444 --- .../src/app/mock/json/slicing_task_auditInfo.json | 1 + usecaseui-portal/src/app/shared/utils/utils.ts | 49 ++++++++++ .../subnet-params-model.component.html | 25 ++--- .../subnet-params-model.component.less | 6 ++ .../subnet-params-model.component.ts | 86 ++++++++--------- usecaseui-portal/src/constants/constants.ts | 102 ++++++++++++++------- 6 files changed, 172 insertions(+), 97 deletions(-) (limited to 'usecaseui-portal') diff --git a/usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json b/usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json index 466d6ee4..012a802c 100644 --- a/usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json +++ b/usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json @@ -82,6 +82,7 @@ "cn_area_traffic_cap_dl": "300", "cn_area_traffic_cap_ul": "300", "cn_script_name":"test_cn_01", + "cn_max_number_of_pud_session":"10000", "cn_overalluser_density":"test_cn_overalluser_density_01", "cn_enableNSSISelection":true, "cn_Endpoint":[ diff --git a/usecaseui-portal/src/app/shared/utils/utils.ts b/usecaseui-portal/src/app/shared/utils/utils.ts index 63d3e3b7..ad6a2f10 100644 --- a/usecaseui-portal/src/app/shared/utils/utils.ts +++ b/usecaseui-portal/src/app/shared/utils/utils.ts @@ -73,4 +73,53 @@ export class Util { validateRulesShow[index] = false; } } + isInteger (value: any) : boolean{ + // for common string and undefined, eg '123a3' + if (isNaN(value)) { + return false; + } else if (isNaN(parseInt(value))) { + return false; + } else if (Number(value) >= 0 && Number(value)%1 !== 0){ + return false; + } else { + return true; + } + } + judgeType (a: any) : string { + return Object.prototype.toString.call(a) + } + isEmpty (a: any): boolean { + const type = this.judgeType(a); + if (type === 'object Null' || type === '[object undefined]' || a === false || a === '') { + return true; + } else { + return false; + } + } + deepCheck (target: any) : boolean{ + //used to verify that each item is not '' or undefined in a object or an array + let type = this.judgeType(target); + if (type === '[object Array]') { + for (let i = 0; i < target.length; i++) { + if (!this.deepCheck(target[i])) { + return false; + } + } + } else if (type === '[object Object]') { + for (const prop in target) { + if (target.hasOwnProperty(prop)) { + if (!this.deepCheck(target[prop])) { + return false; + } + } + } + } else { + if (this.isEmpty(target)) { // '', undefined, null, false + return false; + } else { + return true; + } + } + return true; + } } \ No newline at end of file diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html index c4f377f1..93e6f485 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html @@ -3,8 +3,8 @@
- - {{ item.title }} + + {{item.title}} +
{{Util.isEmpty(formData[item.key])? 'can not be empty!':' '}}
- + {{ item.title }} + *ngIf=" item.title !== 'Resource Sharing Level' && item.title !== 'Mobility' && item.title !== 'Endpoint' " [placeholder]="inputHolder(item.title)"/>