diff options
author | 2020-09-02 15:28:58 +0800 | |
---|---|---|
committer | 2020-09-02 10:22:30 +0000 | |
commit | 4c1a5bd26960aeed20d8fe41b225da39111250b7 (patch) | |
tree | 2e23e8cd33974b6c25cd3ed1c9da0e1c5fa913f3 /usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts | |
parent | f2ab4faa09a577a1d5008b692c67ded0f480db9e (diff) |
fix: fix the bug of enter, add prompt text for every area selector, add hot module replacement
Change-Id: Id0c8810ea3c062acf1f731e93c31b30ea941d1a6
Signed-off-by: wangyuerg <wangyuerg@chinamobile.com>
Issue-ID: USECASEUI-444
Diffstat (limited to 'usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts index 41e63c81..145a03e7 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts @@ -72,8 +72,8 @@ export class SubnetParamsModelComponent implements OnInit { return ''; } } else if (key === 'logical_link') { - if (isNaN(value)){ - return 'number only' + if (!this.isInteger(value)){ + return 'integer only' } else { return '' } @@ -182,18 +182,14 @@ export class SubnetParamsModelComponent implements OnInit { this.cancel.emit(this.showModel) } - checkArea () { - let result = true; - this.areaList.forEach((item) => { - if (item.some((val) => {return val['selected'] === ''})) { - result = false; - } - }) - if (!result) { - return 'can not be empty!'; - } else { - return ''; + checkArea (area: any) { + if (area.every((item) => {return item.selected === ''})) { + return 'empty'; } + if (area.some((item) => {return item.selected === ''})) { + return 'incomplete'; + } + return ''; } judgeType (a) { @@ -229,6 +225,18 @@ export class SubnetParamsModelComponent implements OnInit { return true; } + isInteger (value: any) { + // 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; + } + } endCheckBeforeSubmit () { // check params of Endpoint @@ -244,8 +252,8 @@ export class SubnetParamsModelComponent implements OnInit { result = [false, 'Illegal IpAddress'] } } else if (prop === 'an_logical_link') { - if (isNaN(formatedEndpoint[prop])) { - result = [false, 'LogicalID can only be a number'] + if (!this.isInteger(formatedEndpoint[prop])) { + result = [false, 'LogicalID can only be an integer'] } } } @@ -256,8 +264,8 @@ export class SubnetParamsModelComponent implements OnInit { result = [false, 'Illegal IpAddress'] } } else if (prop === 'cn_logical_link') { - if (isNaN(formatedEndpoint[prop])) { - result = [false, 'LogicalID can only be a number'] + if (!this.isInteger(formatedEndpoint[prop])) { + result = [false, 'LogicalID can only be an integer'] } } } |