diff options
author | 2020-03-04 07:06:55 +0200 | |
---|---|---|
committer | 2020-03-04 18:05:41 +0200 | |
commit | 384afe6d22cb4997874be479fed5633bd4e6a454 (patch) | |
tree | 71a78d0cc352e23b934a2c5a0c9b8a322ff75587 /vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices | |
parent | 03658e97c41cce22f20ac04d69038103089b4f05 (diff) |
Upgrade vfModule popup: show version from instance or model.
Issue-ID: Issue-ID: VID-771
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Change-Id: Idc83bee2f5f94998d1c118f8c911c3370e2f23e1
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices')
4 files changed, 29 insertions, 12 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/generic-popup.interface.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/generic-popup.interface.ts index 7324c64a7..80e8f89b4 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/generic-popup.interface.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/generic-popup.interface.ts @@ -16,7 +16,7 @@ import {FormPopupDetails} from "../../../models/formControlModels/formPopupDetai export interface GenericPopupInterface { onSubmit(that, form: FormGroup, ...args) : void; onCancel(that, form) : void; - getModelInformation(serviceId : string, modelName : string) : void; + getModelInformation(serviceId : string, modelName : string, node: ITreeNode) : void; getGenericFormPopupDetails(serviceId : string, modelName : string , storeKey : string, node : ITreeNode, uuidData : Object, isUpdateMode : boolean) : FormPopupDetails; getInstance(serviceId : string, modelName : string , storeKey : string) : any; getTitle(isUpdateMode : boolean) : string; diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts index b8a592247..d0b4a43f7 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts @@ -15,6 +15,7 @@ import {getTestBed, TestBed} from "@angular/core/testing"; import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service"; import {ModalService} from "../../../customModal/services/modal.service"; import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service"; +import {ITreeNode} from "angular-tree-component/dist/defs/api"; class MockModalService<T> {} @@ -1979,6 +1980,7 @@ describe('VFModule popup service', () => { let defaultDataGeneratorService: DefaultDataGeneratorService; let fb: FormBuilder; let iframeService: IframeService; + let _sharedTreeService : SharedTreeService; beforeAll(done => (async () => { TestBed.configureTestingModule({ @@ -2008,6 +2010,7 @@ describe('VFModule popup service', () => { genericFormService = injector.get(GenericFormService); defaultDataGeneratorService = injector.get(DefaultDataGeneratorService); fb = injector.get(FormBuilder); + _sharedTreeService = injector.get(SharedTreeService); iframeService = injector.get(IframeService); })().then(done).catch(done.fail)); @@ -2041,7 +2044,7 @@ describe('VFModule popup service', () => { const serviceId: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; const vfModuleModelName: string = '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1'; - service.getModelInformation(serviceId, vfModuleModelName); + service.getModelInformation(serviceId, vfModuleModelName, getVfModelNode()); expect(service.modelInformations.length).toEqual(15); expect(service.modelInformations[0].label).toEqual("Subscriber Name"); expect(service.modelInformations[0].values).toEqual(['SILVIA ROBBINS']); @@ -2056,7 +2059,7 @@ describe('VFModule popup service', () => { expect(service.modelInformations[3].values).toEqual(['2017488PasqualeVpe..PASQUALE_vRE_BV..module-1']); expect(service.modelInformations[4].label).toEqual("Model version"); - expect(service.modelInformations[4].values).toEqual(['6']); + expect(service.modelInformations[4].values).toEqual(['1']); expect(service.modelInformations[5].label).toEqual("Description"); expect(service.modelInformations[5].values).toEqual([null]); @@ -2127,4 +2130,15 @@ describe('VFModule popup service', () => { } }, "*"); }); + + function getVfModelNode() { + let vfModuleNode: ITreeNode = <any>{ + data: { + instanceModelInfo: { + modelVersion: "1", + } + } + }; + return vfModuleNode; + } }); diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts index 18dc65590..130e9f50f 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts @@ -21,6 +21,7 @@ import {FormControlModel} from "../../../../models/formControlModels/formControl import * as _ from 'lodash'; import {createVFModuleInstance, updateVFModuleInstance} from "../../../../storeUtil/utils/vfModule/vfModule.actions"; import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service"; +import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service"; export abstract class VfModulePopupServiceBase { dynamicInputs: any; @@ -51,7 +52,8 @@ export abstract class VfModulePopupServiceBase { protected _defaultDataGeneratorService: DefaultDataGeneratorService, protected _aaiService: AaiService, protected _basicPopupService: BasicPopupService, - protected _store: NgRedux<AppState>) { + protected _store: NgRedux<AppState>, + protected _sharedTreeService: SharedTreeService) { } getInstance(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string): any { @@ -62,7 +64,7 @@ export abstract class VfModulePopupServiceBase { return vfModules[this.uuidData['modelName']][vfModuleStoreKey]; } - getModelInformation(serviceId: string, modelName: string) { + getModelInformation(serviceId: string, modelName: string, vfModuleModeNode:ITreeNode) { this._aaiService.getServiceModelById(serviceId).subscribe((result: any) => { this.serviceModel = new ServiceModel(result); @@ -73,7 +75,7 @@ export abstract class VfModulePopupServiceBase { new ModelInformationItem("Service Name", "serviceModelName", [this.serviceModel.name], "", true), new ModelInformationItem("Service Instance Name", "serviceName", [serviceInstance.instanceName], "", false), new ModelInformationItem("Model Name", "modelName", [this.model.name], "", true), - new ModelInformationItem("Model version", "modelVersion", [this.model.version], "", true), + new ModelInformationItem("Model version", "modelVersion", [this._sharedTreeService.getModelVersionEitherFromInstanceOrFromHierarchy(vfModuleModeNode.data, this.model) ], "", true), new ModelInformationItem("Description", "description", [this.model.description]), new ModelInformationItem("Category", "category", [this.model.category]), new ModelInformationItem("Sub Category", "subCategory", [this.model.subCategory]), @@ -115,11 +117,11 @@ export abstract class VfModulePopupServiceBase { abstract getControls(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, isUpdateMode: boolean); abstract getDynamicInputs(UUIDData : Object) : FormControlModel[]; - getGenericFormPopupDetails(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, node: ITreeNode, uuidData: Object, isUpdateMode: boolean): FormPopupDetails { + getGenericFormPopupDetails(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, vfModuleNode: ITreeNode, uuidData: Object, isUpdateMode: boolean): FormPopupDetails { this.uuidData = uuidData; this.instance = this.getInstance(serviceId, vnfStoreKey, vfModuleStoreKey); - this.getModelInformation(serviceId, uuidData['modelName']); + this.getModelInformation(serviceId, uuidData['modelName'], vfModuleNode); return new FormPopupDetails(this, PopupType.VFMODULE, @@ -165,8 +167,9 @@ export class VfModulePopupService extends VfModulePopupServiceBase implements Ge _defaultDataGeneratorService: DefaultDataGeneratorService, _aaiService: AaiService, _basicPopupService : BasicPopupService, - _store: NgRedux<AppState>) { - super(_basicControlGenerator, _sharedControllersService, _vfModuleControlGenerator, _iframeService, _defaultDataGeneratorService, _aaiService, _basicPopupService, _store); + _store: NgRedux<AppState>, + _sharedTreeService: SharedTreeService) { + super(_basicControlGenerator, _sharedControllersService, _vfModuleControlGenerator, _iframeService, _defaultDataGeneratorService, _aaiService, _basicPopupService, _store, _sharedTreeService); } diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts index eddfee074..5fcdc3093 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service.ts @@ -34,8 +34,8 @@ export class VfModuleUpgradePopupService extends VfModulePopupServiceBase { protected _aaiService: AaiService, protected _basicPopupService: BasicPopupService, protected _store: NgRedux<AppState>, - private _sharedTreeService: SharedTreeService) { - super(_basicControlGenerator, _sharedControllersService, _vfModuleControlGenerator, _iframeService, _defaultDataGeneratorService, _aaiService, _basicPopupService, _store); + protected _sharedTreeService: SharedTreeService) { + super(_basicControlGenerator, _sharedControllersService, _vfModuleControlGenerator, _iframeService, _defaultDataGeneratorService, _aaiService, _basicPopupService, _store, _sharedTreeService); } node: ITreeNode; |