summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/shared/components')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts17
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts24
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.ts12
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts1
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts2
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts2
-rw-r--r--vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts1
7 files changed, 44 insertions, 15 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
index eb608652c..9063e6723 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
@@ -8,7 +8,7 @@ import * as _ from "lodash";
import {NgRedux} from "@angular-redux/store";
import {AppState} from "../../store/reducers";
import {ServicePopupService} from "./genericFormServices/service/service.popup.service";
-import {ActivatedRoute} from "@angular/router";
+import {ActivatedRoute, Router} from "@angular/router";
import {AaiService} from "../../services/aaiService/aai.service";
import {GenericFormPopupService} from "./generic-form-popup.service";
import {FormControlModel} from "../../models/formControlModels/formControl.model";
@@ -53,7 +53,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
hasGeneralApiError: boolean = false;
parentElementClassName = 'content';
errorMsg = 'Page contains errors. Please see details next to the relevant fields.';
-
+ serviceModelId : string;
servicesQty = 1;
quantityOptions = _.range(1, 51)
@@ -65,6 +65,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
private _aaiService: AaiService,
private _dialogService: DialogService,
private _route: ActivatedRoute,
+ private _router : Router,
private _genericFormPopupService: GenericFormPopupService) {
super(dialogService);
}
@@ -86,9 +87,9 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
this._route
.queryParams
.subscribe(params => {
- console.log('changed');
- if (params['serviceModelId'] && params['isCreate'] == "true") {
- this.onInitForCreateNewServicePopup();
+ this.serviceModelId = params['serviceModelId'];
+ if (this.serviceModelId && params['isCreate'] == "true") {
+ this.onInitForCreateNewServicePopup(params['hasTemplate']);
}
});
@@ -106,7 +107,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
}
}
- private onInitForCreateNewServicePopup() {
+ private onInitForCreateNewServicePopup(hasTemplate : boolean) {
this._genericFormPopupService.initReduxOnCreateNewService().then((serviceModelId: string) => {
this.uuidData = <any>{
bulkSize: 1,
@@ -115,8 +116,8 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
serviceId: serviceModelId,
popupService: this._servicePopupService,
};
- this.showTemplateBtn = !!this._store.getState().global.flags["FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"];
+ this.showTemplateBtn = this._genericFormPopupService.shouldShowTemplateBtn(hasTemplate);
this.isShowPreviousInstantiationBtn = !!this._store.getState().global.flags["FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER"];
this.uuidData.popupService.closeDialogEvent.subscribe((that) => {
@@ -154,7 +155,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
openTemplateModal = (): void => {
- this._dialogService.addDialog(InstantiationTemplatesModalComponent, {});
+ this._router.navigate(['/instantiationTemplatesPopup'], { queryParams: { serviceModelId: this.serviceModelId}, queryParamsHandling: 'merge' });
}
}
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
index ac417ed6e..53f345af0 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
@@ -22,6 +22,8 @@ import {VfModuleControlGenerator} from "../genericForm/formControlsServices/vfMo
import {FeatureFlagsService} from "../../services/featureFlag/feature-flags.service";
import {VfModuleUpgradePopupService} from "./genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service";
import {SharedControllersService} from "../genericForm/formControlsServices/sharedControlles/shared.controllers.service";
+import {AppState} from "../../store/reducers";
+import each from 'jest-each';
class MockAppStore<T>{
getState() {
@@ -951,6 +953,8 @@ describe('Generic Form popup Service', () => {
let servicePopupService : ServicePopupService;
let _aaiService : AaiService;
let _activatedRoute : ActivatedRoute;
+ let _store : NgRedux<AppState>;
+ let _featureFlagsService : FeatureFlagsService;
beforeAll(done => (async () => {
TestBed.configureTestingModule({
@@ -972,7 +976,7 @@ describe('Generic Form popup Service', () => {
VfModulePopupService,
VfModuleUpgradePopupService,
VfModuleControlGenerator,
- {provide:FeatureFlagsService, useClass: MockFeatureFlagsService},
+ FeatureFlagsService,
{provide: ActivatedRoute, useClass: ActivatedRouteMock},
{provide: NgRedux, useClass: MockAppStore}]
});
@@ -987,7 +991,8 @@ describe('Generic Form popup Service', () => {
servicePopupService = injector.get(ServicePopupService);
_aaiService = injector.get(AaiService);
_activatedRoute = injector.get(ActivatedRoute);
-
+ _store = injector.get(NgRedux);
+ _featureFlagsService = injector.get(FeatureFlagsService);
})().then(done).catch(done.fail));
@@ -1065,5 +1070,18 @@ describe('Generic Form popup Service', () => {
test('initReduxOnCreateNewService',() => {
jest.spyOn(_aaiService, 'getServiceModelById');
service.initReduxOnCreateNewService();
- })
+ });
+
+
+ const shouldShowTemplateBtnDataProvider = [
+ ['shouldShowTemplateBtn : should return true if flag is true and has template', true , true, true],
+ ['shouldShowTemplateBtn : should return false if flag is false and has template',false , true, false],
+ ['shouldShowTemplateBtn : should return false if flag is true and has no template',true , false, false],
+ ['shouldShowTemplateBtn : should return false if flag is false and has no template',false , false, false]];
+ each(shouldShowTemplateBtnDataProvider).test('%s', (desc : string, flag : boolean, hasTemplate : boolean, expected : boolean ) => {
+ spyOn(_featureFlagsService, 'getFlagState').and.returnValue(flag)
+
+ const result: boolean = service.shouldShowTemplateBtn(hasTemplate);
+ expect(result).toEqual(expected);
+ });
});
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.ts
index 6636a54f2..2998ba92b 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.ts
@@ -10,6 +10,7 @@ import {UUIDData} from "./generic-form-popup.component";
import {FormPopupDetails} from "../../models/formControlModels/formPopupDetails.model";
import {Subject} from "rxjs";
import {deleteAllServiceInstances} from "../../storeUtil/utils/service/service.actions";
+import {FeatureFlagsService, Features} from "../../services/featureFlag/feature-flags.service";
@Injectable()
export class GenericFormPopupService {
@@ -17,6 +18,7 @@ export class GenericFormPopupService {
private _store: NgRedux<AppState>,
private _servicePopupService : ServicePopupService,
public _activatedRoute : ActivatedRoute,
+ private _featureFlagsService : FeatureFlagsService,
private _aaiService : AaiService){
}
@@ -90,4 +92,14 @@ export class GenericFormPopupService {
}
refreshModalCheckForGeneralErrorTrigger : Subject<boolean> = new Subject<boolean>();
+
+
+
+ shouldShowTemplateBtn = (hasTemplate: boolean) : boolean => {
+ const instantiationTemplateFlag = this._featureFlagsService.getFlagState(Features.FLAG_2004_INSTANTIATION_TEMPLATES_POPUP);
+ if(instantiationTemplateFlag){
+ return hasTemplate;
+ }
+ return false;
+ }
}
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts
index 0ce051cf4..3a106ec93 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts
@@ -2172,7 +2172,6 @@ describe('Service popup service', () => {
test('getDynamicInputs should return list of controls' ,() => {
const result: FormControlModel[] = service.getDynamicInputs('6b528779-44a3-4472-bdff-9cd15ec93450');
- console.log(result);
expect(result.length).toEqual(4);
expect(result[0].controlName).toEqual('2017488_pasqualevpe0_ASN_1');
expect(result[1].controlName).toEqual('2017488_pasqualevpe0_ASN_2');
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts
index 308597ac6..61f75e84b 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts
@@ -173,7 +173,7 @@ describe('instantiation templates modal service', () => {
service.navigateToNewServiceModal(serviceModelId);
- expect(_router.navigate).toBeCalledWith(["/servicePopup"], {"queryParams": {"isCreate": true, "serviceModelId": serviceModelId}, "queryParamsHandling": "merge"});
+ expect(_router.navigate).toBeCalledWith(["/servicePopup"], {"queryParams": {"isCreate": true, "serviceModelId": serviceModelId, hasTemplate : true}, "queryParamsHandling": "merge"});
})
});
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts
index c17591845..c7c198fcb 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts
@@ -30,7 +30,7 @@ export class InstantiationTemplatesModalService {
navigateToNewServiceModal(serviceModelId: string) {
- this._router.navigate(['/servicePopup'], { queryParams: { serviceModelId: serviceModelId, isCreate:true}, queryParamsHandling: 'merge' });
+ this._router.navigate(['/servicePopup'], { queryParams: { serviceModelId: serviceModelId, isCreate:true, hasTemplate : true}, queryParamsHandling: 'merge' });
}
}
diff --git a/vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts b/vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts
index 94a0e1c52..ebaca6276 100644
--- a/vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts
+++ b/vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts
@@ -29,7 +29,6 @@ export class SpinnerComponent{
}else {
delete this.requestMap[requestUrl]
}
- console.log(this.requestMap);
this.show = !_.isEmpty(this.requestMap) && this.requestMap !== undefined;
})