From df74e8f2ace7cb77afdd48c7c5edc800ba95ab4f Mon Sep 17 00:00:00 2001 From: cyuamber Date: Mon, 23 Nov 2020 18:56:49 +0800 Subject: feat: change tn params Change-Id: Id98dca1004ae1a3b1ce41e9e46a05b5f5835a143 Issue-ID: USECASEUI-444 Signed-off-by: cyuamber --- .../subnet-params-model.component.ts | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model') 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 9d1ee34d..e71b459f 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 @@ -40,22 +40,24 @@ export class SubnetParamsModelComponent implements OnInit { ngOnChanges() { if(this.title){ - this.coreFormItems = this.title === 'An'?CORE_FORM_ITEMS.An:this.title === 'Cn'?CORE_FORM_ITEMS.Cn:[]; - this.formData = JSON.parse(JSON.stringify(this.detailData)); - this.keyList = this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).options.map((val) => {return val.key}); - if(this.formData !==undefined && Object.keys(this.formData).length!==0){ - this.EndpointEnable = this.keyList.every((item) => {return this.formData.hasOwnProperty(item)}) - } - // -------> 2020.08.17 Add 3 parameters for Endpoint, Comment: The following code - if(this.EndpointEnable){ - this.EndpointInputs = this.Util.pick(this.formData, this.keyList)// no? - }else{ - this.coreFormItems.map((item,index)=>{ - if(item.title === 'Endpoint'){ - this.coreFormItems.splice(index,1) - } - }) - } + this.formData = JSON.parse(JSON.stringify(this.detailData)); + if (this.title === 'An' || this.title === 'Cn') { + this.coreFormItems = this.title === 'An'?CORE_FORM_ITEMS.An:this.title === 'Cn'?CORE_FORM_ITEMS.Cn:[]; + this.keyList = this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).options.map((val) => {return val.key}); + if(this.formData !==undefined && Object.keys(this.formData).length!==0){ + this.EndpointEnable = this.keyList.every((item) => {return this.formData.hasOwnProperty(item)}) + } + if(this.EndpointEnable){ + this.EndpointInputs = this.Util.pick(this.formData, this.keyList)// no? + }else{ + this.coreFormItems.map((item,index)=>{ + if(item.title === 'Endpoint'){ + this.coreFormItems.splice(index,1) + } + }) + } + } + } //-------> Comment: Above code if (this.title === 'An') { @@ -210,7 +212,7 @@ export class SubnetParamsModelComponent implements OnInit { endCheckBeforeSubmit () : Array{ // check params of Endpoint let result: Array = [true, '']; - const endPointList = this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).options; + const endPointList = this.coreFormItems&&this.coreFormItems.length!==0?this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).options:{}; let ipKey = ''; let logicalKey = ''; for (let item of endPointList) { -- cgit 1.2.3-korg