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";
import {FormGeneralErrorsService} from "../formGeneralErrors/formGeneralErrors.service";
import {FeatureFlagsService, Features} from "../../services/featureFlag/feature-flags.service";
import {InstantiationTemplatesModalComponent} from "./instantiationTemplatesModal/instantiation.templates.modal.component";
+import {updateCurrentModalModeAction} from "../../storeUtil/utils/global/global.actions";
export interface PopupModel {
type: PopupType;
uuidData: UUIDData;
showTemplateBtn: boolean = false;
- isShowPreviousInstantiationBtn: boolean = false;
isUpdateMode: boolean;
node: ITreeNode = null;
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)
private _aaiService: AaiService,
private _dialogService: DialogService,
private _route: ActivatedRoute,
+ private _router : Router,
private _genericFormPopupService: GenericFormPopupService) {
super(dialogService);
}
closeDialog(that): void {
- this._iframeService.removeClassCloseModal(that.parentElementClassName);
- this.dialogService.removeDialog(this);
- setTimeout(() => {
- window.parent.postMessage("closeIframe", "*");
- }, 15);
+ this._iframeService.closeIframe(this.dialogService, this);
}
shouldShowNotification(): boolean {
return this.formPopupDetails && this.formPopupDetails.UUIDData['bulkSize'] > 1
}
+ clearModalIsUpdateMode() : void {
+ this._store.dispatch(updateCurrentModalModeAction(null));
+ }
+
ngOnInit(): void {
+ this._store.dispatch(updateCurrentModalModeAction(this.isUpdateMode));
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['isInstantiationTemplateExists']);
}
});
}
}
- private onInitForCreateNewServicePopup() {
+ private onInitForCreateNewServicePopup(isInstantiationTemplateExists : boolean) {
this._genericFormPopupService.initReduxOnCreateNewService().then((serviceModelId: string) => {
this.uuidData = <any>{
bulkSize: 1,
serviceId: serviceModelId,
popupService: this._servicePopupService,
};
- this.showTemplateBtn = !!this._store.getState().global.flags["FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"];
- this.isShowPreviousInstantiationBtn = !!this._store.getState().global.flags["FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER"];
+ this.showTemplateBtn = this._genericFormPopupService.shouldShowTemplateBtn(isInstantiationTemplateExists);
this.uuidData.popupService.closeDialogEvent.subscribe((that) => {
this.closeDialog(that);
openTemplateModal = (): void => {
- this._dialogService.addDialog(InstantiationTemplatesModalComponent, {});
+ this._router.navigate(['/instantiationTemplatesPopup'], { queryParams: { serviceModelId: this.serviceModelId}, queryParamsHandling: 'merge' });
}
}