aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master
diff options
context:
space:
mode:
authorYoav Schneiderman <yoav.schneiderman@intl.att.com>2020-01-05 15:03:16 +0200
committerYoav Schneiderman <yoav.schneiderman@intl.att.com>2020-01-06 13:04:17 +0200
commit39a8639ddd4f9821c207cfa53264a475dcca8cf2 (patch)
tree5c671033f1d16caacb1014042fef5f731f96a584 /vid-webpack-master
parenta98e5f9165caf14f058d03cbc6749420adefe568 (diff)
Hide Templates entry point when no instances
Issue-ID: VID-741 Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com> Change-Id: I9f2c1879b30ed15b227cdd6189d14ef988bc3b1e Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master')
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts9
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts12
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts2
-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
-rw-r--r--vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts1
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts2
-rw-r--r--vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts1
13 files changed, 64 insertions, 22 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts
index 73d311555..0db1b099a 100644
--- a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts
@@ -71,7 +71,7 @@ describe('Template', () => {
cy.route(Cypress.config('baseUrl') + "/getuserID", 'us16807000');
- cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
+ cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true&hasTemplate=true');
});
@@ -117,10 +117,15 @@ describe('Template', () => {
cy.getElementByDataTestsId('filterByUserIdTestId').click();
cy.get('.member-table-row').should('have.length', 1);
+
+ // navigate to service modal -> should show Template button
+ cy.getElementByDataTestsId('startFromScratchButton').click().then(()=>{
+ cy.getElementByDataTestsId('templateButton').should('be.visible')
+ });
+
});
it('clicking on load template button, go to expected url', function () {
-
cy.getElementByDataTestsId('templateButton').contains('Template')
.getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal
diff --git a/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts
index 83e6b4dbc..4b27ad008 100644
--- a/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts
@@ -30,6 +30,17 @@ describe('Service popup', function () {
});
});
+ it('a-la-carte service instantiation popup should show Template button ', function () {
+ cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => {
+ res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.vidNotions.instantiationType = 'ALaCarte';
+ res1.global.flags = {};
+ res1.global.flags["FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"] = true;
+ cy.setReduxState(<any>res1);
+ cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true&hasTemplate=true');
+ cy.getElementByDataTestsId('templateButton').should('be.visible')
+ });
+ });
+
it('a-la-carte service instantiation popup has Instance name as required', function () {
cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => {
res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.vidNotions.instantiationType = 'ALaCarte';
@@ -39,6 +50,7 @@ describe('Service popup', function () {
cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
cy.isElementContainsAttr('form-set', 'disabled');
cy.get('label').contains('Instance name:').should('have.class', 'required');
+ cy.getElementByDataTestsId('templateButton').should('not.be.visible')
});
});
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts
index 75ae1e149..f1ebdaff9 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToModelTree/objectToModelTree.service.ts
@@ -28,8 +28,6 @@ export class ObjectToModelTreeService {
}
this.calculateNumberOfNodesWithPlusIcon(serviceModel, nodes);
-
- console.log('nodes', nodes);
return nodes;
}
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;
})
diff --git a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
index 74fcd8f87..cccade887 100644
--- a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
+++ b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
@@ -16,6 +16,7 @@ export enum Features {
FLAG_2004_INSTANTIATION_STATUS_FILTER ='FLAG_2004_INSTANTIATION_STATUS_FILTER',
FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE = 'FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE',
FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER ='FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER',
+ FLAG_2004_INSTANTIATION_TEMPLATES_POPUP = 'FLAG_2004_INSTANTIATION_TEMPLATES_POPUP'
}
@Injectable()
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts
index 9b3a287a6..91b749e0d 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts
@@ -251,7 +251,6 @@ test('#DELETE_ACTION_VF_MODULE_INSTANCE', () => {
serviceId: 'serviceModelId'
}).serviceInstance['serviceModelId'].vnfs['vnfStoreKey'].vfModules['modelName']['dynamicModelName1'];
- console.log(vfModule.action);
expect(vfModule).toBeDefined();
expect(vfModule.isMissingData).toBeTruthy();
expect(vfModule.action).toEqual(ServiceInstanceActions.None_Delete);
@@ -287,7 +286,6 @@ test('#UNDO_DELETE_ACTION_VF_MODULE_INSTANCE', () => {
serviceId: 'serviceModelId'
}).serviceInstance['serviceModelId'].vnfs['vnfStoreKey'].vfModules['modelName']['dynamicModelName1'];
- console.log(vfModule.action);
expect(vfModule).toBeDefined();
expect(vfModule.action).toEqual(ServiceInstanceActions.None);
});
diff --git a/vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts b/vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts
index d3df9268d..c0aeb0b51 100644
--- a/vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts
+++ b/vid-webpack-master/src/app/vlanTagging/network-selector/network-selector.component.ts
@@ -26,7 +26,6 @@ export class NetworkSelectorComponent implements OnInit {
constructor(store: NgRedux<AppState>) {
this.localStore = store;
this.groupSelection = {};
- console.log(store);
}
getValueOfLabelInGroup(group: any, label: string){