summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html7
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts5
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.spec.ts27
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/service/service.popup.service.ts26
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.scss2
-rw-r--r--vid-webpack-master/src/app/shared/models/formControlModels/formPopupDetails.model.ts6
-rw-r--r--vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts1
-rw-r--r--vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts3
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/main.reducer.ts4
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.action.ts17
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.spec.ts18
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.ts20
12 files changed, 128 insertions, 8 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html
index 5b8dfa9c9..f9da42607 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html
@@ -61,6 +61,13 @@
(click)="openTemplateModal()"
><span>Template</span></button>
<button
+ *ngIf=isInstantiationStatusFilterFlagOn()
+ [attr.data-tests-id]="'ShowPreviousInstancesButton'"
+ type="button" class="btn btn-success submit"
+ (click)="formPopupDetails.onOtherAction(formPopupDetails.that, dynamicForm)">
+ <span>Previous Instantiation</span>
+ </button>
+ <button
[attr.data-tests-id]="'cancelButton'"
type="button" class="btn btn-default cancel"
(click)="formPopupDetails.onCancel(formPopupDetails.that, dynamicForm)"><span>Cancel</span></button>
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 cadce7ddb..159871f45 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
@@ -13,6 +13,7 @@ import {AaiService} from "../../services/aaiService/aai.service";
import {GenericFormPopupService} from "./generic-form-popup.service";
import {FormControlModel} from "../../models/formControlModels/formControl.model";
import {FormGeneralErrorsService} from "../formGeneralErrors/formGeneralErrors.service";
+import {FeatureFlagsService, Features} from "../../services/featureFlag/feature-flags.service";
import {InstantiationTemplatesModalComponent} from "./instantiationTemplatesModal/instantiation.templates.modal.component";
@@ -146,6 +147,10 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
openTemplateModal = (): void => {
this._dialogService.addDialog(InstantiationTemplatesModalComponent, {});
}
+
+ isInstantiationStatusFilterFlagOn() {
+ return FeatureFlagsService.getFlagState(Features.FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER, this._store);
+ }
}
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 ccfaacd0d..ebea695f7 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
@@ -2140,6 +2140,33 @@ describe('Service popup service', () => {
expect(service.closeDialogEvent.next).toHaveBeenCalledWith(that);
});
+ test('showPreviousInstantiations should trigger postMessage', () => {
+ let that = <any>{
+ parentElementClassName: 'content',
+ _iframeService: iframeService,
+ resetPopupData : () =>{ },
+ serviceModel:{
+ uuid:'1111'
+ }
+
+ };
+
+ let expectedMessage= {
+ eventId: 'showPreviousInstantiations',
+ data: {
+ serviceModelId: that.serviceModel.uuid
+ }
+ };
+
+ jest.spyOn(window.parent, 'postMessage');
+
+ service.showPreviousInstantiations(that, fb.group({}));
+
+ expect( window.parent.postMessage).toHaveBeenCalledWith(expectedMessage,"*")
+
+ });
+
+
test('getDynamicInputs should return list of controls' ,() => {
const result: FormControlModel[] = service.getDynamicInputs('6b528779-44a3-4472-bdff-9cd15ec93450');
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 e2033aa74..3e7e8c1e5 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
@@ -59,7 +59,12 @@ export class ServicePopupService implements GenericPopupInterface {
this.getDynamicInputs(serviceId),
this.modelInformations,
(that, form: FormGroup) => {that.onSubmit(that, form);},
- (that: any, form: FormGroup) => {that.onCancel(that, form); }
+ (that: any, form: FormGroup) => {
+ that.onCancel(that, form);
+ },
+ (that: any, form: FormGroup) => {
+ that.showPreviousInstantiations(that, form);
+ }
);
}
@@ -123,13 +128,24 @@ export class ServicePopupService implements GenericPopupInterface {
onSubmit(that, form: FormGroup, ...args): void {
form = that.updateExtraValues(that, form);
that.storeServiceInstance(form.value, args[0], [], new ModelInfo(that.serviceModel), that.serviceModel);
- window.parent.postMessage( {
- eventId: 'submitIframe',
+ const eventId = 'submitIframe';
+ this.postMessageToWindowParent(eventId, that.serviceModel.uuid);
+ this.onCancel(that, form);
+ }
+
+ showPreviousInstantiations(that, form: FormGroup,): void {
+ const eventId = 'showPreviousInstantiations';
+ this.postMessageToWindowParent(eventId, that.serviceModel.uuid);
+ this.onCancel(that, form);
+ }
+
+ private postMessageToWindowParent(eventId: string, serviceModelId:string) {
+ window.parent.postMessage({
+ eventId: eventId,
data: {
- serviceModelId: that.serviceModel.uuid
+ serviceModelId
}
}, "*");
- this.onCancel(that, form);
}
updateExtraValues = (that, form) : any => {
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.scss b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.scss
index 23c950c33..ef8d01a75 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.scss
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.scss
@@ -114,7 +114,7 @@ $grid-border: 1px #d2d2d2 solid;
}
.submit {
- width: 120px;
+ min-width: 120px;
height: 36px;
background: #009fdb;
border-radius: 2px;
diff --git a/vid-webpack-master/src/app/shared/models/formControlModels/formPopupDetails.model.ts b/vid-webpack-master/src/app/shared/models/formControlModels/formPopupDetails.model.ts
index 0a7e61082..40d74d63f 100644
--- a/vid-webpack-master/src/app/shared/models/formControlModels/formPopupDetails.model.ts
+++ b/vid-webpack-master/src/app/shared/models/formControlModels/formPopupDetails.model.ts
@@ -14,6 +14,8 @@ export class FormPopupDetails {
modelInformationItems: ModelInformationItem[];
onSubmit : (that : any, form: FormGroup , ...args) => void;
onCancel : (that : any, form: FormGroup) => void;
+ onOtherAction: (that: any, form: FormGroup) => void;
+
constructor(that : any,
popupTypeName : PopupType ,
@@ -25,7 +27,8 @@ export class FormPopupDetails {
dynamicInputsControlList : FormControlModel[],
modelInformationItems : ModelInformationItem[],
onSubmit : (that : any, form : FormGroup, ...args) => void,
- onCancel : (that : any, form : FormGroup) => void){
+ onCancel: (that: any, form: FormGroup) => void,
+ onOtherAction?: (that: any, form: FormGroup) => void) {
this.title = title;
this.leftSubTitle = leftSubTitle;
this.rightSubTitle = rightSubTitle;
@@ -34,6 +37,7 @@ export class FormPopupDetails {
this.modelInformationItems = modelInformationItems;
this.onSubmit = onSubmit;
this.onCancel = onCancel;
+ this.onOtherAction = onOtherAction;
this.popupTypeName = popupTypeName;
this.UUIDData = UUIDData;
this.that = that;
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 2fb39e8b9..8570b0866 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
@@ -14,6 +14,7 @@ export enum Features {
FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT ='FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT',
FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS ='FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS',
FLAG_2004_INSTANTIATION_STATUS_FILTER ='FLAG_2004_INSTANTIATION_STATUS_FILTER',
+ FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER ='FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER',
}
@Injectable()
diff --git a/vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts b/vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts
index 21cdc9296..018e0d367 100644
--- a/vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts
+++ b/vid-webpack-master/src/app/shared/services/templateService/instantiationTemplates.service.ts
@@ -6,6 +6,7 @@ import {Observable} from "rxjs";
import {ServiceInstance} from "../../models/serviceInstance";
import {Constants} from "../../utils/constants";
import {createServiceInstance} from "../../storeUtil/utils/service/service.actions";
+import {createServiceInstanceFromTemplate} from "../../storeUtil/utils/useTemplate/useTemplate.action";
@Injectable()
export class InstantiationTemplatesService {
@@ -19,7 +20,7 @@ export class InstantiationTemplatesService {
public retrieveAndStoreInstantiationTemplateTopology(jobId: string, serviceModelId: string): Observable<ServiceInstance> {
return this.retrieveInstantiationTemplateTopology(jobId).do((instantiationTemplate: ServiceInstance) => {
- this.store.dispatch(createServiceInstance(instantiationTemplate, serviceModelId));
+ this.store.dispatch(createServiceInstanceFromTemplate(instantiationTemplate, serviceModelId));
});
};
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/main.reducer.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/main.reducer.ts
index c02049eb9..a135563eb 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/main.reducer.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/main.reducer.ts
@@ -9,9 +9,11 @@ import {VNFActions} from "./vnf/vnf.actions";
import {vnfReducer} from "./vnf/vnf.reducers";
import {generalReducer} from "./general/general.reducers";
import {serviceReducer} from "./service/service.reducers";
+import {useTemplateReducer} from "./useTemplate/useTemplate.reducer";
import {networkReducer} from "./network/network.reducers";
import {vfModuleReducer} from "./vfModule/vfModule.reducers";
import {ServiceInstance} from "../../models/serviceInstance";
+import {UseTemplateActions} from "./useTemplate/useTemplate.action";
import {SelectOptionInterface} from "../../models/selectOption";
import {ServiceType} from "../../models/serviceType";
import {VnfGroupActions} from "./vnfGroup/vnfGroup.actions";
@@ -72,6 +74,8 @@ export const MainReducer = function (state: ServiceState = initialState, action:
return crReducer(state, action);
}else if(Object.values(NcfActions).includes(action.type)){
return ncfReducer(state, action);
+ } else if(Object.values(UseTemplateActions).includes(action.type)) {
+ return useTemplateReducer(state, action);
} else {
return Object.assign({}, state);
}
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.action.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.action.ts
new file mode 100644
index 000000000..2cfd38482
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.action.ts
@@ -0,0 +1,17 @@
+import {Action, ActionCreator} from "redux";
+import {ServiceInstance} from "../../../models/serviceInstance";
+
+export enum UseTemplateActions {
+ CREATE_SERVICE_INSTANCE_FROM_TEMPLATE = 'CREATE_SERVICE_INSTANCE_FROM_TEMPLATE',
+}
+
+export interface CreateServiceInstanceFromTemplate extends Action {
+ serviceInstantiationTemplate?: ServiceInstance;
+ serviceModelId?: string;
+}
+
+export const createServiceInstanceFromTemplate: ActionCreator<CreateServiceInstanceFromTemplate> = (serviceInstantiationTemplate, serviceModelId) => ({
+ type: UseTemplateActions.CREATE_SERVICE_INSTANCE_FROM_TEMPLATE,
+ serviceInstantiationTemplate: serviceInstantiationTemplate,
+ serviceModelId: serviceModelId
+});
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.spec.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.spec.ts
new file mode 100644
index 000000000..e0f46e13a
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.spec.ts
@@ -0,0 +1,18 @@
+import {ServiceInstance} from "../../../models/serviceInstance";
+import {useTemplateReducer} from "./useTemplate.reducer";
+import {CreateServiceInstanceFromTemplate, UseTemplateActions} from "./useTemplate.action";
+
+test('#CREATE_SERVICE_INSTANCE_FROM_TEMPLATE should add new service instance from template to redux ', () => {
+ let serviceFromTemplateInstance: ServiceInstance = <any>{
+ instanceName: 'templateInstanceName'
+ };
+ let serviceState = useTemplateReducer(<any>{
+ serviceInstance:{}},
+ <CreateServiceInstanceFromTemplate> {
+ type: UseTemplateActions.CREATE_SERVICE_INSTANCE_FROM_TEMPLATE,
+ serviceModelId: 'serviceModelID',
+ serviceInstantiationTemplate: serviceFromTemplateInstance,
+ })
+ expect (serviceState).toBeDefined();
+ expect (serviceState.serviceInstance['serviceModelID'].instanceName).toEqual('templateInstanceName');
+});
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.ts
new file mode 100644
index 000000000..5a06d6e0a
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.ts
@@ -0,0 +1,20 @@
+import {ServiceState} from "../main.reducer";
+import {Action} from "redux";
+import {
+ createServiceInstanceFromTemplate,
+ CreateServiceInstanceFromTemplate,
+ UseTemplateActions
+} from "./useTemplate.action";
+import * as _ from "lodash";
+
+export function useTemplateReducer(state: ServiceState, action: Action) : ServiceState {
+ switch (action.type) {
+ case UseTemplateActions.CREATE_SERVICE_INSTANCE_FROM_TEMPLATE : {
+ const updateServiceInstanceFromTemplateAction = <CreateServiceInstanceFromTemplate>action;
+ const uuid = updateServiceInstanceFromTemplateAction.serviceModelId;
+ let newState = _.cloneDeep(state);
+ newState.serviceInstance[uuid] = updateServiceInstanceFromTemplateAction.serviceInstantiationTemplate;
+ return newState;
+ }
+ }
+}