diff options
Diffstat (limited to 'vid-webpack-master')
5 files changed, 22 insertions, 3 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts index daaacb55d..b5c9598dd 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts @@ -28,6 +28,7 @@ import {DrawingBoardTreeComponent} from "../drawing-board-tree/drawing-board-tre import {ComponentInfoModel} from "../component-info/component-info-model"; import {ComponentInfoService} from "../component-info/component-info.service"; import {FeatureFlagsService, Features} from "../../../shared/services/featureFlag/feature-flags.service"; +import {Utils} from "../../../shared/utils/utils"; @Component({ @@ -146,7 +147,7 @@ export class AvailableModelsTreeComponent { this.isNewObject = isNewObject; let data = node.data; let dynamicInputs = data.dynamicInputs; - let isAlaCarte: boolean = this.serviceHierarchy.service.vidNotions.instantiationType == 'ALaCarte'; + let isAlaCarte: boolean = Utils.isALaCarte(this.serviceHierarchy.service.vidNotions.instantiationType); let isEcompGeneratedNaming: boolean = data.isEcompGeneratedNaming; let type: string = data.type; if (!this.store.getState().global.flags['FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD'] || node.data.type === ServiceNodeTypes.VF || diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.ts index 3fd44974a..757536d13 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.ts @@ -20,6 +20,7 @@ import {ModelInfo} from "../../../../models/modelInfo"; import {FormControlModel} from "../../../../models/formControlModels/formControl.model"; import {createServiceInstance, updateServiceInstance} from "../../../../storeUtil/utils/service/service.actions"; import * as _ from 'lodash'; +import {Utils} from "../../../../utils/utils"; @Injectable() export class ServicePopupService implements GenericPopupInterface { @@ -169,7 +170,7 @@ export class ServicePopupService implements GenericPopupInterface { }; setIsALaCarte = (formValues: any, instantiationType) => { - formValues.isALaCarte = instantiationType !== 'Macro'; + formValues.isALaCarte = Utils.isALaCarte(instantiationType); }; setTestApi = (formValues: any) =>{ diff --git a/vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts b/vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts index 540e02fe6..075e18f25 100644 --- a/vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts +++ b/vid-webpack-master/src/app/shared/resolvers/viewEdit/viewEdit.resolver.ts @@ -10,6 +10,7 @@ import {ServiceInstance} from "../../models/serviceInstance"; import * as _ from "lodash"; import {ModelInfo} from "../../models/modelInfo"; import {FeatureFlagsService, Features} from "../../services/featureFlag/feature-flags.service"; +import {Utils} from "../../utils/utils"; @Injectable() export class ViewEditResolver implements Resolve<Observable<boolean>> { @@ -69,7 +70,7 @@ export class ViewEditResolver implements Resolve<Observable<boolean>> { }; setIsALaCarte(service: any, instantiationType) :void{ - service.isALaCarte = instantiationType === 'ALaCarte'; + service.isALaCarte = Utils.isALaCarte(instantiationType); }; } diff --git a/vid-webpack-master/src/app/shared/utils/util.spec.ts b/vid-webpack-master/src/app/shared/utils/util.spec.ts index 2f9142f9c..4b39764f5 100644 --- a/vid-webpack-master/src/app/shared/utils/util.spec.ts +++ b/vid-webpack-master/src/app/shared/utils/util.spec.ts @@ -1,5 +1,6 @@ import {Utils} from "./utils"; import {TestBed} from "@angular/core/testing"; +import each from "jest-each"; describe('Util', () => { @@ -28,4 +29,15 @@ describe('Util', () => { test('hasContents should return true if object is not undefined and not null and not empty', () => { expect(Utils.hasContents("someValue")).toBeTruthy(); }); + + const instantiationTypesDataProvider = [ + ['Macro', false ], + ['ALaCarte', true ], + ['ClientConfig', true], + ['dont know', true] + ]; + each(instantiationTypesDataProvider).test('instantiationType %s isALaCarte shall be %s', (instantiationType, expected ) => { + expect(Utils.isALaCarte(instantiationType)).toEqual(expected); + }); + }); diff --git a/vid-webpack-master/src/app/shared/utils/utils.ts b/vid-webpack-master/src/app/shared/utils/utils.ts index d63a3c997..cb5e1a1c8 100644 --- a/vid-webpack-master/src/app/shared/utils/utils.ts +++ b/vid-webpack-master/src/app/shared/utils/utils.ts @@ -179,6 +179,10 @@ export class Utils { return (convertedAsdcModel); }; + public static isALaCarte(instantiationType) { + return instantiationType !== 'Macro'; + } + private static convertOldModel(serviceModel ) { let resource = {}; let convertedAsdcModel = { |