From 186b679ba02d7729801b4d560697d87034b9c8f6 Mon Sep 17 00:00:00 2001 From: wangyuerg Date: Thu, 28 Jan 2021 10:34:35 +0800 Subject: feat: TN change modification Signed-off-by: wangyuerg Change-Id: I7bed0f4b43e0f978b5e109bfd198c4cad2205463 Issue-ID: USECASEUI-527 --- .../slicing-task-model.component.html | 6 +- .../slicing-task-model.component.ts | 31 ++- .../subnet-params-model.component.html | 136 ++++++++--- .../subnet-params-model.component.less | 51 +++- .../subnet-params-model.component.ts | 263 +++++++++++++++------ 5 files changed, 374 insertions(+), 113 deletions(-) (limited to 'usecaseui-portal/src/app/views/services') diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.html b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.html index e9ee0ecc..45dd8dc5 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.html +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.html @@ -34,7 +34,8 @@

Matching Shared NSSI:

- +
NSSI ID: @@ -75,6 +76,7 @@ + (cancel)="isShowParams=$event" (paramsDataChange)="changeParams($event)" + (noPassParaChange)="noPassParaChange($event)"> \ No newline at end of file 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 f5e5ac3c..7ac86c85 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 @@ -72,6 +72,7 @@ export class SlicingTaskModelComponent implements OnInit { isShowParams: boolean; paramsTitle: string; params: any; + noPassPara: string[]; // 获取数据loading isSpinning: boolean = false; loading: boolean = false; @@ -181,7 +182,22 @@ export class SlicingTaskModelComponent implements OnInit { 'sliceProfile_AN_logicInterfaceId', 'sliceProfile_AN_nextHopInfo' ]), an_coverage_area_ta_list: area}; - this.slicingSubnet[1].params = this.pick(nsi_nssi_info, ['tn_bh_latency', 'tn_bh_bandwidth', 'tn_bh_script_name', 'sliceProfile_TN_BH_jitte', 'sliceProfile_TN_BH_sNSSAI',"tn_bh_enableNSSISelection"]); + this.slicingSubnet[1].params = this.pick(nsi_nssi_info, [ + 'tn_bh_latency', + 'tn_bh_bandwidth', + 'tn_bh_script_name', + 'sliceProfile_TN_BH_jitte', + 'sliceProfile_TN_BH_sNSSAI', + 'tn_bh_enableNSSISelection', + 'sliceProfile_TN_resourceSharingLevel', + 'sliceProfile_CN_logicInterfaceId', + 'sliceProfile_CN_ipAddress', + 'sliceProfile_CN_nextHopInfo', + 'sliceProfile_AN_ipAddress', + 'sliceProfile_AN_logicInterfaceId', + 'sliceProfile_AN_nextHopInfo', + 'tn_connection_links', + 'tn_connection_links_option']); this.slicingSubnet[2].params = {...this.pick(nsi_nssi_info, [ 'cn_service_snssai', 'cn_resource_sharing_level', @@ -369,7 +385,9 @@ export class SlicingTaskModelComponent implements OnInit { const index = this.paramsTitle === 'An' ? 0 : (this.paramsTitle === 'Tn' ? 1 : 2); this.slicingSubnet[index].params = params } - + noPassParaChange (noPassPara: string[]): void { + this.noPassPara = noPassPara + } handleCancel(bool: boolean = false) { this.showDetail = false; this.cancel.emit({ showDetail: this.showDetail, bool }); @@ -377,6 +395,15 @@ export class SlicingTaskModelComponent implements OnInit { handleOk() { this.loading = true; const { selectedServiceId, selectedServiceName, slicingSubnet, checkDetail, businessRequirement, NSTinfo } = this; + // slicingSubnet[1] is about Tn, + // Delete parameters that do not need to be passed + this.noPassPara.forEach((item) => { + for (let val in slicingSubnet[1].params) { + if (val === item) { + delete slicingSubnet[1].params[val] + } + } + }) const nsi_nssi_info: object = { suggest_nsi_id: selectedServiceId, suggest_nsi_name: selectedServiceName, 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 cde444bf..31c19d49 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 @@ -1,33 +1,101 @@ + nzWidth="960px">
- + {{item.title}} - - -
{{Util.isEmpty(formData[item.key])? 'can not be empty!':' '}}
+ + + + + + +
+
+ +
+ {{validateEndPoint(option.title, ANEndpointInputs[option.key], item.required)}} +
+
+ {{validateEndPoint(option.title, ANEndpointInputs[option.key], item.required)}} +
+
+ {{validateEndPoint(option.title, ANEndpointInputs[option.key], item.required)}} +
+
+
+
+ +
+
+ +
+ {{validateEndPoint(option.title, CNEndpointInputs[option.key], item.required)}} +
+
+ {{validateEndPoint(option.title, CNEndpointInputs[option.key], item.required)}} +
+
+ {{validateEndPoint(option.title, CNEndpointInputs[option.key], item.required)}} +
+
+
+
+ +
+ + + + {{val.title}} + action + + + + + + {{t[val.key]}} + + + + + + + +
+
+ {{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)" />
- + + (nzOpenChange)="handleChange(area, item)" + (ngModelChange)=" handleChangeSelected(area, item) "> @@ -74,12 +142,12 @@
{{checkArea(area)}}
- - diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.less b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.less index 335b377c..a8674691 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.less +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.less @@ -1,34 +1,47 @@ -.subnet_params_container{ +.subnet_params_container { padding-left: 3%; - .subnet_params_area{ + + .subnet_td { + width: 100px; + } + + .subnet_params_area { margin-right: 5px; } - .ant-btn-icon-only{ + + .ant-btn-icon-only { padding: 0 5px !important; } - .subnet_params_button{ + + .subnet_params_button { margin-top: 7px; margin-left: 10px; } - .subnet_params_icon{ + + .subnet_params_icon { font-size: 14px; } } + .ant-form-item-label { text-align: left; } + .validation_alert { color: red; position: absolute; top: 0; margin-top: 15px; } + .validation_alert_area { color: red; margin-left: 6px; } + .endpoint_input { position: relative; + .end_alert_ip { position: absolute; color: red; @@ -36,16 +49,44 @@ margin-top: 30px; margin-left: 6px; } + .end_alert_logical { position: absolute; color: red; top: 0; margin: 30px 0 0 126px; } + .end_alert_nexthop { position: absolute; color: red; top: 0; margin: 30px 0 0 246px; } +} + +.tn_endpoint_input { + position: relative; + + .end_alert_ip { + position: absolute; + color: red; + top: 0; + margin-top: 30px; + margin-left: 6px; + } + + .end_alert_logical { + position: absolute; + color: red; + top: 0; + margin: 30px 0 0 196px; + } + + .end_alert_nexthop { + position: absolute; + color: red; + top: 0; + margin: 30px 0 0 396px; + } } \ 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.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 119f87d4..862e2a1f 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 @@ -16,17 +16,25 @@ export class SubnetParamsModelComponent implements OnInit { @Input() title: string; @Output() cancel = new EventEmitter(); @Output() paramsDataChange = new EventEmitter(); + @Output() noPassParaChange = new EventEmitter(); - transferFormItems = TRANSFRER_FORM_ITEMS; + transferFormItems: any[] = TRANSFRER_FORM_ITEMS; regxpIP = /^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$/; // check for correct ip address formData: any; coreFormItems : any = []; areaList: any[] = []; // 2020.08.17 Add 3 parameters for Endpoint, Comment: The following code NexthopInfoOptions = NexthopInfo_Options; - EndpointInputs: object = {}; + EndpointInputs: object = {}; + ANEndpointInputs: object = {}; + CNEndpointInputs: object = {}; + ANkeyList: string[] = []; + CNkeyList: string[] = []; EndpointEnable: boolean = true; // Whether to enable the three parameters of Endpoint keyList: string[] = []; // keys of endPoint + specialParaTN: string[] = ['Resource Sharing Level', 'Connection Links', 'AN Endpoint', 'CN Endpoint']; + // Parameters not passed to the back end + notPassPara: string[] = ['tn_connection_links']; // Comment: Above code constructor( @@ -39,44 +47,119 @@ export class SubnetParamsModelComponent implements OnInit { } ngOnChanges() { - if(this.title){ + if (this.title) { 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) } + else if (this.title === 'Tn') { + this.ANkeyList = this.transferFormItems.find((item) => {return item.title === 'AN Endpoint'}).options.map((val) => {return val.key}) + this.CNkeyList = this.transferFormItems.find((item) => {return item.title === 'CN Endpoint'}).options.map((val) => {return val.key}) + this.keyList = this.ANkeyList.concat(this.CNkeyList) + this.formData['tn_connection_links_option'].forEach((item) => { // add init selection status + if (this.formData['tn_connection_links']!== null && this.formData['tn_connection_links'].indexOf(item.id) !== -1) { + item.checked = true + } else { + item.checked = false + } }) + this.judgeTn() // init judge + } + // If the endpoint related parameters from the back end are incomplete, delete the endpoint item + if(this.formData !==undefined && Object.keys(this.formData).length!==0) { + this.EndpointEnable = this.keyList.every((item) => {return this.formData.hasOwnProperty(item)}) + } + if(this.EndpointEnable){ + if (this.title === 'An' || this.title === 'Cn') { + this.EndpointInputs = this.Util.pick(this.formData, this.keyList) + } else if (this.title === 'Tn') { + this.ANEndpointInputs = this.Util.pick(this.formData, this.ANkeyList) + this.CNEndpointInputs = this.Util.pick(this.formData, this.CNkeyList) + } else { + if (this.title === 'An' || this.title === 'Cn') { + this.coreFormItems.map((item,index)=>{ + if (item.title === 'Endpoint') { + this.coreFormItems.splice(index,1) + } + }) + } else if (this.title === 'Tn') { + this.transferFormItems.map((item,index)=>{ + if (item.title === 'AN Endpoint' || item.title === 'CN Endpoint') { + this.coreFormItems.splice(index,1) + } + }) } } - + //-------> Comment: Above code + if (this.title === 'An') { + this.AreaFormatting(); + } + } } - //-------> Comment: Above code - if (this.title === 'An') { - this.AreaFormatting(); + } + changeResourceShare () { + this.judgeTn() + } + + judgeTn (): void { + if (this.formData['sliceProfile_TN_resourceSharingLevel'] === 'non-shared') { + this.formData['tn_connection_links_option'].forEach ((item) => { + item.checked = false + }) + this.formData['tn_connection_links'] = null + this.transferFormItems.forEach((item) => { + if (item.title === 'Connection Links') { + item.disable = true + this.notPassPara = ['tn_connection_links', 'tn_connection_links_option'] + } else if (item.title === 'AN Endpoint' || item.title === 'CN Endpoint') { + item.required = true + item.disable = false + } + }) + } else if (this.formData['sliceProfile_TN_resourceSharingLevel'] === 'shared') { + this.transferFormItems.forEach((item) => { + if (item.title === 'Connection Links') { + item.disable = false + } else if (item.title === 'AN Endpoint' || item.title === 'CN Endpoint') { + if (this.formData['tn_connection_links']!==null && this.formData['tn_connection_links'].length !== 0) { + item.disable = true + item.required = false + this.notPassPara = ['tn_connection_links_option'] + this.notPassPara = this.notPassPara.concat(this.ANkeyList, this.CNkeyList) + console.log('not', this.notPassPara) + } else if (this.formData['tn_connection_links']!==null && this.formData['tn_connection_links'].length === 0) { + item.disable = false + item.required = true + } + } + }) } } - validateEndPoint (key: string, value: any): string { - if (this.Util.isEmpty(value)) { - return 'can not be empty'; + + validateEndPoint (key: string, value: any, required: boolean): string { + if (required) { + if (this.Util.isEmpty(value)) { + return 'can not be empty'; + } } if (key === 'ip_address') { if (!this.regxpIP.test(value)) { - return 'xxx.xxx.xxx.xxx'; + if (value !== '') { + return 'xxx.xxx.xxx.xxx'; + } else { + return '' + } } else { return ''; } } else if (key === 'logical_link') { if (!this.Util.isInteger(value)){ - return 'integer only' + if (value !== ''){ + return 'integer only' + } else { + return '' + } } else { return '' } @@ -85,21 +168,15 @@ 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, ''); - // } - // } + changeLinkCheck (id: string, e: boolean) : void{ // update the selection state + this.formData['tn_connection_links_option'].find((item) => { + return item.id === id + }).checked = e + const checkedList = this.formData['tn_connection_links_option'].filter((item) => {return item.checked === true}) + this.formData['tn_connection_links'] = checkedList.map((item) => {return item.id}) // get the selected id + this.judgeTn() + } + AreaFormatting () { let areaList = [...this.formData.an_coverage_area_ta_list]; this.areaList = areaList.map ( (item: any) => { @@ -180,13 +257,13 @@ export class SubnetParamsModelComponent implements OnInit { } } - handleCancel() { + handleCancel() : void{ this.showModel = false this.cancel.emit(this.showModel) } // prompt text for each item of area_list - checkArea (area: any) { + checkArea (area: any) : string{ if (area.every((item) => {return item.selected === ''})) { return 'empty'; } @@ -209,31 +286,56 @@ export class SubnetParamsModelComponent implements OnInit { return true; } - endCheckBeforeSubmit () : Array{ + endCheckBeforeSubmit (endpoint, required) : Array{ // check params of Endpoint - let result: Array = [true, '']; - 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) { - if (item.title === 'ip_address') { - ipKey = item.key - } else if (item.title === 'logical_link') { - logicalKey = item.key + console.log('end', endpoint) + let result: Array = [true, '']; + let endPointList; + if (this.title === 'An' || this.title === 'Cn') { + endPointList = this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).options + } else { + endPointList = this.transferFormItems.find((item) => {return item.title === 'AN Endpoint'}).options } - } - for (let prop in this.EndpointInputs) { - if (prop === ipKey) { - if (!this.regxpIP.test(this.EndpointInputs[prop])) { - result = [false, 'Illegal IpAddress'] - } - } else if (prop === logicalKey) { - if (!this.Util.isInteger(this.EndpointInputs[prop])) { - result = [false, 'LogicalID can only be an integer'] + let ipKey = ''; + let logicalKey = ''; + let nextKey = '' + for (let item of endPointList) { + if (item.title === 'ip_address') { + ipKey = item.key + } else if (item.title === 'logical_link') { + logicalKey = item.key + } else if (item.title === 'nexthop_info') { + nextKey = item.key } } - } - return result; + for (let prop in endpoint) { + if (prop === ipKey) { + if (required) { + if (endpoint[prop] === '') { + result = [false, 'Endpoint can not be empty'] + } else if (!this.regxpIP.test(endpoint[prop])) { + result = [false, 'Illegal IpAddress'] + } + } else if (!this.regxpIP.test(endpoint[prop]) && endpoint[prop] !== '') { + result = [false, 'Illegal IpAddress'] + } + } else if (prop === logicalKey) { + if (required) { + if (endpoint[prop] === '') { + result = [false, 'logical can not be empty'] + } else if (!this.Util.isInteger(endpoint[prop])) { + result = [false, 'LogicalID can only be an integer'] + } + } else if (!this.Util.isInteger(endpoint[prop]) && endpoint[prop] !== '') { + result = [false, 'LogicalID can only be an integer'] + } + } else if (prop === nextKey) { + if (required && endpoint[prop] === '') { + result = [false, 'Endpoint can not be empty'] + } + } + } + return result; } inputHolder (title: string): string { @@ -257,15 +359,36 @@ export class SubnetParamsModelComponent implements OnInit { handleOk(): void { // Verify that items of EndPoint is correct - let endCheckResult = this.endCheckBeforeSubmit() - if (!endCheckResult[0]) { - 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]; + if (this.EndpointEnable) { + let endCheckResult = [] + if (this.title === 'An' || this.title === 'Cn') { + endCheckResult = this.endCheckBeforeSubmit(this.EndpointInputs, this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).required) + } else if (this.title === 'Tn') { + const ANendCheckResult = this.endCheckBeforeSubmit(this.ANEndpointInputs, this.transferFormItems.find((item) => {return item.title === 'AN Endpoint'}).required) + const CNendCheckResult = this.endCheckBeforeSubmit(this.CNEndpointInputs, this.transferFormItems.find((item) => {return item.title === 'CN Endpoint'}).required) + if (ANendCheckResult[0] && CNendCheckResult[0]) { + endCheckResult[0] = true + } else { + if (ANendCheckResult[0] === false) { + endCheckResult = ANendCheckResult + } else { + endCheckResult = CNendCheckResult + } + } + } + if (!endCheckResult[0]) { + this.message.error(endCheckResult[1].toString()); + return; + } + // replace the params about endPoint + for (let prop in this.formData) { + if ((this.title === 'An' || this.title === 'Cn') && typeof this.EndpointInputs[prop] !== 'undefined') { + this.formData[prop] = this.EndpointInputs[prop]; + } else if (this.title === 'Tn' && typeof this.ANEndpointInputs[prop] !== 'undefined') { + this.formData[prop] = this.ANEndpointInputs[prop]; + } else if (this.title === 'Tn' && typeof this.CNEndpointInputs[prop] !== 'undefined') { + this.formData[prop] = this.CNEndpointInputs[prop]; + } } } let params: object; @@ -282,8 +405,7 @@ export class SubnetParamsModelComponent implements OnInit { } else { params = {...this.formData}; } - // Verify that each item is not empty, include special handeling of area_list - console.log(params) + // Verify that each item exclude endpoint is not empty, include special handeling of area_list let checkParams = params if (this.title === 'An' || this.title === 'Cn') { checkParams = this.coreFormItems.filter((item) => { @@ -296,6 +418,7 @@ export class SubnetParamsModelComponent implements OnInit { } if (this.Util.deepCheck(checkParams) && this.areaCheckBeforeSubmit(params)) { this.paramsDataChange.emit(params); + this.noPassParaChange.emit(this.notPassPara) this.handleCancel(); } else { this.message.error('Please complete the form'); -- cgit 1.2.3-korg