diff options
author | 2019-12-18 21:04:38 +0200 | |
---|---|---|
committer | 2019-12-22 14:01:45 +0200 | |
commit | 4c87ecaa8cce40f078f8540a15928e7e805e4ef7 (patch) | |
tree | f31c55200451d13f108c8583b8d275ae7a7c8bab /vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts | |
parent | 54af5cdca044c7b486f02f4163d16c39e990f701 (diff) |
Refactor Generic Generators
Issue-ID: VID-731
Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Change-Id: Ib851ff4056d64e12eaf415c5d689c832196ec8b0
Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator.ts | 24 |
1 files changed, 9 insertions, 15 deletions
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 => { |