diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator')
2 files changed, 13 insertions, 17 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.spec.ts index 81cfd9614..c485dc04e 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.spec.ts @@ -2,7 +2,7 @@ import {getTestBed, TestBed} from '@angular/core/testing'; import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; import {NgRedux} from '@angular-redux/store'; import {FormControlNames} from "../service.control.generator"; -import {BasicControlGenerator} from "../basic.control.generator"; +import {ControlGeneratorUtil} from "../control.generator.util.service"; import {AaiService} from "../../../../services/aaiService/aai.service"; import {GenericFormService} from "../../generic-form.service"; import {FormBuilder} from "@angular/forms"; @@ -12,6 +12,7 @@ import {VnfGroupControlGenerator} from "./vnfGroup.control.generator"; import {Observable} from "rxjs"; import {SelectOption} from "../../../../models/selectOption"; import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service"; +import {SharedControllersService} from "../sharedControlles/shared.controllers.service"; class MockAppStore<T> { getState(){ @@ -217,7 +218,8 @@ describe('VNF Group Control Generator', () => { imports: [HttpClientTestingModule], providers: [VnfGroupControlGenerator, GenericFormService, - BasicControlGenerator, + ControlGeneratorUtil, + SharedControllersService, AaiService, FormBuilder, LogService, diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts index 45f5ffa63..0fee0c223 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts @@ -1,7 +1,7 @@ import {Injectable} from "@angular/core"; import {AaiService} from "../../../../services/aaiService/aai.service"; import {NgRedux} from "@angular-redux/store"; -import {BasicControlGenerator} from "../basic.control.generator"; +import {ControlGeneratorUtil} from "../control.generator.util.service"; import { FormControlModel, ValidatorModel, @@ -15,6 +15,7 @@ import {SelectOption} from "../../../../models/selectOption"; import {VnfGroupModel} from "../../../../models/vnfGroupModel"; import * as _ from 'lodash'; import {Observable, of} from "rxjs"; +import {SharedControllersService} from "../sharedControlles/shared.controllers.service"; export enum FormControlNames { @@ -22,14 +23,12 @@ export enum FormControlNames { ROLLBACK_ON_FAILURE = 'rollbackOnFailure', } -enum InputType { - ROLLBACK = "rollbackOnFailure" -} - @Injectable() export class VnfGroupControlGenerator { aaiService: AaiService; - constructor(private _basicControlGenerator: BasicControlGenerator, + + constructor(private _basicControlGenerator: ControlGeneratorUtil, + private _sharedControllersService: SharedControllersService, private store: NgRedux<AppState>, private _aaiService: AaiService, private _logService: LogService) { @@ -80,19 +79,14 @@ export class VnfGroupControlGenerator { return result; } - isInputShouldBeShown = (inputType: any): boolean => { - let vnfGroupInputs = [InputType.ROLLBACK]; - return vnfGroupInputs.indexOf(inputType) > -1; - }; - - getDefaultInstanceName(instance : any, serviceId : string, vnfGroupName : string) : string { + getDefaultInstanceName(instance: any, serviceId: string, vnfGroupName: string): string { const vnfGroupModel: VnfGroupModel = this.store.getState().service.serviceHierarchy[serviceId].vnfGroups[vnfGroupName]; return this._basicControlGenerator.getDefaultInstanceName(instance, vnfGroupModel); } - getInstanceName(instance : any, serviceId : string, vnfGroupName : string, isEcompGeneratedNaming: boolean): FormControlModel { - const vnfGroupModel : VnfGroupModel = this.store.getState().service.serviceHierarchy[serviceId].vnfGroups[vnfGroupName]; - return this._basicControlGenerator.getInstanceNameController(instance, serviceId, isEcompGeneratedNaming, vnfGroupModel); + getInstanceName(instance: any, serviceId: string, vnfGroupName: string, isEcompGeneratedNaming: boolean): FormControlModel { + const vnfGroupModel: VnfGroupModel = this.store.getState().service.serviceHierarchy[serviceId].vnfGroups[vnfGroupName]; + return this._sharedControllersService.getInstanceNameController(instance, serviceId, isEcompGeneratedNaming, vnfGroupModel); } getRollbackOnFailureControl = (instance: any, controls: FormControlModel[]): DropdownFormControl => { |