diff options
author | 2019-07-09 14:23:37 +0000 | |
---|---|---|
committer | 2019-07-09 14:23:37 +0000 | |
commit | 58d22b526418ffeb89337fed9e20406da420bc6f (patch) | |
tree | 4357c9cfe1c92d57ac0a3f90167cade7af505b95 /vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/service.control.generator.ts | |
parent | 302b02a847e7aa8ccf3ff4bc14ff8a9cf67511b0 (diff) | |
parent | 97d9f66df456ef4573047a90baa3cc3ee4bfb0b7 (diff) |
Merge changes Ib4430bf2,Icc0bdb9e,I2736b984
* changes:
Merge from ecomp 718fd196 - Ext. Services Simulator
Merge from ecomp 718fd196 - Integration Tests
Merge from ecomp 718fd196 - Modern UI
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/service.control.generator.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/service.control.generator.ts | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/service.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/service.control.generator.ts index 539f848d5..12054a8a7 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/service.control.generator.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/service.control.generator.ts @@ -2,11 +2,7 @@ import {Injectable} from "@angular/core"; import {GenericFormService} from "../generic-form.service"; import {NgRedux} from "@angular-redux/store"; import {AppState} from "../../../store/reducers"; -import { - FormControlModel, - ValidatorModel, - ValidatorOptions -} from "../../../models/formControlModels/formControl.model"; +import {FormControlModel, ValidatorModel, ValidatorOptions} from "../../../models/formControlModels/formControl.model"; import {DropdownFormControl} from "../../../models/formControlModels/dropdownFormControl.model"; import * as _ from 'lodash'; import {BasicControlGenerator} from "./basic.control.generator"; @@ -15,12 +11,12 @@ import {FormGroup} from "@angular/forms"; import {FormControlType} from "../../../models/formControlModels/formControlTypes.enum"; import {HttpClient} from "@angular/common/http"; import {SelectOption} from "../../../models/selectOption"; -import {Observable} from "rxjs"; +import {Observable, of} from "rxjs"; import {LogService} from "../../../utils/log/log.service"; import {ServiceModel} from "../../../models/serviceModel"; -import {of} from "rxjs"; import {CheckboxFormControl} from "../../../models/formControlModels/checkboxFormControl.model"; +import {VidNotions} from "../../../models/vidNotions"; export enum FormControlNames { INSTANCE_NAME = 'instanceName', @@ -96,10 +92,12 @@ export class ServiceControlGenerator { result.push(this.getServiceTypeControl(serviceInstance, result, true)); result.push(this.getOwningEntityControl(serviceInstance, result)); result.push(this.getProductFamilyControl(serviceInstance, result)); - result.push(this.getLcpRegionControl(serviceInstance, result)); - result.push(this.getTenantControl(serviceInstance, result),); + result.push(this.getLcpRegionControl(serviceInstance, result, serviceModel.vidNotions)); + result.push(this.getTenantControl(serviceInstance, result, serviceModel.vidNotions),); result.push(this.getAICZoneControl(serviceInstance, result)); + + if(serviceModel.isMultiStepDesign){ result.push(new CheckboxFormControl({ controlName : FormControlNames.PAUSE, @@ -221,7 +219,11 @@ export class ServiceControlGenerator { }) }; - getLcpRegionControl = (serviceInstance : any, controls : FormControlModel[]) : DropdownFormControl => { + isRegionAndTenantOptional = (vidNotions?: VidNotions) : boolean => { + return !_.isNil(vidNotions) && vidNotions.modelCategory === "Transport" + }; + + getLcpRegionControl = (serviceInstance: any, controls: FormControlModel[], vidNotions?: VidNotions) : DropdownFormControl => { return new DropdownFormControl({ type : FormControlType.DROPDOWN, controlName : FormControlNames.LCPCLOUD_REGION_ID, @@ -231,7 +233,8 @@ export class ServiceControlGenerator { name : "lcpRegion", isDisabled : _.isNil(serviceInstance), value : serviceInstance ? serviceInstance.lcpCloudRegionId : null, - validations : [new ValidatorModel(ValidatorOptions.required, 'is required')], + validations : this.isRegionAndTenantOptional(vidNotions) ? [] : + [new ValidatorModel(ValidatorOptions.required, 'is required')], onInitSelectedField : ['lcpRegionList'], onInit : serviceInstance ? this._basicControlGenerator.getSubscribeInitResult.bind( this._aaiService, @@ -255,7 +258,7 @@ export class ServiceControlGenerator { }) }; - getTenantControl = (serviceInstance : any, controls : FormControlModel[]) : DropdownFormControl => { + getTenantControl = (serviceInstance: any, controls: FormControlModel[], vidNotions?: VidNotions) : DropdownFormControl => { return new DropdownFormControl({ type : FormControlType.DROPDOWN, controlName : FormControlNames.TENANT_ID, @@ -264,12 +267,12 @@ export class ServiceControlGenerator { placeHolder : 'Select Tenant', name : "tenant", isDisabled : _.isNil(serviceInstance), - onInitSelectedField :serviceInstance ? ['lcpRegionsTenantsMap', serviceInstance.lcpCloudRegionId] : null, + onInitSelectedField : serviceInstance ? ['lcpRegionsTenantsMap', serviceInstance.lcpCloudRegionId] : null, onInit : serviceInstance ? this._basicControlGenerator.getSubscribeInitResult.bind( this._aaiService, this.aaiService.getLcpRegionsAndTenants.bind(this, serviceInstance.globalSubscriberId, serviceInstance.subscriptionServiceType)) : ()=>{}, value : serviceInstance ? serviceInstance.tenantId : null, - validations : [new ValidatorModel(ValidatorOptions.required, 'is required')], + validations : this.isRegionAndTenantOptional(vidNotions) ? [] : [new ValidatorModel(ValidatorOptions.required, 'is required')], }) }; |