diff options
author | wangyuerg <wangyuerg@chinamobile.com> | 2020-09-04 18:30:46 +0800 |
---|---|---|
committer | Yue Wang <wangyuerg@chinamobile.com> | 2020-09-07 01:46:37 +0000 |
commit | 926b57b4d540c73f1930e6d2d2070e5ac6939e5d (patch) | |
tree | 0e7cbc7ef248ededda4e1a96ca10cd31347dcc55 /usecaseui-portal/src/app/views | |
parent | c271c4e5c5f63753f7545bea64b7d24551fb3d2c (diff) |
fix: change type and key of parameters
Change-Id: I51f96580758f10c9bc7bcc7d909b5d7b3bb5d7e9
Signed-off-by: wangyuerg <wangyuerg@chinamobile.com>
Issue-ID: USECASEUI-444
Diffstat (limited to 'usecaseui-portal/src/app/views')
3 files changed, 70 insertions, 71 deletions
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts index c9f61215..ae5102ae 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts @@ -159,23 +159,25 @@ export class SlicingTaskModelComponent implements OnInit { // 前端模拟数据 let area = ["Beijing;Beijing;Haidian District", "Beijing;Beijing;Xicheng District", "Beijing;Beijing;Changping District"]; this.slicingSubnet[0].params = {...this.pick(nsi_nssi_info, [ - 'an_service_snssai', - 'an_resource_sharing_level', - 'an_ue_mobility_level', + 'sliceProfile_AN_sNSSAI', + 'sliceProfile_AN_resourceSharingLevel', + 'sliceProfile_AN_uEMobilityLevel', 'an_latency', - 'an_max_number_of_ues', - 'an_activity_factor', - 'an_exp_data_rate_dl', - 'an_exp_data_rate_ul', - 'an_area_traffic_cap_dl', - 'an_area_traffic_cap_ul', + 'sliceProfile_AN_maxNumberofUEs', + 'sliceProfile_AN_activityFactor', + 'sliceProfile_AN_expDataRateDL', + 'sliceProfile_AN_expDataRateUL', + 'sliceProfile_AN_areaTrafficCapDL', + 'sliceProfile_AN_areaTrafficCapUL', 'an_script_name', - 'an_overalluser_density', - 'an_Endpoint', + 'sliceProfile_AN_overallUserDensity', 'an_enableNSSISelection', - 'an_max_number_of_pud_session' + 'sliceProfile_AN_maxNumberofPDUSession', + 'sliceProfile_AN_ipAddress', + 'sliceProfile_AN_logicInterfaceId', + 'sliceProfile_AN_nextHopInfo' ]), an_coverage_area_ta_list: area}; - this.slicingSubnet[1].params = this.pick(nsi_nssi_info, ['tn_latency', 'tn_bandwidth', 'tn_script_name', 'tn_jitter', 'tn_service_snssai',"tn_enableNSSISelection"]); + this.slicingSubnet[1].params = this.pick(nsi_nssi_info, ['tn_latency', 'tn_bandwidth', 'tn_script_name', 'sliceProfile_TN_jitte', 'sliceProfile_TN_sNSSAI',"tn_enableNSSISelection"]); this.slicingSubnet[2].params = {...this.pick(nsi_nssi_info, [ 'cn_service_snssai', 'cn_resource_sharing_level', @@ -188,10 +190,12 @@ export class SlicingTaskModelComponent implements OnInit { 'cn_area_traffic_cap_dl', 'cn_area_traffic_cap_ul', 'cn_script_name', - 'cn_overalluser_density', - 'cn_Endpoint', + 'sliceProfile_CN_overallUserDensity', 'cn_enableNSSISelection', - 'cn_max_number_of_pud_session' + 'sliceProfile_CN_maxNumberofPDUSession', + 'sliceProfile_CN_logicInterfaceId', + 'sliceProfile_CN_ipAddress', + 'sliceProfile_CN_nextHopInfo' ])}; } else { this.message.error(result_message || 'Failed to get data') 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 93e6f485..cde444bf 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 @@ -47,14 +47,13 @@ <input nz-input [id]="option.key" [name]="option.key" - [title]="EndpointInputs[i][option.key]" - [(ngModel)]="EndpointInputs[i][option.key]" + [title]="EndpointInputs[option.key]" + [(ngModel)]="EndpointInputs[option.key]" [placeholder]="option.holder" - (input)="onInput($event, option.title)" style="width:32%;margin-right:1%" /> - <div class="end_alert_ip" *ngIf="option.title === 'ip_address'">{{validateEndPoint(option.title, EndpointInputs[i][option.key])}}</div> - <div class="end_alert_logical" *ngIf="option.title === 'logical_link'">{{validateEndPoint(option.title, EndpointInputs[i][option.key])}}</div> - <div class="end_alert_nexthop" *ngIf="option.title === 'nexthop_info'">{{validateEndPoint(option.title, EndpointInputs[i][option.key])}}</div> + <div class="end_alert_ip" *ngIf="option.title === 'ip_address'">{{validateEndPoint(option.title, EndpointInputs[option.key])}}</div> + <div class="end_alert_logical" *ngIf="option.title === 'logical_link'">{{validateEndPoint(option.title, EndpointInputs[option.key])}}</div> + <div class="end_alert_nexthop" *ngIf="option.title === 'nexthop_info'">{{validateEndPoint(option.title, EndpointInputs[option.key])}}</div> </div> </div> </nz-input-group> 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 fb1e5b55..9d1ee34d 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 @@ -24,8 +24,9 @@ export class SubnetParamsModelComponent implements OnInit { areaList: any[] = []; // 2020.08.17 Add 3 parameters for Endpoint, Comment: The following code NexthopInfoOptions = NexthopInfo_Options; - EndpointInputs: any[] = []; + EndpointInputs: object = {}; EndpointEnable: boolean = true; // Whether to enable the three parameters of Endpoint + keyList: string[] = []; // keys of endPoint // Comment: Above code constructor( @@ -41,16 +42,13 @@ export class SubnetParamsModelComponent implements OnInit { 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.formData.hasOwnProperty("an_Endpoint") && this.formData['an_Endpoint'].length!==0) || (this.formData.hasOwnProperty("cn_Endpoint") && this.formData['cn_Endpoint'].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.title === 'An' - ?this.formData["an_Endpoint"] - :this.title === 'Cn' - ?this.formData["cn_Endpoint"] - :[]; + this.EndpointInputs = this.Util.pick(this.formData, this.keyList)// no? }else{ this.coreFormItems.map((item,index)=>{ if(item.title === 'Endpoint'){ @@ -85,21 +83,21 @@ export class SubnetParamsModelComponent implements OnInit { } } - onInput ($event:any, title: string) { - if (!$event) { - return; - } - const target = $event.target; - if (title === 'ip_address') { - // only number and '.' can be inputted - const regexp = /[^\d^\.]+/g; - target.value = target.value.replace(regexp, ''); - } else if (title === 'logical_link') { - // only number can be inputted - const regxp = /[^\d]/g; - target.value = target.value.replace(regxp, ''); - } - } + // onInput ($event:any, title: string) { + // if (!$event) { + // return; + // } + // const target = $event.target; + // if (title === 'ip_address') { + // // only number and '.' can be inputted + // const regexp = /[^\d^\.]+/g; + // target.value = target.value.replace(regexp, ''); + // } else if (title === 'logical_link') { + // // only number can be inputted + // const regxp = /[^\d]/g; + // target.value = target.value.replace(regxp, ''); + // } + // } AreaFormatting () { let areaList = [...this.formData.an_coverage_area_ta_list]; this.areaList = areaList.map ( (item: any) => { @@ -212,35 +210,27 @@ export class SubnetParamsModelComponent implements OnInit { endCheckBeforeSubmit () : Array<any>{ // check params of Endpoint let result: Array<any> = [true, '']; - let formatedEndpoint = {}; - this.EndpointInputs.forEach((item) => { - formatedEndpoint[Object.keys(item)[0]] = item[Object.keys(item)[0]]; - }) - if (this.title === 'An') { - for (let prop in formatedEndpoint) { - if (prop === 'an_ip_address') { - if (!this.regxpIP.test(formatedEndpoint[prop])) { - result = [false, 'Illegal IpAddress'] - } - } else if (prop === 'an_logical_link') { - if (!this.Util.isInteger(formatedEndpoint[prop])) { - result = [false, 'LogicalID can only be an integer'] - } + const endPointList = this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).options; + let ipKey = ''; + let logicalKey = ''; + for (let item of endPointList) { + if (item.title === 'ip_address') { + ipKey = item.key + } else if (item.title === 'logical_link') { + logicalKey = item.key + } + } + for (let prop in this.EndpointInputs) { + if (prop === ipKey) { + if (!this.regxpIP.test(this.EndpointInputs[prop])) { + result = [false, 'Illegal IpAddress'] } - } - } else if (this.title === 'Cn') { - for (let prop in formatedEndpoint) { - if (prop === 'cn_ip_address') { - if (!this.regxpIP.test(formatedEndpoint[prop])) { - result = [false, 'Illegal IpAddress'] - } - } else if (prop === 'cn_logical_link') { - if (!this.Util.isInteger(formatedEndpoint[prop])) { - result = [false, 'LogicalID can only be an integer'] - } + } else if (prop === logicalKey) { + if (!this.Util.isInteger(this.EndpointInputs[prop])) { + result = [false, 'LogicalID can only be an integer'] } - } - } + } + } return result; } @@ -270,6 +260,12 @@ export class SubnetParamsModelComponent implements OnInit { this.message.error(endCheckResult[1].toString()); return; } + // replace the params about endPoint + for (let prop in this.formData) { + if (typeof this.EndpointInputs[prop] !== 'undefined') { + this.formData[prop] = this.EndpointInputs[prop]; + } + } let params: object; if (this.title === 'An') { const an_coverage_area_ta_list: string[] = []; |